amber-cli.js 2.2 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649
  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. /*!
  8. * @overview es6-promise - a tiny implementation of Promises/A+.
  9. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  10. * @license Licensed under MIT license
  11. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  12. * @version 3.3.1
  13. */
  14. (function (global, factory) {
  15. typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  16. typeof define === 'function' && define.amd ? define('amber/es6-promise',factory) :
  17. (global.ES6Promise = factory());
  18. }(this, (function () { 'use strict';
  19. function objectOrFunction(x) {
  20. return typeof x === 'function' || typeof x === 'object' && x !== null;
  21. }
  22. function isFunction(x) {
  23. return typeof x === 'function';
  24. }
  25. var _isArray = undefined;
  26. if (!Array.isArray) {
  27. _isArray = function (x) {
  28. return Object.prototype.toString.call(x) === '[object Array]';
  29. };
  30. } else {
  31. _isArray = Array.isArray;
  32. }
  33. var isArray = _isArray;
  34. var len = 0;
  35. var vertxNext = undefined;
  36. var customSchedulerFn = undefined;
  37. var asap = function asap(callback, arg) {
  38. queue[len] = callback;
  39. queue[len + 1] = arg;
  40. len += 2;
  41. if (len === 2) {
  42. // If len is 2, that means that we need to schedule an async flush.
  43. // If additional callbacks are queued before the queue is flushed, they
  44. // will be processed by this flush that we are scheduling.
  45. if (customSchedulerFn) {
  46. customSchedulerFn(flush);
  47. } else {
  48. scheduleFlush();
  49. }
  50. }
  51. };
  52. function setScheduler(scheduleFn) {
  53. customSchedulerFn = scheduleFn;
  54. }
  55. function setAsap(asapFn) {
  56. asap = asapFn;
  57. }
  58. var browserWindow = typeof window !== 'undefined' ? window : undefined;
  59. var browserGlobal = browserWindow || {};
  60. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  61. var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && ({}).toString.call(process) === '[object process]';
  62. // test for web worker but not in IE10
  63. var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined';
  64. // node
  65. function useNextTick() {
  66. // node version 0.10.x displays a deprecation warning when nextTick is used recursively
  67. // see https://github.com/cujojs/when/issues/410 for details
  68. return function () {
  69. return process.nextTick(flush);
  70. };
  71. }
  72. // vertx
  73. function useVertxTimer() {
  74. return function () {
  75. vertxNext(flush);
  76. };
  77. }
  78. function useMutationObserver() {
  79. var iterations = 0;
  80. var observer = new BrowserMutationObserver(flush);
  81. var node = document.createTextNode('');
  82. observer.observe(node, { characterData: true });
  83. return function () {
  84. node.data = iterations = ++iterations % 2;
  85. };
  86. }
  87. // web worker
  88. function useMessageChannel() {
  89. var channel = new MessageChannel();
  90. channel.port1.onmessage = flush;
  91. return function () {
  92. return channel.port2.postMessage(0);
  93. };
  94. }
  95. function useSetTimeout() {
  96. // Store setTimeout reference so es6-promise will be unaffected by
  97. // other code modifying setTimeout (like sinon.useFakeTimers())
  98. var globalSetTimeout = setTimeout;
  99. return function () {
  100. return globalSetTimeout(flush, 1);
  101. };
  102. }
  103. var queue = new Array(1000);
  104. function flush() {
  105. for (var i = 0; i < len; i += 2) {
  106. var callback = queue[i];
  107. var arg = queue[i + 1];
  108. callback(arg);
  109. queue[i] = undefined;
  110. queue[i + 1] = undefined;
  111. }
  112. len = 0;
  113. }
  114. function attemptVertx() {
  115. try {
  116. var r = require;
  117. var vertx = r('vertx');
  118. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  119. return useVertxTimer();
  120. } catch (e) {
  121. return useSetTimeout();
  122. }
  123. }
  124. var scheduleFlush = undefined;
  125. // Decide what async method to use to triggering processing of queued callbacks:
  126. if (isNode) {
  127. scheduleFlush = useNextTick();
  128. } else if (BrowserMutationObserver) {
  129. scheduleFlush = useMutationObserver();
  130. } else if (isWorker) {
  131. scheduleFlush = useMessageChannel();
  132. } else if (browserWindow === undefined && typeof require === 'function') {
  133. scheduleFlush = attemptVertx();
  134. } else {
  135. scheduleFlush = useSetTimeout();
  136. }
  137. function then(onFulfillment, onRejection) {
  138. var _arguments = arguments;
  139. var parent = this;
  140. var child = new this.constructor(noop);
  141. if (child[PROMISE_ID] === undefined) {
  142. makePromise(child);
  143. }
  144. var _state = parent._state;
  145. if (_state) {
  146. (function () {
  147. var callback = _arguments[_state - 1];
  148. asap(function () {
  149. return invokeCallback(_state, child, callback, parent._result);
  150. });
  151. })();
  152. } else {
  153. subscribe(parent, child, onFulfillment, onRejection);
  154. }
  155. return child;
  156. }
  157. /**
  158. `Promise.resolve` returns a promise that will become resolved with the
  159. passed `value`. It is shorthand for the following:
  160. ```javascript
  161. let promise = new Promise(function(resolve, reject){
  162. resolve(1);
  163. });
  164. promise.then(function(value){
  165. // value === 1
  166. });
  167. ```
  168. Instead of writing the above, your code now simply becomes the following:
  169. ```javascript
  170. let promise = Promise.resolve(1);
  171. promise.then(function(value){
  172. // value === 1
  173. });
  174. ```
  175. @method resolve
  176. @static
  177. @param {Any} value value that the returned promise will be resolved with
  178. Useful for tooling.
  179. @return {Promise} a promise that will become fulfilled with the given
  180. `value`
  181. */
  182. function resolve(object) {
  183. /*jshint validthis:true */
  184. var Constructor = this;
  185. if (object && typeof object === 'object' && object.constructor === Constructor) {
  186. return object;
  187. }
  188. var promise = new Constructor(noop);
  189. _resolve(promise, object);
  190. return promise;
  191. }
  192. var PROMISE_ID = Math.random().toString(36).substring(16);
  193. function noop() {}
  194. var PENDING = void 0;
  195. var FULFILLED = 1;
  196. var REJECTED = 2;
  197. var GET_THEN_ERROR = new ErrorObject();
  198. function selfFulfillment() {
  199. return new TypeError("You cannot resolve a promise with itself");
  200. }
  201. function cannotReturnOwn() {
  202. return new TypeError('A promises callback cannot return that same promise.');
  203. }
  204. function getThen(promise) {
  205. try {
  206. return promise.then;
  207. } catch (error) {
  208. GET_THEN_ERROR.error = error;
  209. return GET_THEN_ERROR;
  210. }
  211. }
  212. function tryThen(then, value, fulfillmentHandler, rejectionHandler) {
  213. try {
  214. then.call(value, fulfillmentHandler, rejectionHandler);
  215. } catch (e) {
  216. return e;
  217. }
  218. }
  219. function handleForeignThenable(promise, thenable, then) {
  220. asap(function (promise) {
  221. var sealed = false;
  222. var error = tryThen(then, thenable, function (value) {
  223. if (sealed) {
  224. return;
  225. }
  226. sealed = true;
  227. if (thenable !== value) {
  228. _resolve(promise, value);
  229. } else {
  230. fulfill(promise, value);
  231. }
  232. }, function (reason) {
  233. if (sealed) {
  234. return;
  235. }
  236. sealed = true;
  237. _reject(promise, reason);
  238. }, 'Settle: ' + (promise._label || ' unknown promise'));
  239. if (!sealed && error) {
  240. sealed = true;
  241. _reject(promise, error);
  242. }
  243. }, promise);
  244. }
  245. function handleOwnThenable(promise, thenable) {
  246. if (thenable._state === FULFILLED) {
  247. fulfill(promise, thenable._result);
  248. } else if (thenable._state === REJECTED) {
  249. _reject(promise, thenable._result);
  250. } else {
  251. subscribe(thenable, undefined, function (value) {
  252. return _resolve(promise, value);
  253. }, function (reason) {
  254. return _reject(promise, reason);
  255. });
  256. }
  257. }
  258. function handleMaybeThenable(promise, maybeThenable, then$$) {
  259. if (maybeThenable.constructor === promise.constructor && then$$ === then && maybeThenable.constructor.resolve === resolve) {
  260. handleOwnThenable(promise, maybeThenable);
  261. } else {
  262. if (then$$ === GET_THEN_ERROR) {
  263. _reject(promise, GET_THEN_ERROR.error);
  264. } else if (then$$ === undefined) {
  265. fulfill(promise, maybeThenable);
  266. } else if (isFunction(then$$)) {
  267. handleForeignThenable(promise, maybeThenable, then$$);
  268. } else {
  269. fulfill(promise, maybeThenable);
  270. }
  271. }
  272. }
  273. function _resolve(promise, value) {
  274. if (promise === value) {
  275. _reject(promise, selfFulfillment());
  276. } else if (objectOrFunction(value)) {
  277. handleMaybeThenable(promise, value, getThen(value));
  278. } else {
  279. fulfill(promise, value);
  280. }
  281. }
  282. function publishRejection(promise) {
  283. if (promise._onerror) {
  284. promise._onerror(promise._result);
  285. }
  286. publish(promise);
  287. }
  288. function fulfill(promise, value) {
  289. if (promise._state !== PENDING) {
  290. return;
  291. }
  292. promise._result = value;
  293. promise._state = FULFILLED;
  294. if (promise._subscribers.length !== 0) {
  295. asap(publish, promise);
  296. }
  297. }
  298. function _reject(promise, reason) {
  299. if (promise._state !== PENDING) {
  300. return;
  301. }
  302. promise._state = REJECTED;
  303. promise._result = reason;
  304. asap(publishRejection, promise);
  305. }
  306. function subscribe(parent, child, onFulfillment, onRejection) {
  307. var _subscribers = parent._subscribers;
  308. var length = _subscribers.length;
  309. parent._onerror = null;
  310. _subscribers[length] = child;
  311. _subscribers[length + FULFILLED] = onFulfillment;
  312. _subscribers[length + REJECTED] = onRejection;
  313. if (length === 0 && parent._state) {
  314. asap(publish, parent);
  315. }
  316. }
  317. function publish(promise) {
  318. var subscribers = promise._subscribers;
  319. var settled = promise._state;
  320. if (subscribers.length === 0) {
  321. return;
  322. }
  323. var child = undefined,
  324. callback = undefined,
  325. detail = promise._result;
  326. for (var i = 0; i < subscribers.length; i += 3) {
  327. child = subscribers[i];
  328. callback = subscribers[i + settled];
  329. if (child) {
  330. invokeCallback(settled, child, callback, detail);
  331. } else {
  332. callback(detail);
  333. }
  334. }
  335. promise._subscribers.length = 0;
  336. }
  337. function ErrorObject() {
  338. this.error = null;
  339. }
  340. var TRY_CATCH_ERROR = new ErrorObject();
  341. function tryCatch(callback, detail) {
  342. try {
  343. return callback(detail);
  344. } catch (e) {
  345. TRY_CATCH_ERROR.error = e;
  346. return TRY_CATCH_ERROR;
  347. }
  348. }
  349. function invokeCallback(settled, promise, callback, detail) {
  350. var hasCallback = isFunction(callback),
  351. value = undefined,
  352. error = undefined,
  353. succeeded = undefined,
  354. failed = undefined;
  355. if (hasCallback) {
  356. value = tryCatch(callback, detail);
  357. if (value === TRY_CATCH_ERROR) {
  358. failed = true;
  359. error = value.error;
  360. value = null;
  361. } else {
  362. succeeded = true;
  363. }
  364. if (promise === value) {
  365. _reject(promise, cannotReturnOwn());
  366. return;
  367. }
  368. } else {
  369. value = detail;
  370. succeeded = true;
  371. }
  372. if (promise._state !== PENDING) {
  373. // noop
  374. } else if (hasCallback && succeeded) {
  375. _resolve(promise, value);
  376. } else if (failed) {
  377. _reject(promise, error);
  378. } else if (settled === FULFILLED) {
  379. fulfill(promise, value);
  380. } else if (settled === REJECTED) {
  381. _reject(promise, value);
  382. }
  383. }
  384. function initializePromise(promise, resolver) {
  385. try {
  386. resolver(function resolvePromise(value) {
  387. _resolve(promise, value);
  388. }, function rejectPromise(reason) {
  389. _reject(promise, reason);
  390. });
  391. } catch (e) {
  392. _reject(promise, e);
  393. }
  394. }
  395. var id = 0;
  396. function nextId() {
  397. return id++;
  398. }
  399. function makePromise(promise) {
  400. promise[PROMISE_ID] = id++;
  401. promise._state = undefined;
  402. promise._result = undefined;
  403. promise._subscribers = [];
  404. }
  405. function Enumerator(Constructor, input) {
  406. this._instanceConstructor = Constructor;
  407. this.promise = new Constructor(noop);
  408. if (!this.promise[PROMISE_ID]) {
  409. makePromise(this.promise);
  410. }
  411. if (isArray(input)) {
  412. this._input = input;
  413. this.length = input.length;
  414. this._remaining = input.length;
  415. this._result = new Array(this.length);
  416. if (this.length === 0) {
  417. fulfill(this.promise, this._result);
  418. } else {
  419. this.length = this.length || 0;
  420. this._enumerate();
  421. if (this._remaining === 0) {
  422. fulfill(this.promise, this._result);
  423. }
  424. }
  425. } else {
  426. _reject(this.promise, validationError());
  427. }
  428. }
  429. function validationError() {
  430. return new Error('Array Methods must be provided an Array');
  431. };
  432. Enumerator.prototype._enumerate = function () {
  433. var length = this.length;
  434. var _input = this._input;
  435. for (var i = 0; this._state === PENDING && i < length; i++) {
  436. this._eachEntry(_input[i], i);
  437. }
  438. };
  439. Enumerator.prototype._eachEntry = function (entry, i) {
  440. var c = this._instanceConstructor;
  441. var resolve$$ = c.resolve;
  442. if (resolve$$ === resolve) {
  443. var _then = getThen(entry);
  444. if (_then === then && entry._state !== PENDING) {
  445. this._settledAt(entry._state, i, entry._result);
  446. } else if (typeof _then !== 'function') {
  447. this._remaining--;
  448. this._result[i] = entry;
  449. } else if (c === Promise) {
  450. var promise = new c(noop);
  451. handleMaybeThenable(promise, entry, _then);
  452. this._willSettleAt(promise, i);
  453. } else {
  454. this._willSettleAt(new c(function (resolve$$) {
  455. return resolve$$(entry);
  456. }), i);
  457. }
  458. } else {
  459. this._willSettleAt(resolve$$(entry), i);
  460. }
  461. };
  462. Enumerator.prototype._settledAt = function (state, i, value) {
  463. var promise = this.promise;
  464. if (promise._state === PENDING) {
  465. this._remaining--;
  466. if (state === REJECTED) {
  467. _reject(promise, value);
  468. } else {
  469. this._result[i] = value;
  470. }
  471. }
  472. if (this._remaining === 0) {
  473. fulfill(promise, this._result);
  474. }
  475. };
  476. Enumerator.prototype._willSettleAt = function (promise, i) {
  477. var enumerator = this;
  478. subscribe(promise, undefined, function (value) {
  479. return enumerator._settledAt(FULFILLED, i, value);
  480. }, function (reason) {
  481. return enumerator._settledAt(REJECTED, i, reason);
  482. });
  483. };
  484. /**
  485. `Promise.all` accepts an array of promises, and returns a new promise which
  486. is fulfilled with an array of fulfillment values for the passed promises, or
  487. rejected with the reason of the first passed promise to be rejected. It casts all
  488. elements of the passed iterable to promises as it runs this algorithm.
  489. Example:
  490. ```javascript
  491. let promise1 = resolve(1);
  492. let promise2 = resolve(2);
  493. let promise3 = resolve(3);
  494. let promises = [ promise1, promise2, promise3 ];
  495. Promise.all(promises).then(function(array){
  496. // The array here would be [ 1, 2, 3 ];
  497. });
  498. ```
  499. If any of the `promises` given to `all` are rejected, the first promise
  500. that is rejected will be given as an argument to the returned promises's
  501. rejection handler. For example:
  502. Example:
  503. ```javascript
  504. let promise1 = resolve(1);
  505. let promise2 = reject(new Error("2"));
  506. let promise3 = reject(new Error("3"));
  507. let promises = [ promise1, promise2, promise3 ];
  508. Promise.all(promises).then(function(array){
  509. // Code here never runs because there are rejected promises!
  510. }, function(error) {
  511. // error.message === "2"
  512. });
  513. ```
  514. @method all
  515. @static
  516. @param {Array} entries array of promises
  517. @param {String} label optional string for labeling the promise.
  518. Useful for tooling.
  519. @return {Promise} promise that is fulfilled when all `promises` have been
  520. fulfilled, or rejected if any of them become rejected.
  521. @static
  522. */
  523. function all(entries) {
  524. return new Enumerator(this, entries).promise;
  525. }
  526. /**
  527. `Promise.race` returns a new promise which is settled in the same way as the
  528. first passed promise to settle.
  529. Example:
  530. ```javascript
  531. let promise1 = new Promise(function(resolve, reject){
  532. setTimeout(function(){
  533. resolve('promise 1');
  534. }, 200);
  535. });
  536. let promise2 = new Promise(function(resolve, reject){
  537. setTimeout(function(){
  538. resolve('promise 2');
  539. }, 100);
  540. });
  541. Promise.race([promise1, promise2]).then(function(result){
  542. // result === 'promise 2' because it was resolved before promise1
  543. // was resolved.
  544. });
  545. ```
  546. `Promise.race` is deterministic in that only the state of the first
  547. settled promise matters. For example, even if other promises given to the
  548. `promises` array argument are resolved, but the first settled promise has
  549. become rejected before the other promises became fulfilled, the returned
  550. promise will become rejected:
  551. ```javascript
  552. let promise1 = new Promise(function(resolve, reject){
  553. setTimeout(function(){
  554. resolve('promise 1');
  555. }, 200);
  556. });
  557. let promise2 = new Promise(function(resolve, reject){
  558. setTimeout(function(){
  559. reject(new Error('promise 2'));
  560. }, 100);
  561. });
  562. Promise.race([promise1, promise2]).then(function(result){
  563. // Code here never runs
  564. }, function(reason){
  565. // reason.message === 'promise 2' because promise 2 became rejected before
  566. // promise 1 became fulfilled
  567. });
  568. ```
  569. An example real-world use case is implementing timeouts:
  570. ```javascript
  571. Promise.race([ajax('foo.json'), timeout(5000)])
  572. ```
  573. @method race
  574. @static
  575. @param {Array} promises array of promises to observe
  576. Useful for tooling.
  577. @return {Promise} a promise which settles in the same way as the first passed
  578. promise to settle.
  579. */
  580. function race(entries) {
  581. /*jshint validthis:true */
  582. var Constructor = this;
  583. if (!isArray(entries)) {
  584. return new Constructor(function (_, reject) {
  585. return reject(new TypeError('You must pass an array to race.'));
  586. });
  587. } else {
  588. return new Constructor(function (resolve, reject) {
  589. var length = entries.length;
  590. for (var i = 0; i < length; i++) {
  591. Constructor.resolve(entries[i]).then(resolve, reject);
  592. }
  593. });
  594. }
  595. }
  596. /**
  597. `Promise.reject` returns a promise rejected with the passed `reason`.
  598. It is shorthand for the following:
  599. ```javascript
  600. let promise = new Promise(function(resolve, reject){
  601. reject(new Error('WHOOPS'));
  602. });
  603. promise.then(function(value){
  604. // Code here doesn't run because the promise is rejected!
  605. }, function(reason){
  606. // reason.message === 'WHOOPS'
  607. });
  608. ```
  609. Instead of writing the above, your code now simply becomes the following:
  610. ```javascript
  611. let promise = Promise.reject(new Error('WHOOPS'));
  612. promise.then(function(value){
  613. // Code here doesn't run because the promise is rejected!
  614. }, function(reason){
  615. // reason.message === 'WHOOPS'
  616. });
  617. ```
  618. @method reject
  619. @static
  620. @param {Any} reason value that the returned promise will be rejected with.
  621. Useful for tooling.
  622. @return {Promise} a promise rejected with the given `reason`.
  623. */
  624. function reject(reason) {
  625. /*jshint validthis:true */
  626. var Constructor = this;
  627. var promise = new Constructor(noop);
  628. _reject(promise, reason);
  629. return promise;
  630. }
  631. function needsResolver() {
  632. throw new TypeError('You must pass a resolver function as the first argument to the promise constructor');
  633. }
  634. function needsNew() {
  635. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  636. }
  637. /**
  638. Promise objects represent the eventual result of an asynchronous operation. The
  639. primary way of interacting with a promise is through its `then` method, which
  640. registers callbacks to receive either a promise's eventual value or the reason
  641. why the promise cannot be fulfilled.
  642. Terminology
  643. -----------
  644. - `promise` is an object or function with a `then` method whose behavior conforms to this specification.
  645. - `thenable` is an object or function that defines a `then` method.
  646. - `value` is any legal JavaScript value (including undefined, a thenable, or a promise).
  647. - `exception` is a value that is thrown using the throw statement.
  648. - `reason` is a value that indicates why a promise was rejected.
  649. - `settled` the final resting state of a promise, fulfilled or rejected.
  650. A promise can be in one of three states: pending, fulfilled, or rejected.
  651. Promises that are fulfilled have a fulfillment value and are in the fulfilled
  652. state. Promises that are rejected have a rejection reason and are in the
  653. rejected state. A fulfillment value is never a thenable.
  654. Promises can also be said to *resolve* a value. If this value is also a
  655. promise, then the original promise's settled state will match the value's
  656. settled state. So a promise that *resolves* a promise that rejects will
  657. itself reject, and a promise that *resolves* a promise that fulfills will
  658. itself fulfill.
  659. Basic Usage:
  660. ------------
  661. ```js
  662. let promise = new Promise(function(resolve, reject) {
  663. // on success
  664. resolve(value);
  665. // on failure
  666. reject(reason);
  667. });
  668. promise.then(function(value) {
  669. // on fulfillment
  670. }, function(reason) {
  671. // on rejection
  672. });
  673. ```
  674. Advanced Usage:
  675. ---------------
  676. Promises shine when abstracting away asynchronous interactions such as
  677. `XMLHttpRequest`s.
  678. ```js
  679. function getJSON(url) {
  680. return new Promise(function(resolve, reject){
  681. let xhr = new XMLHttpRequest();
  682. xhr.open('GET', url);
  683. xhr.onreadystatechange = handler;
  684. xhr.responseType = 'json';
  685. xhr.setRequestHeader('Accept', 'application/json');
  686. xhr.send();
  687. function handler() {
  688. if (this.readyState === this.DONE) {
  689. if (this.status === 200) {
  690. resolve(this.response);
  691. } else {
  692. reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']'));
  693. }
  694. }
  695. };
  696. });
  697. }
  698. getJSON('/posts.json').then(function(json) {
  699. // on fulfillment
  700. }, function(reason) {
  701. // on rejection
  702. });
  703. ```
  704. Unlike callbacks, promises are great composable primitives.
  705. ```js
  706. Promise.all([
  707. getJSON('/posts'),
  708. getJSON('/comments')
  709. ]).then(function(values){
  710. values[0] // => postsJSON
  711. values[1] // => commentsJSON
  712. return values;
  713. });
  714. ```
  715. @class Promise
  716. @param {function} resolver
  717. Useful for tooling.
  718. @constructor
  719. */
  720. function Promise(resolver) {
  721. this[PROMISE_ID] = nextId();
  722. this._result = this._state = undefined;
  723. this._subscribers = [];
  724. if (noop !== resolver) {
  725. typeof resolver !== 'function' && needsResolver();
  726. this instanceof Promise ? initializePromise(this, resolver) : needsNew();
  727. }
  728. }
  729. Promise.all = all;
  730. Promise.race = race;
  731. Promise.resolve = resolve;
  732. Promise.reject = reject;
  733. Promise._setScheduler = setScheduler;
  734. Promise._setAsap = setAsap;
  735. Promise._asap = asap;
  736. Promise.prototype = {
  737. constructor: Promise,
  738. /**
  739. The primary way of interacting with a promise is through its `then` method,
  740. which registers callbacks to receive either a promise's eventual value or the
  741. reason why the promise cannot be fulfilled.
  742. ```js
  743. findUser().then(function(user){
  744. // user is available
  745. }, function(reason){
  746. // user is unavailable, and you are given the reason why
  747. });
  748. ```
  749. Chaining
  750. --------
  751. The return value of `then` is itself a promise. This second, 'downstream'
  752. promise is resolved with the return value of the first promise's fulfillment
  753. or rejection handler, or rejected if the handler throws an exception.
  754. ```js
  755. findUser().then(function (user) {
  756. return user.name;
  757. }, function (reason) {
  758. return 'default name';
  759. }).then(function (userName) {
  760. // If `findUser` fulfilled, `userName` will be the user's name, otherwise it
  761. // will be `'default name'`
  762. });
  763. findUser().then(function (user) {
  764. throw new Error('Found user, but still unhappy');
  765. }, function (reason) {
  766. throw new Error('`findUser` rejected and we're unhappy');
  767. }).then(function (value) {
  768. // never reached
  769. }, function (reason) {
  770. // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'.
  771. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'.
  772. });
  773. ```
  774. If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream.
  775. ```js
  776. findUser().then(function (user) {
  777. throw new PedagogicalException('Upstream error');
  778. }).then(function (value) {
  779. // never reached
  780. }).then(function (value) {
  781. // never reached
  782. }, function (reason) {
  783. // The `PedgagocialException` is propagated all the way down to here
  784. });
  785. ```
  786. Assimilation
  787. ------------
  788. Sometimes the value you want to propagate to a downstream promise can only be
  789. retrieved asynchronously. This can be achieved by returning a promise in the
  790. fulfillment or rejection handler. The downstream promise will then be pending
  791. until the returned promise is settled. This is called *assimilation*.
  792. ```js
  793. findUser().then(function (user) {
  794. return findCommentsByAuthor(user);
  795. }).then(function (comments) {
  796. // The user's comments are now available
  797. });
  798. ```
  799. If the assimliated promise rejects, then the downstream promise will also reject.
  800. ```js
  801. findUser().then(function (user) {
  802. return findCommentsByAuthor(user);
  803. }).then(function (comments) {
  804. // If `findCommentsByAuthor` fulfills, we'll have the value here
  805. }, function (reason) {
  806. // If `findCommentsByAuthor` rejects, we'll have the reason here
  807. });
  808. ```
  809. Simple Example
  810. --------------
  811. Synchronous Example
  812. ```javascript
  813. let result;
  814. try {
  815. result = findResult();
  816. // success
  817. } catch(reason) {
  818. // failure
  819. }
  820. ```
  821. Errback Example
  822. ```js
  823. findResult(function(result, err){
  824. if (err) {
  825. // failure
  826. } else {
  827. // success
  828. }
  829. });
  830. ```
  831. Promise Example;
  832. ```javascript
  833. findResult().then(function(result){
  834. // success
  835. }, function(reason){
  836. // failure
  837. });
  838. ```
  839. Advanced Example
  840. --------------
  841. Synchronous Example
  842. ```javascript
  843. let author, books;
  844. try {
  845. author = findAuthor();
  846. books = findBooksByAuthor(author);
  847. // success
  848. } catch(reason) {
  849. // failure
  850. }
  851. ```
  852. Errback Example
  853. ```js
  854. function foundBooks(books) {
  855. }
  856. function failure(reason) {
  857. }
  858. findAuthor(function(author, err){
  859. if (err) {
  860. failure(err);
  861. // failure
  862. } else {
  863. try {
  864. findBoooksByAuthor(author, function(books, err) {
  865. if (err) {
  866. failure(err);
  867. } else {
  868. try {
  869. foundBooks(books);
  870. } catch(reason) {
  871. failure(reason);
  872. }
  873. }
  874. });
  875. } catch(error) {
  876. failure(err);
  877. }
  878. // success
  879. }
  880. });
  881. ```
  882. Promise Example;
  883. ```javascript
  884. findAuthor().
  885. then(findBooksByAuthor).
  886. then(function(books){
  887. // found books
  888. }).catch(function(reason){
  889. // something went wrong
  890. });
  891. ```
  892. @method then
  893. @param {Function} onFulfilled
  894. @param {Function} onRejected
  895. Useful for tooling.
  896. @return {Promise}
  897. */
  898. then: then,
  899. /**
  900. `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same
  901. as the catch block of a try/catch statement.
  902. ```js
  903. function findAuthor(){
  904. throw new Error('couldn't find that author');
  905. }
  906. // synchronous
  907. try {
  908. findAuthor();
  909. } catch(reason) {
  910. // something went wrong
  911. }
  912. // async with promises
  913. findAuthor().catch(function(reason){
  914. // something went wrong
  915. });
  916. ```
  917. @method catch
  918. @param {Function} onRejection
  919. Useful for tooling.
  920. @return {Promise}
  921. */
  922. 'catch': function _catch(onRejection) {
  923. return this.then(null, onRejection);
  924. }
  925. };
  926. function polyfill() {
  927. var local = undefined;
  928. if (typeof global !== 'undefined') {
  929. local = global;
  930. } else if (typeof self !== 'undefined') {
  931. local = self;
  932. } else {
  933. try {
  934. local = Function('return this')();
  935. } catch (e) {
  936. throw new Error('polyfill failed because global object is unavailable in this environment');
  937. }
  938. }
  939. var P = local.Promise;
  940. if (P) {
  941. var promiseToString = null;
  942. try {
  943. promiseToString = Object.prototype.toString.call(P.resolve());
  944. } catch (e) {
  945. // silently ignored
  946. }
  947. if (promiseToString === '[object Promise]' && !P.cast) {
  948. return;
  949. }
  950. }
  951. local.Promise = Promise;
  952. }
  953. polyfill();
  954. // Strange compat..
  955. Promise.polyfill = polyfill;
  956. Promise.Promise = Promise;
  957. return Promise;
  958. })));
  959. //# sourceMappingURL=es6-promise.map;
  960. define('amber/es2015-polyfills',['amber/es6-promise'], function (promiseLib) {
  961. promiseLib.polyfill();
  962. });
  963. (function () {
  964. define('app',["require", "amber/es2015-polyfills"], function (require) {
  965. require(["__app__"]);
  966. });
  967. }());
  968. //jshint eqnull:true
  969. define('amber/kernel-runtime',[],function () {
  970. "use strict";
  971. function defineMethod (klass, name, method) {
  972. Object.defineProperty(klass.prototype, name, {
  973. value: method,
  974. enumerable: false, configurable: true, writable: true
  975. });
  976. }
  977. function installJSMethod (obj, jsSelector, fn) {
  978. Object.defineProperty(obj, jsSelector, {
  979. value: fn,
  980. enumerable: false, configurable: true, writable: true
  981. });
  982. }
  983. RuntimeSelectorsBrik.deps = ["selectors", "selectorConversion", "smalltalkGlobals", "classes"];
  984. function RuntimeSelectorsBrik (brikz, st) {
  985. var selectors = brikz.selectors.selectors;
  986. var globals = brikz.smalltalkGlobals.globals;
  987. var nilAsClass = brikz.classes.nilAsClass;
  988. var st2js = brikz.selectorConversion.st2js;
  989. var jsSelectors = this.jsSelectors = [];
  990. /* Method not implemented handlers */
  991. function installNewSelectors (newSelectors, targetClasses) {
  992. newSelectors.forEach(function (selector) {
  993. var jsSelector = st2js(selector);
  994. jsSelectors.push(jsSelector);
  995. var fn = createDnuHandler(selector);
  996. installJSMethod(nilAsClass.fn.prototype, jsSelector, fn);
  997. targetClasses.forEach(function (target) {
  998. installJSMethod(target.fn.prototype, jsSelector, fn);
  999. });
  1000. });
  1001. }
  1002. this.installNewSelectors = installNewSelectors;
  1003. /* Dnu handler method */
  1004. function createDnuHandler (stSelector) {
  1005. return function () {
  1006. return globals.Message._selector_arguments_notUnderstoodBy_(
  1007. stSelector, [].slice.call(arguments), this
  1008. );
  1009. };
  1010. }
  1011. installNewSelectors(selectors, []);
  1012. }
  1013. RuntimeClassesBrik.deps = ["event", "runtimeSelectors", "behaviors", "classes", "runtimeMethods"];
  1014. function RuntimeClassesBrik (brikz, st) {
  1015. var jsSelectors = brikz.runtimeSelectors.jsSelectors;
  1016. var installNewSelectors = brikz.runtimeSelectors.installNewSelectors;
  1017. var installMethod = brikz.runtimeMethods.installMethod;
  1018. var traitsOrClasses = brikz.behaviors.traitsOrClasses;
  1019. var wireKlass = brikz.classes.wireKlass;
  1020. var emit = brikz.event.emit;
  1021. var detachedRootClasses = [];
  1022. function markClassDetachedRoot (klass) {
  1023. klass.detachedRoot = true;
  1024. detachedRootClasses = traitsOrClasses.filter(function (klass) {
  1025. return klass.detachedRoot;
  1026. });
  1027. }
  1028. emit.selectorsAdded = function (newSelectors) {
  1029. installNewSelectors(newSelectors, detachedRootClasses);
  1030. };
  1031. /* Initialize a class in its class hierarchy. Handle both classes and
  1032. metaclasses. */
  1033. function initClassAndMetaclass (klass) {
  1034. initClass(klass);
  1035. if (klass.a$cls && !klass.meta) {
  1036. initClass(klass.a$cls);
  1037. }
  1038. }
  1039. traitsOrClasses.forEach(function (traitOrClass) {
  1040. if (!traitOrClass.trait) initClassAndMetaclass(traitOrClass);
  1041. });
  1042. emit.classAdded = function (klass) {
  1043. initClassAndMetaclass(klass);
  1044. klass._enterOrganization();
  1045. };
  1046. emit.traitAdded = function (trait) {
  1047. trait._enterOrganization();
  1048. };
  1049. emit.classRemoved = function (klass) {
  1050. klass._leaveOrganization();
  1051. };
  1052. emit.traitRemoved = function (trait) {
  1053. trait._leaveOrganization();
  1054. };
  1055. function initClass (klass) {
  1056. wireKlass(klass);
  1057. if (klass.detachedRoot) {
  1058. copySuperclass(klass);
  1059. }
  1060. installMethods(klass);
  1061. }
  1062. function copySuperclass (klass) {
  1063. var myproto = klass.fn.prototype,
  1064. superproto = klass.superclass.fn.prototype;
  1065. jsSelectors.forEach(function (jsSelector) {
  1066. installJSMethod(myproto, jsSelector, superproto[jsSelector]);
  1067. });
  1068. }
  1069. function installMethods (klass) {
  1070. var methods = klass.methods;
  1071. Object.keys(methods).forEach(function (selector) {
  1072. installMethod(methods[selector], klass);
  1073. });
  1074. }
  1075. /* Manually set the constructor of an existing Smalltalk klass, making it a detached root class. */
  1076. st.setClassConstructor = this.setClassConstructor = function (klass, constructor) {
  1077. markClassDetachedRoot(klass);
  1078. klass.fn = constructor;
  1079. initClass(klass);
  1080. };
  1081. }
  1082. FrameBindingBrik.deps = ["smalltalkGlobals", "runtimeClasses"];
  1083. function FrameBindingBrik (brikz, st) {
  1084. var globals = brikz.smalltalkGlobals.globals;
  1085. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1086. setClassConstructor(globals.Number, Number);
  1087. setClassConstructor(globals.BlockClosure, Function);
  1088. setClassConstructor(globals.Boolean, Boolean);
  1089. setClassConstructor(globals.Date, Date);
  1090. setClassConstructor(globals.String, String);
  1091. setClassConstructor(globals.Array, Array);
  1092. setClassConstructor(globals.RegularExpression, RegExp);
  1093. setClassConstructor(globals.Error, Error);
  1094. setClassConstructor(globals.Promise, Promise);
  1095. this.__init__ = function () {
  1096. st.alias(globals.Array, "OrderedCollection");
  1097. st.alias(globals.Date, "Time");
  1098. }
  1099. }
  1100. RuntimeMethodsBrik.deps = ["event", "selectorConversion"];
  1101. function RuntimeMethodsBrik (brikz, st) {
  1102. var st2js = brikz.selectorConversion.st2js;
  1103. var emit = brikz.event.emit;
  1104. function installMethod (method, klass) {
  1105. var jsSelector = method.jsSelector;
  1106. if (!jsSelector) {
  1107. jsSelector = method.jsSelector = st2js(method.selector);
  1108. }
  1109. installJSMethod(klass.fn.prototype, jsSelector, method.fn);
  1110. }
  1111. this.installMethod = installMethod;
  1112. emit.behaviorMethodAdded = function (method, klass) {
  1113. installMethod(method, klass);
  1114. propagateMethodChange(klass, method, klass);
  1115. };
  1116. emit.behaviorMethodRemoved = function (method, klass) {
  1117. delete klass.fn.prototype[method.jsSelector];
  1118. propagateMethodChange(klass, method, null);
  1119. };
  1120. emit.methodReplaced = function (newMethod, oldMethod, traitOrBehavior) {
  1121. traitOrBehavior._methodOrganizationEnter_andLeave_(newMethod, oldMethod);
  1122. };
  1123. function propagateMethodChange (klass, method, exclude) {
  1124. var selector = method.selector;
  1125. var jsSelector = method.jsSelector;
  1126. st.traverseClassTree(klass, function (subclass, sentinel) {
  1127. if (subclass === exclude) return;
  1128. if (subclass.methods[selector]) return sentinel;
  1129. if (subclass.detachedRoot) {
  1130. installJSMethod(subclass.fn.prototype, jsSelector, subclass.superclass.fn.prototype[jsSelector]);
  1131. }
  1132. });
  1133. }
  1134. }
  1135. PrimitivesBrik.deps = ["smalltalkGlobals"];
  1136. function PrimitivesBrik (brikz, st) {
  1137. var globals = brikz.smalltalkGlobals.globals;
  1138. /* Converts a JavaScript object to valid Smalltalk Object */
  1139. st.readJSObject = function (js) {
  1140. if (js == null) return null;
  1141. else if (Array.isArray(js)) return js.map(st.readJSObject);
  1142. else if (js.constructor !== Object) return js;
  1143. var pairs = [];
  1144. for (var i in js) {
  1145. pairs.push(i, st.readJSObject(js[i]));
  1146. }
  1147. return globals.Dictionary._newFromPairs_(pairs);
  1148. };
  1149. /* Boolean assertion */
  1150. st.assert = function (shouldBeBoolean) {
  1151. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1152. else if (shouldBeBoolean != null && typeof shouldBeBoolean === "object") {
  1153. shouldBeBoolean = shouldBeBoolean.valueOf();
  1154. if (typeof shouldBeBoolean === "boolean") return shouldBeBoolean;
  1155. }
  1156. globals.NonBooleanReceiver._signalOn_(shouldBeBoolean);
  1157. };
  1158. }
  1159. RuntimeBrik.deps = ["selectorConversion", "smalltalkGlobals", "runtimeClasses"];
  1160. function RuntimeBrik (brikz, st) {
  1161. var globals = brikz.smalltalkGlobals.globals;
  1162. var setClassConstructor = brikz.runtimeClasses.setClassConstructor;
  1163. function SmalltalkMethodContext (home, setup) {
  1164. // TODO lazy fill of .sendIdx
  1165. this.sendIdx = {};
  1166. // TODO very likely .senderContext, not .homeContext here
  1167. this.homeContext = home;
  1168. this.setup = setup;
  1169. }
  1170. // Fallbacks
  1171. SmalltalkMethodContext.prototype.supercall = false;
  1172. SmalltalkMethodContext.prototype.locals = Object.freeze({});
  1173. SmalltalkMethodContext.prototype.receiver = null;
  1174. SmalltalkMethodContext.prototype.selector = null;
  1175. SmalltalkMethodContext.prototype.lookupClass = null;
  1176. SmalltalkMethodContext.prototype.outerContext = null;
  1177. SmalltalkMethodContext.prototype.index = 0;
  1178. defineMethod(SmalltalkMethodContext, "fill", function (receiver, selector, locals, lookupClass) {
  1179. this.receiver = receiver;
  1180. this.selector = selector;
  1181. if (locals != null) this.locals = locals;
  1182. this.lookupClass = lookupClass;
  1183. if (this.homeContext) {
  1184. this.homeContext.evaluatedSelector = selector;
  1185. }
  1186. });
  1187. defineMethod(SmalltalkMethodContext, "fillBlock", function (locals, ctx, index) {
  1188. if (locals != null) this.locals = locals;
  1189. this.outerContext = ctx;
  1190. if (index) this.index = index;
  1191. });
  1192. defineMethod(SmalltalkMethodContext, "method", function () {
  1193. var method;
  1194. var lookup = this.lookupClass || this.receiver.a$cls;
  1195. while (!method && lookup) {
  1196. method = lookup.methods[st.js2st(this.selector)];
  1197. lookup = lookup.superclass;
  1198. }
  1199. return method;
  1200. });
  1201. setClassConstructor(globals.MethodContext, SmalltalkMethodContext);
  1202. /* This is the current call context object.
  1203. In Smalltalk code, it is accessible just by using 'thisContext' variable.
  1204. In JS code, use api.getThisContext() (see below).
  1205. */
  1206. var thisContext = null;
  1207. /*
  1208. Runs worker function so that error handler is not set up
  1209. if there isn't one. This is accomplished by unconditional
  1210. wrapping inside a context of a simulated `nil seamlessDoIt` call,
  1211. which then stops error handler setup (see st.withContext above).
  1212. The effect is, $core.seamless(fn)'s exceptions are not
  1213. handed into ST error handler and caller should process them.
  1214. */
  1215. st.seamless = function (worker) {
  1216. var oldContext = thisContext;
  1217. thisContext = new SmalltalkMethodContext(thisContext, function (ctx) {
  1218. ctx.fill(null, "seamlessDoIt", {}, globals.UndefinedObject);
  1219. });
  1220. var result = worker(thisContext);
  1221. thisContext = oldContext;
  1222. return result;
  1223. };
  1224. function resultWithErrorHandling (worker) {
  1225. try {
  1226. return worker(thisContext);
  1227. } catch (error) {
  1228. globals.ErrorHandler._handleError_(error);
  1229. thisContext = null;
  1230. // Rethrow the error in any case.
  1231. throw error;
  1232. }
  1233. }
  1234. /*
  1235. Standard way to run within context.
  1236. Sets up error handler if entering first ST context in a stack.
  1237. */
  1238. st.withContext = function (worker, setup) {
  1239. var oldContext = thisContext;
  1240. thisContext = new SmalltalkMethodContext(thisContext, setup);
  1241. var result = oldContext == null ? resultWithErrorHandling(worker) : worker(thisContext);
  1242. thisContext = oldContext;
  1243. return result;
  1244. };
  1245. /* Handle thisContext pseudo variable */
  1246. st.getThisContext = function () {
  1247. if (!thisContext) return null;
  1248. for (var frame = thisContext; frame; frame = frame.homeContext) {
  1249. frame.setup(frame);
  1250. }
  1251. return thisContext;
  1252. };
  1253. }
  1254. MessageSendBrik.deps = ["smalltalkGlobals", "selectorConversion", "root"];
  1255. function MessageSendBrik (brikz, st) {
  1256. var globals = brikz.smalltalkGlobals.globals;
  1257. var nilAsReceiver = brikz.root.nilAsReceiver;
  1258. /* Send message programmatically. Used to implement #perform: & Co. */
  1259. st.send2 = function (self, selector, args, klass) {
  1260. if (self == null) {
  1261. self = nilAsReceiver;
  1262. }
  1263. var method = klass ? klass.fn.prototype[st.st2js(selector)] : self.a$cls && self[st.st2js(selector)];
  1264. return method != null ?
  1265. method.apply(self, args || []) :
  1266. globals.Message._selector_arguments_notUnderstoodBy_(
  1267. selector, [].slice.call(args), self.a$cls ? self : wrapJavaScript(self)
  1268. );
  1269. };
  1270. function wrapJavaScript (o) {
  1271. return globals.JSObjectProxy._on_(o);
  1272. }
  1273. st.wrapJavaScript = wrapJavaScript;
  1274. /* If the object property is a function, then call it, except if it starts with
  1275. an uppercase character (we probably want to answer the function itself in this
  1276. case and send it #new from Amber).
  1277. */
  1278. st.accessJavaScript = function (self, propertyName, args) {
  1279. var propertyValue = self[propertyName];
  1280. if (typeof propertyValue === "function" && !/^[A-Z]/.test(propertyName)) {
  1281. return propertyValue.apply(self, args || []);
  1282. } else if (args.length === 0) {
  1283. return propertyValue;
  1284. } else {
  1285. self[propertyName] = args[0];
  1286. return self;
  1287. }
  1288. };
  1289. }
  1290. function SelectorConversionBrik (brikz, st) {
  1291. /* Convert a Smalltalk selector into a JS selector */
  1292. st.st2js = this.st2js = function (string) {
  1293. return '_' + string
  1294. .replace(/:/g, '_')
  1295. .replace(/[\&]/g, '_and')
  1296. .replace(/[\|]/g, '_or')
  1297. .replace(/[+]/g, '_plus')
  1298. .replace(/-/g, '_minus')
  1299. .replace(/[*]/g, '_star')
  1300. .replace(/[\/]/g, '_slash')
  1301. .replace(/[\\]/g, '_backslash')
  1302. .replace(/[\~]/g, '_tild')
  1303. .replace(/%/g, '_percent')
  1304. .replace(/>/g, '_gt')
  1305. .replace(/</g, '_lt')
  1306. .replace(/=/g, '_eq')
  1307. .replace(/,/g, '_comma')
  1308. .replace(/[@]/g, '_at');
  1309. };
  1310. /* Convert a string to a valid smalltalk selector.
  1311. if you modify the following functions, also change st2js
  1312. accordingly */
  1313. st.js2st = function (selector) {
  1314. if (selector.match(/^__/)) {
  1315. return binaryJsToSt(selector);
  1316. } else {
  1317. return keywordJsToSt(selector);
  1318. }
  1319. };
  1320. function keywordJsToSt (selector) {
  1321. return selector.replace(/^_/, '').replace(/_/g, ':');
  1322. }
  1323. function binaryJsToSt (selector) {
  1324. return selector
  1325. .replace(/^_/, '')
  1326. .replace(/_and/g, '&')
  1327. .replace(/_or/g, '|')
  1328. .replace(/_plus/g, '+')
  1329. .replace(/_minus/g, '-')
  1330. .replace(/_star/g, '*')
  1331. .replace(/_slash/g, '/')
  1332. .replace(/_backslash/g, '\\')
  1333. .replace(/_tild/g, '~')
  1334. .replace(/_percent/g, '%')
  1335. .replace(/_gt/g, '>')
  1336. .replace(/_lt/g, '<')
  1337. .replace(/_eq/g, '=')
  1338. .replace(/_comma/g, ',')
  1339. .replace(/_at/g, '@');
  1340. }
  1341. st.st2prop = function (stSelector) {
  1342. var colonPosition = stSelector.indexOf(':');
  1343. return colonPosition === -1 ? stSelector : stSelector.slice(0, colonPosition);
  1344. };
  1345. }
  1346. StartImageBrik.deps = ["smalltalkGlobals"];
  1347. function StartImageBrik (brikz, st) {
  1348. var globals = brikz.smalltalkGlobals.globals;
  1349. this.run = function () {
  1350. globals.AmberBootstrapInitialization._run();
  1351. };
  1352. }
  1353. /* Making smalltalk that can run */
  1354. function configureWithRuntime (brikz) {
  1355. brikz.runtimeSelectors = RuntimeSelectorsBrik;
  1356. brikz.runtimeClasses = RuntimeClassesBrik;
  1357. brikz.frameBinding = FrameBindingBrik;
  1358. brikz.runtimeMethods = RuntimeMethodsBrik;
  1359. brikz.messageSend = MessageSendBrik;
  1360. brikz.runtime = RuntimeBrik;
  1361. brikz.primitives = PrimitivesBrik;
  1362. brikz.selectorConversion = SelectorConversionBrik;
  1363. brikz.startImage = StartImageBrik;
  1364. brikz.rebuild();
  1365. }
  1366. return configureWithRuntime;
  1367. });
  1368. // Depend on each module that is loaded lazily.
  1369. // Add to packager tasks as dependency,
  1370. // so the lazy-loaded modules are included.
  1371. define('amber/lazypack',['./kernel-runtime'], {});
  1372. //jshint eqnull:true
  1373. define('amber/kernel-checks',[],function () {
  1374. "use strict";
  1375. function assert (fn) {
  1376. try {
  1377. if (fn()) return;
  1378. } catch (ex) {
  1379. throw new Error("Error:\n" + ex + "in assertion:\n" + fn);
  1380. }
  1381. throw new Error("Assertion failed:\n" + fn);
  1382. }
  1383. assert(function () {
  1384. return !("hasOwnProperty" in Object.create(null));
  1385. });
  1386. assert(function () {
  1387. return Object.getPrototypeOf(Object.create(null)) === null;
  1388. });
  1389. assert(function () {
  1390. var p = {};
  1391. return Object.getPrototypeOf(Object.create(p)) === p;
  1392. });
  1393. // assert(function () {
  1394. // return new Function("return this")().Object === Object;
  1395. // });
  1396. // assert(function () {
  1397. // return Object.create(new Function("return this")()).Object === Object;
  1398. // });
  1399. assert(function () {
  1400. return typeof global !== "undefined";
  1401. });
  1402. assert(function () {
  1403. return global.Object === Object;
  1404. });
  1405. assert(function () {
  1406. return Object.create(global).Object === Object;
  1407. });
  1408. assert(function () {
  1409. return (function () {
  1410. return this;
  1411. }).apply(void 0) === void 0;
  1412. });
  1413. assert(function () {
  1414. return (function () {
  1415. return this;
  1416. }).apply(null) === null;
  1417. });
  1418. assert(function () {
  1419. return (function () {
  1420. return this;
  1421. }).apply(3) === 3;
  1422. });
  1423. assert(function () {
  1424. return (function () {
  1425. return this;
  1426. }).apply("foo") === "foo";
  1427. });
  1428. assert(function () {
  1429. return (function () {
  1430. return this;
  1431. }).apply(true) === true;
  1432. });
  1433. assert(function () {
  1434. var o = Object.freeze({});
  1435. try {
  1436. o.foo = "bar";
  1437. } catch (ex) {
  1438. }
  1439. return o.foo == null;
  1440. });
  1441. assert(function () {
  1442. return typeof Promise === "function";
  1443. });
  1444. assert(function () {
  1445. return typeof Promise.resolve === "function";
  1446. });
  1447. assert(function () {
  1448. return typeof Promise.reject === "function";
  1449. });
  1450. assert(function () {
  1451. return typeof new Promise(function () {
  1452. }).then === "function";
  1453. });
  1454. });
  1455. define('amber/brikz',[], function () {
  1456. return function Brikz(api, apiKey, initKey) {
  1457. "use strict";
  1458. //jshint eqnull:true
  1459. var brikz = this,
  1460. backup = {};
  1461. apiKey = apiKey || 'exports';
  1462. initKey = initKey || '__init__';
  1463. function mixin(src, target, what) {
  1464. for (var keys = Object.keys(what || src), l = keys.length, i = 0; i < l; ++i) {
  1465. if (src == null) {
  1466. target[keys[i]] = undefined;
  1467. } else {
  1468. var value = src[keys[i]];
  1469. if (typeof value !== "undefined") {
  1470. target[keys[i]] = value;
  1471. }
  1472. }
  1473. }
  1474. return target;
  1475. }
  1476. Object.defineProperties(this, {
  1477. rebuild: { value: null, enumerable: false, configurable: true, writable: true }
  1478. });
  1479. var exclude = mixin(this, {});
  1480. this.rebuild = function () {
  1481. Object.keys(backup).forEach(function (key) {
  1482. mixin(null, api, (backup[key] || 0)[apiKey] || {});
  1483. });
  1484. var oapi = mixin(api, {}),
  1485. order = [],
  1486. chk = {};
  1487. function ensure(key) {
  1488. if (key in exclude) {
  1489. return null;
  1490. }
  1491. var b = brikz[key],
  1492. bak = backup[key];
  1493. mixin(null, api, api);
  1494. while (typeof b === "function") {
  1495. (b.deps || []).forEach(ensure);
  1496. b = new b(brikz, api, bak);
  1497. }
  1498. brikz[key] = b;
  1499. if (b && !chk[key]) {
  1500. chk[key] = true;
  1501. order.push(b);
  1502. }
  1503. if (b && !b[apiKey]) {
  1504. b[apiKey] = mixin(api, {});
  1505. }
  1506. }
  1507. Object.keys(brikz).forEach(ensure);
  1508. mixin(oapi, mixin(null, api, api));
  1509. order.forEach(function (brik) {
  1510. mixin(brik[apiKey] || {}, api);
  1511. });
  1512. order.forEach(function (brik) {
  1513. if (brik[initKey]) {
  1514. brik[initKey]();
  1515. if (brik[initKey].once) {
  1516. delete brik[initKey];
  1517. }
  1518. }
  1519. });
  1520. backup = mixin(brikz, {});
  1521. };
  1522. };
  1523. });
  1524. /* ====================================================================
  1525. |
  1526. | Amber Smalltalk
  1527. | http://amber-lang.net
  1528. |
  1529. ======================================================================
  1530. ======================================================================
  1531. |
  1532. | Copyright (c) 2010-2014
  1533. | Nicolas Petton <petton.nicolas@gmail.com>
  1534. |
  1535. | Copyright (c) 2012-2017
  1536. | The Amber team https://lolg.it/org/amber/members
  1537. | Amber contributors (see /CONTRIBUTORS)
  1538. |
  1539. | Amber is released under the MIT license
  1540. |
  1541. | Permission is hereby granted, free of charge, to any person obtaining
  1542. | a copy of this software and associated documentation files (the
  1543. | 'Software'), to deal in the Software without restriction, including
  1544. | without limitation the rights to use, copy, modify, merge, publish,
  1545. | distribute, sublicense, and/or sell copies of the Software, and to
  1546. | permit persons to whom the Software is furnished to do so, subject to
  1547. | the following conditions:
  1548. |
  1549. | The above copyright notice and this permission notice shall be
  1550. | included in all copies or substantial portions of the Software.
  1551. |
  1552. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1553. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1554. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1555. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1556. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1557. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1558. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1559. |
  1560. ==================================================================== */
  1561. //jshint eqnull:true
  1562. define('amber/kernel-fundamentals',[],function () {
  1563. "use strict";
  1564. function inherits (child, parent) {
  1565. child.prototype = Object.create(parent.prototype, {
  1566. constructor: {
  1567. value: child,
  1568. enumerable: false, configurable: true, writable: true
  1569. }
  1570. });
  1571. return child;
  1572. }
  1573. function SmalltalkGlobalsBrik (brikz, st) {
  1574. var globals = Object.create(global);
  1575. globals.SmalltalkSettings = {};
  1576. this.globals = globals;
  1577. }
  1578. function EventBrik (brikz, st) {
  1579. var emit = {};
  1580. this.emit = emit;
  1581. this.declareEvent = function (event) {
  1582. if (!emit[event]) emit[event] = function () {
  1583. };
  1584. }
  1585. }
  1586. function RootBrik (brikz, st) {
  1587. /* Smalltalk foundational objects */
  1588. var coreFns = this.coreFns = {};
  1589. /* SmalltalkRoot is the hidden root of the normal Amber hierarchy.
  1590. All objects including `ProtoObject` inherit from SmalltalkRoot.
  1591. Detached roots (eg. wrapped JS classes like Number or Date)
  1592. do not directly inherit from SmalltalkRoot, but employ a workaround.*/
  1593. function SmalltalkRoot () {
  1594. }
  1595. function SmalltalkProtoObject () {
  1596. }
  1597. function SmalltalkObject () {
  1598. }
  1599. coreFns.ProtoObject = inherits(SmalltalkProtoObject, SmalltalkRoot);
  1600. coreFns.Object = inherits(SmalltalkObject, SmalltalkProtoObject);
  1601. this.Root = SmalltalkRoot;
  1602. this.Object = SmalltalkObject;
  1603. }
  1604. function SelectorsBrik (brikz, st) {
  1605. var selectorSet = Object.create(null);
  1606. var selectors = this.selectors = [];
  1607. this.registerSelector = function (stSelector) {
  1608. if (selectorSet[stSelector]) return false;
  1609. selectors.push(stSelector);
  1610. return selectorSet[stSelector] = true;
  1611. };
  1612. st.allSelectors = function () {
  1613. return selectors;
  1614. };
  1615. }
  1616. function PackagesBrik (brikz, st) {
  1617. st.packages = st.packageDescriptors = {};
  1618. /* Add a package load descriptor to the system */
  1619. st.addPackage = function (name, properties) {
  1620. if (!name) return null;
  1621. return st.packageDescriptors[name] = {properties: properties};
  1622. };
  1623. }
  1624. BehaviorsBrik.deps = ["root", "smalltalkGlobals", "arraySet"];
  1625. function BehaviorsBrik (brikz, st) {
  1626. var globals = brikz.smalltalkGlobals.globals;
  1627. var addElement = brikz.arraySet.addElement;
  1628. var removeElement = brikz.arraySet.removeElement;
  1629. /* Smalltalk classes and traits */
  1630. var traitsOrClasses = [];
  1631. this.buildTraitOrClass = function (category, builder) {
  1632. var traitOrClass = globals.hasOwnProperty(builder.name) && globals[builder.name];
  1633. if (traitOrClass) {
  1634. builder.updateExisting(traitOrClass);
  1635. } else {
  1636. traitOrClass = builder.make();
  1637. traitOrClass.category = category;
  1638. addTraitOrClass(traitOrClass);
  1639. }
  1640. return traitOrClass;
  1641. };
  1642. function addTraitOrClass (traitOrClass) {
  1643. globals[traitOrClass.name] = traitOrClass;
  1644. addElement(traitsOrClasses, traitOrClass);
  1645. traitOrClass.added();
  1646. }
  1647. function removeTraitOrClass (traitOrClass) {
  1648. traitOrClass.removed();
  1649. removeElement(traitsOrClasses, traitOrClass);
  1650. delete globals[traitOrClass.name];
  1651. }
  1652. this.removeTraitOrClass = removeTraitOrClass;
  1653. /* Create an alias for an existing class */
  1654. st.alias = function (traitOrClass, alias) {
  1655. globals[alias] = traitOrClass;
  1656. };
  1657. st.traitsOrClasses = this.traitsOrClasses = traitsOrClasses;
  1658. }
  1659. MethodsBrik.deps = ["event", "selectors", "root"];
  1660. function MethodsBrik (brikz, st) {
  1661. var registerSelector = brikz.selectors.registerSelector;
  1662. var SmalltalkObject = brikz.root.Object;
  1663. var coreFns = brikz.root.coreFns;
  1664. var emit = brikz.event.emit;
  1665. var declareEvent = brikz.event.declareEvent;
  1666. function SmalltalkMethod () {
  1667. }
  1668. coreFns.CompiledMethod = inherits(SmalltalkMethod, SmalltalkObject);
  1669. /* Smalltalk method object. To add a method to a class,
  1670. use api.addMethod() */
  1671. st.method = function (spec) {
  1672. var that = new SmalltalkMethod();
  1673. var selector = spec.selector;
  1674. that.selector = selector;
  1675. that.args = spec.args || {};
  1676. that.protocol = spec.protocol;
  1677. that.source = spec.source;
  1678. that.messageSends = spec.messageSends || [];
  1679. // TODO remove .referencedClasses, have .referencedGlobals
  1680. that.referencedClasses = spec.referencedClasses || [];
  1681. that.fn = spec.fn;
  1682. return that;
  1683. };
  1684. /* Add/remove a method to/from a class */
  1685. st.addMethod = function (method, traitOrBehavior) {
  1686. if (method.owner != null) {
  1687. throw new Error("addMethod: Method " + method.selector + " already bound to " + method.owner);
  1688. }
  1689. method.owner = traitOrBehavior;
  1690. // TODO deprecation helper; remove
  1691. Object.defineProperty(method, "methodClass", {
  1692. get: function () {
  1693. console.warn("Use of .methodClass deprecated, use .owner");
  1694. return method.owner;
  1695. },
  1696. set: function (v) {
  1697. console.warn("Use of .methodClass= deprecated, use .owner=");
  1698. method.owner = v;
  1699. }
  1700. });
  1701. registerNewSelectors(method);
  1702. traitOrBehavior.localMethods[method.selector] = method;
  1703. updateMethod(method.selector, traitOrBehavior);
  1704. };
  1705. declareEvent("selectorsAdded");
  1706. function registerNewSelectors (method) {
  1707. var newSelectors = [];
  1708. function selectorInUse (stSelector) {
  1709. if (registerSelector(stSelector)) {
  1710. newSelectors.push(stSelector);
  1711. }
  1712. }
  1713. selectorInUse(method.selector);
  1714. method.messageSends.forEach(selectorInUse);
  1715. emit.selectorsAdded(newSelectors);
  1716. }
  1717. st.removeMethod = function (method, traitOrBehavior) {
  1718. if (traitOrBehavior.localMethods[method.selector] !== method) return;
  1719. delete traitOrBehavior.localMethods[method.selector];
  1720. updateMethod(method.selector, traitOrBehavior);
  1721. };
  1722. this.setupMethods = function (traitOrBehavior) {
  1723. traitOrBehavior.localMethods = Object.create(null);
  1724. traitOrBehavior.methods = Object.create(null);
  1725. };
  1726. declareEvent("methodReplaced");
  1727. function updateMethod (selector, traitOrBehavior) {
  1728. var oldMethod = traitOrBehavior.methods[selector],
  1729. newMethod = traitOrBehavior.localMethods[selector];
  1730. if (oldMethod == null && newMethod == null) {
  1731. console.warn("Removal of nonexistent method " + traitOrBehavior + " >> " + selector);
  1732. return;
  1733. }
  1734. if (newMethod === oldMethod) return;
  1735. if (newMethod != null) {
  1736. traitOrBehavior.methods[selector] = newMethod;
  1737. traitOrBehavior.methodAdded(newMethod);
  1738. } else {
  1739. delete traitOrBehavior.methods[selector];
  1740. traitOrBehavior.methodRemoved(oldMethod);
  1741. }
  1742. emit.methodReplaced(newMethod, oldMethod, traitOrBehavior);
  1743. }
  1744. this.updateMethod = updateMethod;
  1745. }
  1746. function ArraySetBrik (brikz, st) {
  1747. st.addElement = this.addElement = function (array, el) {
  1748. if (typeof el === 'undefined') {
  1749. return;
  1750. }
  1751. if (array.indexOf(el) === -1) {
  1752. array.push(el);
  1753. }
  1754. };
  1755. st.removeElement = this.removeElement = function (array, el) {
  1756. var i = array.indexOf(el);
  1757. if (i !== -1) {
  1758. array.splice(i, 1);
  1759. }
  1760. };
  1761. }
  1762. NilBrik.deps = ["root"];
  1763. function NilBrik (brikz, st) {
  1764. var SmalltalkObject = brikz.root.Object;
  1765. var coreFns = brikz.root.coreFns;
  1766. function SmalltalkNil () {
  1767. }
  1768. coreFns.UndefinedObject = inherits(SmalltalkNil, SmalltalkObject);
  1769. this.nilAsReceiver = new SmalltalkNil();
  1770. this.nilAsValue = this.nilAsReceiver; // TODO null
  1771. // Adds an `a$nil` (and legacy `isNil`) property to the `nil` object. When sending
  1772. // nil objects from one environment to another, doing
  1773. // `anObject == nil` (in JavaScript) does not always answer
  1774. // true as the referenced nil object might come from the other
  1775. // environment.
  1776. Object.defineProperty(this.nilAsReceiver, 'a$nil', {
  1777. value: true,
  1778. enumerable: false, configurable: false, writable: false
  1779. });
  1780. Object.defineProperty(this.nilAsReceiver, 'isNil', {
  1781. value: true,
  1782. enumerable: false, configurable: false, writable: false
  1783. });
  1784. }
  1785. /* Making smalltalk that has basic building blocks */
  1786. function configureWithFundamentals (brikz) {
  1787. brikz.smalltalkGlobals = SmalltalkGlobalsBrik;
  1788. brikz.root = RootBrik;
  1789. brikz.nil = NilBrik;
  1790. brikz.event = EventBrik;
  1791. brikz.arraySet = ArraySetBrik;
  1792. brikz.selectors = SelectorsBrik;
  1793. brikz.packages = PackagesBrik;
  1794. brikz.behaviors = BehaviorsBrik;
  1795. brikz.methods = MethodsBrik;
  1796. brikz.rebuild();
  1797. }
  1798. return configureWithFundamentals;
  1799. });
  1800. /* ====================================================================
  1801. |
  1802. | Amber Smalltalk
  1803. | http://amber-lang.net
  1804. |
  1805. ======================================================================
  1806. ======================================================================
  1807. |
  1808. | Copyright (c) 2010-2014
  1809. | Nicolas Petton <petton.nicolas@gmail.com>
  1810. |
  1811. | Copyright (c) 2012-2017
  1812. | The Amber team https://lolg.it/org/amber/members
  1813. | Amber contributors (see /CONTRIBUTORS)
  1814. |
  1815. | Amber is released under the MIT license
  1816. |
  1817. | Permission is hereby granted, free of charge, to any person obtaining
  1818. | a copy of this software and associated documentation files (the
  1819. | 'Software'), to deal in the Software without restriction, including
  1820. | without limitation the rights to use, copy, modify, merge, publish,
  1821. | distribute, sublicense, and/or sell copies of the Software, and to
  1822. | permit persons to whom the Software is furnished to do so, subject to
  1823. | the following conditions:
  1824. |
  1825. | The above copyright notice and this permission notice shall be
  1826. | included in all copies or substantial portions of the Software.
  1827. |
  1828. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  1829. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  1830. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  1831. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  1832. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  1833. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  1834. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  1835. |
  1836. ==================================================================== */
  1837. //jshint eqnull:true
  1838. define('amber/kernel-language',[],function () {
  1839. "use strict";
  1840. function inherits (child, parent) {
  1841. child.prototype = Object.create(parent.prototype, {
  1842. constructor: {
  1843. value: child,
  1844. enumerable: false, configurable: true, writable: true
  1845. }
  1846. });
  1847. return child;
  1848. }
  1849. function defineMethod (klass, name, method) {
  1850. Object.defineProperty(klass.prototype, name, {
  1851. value: method,
  1852. enumerable: false, configurable: true, writable: true
  1853. });
  1854. }
  1855. TraitsBrik.deps = ["event", "behaviors", "methods", "composition", "root"];
  1856. function TraitsBrik (brikz, st) {
  1857. var coreFns = brikz.root.coreFns;
  1858. var SmalltalkObject = brikz.root.Object;
  1859. var setupMethods = brikz.methods.setupMethods;
  1860. var traitMethodChanged = brikz.composition.traitMethodChanged;
  1861. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  1862. var emit = brikz.event.emit;
  1863. var declareEvent = brikz.event.declareEvent;
  1864. function SmalltalkTrait () {
  1865. }
  1866. coreFns.Trait = inherits(SmalltalkTrait, SmalltalkObject);
  1867. SmalltalkTrait.prototype.trait = true;
  1868. defineMethod(SmalltalkTrait, "toString", function () {
  1869. return 'Smalltalk Trait ' + this.name;
  1870. });
  1871. declareEvent("traitAdded");
  1872. defineMethod(SmalltalkTrait, "added", function () {
  1873. emit.traitAdded(this);
  1874. });
  1875. declareEvent("traitRemoved");
  1876. defineMethod(SmalltalkTrait, "removed", function () {
  1877. emit.traitRemoved(this);
  1878. });
  1879. declareEvent("traitMethodAdded");
  1880. defineMethod(SmalltalkTrait, "methodAdded", function (method) {
  1881. var self = this;
  1882. this.traitUsers.forEach(function (each) {
  1883. traitMethodChanged(method.selector, method, self, each);
  1884. });
  1885. emit.traitMethodAdded(method, this);
  1886. });
  1887. declareEvent("traitMethodRemoved");
  1888. defineMethod(SmalltalkTrait, "methodRemoved", function (method) {
  1889. var self = this;
  1890. this.traitUsers.forEach(function (each) {
  1891. traitMethodChanged(method.selector, null, self, each);
  1892. });
  1893. emit.traitMethodRemoved(method, this);
  1894. });
  1895. function traitBuilder (traitName) {
  1896. return {
  1897. name: traitName,
  1898. make: function () {
  1899. var that = new SmalltalkTrait();
  1900. // TODO deprecation helper; remove
  1901. Object.defineProperty(that, "className", {
  1902. get: function () {
  1903. console.warn("Use of .className deprecated, use .name");
  1904. return that.name;
  1905. },
  1906. set: function (v) {
  1907. console.warn("Use of .className= deprecated, use .name=");
  1908. that.name = v;
  1909. }
  1910. });
  1911. that.name = traitName;
  1912. that.traitUsers = [];
  1913. setupMethods(that);
  1914. return that;
  1915. },
  1916. updateExisting: function (trait) {
  1917. }
  1918. };
  1919. }
  1920. st.addTrait = function (className, category) {
  1921. return buildTraitOrClass(category, traitBuilder(className));
  1922. };
  1923. }
  1924. MethodCompositionBrik.deps = ["methods", "arraySet"];
  1925. function MethodCompositionBrik (brikz, st) {
  1926. var updateMethod = brikz.methods.updateMethod;
  1927. var addElement = brikz.arraySet.addElement;
  1928. var removeElement = brikz.arraySet.removeElement;
  1929. function aliased (selector, method) {
  1930. if (method.selector === selector) return method;
  1931. var result = st.method({
  1932. selector: selector,
  1933. args: method.args,
  1934. protocol: method.protocol,
  1935. source: '"Aliased as ' + selector + '"\n' + method.source,
  1936. messageSends: method.messageSends,
  1937. referencesClasses: method.referencedClasses,
  1938. fn: method.fn
  1939. });
  1940. result.owner = method.owner;
  1941. return result;
  1942. }
  1943. function deleteKeysFrom (keys, obj) {
  1944. keys.forEach(function (each) {
  1945. delete obj[each];
  1946. });
  1947. }
  1948. function fillTraitTransformation (traitTransformation, obj) {
  1949. // assert(Object.getOwnProperties(obj).length === 0)
  1950. var traitMethods = traitTransformation.trait.methods;
  1951. Object.keys(traitMethods).forEach(function (selector) {
  1952. obj[selector] = traitMethods[selector];
  1953. });
  1954. var traitAliases = traitTransformation.aliases;
  1955. if (traitAliases) {
  1956. Object.keys(traitAliases).forEach(function (aliasSelector) {
  1957. var aliasedMethod = traitMethods[traitAliases[aliasSelector]];
  1958. if (aliasedMethod) obj[aliasSelector] = aliased(aliasSelector, aliasedMethod);
  1959. // else delete obj[aliasSelector]; // semantically correct; optimized away
  1960. });
  1961. }
  1962. var traitExclusions = traitTransformation.exclusions;
  1963. if (traitExclusions) {
  1964. deleteKeysFrom(traitExclusions, obj);
  1965. }
  1966. return obj;
  1967. }
  1968. function buildCompositionChain (traitComposition) {
  1969. return traitComposition.reduce(function (soFar, each) {
  1970. return fillTraitTransformation(each, Object.create(soFar));
  1971. }, null);
  1972. }
  1973. st.setTraitComposition = function (traitComposition, traitOrBehavior) {
  1974. var oldLocalMethods = traitOrBehavior.localMethods,
  1975. newLocalMethods = Object.create(buildCompositionChain(traitComposition));
  1976. Object.keys(oldLocalMethods).forEach(function (selector) {
  1977. newLocalMethods[selector] = oldLocalMethods[selector];
  1978. });
  1979. var selector;
  1980. traitOrBehavior.localMethods = newLocalMethods;
  1981. for (selector in newLocalMethods) {
  1982. updateMethod(selector, traitOrBehavior);
  1983. }
  1984. for (selector in oldLocalMethods) {
  1985. updateMethod(selector, traitOrBehavior);
  1986. }
  1987. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1988. removeElement(each.trait.traitUsers, traitOrBehavior);
  1989. });
  1990. traitOrBehavior.traitComposition = traitComposition && traitComposition.length ? traitComposition : null;
  1991. (traitOrBehavior.traitComposition || []).forEach(function (each) {
  1992. addElement(each.trait.traitUsers, traitOrBehavior);
  1993. });
  1994. };
  1995. function aliasesOfSelector (selector, traitAliases) {
  1996. if (!traitAliases) return [selector];
  1997. var result = Object.keys(traitAliases).filter(function (aliasSelector) {
  1998. return traitAliases[aliasSelector] === selector
  1999. });
  2000. if (!traitAliases[selector]) result.push(selector);
  2001. return result;
  2002. }
  2003. function applyTraitMethodAddition (selector, method, traitTransformation, obj) {
  2004. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2005. changes.forEach(function (aliasSelector) {
  2006. obj[aliasSelector] = aliased(aliasSelector, method);
  2007. });
  2008. var traitExclusions = traitTransformation.exclusions;
  2009. if (traitExclusions) {
  2010. deleteKeysFrom(traitExclusions, obj);
  2011. }
  2012. return changes;
  2013. }
  2014. function applyTraitMethodDeletion (selector, traitTransformation, obj) {
  2015. var changes = aliasesOfSelector(selector, traitTransformation.aliases);
  2016. deleteKeysFrom(changes, obj);
  2017. return changes;
  2018. }
  2019. function traitMethodChanged (selector, method, trait, traitOrBehavior) {
  2020. var traitComposition = traitOrBehavior.traitComposition,
  2021. chain = traitOrBehavior.localMethods,
  2022. changes = [];
  2023. for (var i = traitComposition.length - 1; i >= 0; --i) {
  2024. chain = Object.getPrototypeOf(chain);
  2025. var traitTransformation = traitComposition[i];
  2026. if (traitTransformation.trait !== trait) continue;
  2027. changes.push.apply(changes, method ?
  2028. applyTraitMethodAddition(selector, method, traitTransformation, chain) :
  2029. applyTraitMethodDeletion(selector, traitTransformation, chain));
  2030. }
  2031. // assert(chain === null);
  2032. changes.forEach(function (each) {
  2033. updateMethod(each, traitOrBehavior);
  2034. });
  2035. }
  2036. this.traitMethodChanged = traitMethodChanged;
  2037. }
  2038. ClassesBrik.deps = ["root", "event", "behaviors", "methods", "arraySet", "smalltalkGlobals"];
  2039. function ClassesBrik (brikz, st) {
  2040. var SmalltalkRoot = brikz.root.Root;
  2041. var coreFns = brikz.root.coreFns;
  2042. var globals = brikz.smalltalkGlobals.globals;
  2043. var SmalltalkObject = brikz.root.Object;
  2044. var buildTraitOrClass = brikz.behaviors.buildTraitOrClass;
  2045. var setupMethods = brikz.methods.setupMethods;
  2046. var removeTraitOrClass = brikz.behaviors.removeTraitOrClass;
  2047. var addElement = brikz.arraySet.addElement;
  2048. var removeElement = brikz.arraySet.removeElement;
  2049. var emit = brikz.event.emit;
  2050. var declareEvent = brikz.event.declareEvent;
  2051. function SmalltalkBehavior () {
  2052. }
  2053. function SmalltalkClass () {
  2054. }
  2055. function SmalltalkMetaclass () {
  2056. }
  2057. coreFns.Behavior = inherits(SmalltalkBehavior, SmalltalkObject);
  2058. coreFns.Class = inherits(SmalltalkClass, SmalltalkBehavior);
  2059. coreFns.Metaclass = inherits(SmalltalkMetaclass, SmalltalkBehavior);
  2060. // Fake root class of the system.
  2061. // Effective superclass of all classes created with `nil subclass: ...`.
  2062. var nilAsClass = this.nilAsClass = {
  2063. fn: SmalltalkRoot,
  2064. a$cls: {fn: SmalltalkClass},
  2065. klass: {fn: SmalltalkClass}
  2066. };
  2067. SmalltalkMetaclass.prototype.meta = true;
  2068. defineMethod(SmalltalkClass, "toString", function () {
  2069. return 'Smalltalk ' + this.name;
  2070. });
  2071. defineMethod(SmalltalkMetaclass, "toString", function () {
  2072. return 'Smalltalk Metaclass ' + this.instanceClass.name;
  2073. });
  2074. declareEvent("classAdded");
  2075. defineMethod(SmalltalkClass, "added", function () {
  2076. addSubclass(this);
  2077. emit.classAdded(this);
  2078. });
  2079. declareEvent("classRemoved");
  2080. defineMethod(SmalltalkClass, "removed", function () {
  2081. emit.classRemoved(this);
  2082. removeSubclass(this);
  2083. });
  2084. declareEvent("behaviorMethodAdded");
  2085. defineMethod(SmalltalkBehavior, "methodAdded", function (method) {
  2086. emit.behaviorMethodAdded(method, this);
  2087. });
  2088. declareEvent("behaviorMethodRemove");
  2089. defineMethod(SmalltalkBehavior, "methodRemoved", function (method) {
  2090. emit.behaviorMethodRemoved(method, this);
  2091. });
  2092. this.bootstrapHierarchy = function () {
  2093. var nilSubclasses = [globals.ProtoObject];
  2094. nilAsClass.a$cls = nilAsClass.klass = globals.Class;
  2095. nilSubclasses.forEach(function (each) {
  2096. each.a$cls.superclass = globals.Class;
  2097. addSubclass(each.a$cls);
  2098. });
  2099. };
  2100. /* Smalltalk class creation. A class is an instance of an automatically
  2101. created metaclass object. Newly created classes (not their metaclass)
  2102. should be added to the system, see smalltalk.addClass().
  2103. Superclass linking is *not* handled here, see api.initialize() */
  2104. function classBuilder (className, superclass, iVarNames, fn) {
  2105. var logicalSuperclass = superclass;
  2106. if (superclass == null || superclass.a$nil) {
  2107. superclass = nilAsClass;
  2108. logicalSuperclass = null;
  2109. }
  2110. function klass () {
  2111. var that = metaclass().instanceClass;
  2112. that.superclass = logicalSuperclass;
  2113. that.fn = fn || inherits(function () {
  2114. }, superclass.fn);
  2115. that.iVarNames = iVarNames || [];
  2116. // TODO deprecation helper; remove
  2117. Object.defineProperty(that, "className", {
  2118. get: function () {
  2119. console.warn("Use of .className deprecated, use .name");
  2120. return that.name;
  2121. },
  2122. set: function (v) {
  2123. console.warn("Use of .className= deprecated, use .name=");
  2124. that.name = v;
  2125. }
  2126. });
  2127. that.name = className;
  2128. that.subclasses = [];
  2129. setupMethods(that);
  2130. return that;
  2131. }
  2132. function metaclass () {
  2133. var that = new SmalltalkMetaclass();
  2134. that.superclass = superclass.a$cls;
  2135. that.fn = inherits(function () {
  2136. }, that.superclass.fn);
  2137. that.iVarNames = [];
  2138. that.instanceClass = new that.fn();
  2139. wireKlass(that);
  2140. setupMethods(that);
  2141. return that;
  2142. }
  2143. return {
  2144. name: className,
  2145. make: klass,
  2146. updateExisting: function (klass) {
  2147. if (klass.superclass == logicalSuperclass && (!fn || fn === klass.fn)) {
  2148. if (iVarNames) klass.iVarNames = iVarNames;
  2149. } else throw new Error("Incompatible change of class: " + klass.name);
  2150. }
  2151. };
  2152. }
  2153. function wireKlass (klass) {
  2154. Object.defineProperty(klass.fn.prototype, "a$cls", {
  2155. value: klass,
  2156. enumerable: false, configurable: true, writable: true
  2157. });
  2158. Object.defineProperty(klass.fn.prototype, "klass", {
  2159. value: klass,
  2160. enumerable: false, configurable: true, writable: true
  2161. });
  2162. }
  2163. this.wireKlass = wireKlass;
  2164. /* Add a class to the system, creating a new one if needed.
  2165. A Package is lazily created if one with given name does not exist. */
  2166. st.addClass = function (className, superclass, iVarNames, category) {
  2167. // While subclassing nil is allowed, it might be an error, so
  2168. // warn about it.
  2169. if (typeof superclass === 'undefined' || superclass && superclass.a$nil) {
  2170. console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
  2171. }
  2172. return buildTraitOrClass(category, classBuilder(className, superclass, iVarNames, coreFns[className]));
  2173. };
  2174. st.removeClass = removeTraitOrClass;
  2175. function addSubclass (klass) {
  2176. if (klass.superclass) {
  2177. addElement(klass.superclass.subclasses, klass);
  2178. }
  2179. }
  2180. function removeSubclass (klass) {
  2181. if (klass.superclass) {
  2182. removeElement(klass.superclass.subclasses, klass);
  2183. }
  2184. }
  2185. function metaSubclasses (metaclass) {
  2186. return metaclass.instanceClass.subclasses
  2187. .filter(function (each) {
  2188. return !each.meta;
  2189. })
  2190. .map(function (each) {
  2191. return each.a$cls;
  2192. });
  2193. }
  2194. st.metaSubclasses = metaSubclasses;
  2195. st.traverseClassTree = function (klass, fn) {
  2196. var queue = [klass], sentinel = {};
  2197. for (var i = 0; i < queue.length; ++i) {
  2198. var item = queue[i];
  2199. if (fn(item, sentinel) === sentinel) continue;
  2200. var subclasses = item.meta ? metaSubclasses(item) : item.subclasses;
  2201. queue.push.apply(queue, subclasses);
  2202. }
  2203. };
  2204. }
  2205. /* Making smalltalk that can load */
  2206. function configureWithHierarchy (brikz) {
  2207. brikz.traits = TraitsBrik;
  2208. brikz.composition = MethodCompositionBrik;
  2209. brikz.classes = ClassesBrik;
  2210. brikz.rebuild();
  2211. }
  2212. return configureWithHierarchy;
  2213. });
  2214. /* ====================================================================
  2215. |
  2216. | Amber Smalltalk
  2217. | http://amber-lang.net
  2218. |
  2219. ======================================================================
  2220. ======================================================================
  2221. |
  2222. | Copyright (c) 2010-2014
  2223. | Nicolas Petton <petton.nicolas@gmail.com>
  2224. |
  2225. | Copyright (c) 2012-2017
  2226. | The Amber team https://lolg.it/org/amber/members
  2227. | Amber contributors (see /CONTRIBUTORS)
  2228. |
  2229. | Amber is released under the MIT license
  2230. |
  2231. | Permission is hereby granted, free of charge, to any person obtaining
  2232. | a copy of this software and associated documentation files (the
  2233. | 'Software'), to deal in the Software without restriction, including
  2234. | without limitation the rights to use, copy, modify, merge, publish,
  2235. | distribute, sublicense, and/or sell copies of the Software, and to
  2236. | permit persons to whom the Software is furnished to do so, subject to
  2237. | the following conditions:
  2238. |
  2239. | The above copyright notice and this permission notice shall be
  2240. | included in all copies or substantial portions of the Software.
  2241. |
  2242. | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
  2243. | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  2244. | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
  2245. | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
  2246. | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  2247. | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
  2248. | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  2249. |
  2250. ==================================================================== */
  2251. //jshint eqnull:true
  2252. define('amber/boot',[
  2253. 'require', './kernel-checks', './brikz', './kernel-fundamentals', './kernel-language'
  2254. ], function (require, _, Brikz, configureWithFundamentals, configureWithHierarchy) {
  2255. "use strict";
  2256. require(['./kernel-runtime']); // preload
  2257. function SmalltalkInitBrik (brikz, st) {
  2258. var initialized = false;
  2259. var runtimeLoadedPromise = new Promise(function (resolve, reject) {
  2260. require(['./kernel-runtime'], resolve, reject);
  2261. });
  2262. /* Smalltalk initialization. Called on page load */
  2263. st.initialize = function () {
  2264. return runtimeLoadedPromise.then(function (configureWithRuntime) {
  2265. if (initialized) return;
  2266. brikz.classes.bootstrapHierarchy();
  2267. configureWithRuntime(brikz);
  2268. // TODO deprecation helper; remove
  2269. Object.defineProperty(st, "packages", {
  2270. get: function () {
  2271. console.warn("Use of .packages deprecated, use .packageDescriptors");
  2272. return st.packageDescriptors;
  2273. },
  2274. set: function (v) {
  2275. console.trace();
  2276. throw new Error("No one should be setting st.packages directly on initialized Amber.");
  2277. }
  2278. });
  2279. brikz.startImage.run();
  2280. initialized = true;
  2281. });
  2282. };
  2283. }
  2284. /* Adds AMD and requirejs related methods to the api */
  2285. function AMDBrik (brikz, st) {
  2286. st.amdRequire = require;
  2287. st.defaultTransportType = st.defaultTransportType || "amd";
  2288. st.defaultAmdNamespace = st.defaultAmdNamespace || "amber_core";
  2289. }
  2290. /* Defines asReceiver to be present at load time */
  2291. /* (logically it belongs more to PrimitiveBrik) */
  2292. AsReceiverBrik.deps = ["nil"];
  2293. function AsReceiverBrik (brikz, st) {
  2294. var nilAsReceiver = brikz.nil.nilAsReceiver;
  2295. /**
  2296. * This function is used all over the compiled amber code.
  2297. * It takes any value (JavaScript or Smalltalk)
  2298. * and returns a proper Amber Smalltalk receiver.
  2299. *
  2300. * null or undefined -> nilAsReceiver,
  2301. * object having Smalltalk signature -> unchanged,
  2302. * otherwise wrapped foreign (JS) object
  2303. */
  2304. this.asReceiver = function (o) {
  2305. if (o == null) return nilAsReceiver;
  2306. else if (o.a$cls != null) return o;
  2307. else return st.wrapJavaScript(o);
  2308. };
  2309. }
  2310. var api = {};
  2311. var brikz = new Brikz(api);
  2312. configureWithFundamentals(brikz);
  2313. configureWithHierarchy(brikz);
  2314. brikz.asReceiver = AsReceiverBrik;
  2315. brikz.stInit = SmalltalkInitBrik;
  2316. brikz.amd = AMDBrik;
  2317. brikz.rebuild();
  2318. return {
  2319. api: api,
  2320. nilAsReceiver: brikz.nil.nilAsReceiver,
  2321. nilAsValue: brikz.nil.nilAsValue,
  2322. nilAsClass: brikz.classes.nilAsClass,
  2323. globals: brikz.smalltalkGlobals.globals,
  2324. asReceiver: brikz.asReceiver.asReceiver
  2325. };
  2326. });
  2327. define('amber/helpers',["amber/boot", "require"], function (boot, require) {
  2328. var globals = boot.globals,
  2329. exports = {},
  2330. api = boot.api,
  2331. nil = boot.nilAsReceiver;
  2332. // API
  2333. exports.popupHelios = function () {
  2334. require(['helios/index'], function (helios) {
  2335. helios.popup();
  2336. }, function (err) {
  2337. window.alert("Error loading helios.\nIf not present, you can install it with 'bower install helios --save-dev'.\nThe error follows:\n" + err);
  2338. });
  2339. };
  2340. Object.defineProperty(exports, "api", {
  2341. value: api,
  2342. enumerable: true, configurable: true, writable: false
  2343. });
  2344. Object.defineProperty(exports, "globals", {
  2345. value: globals,
  2346. enumerable: true, configurable: true, writable: false
  2347. });
  2348. Object.defineProperty(exports, "nil", {
  2349. value: nil,
  2350. enumerable: true, configurable: true, writable: false
  2351. });
  2352. function mixinToSettings (source) {
  2353. var settings = globals.SmalltalkSettings;
  2354. Object.keys(source).forEach(function (key) {
  2355. settings[key] = source[key];
  2356. });
  2357. }
  2358. function settingsInLocalStorage () {
  2359. //jshint evil:true
  2360. var storage = 'localStorage' in global && global.localStorage;
  2361. if (storage) {
  2362. var fromStorage;
  2363. try {
  2364. fromStorage = JSON.parse(storage.getItem('amber.SmalltalkSettings'));
  2365. } catch (ex) {
  2366. // pass
  2367. }
  2368. mixinToSettings(fromStorage || {});
  2369. // TODO find less hackish way to store settings back to storage.
  2370. if (typeof window !== "undefined") {
  2371. requirejs(['jquery'], function ($) {
  2372. $(window).on('beforeunload', function () {
  2373. storage.setItem('amber.SmalltalkSettings', JSON.stringify(globals.SmalltalkSettings));
  2374. });
  2375. });
  2376. }
  2377. }
  2378. }
  2379. exports.initialize = function (options) {
  2380. return Promise.resolve()
  2381. .then(function () {
  2382. globals.SmalltalkSettings['transport.defaultAmdNamespace'] = api.defaultAmdNamespace;
  2383. })
  2384. .then(settingsInLocalStorage)
  2385. .then(function () {
  2386. return options || {};
  2387. })
  2388. .then(mixinToSettings)
  2389. .then(function () {
  2390. return api.initialize();
  2391. });
  2392. };
  2393. // Exports
  2394. return exports;
  2395. });
  2396. define('amber_core/Kernel-Helpers',["amber/boot"], function($boot){"use strict";
  2397. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2398. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2399. $core.addPackage("Kernel-Helpers");
  2400. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].innerEval = function (expr) { return eval(expr); };
  2401. ($core.packageDescriptors||$core.packages)["Kernel-Helpers"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2402. $core.addTrait("TSubclassable", "Kernel-Helpers");
  2403. $core.addMethod(
  2404. $core.method({
  2405. selector: "subclass:",
  2406. protocol: "class creation",
  2407. fn: function (aString){
  2408. var self=this,$self=this;
  2409. return $core.withContext(function($ctx1) {
  2410. return $self._subclass_instanceVariableNames_package_(aString,"",nil);
  2411. }, function($ctx1) {$ctx1.fill(self,"subclass:",{aString:aString},$globals.TSubclassable)});
  2412. },
  2413. args: ["aString"],
  2414. source: "subclass: aString \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: '' package: nil",
  2415. referencedClasses: [],
  2416. messageSends: ["subclass:instanceVariableNames:package:"]
  2417. }),
  2418. $globals.TSubclassable);
  2419. $core.addMethod(
  2420. $core.method({
  2421. selector: "subclass:instanceVariableNames:",
  2422. protocol: "class creation",
  2423. fn: function (aString,anotherString){
  2424. var self=this,$self=this;
  2425. return $core.withContext(function($ctx1) {
  2426. return $self._subclass_instanceVariableNames_package_(aString,anotherString,nil);
  2427. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:",{aString:aString,anotherString:anotherString},$globals.TSubclassable)});
  2428. },
  2429. args: ["aString", "anotherString"],
  2430. source: "subclass: aString instanceVariableNames: anotherString\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: anotherString package: nil",
  2431. referencedClasses: [],
  2432. messageSends: ["subclass:instanceVariableNames:package:"]
  2433. }),
  2434. $globals.TSubclassable);
  2435. $core.addMethod(
  2436. $core.method({
  2437. selector: "subclass:instanceVariableNames:category:",
  2438. protocol: "class creation",
  2439. fn: function (aString,aString2,aString3){
  2440. var self=this,$self=this;
  2441. return $core.withContext(function($ctx1) {
  2442. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2443. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:category:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2444. },
  2445. args: ["aString", "aString2", "aString3"],
  2446. source: "subclass: aString instanceVariableNames: aString2 category: aString3\x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString instanceVariableNames: aString2 package: aString3",
  2447. referencedClasses: [],
  2448. messageSends: ["subclass:instanceVariableNames:package:"]
  2449. }),
  2450. $globals.TSubclassable);
  2451. $core.addMethod(
  2452. $core.method({
  2453. selector: "subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2454. protocol: "class creation",
  2455. fn: function (aString,aString2,classVars,pools,aString3){
  2456. var self=this,$self=this;
  2457. return $core.withContext(function($ctx1) {
  2458. return $self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2459. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:classVariableNames:poolDictionaries:category:",{aString:aString,aString2:aString2,classVars:classVars,pools:pools,aString3:aString3},$globals.TSubclassable)});
  2460. },
  2461. args: ["aString", "aString2", "classVars", "pools", "aString3"],
  2462. 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",
  2463. referencedClasses: [],
  2464. messageSends: ["subclass:instanceVariableNames:package:"]
  2465. }),
  2466. $globals.TSubclassable);
  2467. $core.addMethod(
  2468. $core.method({
  2469. selector: "subclass:instanceVariableNames:package:",
  2470. protocol: "class creation",
  2471. fn: function (aString,aString2,aString3){
  2472. var self=this,$self=this;
  2473. return $core.withContext(function($ctx1) {
  2474. return $recv($recv($globals.ClassBuilder)._new())._superclass_subclass_instanceVariableNames_package_(self,$recv(aString)._asString(),aString2,aString3);
  2475. }, function($ctx1) {$ctx1.fill(self,"subclass:instanceVariableNames:package:",{aString:aString,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2476. },
  2477. args: ["aString", "aString2", "aString3"],
  2478. source: "subclass: aString instanceVariableNames: aString2 package: aString3\x0a\x09^ ClassBuilder new\x0a\x09\x09superclass: self subclass: aString asString instanceVariableNames: aString2 package: aString3",
  2479. referencedClasses: ["ClassBuilder"],
  2480. messageSends: ["superclass:subclass:instanceVariableNames:package:", "new", "asString"]
  2481. }),
  2482. $globals.TSubclassable);
  2483. $core.addMethod(
  2484. $core.method({
  2485. selector: "subclass:uses:",
  2486. protocol: "class creation",
  2487. fn: function (aString,aTraitCompositionDescription){
  2488. var self=this,$self=this;
  2489. return $core.withContext(function($ctx1) {
  2490. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,"",nil);
  2491. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription},$globals.TSubclassable)});
  2492. },
  2493. args: ["aString", "aTraitCompositionDescription"],
  2494. source: "subclass: aString uses: aTraitCompositionDescription \x0a\x09\x22Kept for file-in compatibility.\x22\x0a\x09^ self subclass: aString uses: aTraitCompositionDescription instanceVariableNames: '' package: nil",
  2495. referencedClasses: [],
  2496. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2497. }),
  2498. $globals.TSubclassable);
  2499. $core.addMethod(
  2500. $core.method({
  2501. selector: "subclass:uses:instanceVariableNames:",
  2502. protocol: "class creation",
  2503. fn: function (aString,aTraitCompositionDescription,anotherString){
  2504. var self=this,$self=this;
  2505. return $core.withContext(function($ctx1) {
  2506. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,anotherString,nil);
  2507. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString},$globals.TSubclassable)});
  2508. },
  2509. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  2510. 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",
  2511. referencedClasses: [],
  2512. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2513. }),
  2514. $globals.TSubclassable);
  2515. $core.addMethod(
  2516. $core.method({
  2517. selector: "subclass:uses:instanceVariableNames:category:",
  2518. protocol: "class creation",
  2519. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2520. var self=this,$self=this;
  2521. return $core.withContext(function($ctx1) {
  2522. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2523. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:category:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3},$globals.TSubclassable)});
  2524. },
  2525. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2526. 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",
  2527. referencedClasses: [],
  2528. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2529. }),
  2530. $globals.TSubclassable);
  2531. $core.addMethod(
  2532. $core.method({
  2533. selector: "subclass:uses:instanceVariableNames:classVariableNames:poolDictionaries:category:",
  2534. protocol: "class creation",
  2535. fn: function (aString,aTraitCompositionDescription,aString2,classVars,pools,aString3){
  2536. var self=this,$self=this;
  2537. return $core.withContext(function($ctx1) {
  2538. return $self._subclass_uses_instanceVariableNames_package_(aString,aTraitCompositionDescription,aString2,aString3);
  2539. }, 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)});
  2540. },
  2541. args: ["aString", "aTraitCompositionDescription", "aString2", "classVars", "pools", "aString3"],
  2542. 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",
  2543. referencedClasses: [],
  2544. messageSends: ["subclass:uses:instanceVariableNames:package:"]
  2545. }),
  2546. $globals.TSubclassable);
  2547. $core.addMethod(
  2548. $core.method({
  2549. selector: "subclass:uses:instanceVariableNames:package:",
  2550. protocol: "class creation",
  2551. fn: function (aString,aTraitCompositionDescription,aString2,aString3){
  2552. var self=this,$self=this;
  2553. var cls;
  2554. return $core.withContext(function($ctx1) {
  2555. cls=$self._subclass_instanceVariableNames_package_(aString,aString2,aString3);
  2556. $recv(cls)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  2557. return cls;
  2558. }, function($ctx1) {$ctx1.fill(self,"subclass:uses:instanceVariableNames:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,aString2:aString2,aString3:aString3,cls:cls},$globals.TSubclassable)});
  2559. },
  2560. args: ["aString", "aTraitCompositionDescription", "aString2", "aString3"],
  2561. 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",
  2562. referencedClasses: [],
  2563. messageSends: ["subclass:instanceVariableNames:package:", "setTraitComposition:", "asTraitComposition"]
  2564. }),
  2565. $globals.TSubclassable);
  2566. });
  2567. define('amber_core/Kernel-Objects',["amber/boot", "amber_core/Kernel-Helpers"], function($boot){"use strict";
  2568. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  2569. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  2570. $core.addPackage("Kernel-Objects");
  2571. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].innerEval = function (expr) { return eval(expr); };
  2572. ($core.packageDescriptors||$core.packages)["Kernel-Objects"].transport = {"type":"amd","amdNamespace":"amber_core"};
  2573. $core.addClass("ProtoObject", null, [], "Kernel-Objects");
  2574. $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.";
  2575. $core.addMethod(
  2576. $core.method({
  2577. selector: "=",
  2578. protocol: "comparing",
  2579. fn: function (anObject){
  2580. var self=this,$self=this;
  2581. return $core.withContext(function($ctx1) {
  2582. return $self.__eq_eq(anObject);
  2583. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.ProtoObject)});
  2584. },
  2585. args: ["anObject"],
  2586. source: "= anObject\x0a\x09^ self == anObject",
  2587. referencedClasses: [],
  2588. messageSends: ["=="]
  2589. }),
  2590. $globals.ProtoObject);
  2591. $core.addMethod(
  2592. $core.method({
  2593. selector: "==",
  2594. protocol: "comparing",
  2595. fn: function (anObject){
  2596. var self=this,$self=this;
  2597. return $core.withContext(function($ctx1) {
  2598. return self === anObject;
  2599. return self;
  2600. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.ProtoObject)});
  2601. },
  2602. args: ["anObject"],
  2603. source: "== anObject\x0a<inlineJS: 'return self === anObject'>",
  2604. referencedClasses: [],
  2605. messageSends: []
  2606. }),
  2607. $globals.ProtoObject);
  2608. $core.addMethod(
  2609. $core.method({
  2610. selector: "asString",
  2611. protocol: "converting",
  2612. fn: function (){
  2613. var self=this,$self=this;
  2614. return $core.withContext(function($ctx1) {
  2615. return $self._printString();
  2616. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.ProtoObject)});
  2617. },
  2618. args: [],
  2619. source: "asString\x0a\x09^ self printString",
  2620. referencedClasses: [],
  2621. messageSends: ["printString"]
  2622. }),
  2623. $globals.ProtoObject);
  2624. $core.addMethod(
  2625. $core.method({
  2626. selector: "class",
  2627. protocol: "accessing",
  2628. fn: function (){
  2629. var self=this,$self=this;
  2630. return $core.withContext(function($ctx1) {
  2631. return $self.a$cls;
  2632. return self;
  2633. }, function($ctx1) {$ctx1.fill(self,"class",{},$globals.ProtoObject)});
  2634. },
  2635. args: [],
  2636. source: "class\x0a\x09<inlineJS: 'return $self.a$cls'>",
  2637. referencedClasses: [],
  2638. messageSends: []
  2639. }),
  2640. $globals.ProtoObject);
  2641. $core.addMethod(
  2642. $core.method({
  2643. selector: "doesNotUnderstand:",
  2644. protocol: "error handling",
  2645. fn: function (aMessage){
  2646. var self=this,$self=this;
  2647. return $core.withContext(function($ctx1) {
  2648. var $1;
  2649. $1=$recv($globals.MessageNotUnderstood)._new();
  2650. $recv($1)._receiver_(self);
  2651. $recv($1)._message_(aMessage);
  2652. $recv($1)._signal();
  2653. return self;
  2654. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.ProtoObject)});
  2655. },
  2656. args: ["aMessage"],
  2657. source: "doesNotUnderstand: aMessage\x0a\x09MessageNotUnderstood new\x0a\x09\x09receiver: self;\x0a\x09\x09message: aMessage;\x0a\x09\x09signal",
  2658. referencedClasses: ["MessageNotUnderstood"],
  2659. messageSends: ["receiver:", "new", "message:", "signal"]
  2660. }),
  2661. $globals.ProtoObject);
  2662. $core.addMethod(
  2663. $core.method({
  2664. selector: "evaluate:on:",
  2665. protocol: "evaluating",
  2666. fn: function (aString,anEvaluator){
  2667. var self=this,$self=this;
  2668. return $core.withContext(function($ctx1) {
  2669. return $recv(anEvaluator)._evaluate_receiver_(aString,self);
  2670. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.ProtoObject)});
  2671. },
  2672. args: ["aString", "anEvaluator"],
  2673. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString receiver: self",
  2674. referencedClasses: [],
  2675. messageSends: ["evaluate:receiver:"]
  2676. }),
  2677. $globals.ProtoObject);
  2678. $core.addMethod(
  2679. $core.method({
  2680. selector: "identityHash",
  2681. protocol: "accessing",
  2682. fn: function (){
  2683. var self=this,$self=this;
  2684. return $core.withContext(function($ctx1) {
  2685. self._deprecatedAPI();
  2686. var hash=self.identityHash;
  2687. if (hash) return hash;
  2688. hash=$core.nextId();
  2689. Object.defineProperty(self, 'identityHash', {value:hash});
  2690. return hash;
  2691. ;
  2692. return self;
  2693. }, function($ctx1) {$ctx1.fill(self,"identityHash",{},$globals.ProtoObject)});
  2694. },
  2695. args: [],
  2696. source: "identityHash\x0a\x09<inlineJS: '\x0a\x09\x09self._deprecatedAPI();\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'>",
  2697. referencedClasses: [],
  2698. messageSends: []
  2699. }),
  2700. $globals.ProtoObject);
  2701. $core.addMethod(
  2702. $core.method({
  2703. selector: "ifNil:",
  2704. protocol: "testing",
  2705. fn: function (aBlock){
  2706. var self=this,$self=this;
  2707. return self;
  2708. },
  2709. args: ["aBlock"],
  2710. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  2711. referencedClasses: [],
  2712. messageSends: []
  2713. }),
  2714. $globals.ProtoObject);
  2715. $core.addMethod(
  2716. $core.method({
  2717. selector: "ifNil:ifNotNil:",
  2718. protocol: "testing",
  2719. fn: function (aBlock,anotherBlock){
  2720. var self=this,$self=this;
  2721. return $core.withContext(function($ctx1) {
  2722. return $recv(anotherBlock)._value_(self);
  2723. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2724. },
  2725. args: ["aBlock", "anotherBlock"],
  2726. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value: self",
  2727. referencedClasses: [],
  2728. messageSends: ["value:"]
  2729. }),
  2730. $globals.ProtoObject);
  2731. $core.addMethod(
  2732. $core.method({
  2733. selector: "ifNotNil:",
  2734. protocol: "testing",
  2735. fn: function (aBlock){
  2736. var self=this,$self=this;
  2737. return $core.withContext(function($ctx1) {
  2738. return $recv(aBlock)._value_(self);
  2739. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{aBlock:aBlock},$globals.ProtoObject)});
  2740. },
  2741. args: ["aBlock"],
  2742. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2743. referencedClasses: [],
  2744. messageSends: ["value:"]
  2745. }),
  2746. $globals.ProtoObject);
  2747. $core.addMethod(
  2748. $core.method({
  2749. selector: "ifNotNil:ifNil:",
  2750. protocol: "testing",
  2751. fn: function (aBlock,anotherBlock){
  2752. var self=this,$self=this;
  2753. return $core.withContext(function($ctx1) {
  2754. return $recv(aBlock)._value_(self);
  2755. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.ProtoObject)});
  2756. },
  2757. args: ["aBlock", "anotherBlock"],
  2758. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value: self",
  2759. referencedClasses: [],
  2760. messageSends: ["value:"]
  2761. }),
  2762. $globals.ProtoObject);
  2763. $core.addMethod(
  2764. $core.method({
  2765. selector: "initialize",
  2766. protocol: "initialization",
  2767. fn: function (){
  2768. var self=this,$self=this;
  2769. return self;
  2770. },
  2771. args: [],
  2772. source: "initialize",
  2773. referencedClasses: [],
  2774. messageSends: []
  2775. }),
  2776. $globals.ProtoObject);
  2777. $core.addMethod(
  2778. $core.method({
  2779. selector: "inspect",
  2780. protocol: "inspecting",
  2781. fn: function (){
  2782. var self=this,$self=this;
  2783. return $core.withContext(function($ctx1) {
  2784. $recv($globals.Inspector)._inspect_(self);
  2785. return self;
  2786. }, function($ctx1) {$ctx1.fill(self,"inspect",{},$globals.ProtoObject)});
  2787. },
  2788. args: [],
  2789. source: "inspect\x0a\x09Inspector inspect: self",
  2790. referencedClasses: ["Inspector"],
  2791. messageSends: ["inspect:"]
  2792. }),
  2793. $globals.ProtoObject);
  2794. $core.addMethod(
  2795. $core.method({
  2796. selector: "inspectOn:",
  2797. protocol: "inspecting",
  2798. fn: function (anInspector){
  2799. var self=this,$self=this;
  2800. return self;
  2801. },
  2802. args: ["anInspector"],
  2803. source: "inspectOn: anInspector",
  2804. referencedClasses: [],
  2805. messageSends: []
  2806. }),
  2807. $globals.ProtoObject);
  2808. $core.addMethod(
  2809. $core.method({
  2810. selector: "instVarAt:",
  2811. protocol: "accessing",
  2812. fn: function (aString){
  2813. var self=this,$self=this;
  2814. return $core.withContext(function($ctx1) {
  2815. return $self['@'+aString];
  2816. return self;
  2817. }, function($ctx1) {$ctx1.fill(self,"instVarAt:",{aString:aString},$globals.ProtoObject)});
  2818. },
  2819. args: ["aString"],
  2820. source: "instVarAt: aString\x0a\x09<inlineJS: 'return $self[''@''+aString]'>",
  2821. referencedClasses: [],
  2822. messageSends: []
  2823. }),
  2824. $globals.ProtoObject);
  2825. $core.addMethod(
  2826. $core.method({
  2827. selector: "instVarAt:put:",
  2828. protocol: "accessing",
  2829. fn: function (aString,anObject){
  2830. var self=this,$self=this;
  2831. return $core.withContext(function($ctx1) {
  2832. $self['@' + aString] = anObject;
  2833. return self;
  2834. }, function($ctx1) {$ctx1.fill(self,"instVarAt:put:",{aString:aString,anObject:anObject},$globals.ProtoObject)});
  2835. },
  2836. args: ["aString", "anObject"],
  2837. source: "instVarAt: aString put: anObject\x0a\x09<inlineJS: '$self[''@'' + aString] = anObject'>",
  2838. referencedClasses: [],
  2839. messageSends: []
  2840. }),
  2841. $globals.ProtoObject);
  2842. $core.addMethod(
  2843. $core.method({
  2844. selector: "isKindOf:",
  2845. protocol: "testing",
  2846. fn: function (aClass){
  2847. var self=this,$self=this;
  2848. return $core.withContext(function($ctx1) {
  2849. var $1;
  2850. $1=$self._isMemberOf_(aClass);
  2851. if($core.assert($1)){
  2852. return true;
  2853. } else {
  2854. return $recv($self._class())._inheritsFrom_(aClass);
  2855. }
  2856. }, function($ctx1) {$ctx1.fill(self,"isKindOf:",{aClass:aClass},$globals.ProtoObject)});
  2857. },
  2858. args: ["aClass"],
  2859. source: "isKindOf: aClass\x0a\x09^ (self isMemberOf: aClass)\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: [ self class inheritsFrom: aClass ]",
  2860. referencedClasses: [],
  2861. messageSends: ["ifTrue:ifFalse:", "isMemberOf:", "inheritsFrom:", "class"]
  2862. }),
  2863. $globals.ProtoObject);
  2864. $core.addMethod(
  2865. $core.method({
  2866. selector: "isNil",
  2867. protocol: "testing",
  2868. fn: function (){
  2869. var self=this,$self=this;
  2870. return false;
  2871. },
  2872. args: [],
  2873. source: "isNil\x0a\x09^ false",
  2874. referencedClasses: [],
  2875. messageSends: []
  2876. }),
  2877. $globals.ProtoObject);
  2878. $core.addMethod(
  2879. $core.method({
  2880. selector: "notNil",
  2881. protocol: "testing",
  2882. fn: function (){
  2883. var self=this,$self=this;
  2884. return $core.withContext(function($ctx1) {
  2885. return $recv($self._isNil())._not();
  2886. }, function($ctx1) {$ctx1.fill(self,"notNil",{},$globals.ProtoObject)});
  2887. },
  2888. args: [],
  2889. source: "notNil\x0a\x09^ self isNil not",
  2890. referencedClasses: [],
  2891. messageSends: ["not", "isNil"]
  2892. }),
  2893. $globals.ProtoObject);
  2894. $core.addMethod(
  2895. $core.method({
  2896. selector: "perform:",
  2897. protocol: "message handling",
  2898. fn: function (aString){
  2899. var self=this,$self=this;
  2900. return $core.withContext(function($ctx1) {
  2901. return $self._perform_withArguments_(aString,[]);
  2902. }, function($ctx1) {$ctx1.fill(self,"perform:",{aString:aString},$globals.ProtoObject)});
  2903. },
  2904. args: ["aString"],
  2905. source: "perform: aString\x0a\x09^ self perform: aString withArguments: #()",
  2906. referencedClasses: [],
  2907. messageSends: ["perform:withArguments:"]
  2908. }),
  2909. $globals.ProtoObject);
  2910. $core.addMethod(
  2911. $core.method({
  2912. selector: "perform:withArguments:",
  2913. protocol: "message handling",
  2914. fn: function (aString,aCollection){
  2915. var self=this,$self=this;
  2916. return $core.withContext(function($ctx1) {
  2917. return $core.send2(self, aString, aCollection);
  2918. return self;
  2919. }, function($ctx1) {$ctx1.fill(self,"perform:withArguments:",{aString:aString,aCollection:aCollection},$globals.ProtoObject)});
  2920. },
  2921. args: ["aString", "aCollection"],
  2922. source: "perform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return $core.send2(self, aString, aCollection)'>",
  2923. referencedClasses: [],
  2924. messageSends: []
  2925. }),
  2926. $globals.ProtoObject);
  2927. $core.addMethod(
  2928. $core.method({
  2929. selector: "printOn:",
  2930. protocol: "printing",
  2931. fn: function (aStream){
  2932. var self=this,$self=this;
  2933. return $core.withContext(function($ctx1) {
  2934. var $5,$4,$3,$2,$1;
  2935. $5=$self._class();
  2936. $ctx1.sendIdx["class"]=1;
  2937. $4=$recv($5)._name();
  2938. $ctx1.sendIdx["name"]=1;
  2939. $3=$recv($4)._first();
  2940. $2=$recv($3)._isVowel();
  2941. if($core.assert($2)){
  2942. $1="an ";
  2943. } else {
  2944. $1="a ";
  2945. }
  2946. $recv(aStream)._nextPutAll_($1);
  2947. $ctx1.sendIdx["nextPutAll:"]=1;
  2948. $recv(aStream)._nextPutAll_($recv($self._class())._name());
  2949. return self;
  2950. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.ProtoObject)});
  2951. },
  2952. args: ["aStream"],
  2953. 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",
  2954. referencedClasses: [],
  2955. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isVowel", "first", "name", "class"]
  2956. }),
  2957. $globals.ProtoObject);
  2958. $core.addMethod(
  2959. $core.method({
  2960. selector: "printString",
  2961. protocol: "printing",
  2962. fn: function (){
  2963. var self=this,$self=this;
  2964. return $core.withContext(function($ctx1) {
  2965. return $recv($globals.String)._streamContents_((function(str){
  2966. return $core.withContext(function($ctx2) {
  2967. return $self._printOn_(str);
  2968. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  2969. }));
  2970. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.ProtoObject)});
  2971. },
  2972. args: [],
  2973. source: "printString\x0a\x09^ String streamContents: [ :str | \x0a\x09\x09self printOn: str ]",
  2974. referencedClasses: ["String"],
  2975. messageSends: ["streamContents:", "printOn:"]
  2976. }),
  2977. $globals.ProtoObject);
  2978. $core.addMethod(
  2979. $core.method({
  2980. selector: "yourself",
  2981. protocol: "accessing",
  2982. fn: function (){
  2983. var self=this,$self=this;
  2984. return self;
  2985. },
  2986. args: [],
  2987. source: "yourself\x0a\x09^ self",
  2988. referencedClasses: [],
  2989. messageSends: []
  2990. }),
  2991. $globals.ProtoObject);
  2992. $core.addMethod(
  2993. $core.method({
  2994. selector: "~=",
  2995. protocol: "comparing",
  2996. fn: function (anObject){
  2997. var self=this,$self=this;
  2998. return $core.withContext(function($ctx1) {
  2999. var $1;
  3000. $1=$recv($self.__eq(anObject)).__eq(false);
  3001. $ctx1.sendIdx["="]=1;
  3002. return $1;
  3003. }, function($ctx1) {$ctx1.fill(self,"~=",{anObject:anObject},$globals.ProtoObject)});
  3004. },
  3005. args: ["anObject"],
  3006. source: "~= anObject\x0a\x09^ (self = anObject) = false",
  3007. referencedClasses: [],
  3008. messageSends: ["="]
  3009. }),
  3010. $globals.ProtoObject);
  3011. $core.addMethod(
  3012. $core.method({
  3013. selector: "~~",
  3014. protocol: "comparing",
  3015. fn: function (anObject){
  3016. var self=this,$self=this;
  3017. return $core.withContext(function($ctx1) {
  3018. return $recv($self.__eq_eq(anObject)).__eq(false);
  3019. }, function($ctx1) {$ctx1.fill(self,"~~",{anObject:anObject},$globals.ProtoObject)});
  3020. },
  3021. args: ["anObject"],
  3022. source: "~~ anObject\x0a\x09^ (self == anObject) = false",
  3023. referencedClasses: [],
  3024. messageSends: ["=", "=="]
  3025. }),
  3026. $globals.ProtoObject);
  3027. $core.addMethod(
  3028. $core.method({
  3029. selector: "initialize",
  3030. protocol: "initialization",
  3031. fn: function (){
  3032. var self=this,$self=this;
  3033. return self;
  3034. },
  3035. args: [],
  3036. source: "initialize",
  3037. referencedClasses: [],
  3038. messageSends: []
  3039. }),
  3040. $globals.ProtoObject.a$cls);
  3041. $core.addClass("Object", $globals.ProtoObject, [], "Kernel-Objects");
  3042. $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.";
  3043. $core.addMethod(
  3044. $core.method({
  3045. selector: "->",
  3046. protocol: "converting",
  3047. fn: function (anObject){
  3048. var self=this,$self=this;
  3049. return $core.withContext(function($ctx1) {
  3050. return $recv($globals.Association)._key_value_(self,anObject);
  3051. }, function($ctx1) {$ctx1.fill(self,"->",{anObject:anObject},$globals.Object)});
  3052. },
  3053. args: ["anObject"],
  3054. source: "-> anObject\x0a\x09^ Association key: self value: anObject",
  3055. referencedClasses: ["Association"],
  3056. messageSends: ["key:value:"]
  3057. }),
  3058. $globals.Object);
  3059. $core.addMethod(
  3060. $core.method({
  3061. selector: "asJSONString",
  3062. protocol: "converting",
  3063. fn: function (){
  3064. var self=this,$self=this;
  3065. return $core.withContext(function($ctx1) {
  3066. return $recv($globals.JSON)._stringify_($self._asJavaScriptObject());
  3067. }, function($ctx1) {$ctx1.fill(self,"asJSONString",{},$globals.Object)});
  3068. },
  3069. args: [],
  3070. source: "asJSONString\x0a\x09^ JSON stringify: self asJavaScriptObject",
  3071. referencedClasses: ["JSON"],
  3072. messageSends: ["stringify:", "asJavaScriptObject"]
  3073. }),
  3074. $globals.Object);
  3075. $core.addMethod(
  3076. $core.method({
  3077. selector: "asJavaScriptObject",
  3078. protocol: "converting",
  3079. fn: function (){
  3080. var self=this,$self=this;
  3081. var variables;
  3082. return $core.withContext(function($ctx1) {
  3083. variables=$recv($globals.HashedCollection)._new();
  3084. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  3085. return $core.withContext(function($ctx2) {
  3086. return $recv(variables)._at_put_(each,$recv($self._instVarAt_(each))._asJavaScriptObject());
  3087. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  3088. }));
  3089. return variables;
  3090. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{variables:variables},$globals.Object)});
  3091. },
  3092. args: [],
  3093. 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",
  3094. referencedClasses: ["HashedCollection"],
  3095. messageSends: ["new", "do:", "allInstanceVariableNames", "class", "at:put:", "asJavaScriptObject", "instVarAt:"]
  3096. }),
  3097. $globals.Object);
  3098. $core.addMethod(
  3099. $core.method({
  3100. selector: "asJavaScriptSource",
  3101. protocol: "converting",
  3102. fn: function (){
  3103. var self=this,$self=this;
  3104. return $core.withContext(function($ctx1) {
  3105. return $self._asString();
  3106. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Object)});
  3107. },
  3108. args: [],
  3109. source: "asJavaScriptSource\x0a\x09^ self asString",
  3110. referencedClasses: [],
  3111. messageSends: ["asString"]
  3112. }),
  3113. $globals.Object);
  3114. $core.addMethod(
  3115. $core.method({
  3116. selector: "basicAt:",
  3117. protocol: "accessing",
  3118. fn: function (aString){
  3119. var self=this,$self=this;
  3120. return $core.withContext(function($ctx1) {
  3121. return self[aString];
  3122. return self;
  3123. }, function($ctx1) {$ctx1.fill(self,"basicAt:",{aString:aString},$globals.Object)});
  3124. },
  3125. args: ["aString"],
  3126. source: "basicAt: aString\x0a\x09<inlineJS: 'return self[aString]'>",
  3127. referencedClasses: [],
  3128. messageSends: []
  3129. }),
  3130. $globals.Object);
  3131. $core.addMethod(
  3132. $core.method({
  3133. selector: "basicAt:put:",
  3134. protocol: "accessing",
  3135. fn: function (aString,anObject){
  3136. var self=this,$self=this;
  3137. return $core.withContext(function($ctx1) {
  3138. return self[aString] = anObject;
  3139. return self;
  3140. }, function($ctx1) {$ctx1.fill(self,"basicAt:put:",{aString:aString,anObject:anObject},$globals.Object)});
  3141. },
  3142. args: ["aString", "anObject"],
  3143. source: "basicAt: aString put: anObject\x0a\x09<inlineJS: 'return self[aString] = anObject'>",
  3144. referencedClasses: [],
  3145. messageSends: []
  3146. }),
  3147. $globals.Object);
  3148. $core.addMethod(
  3149. $core.method({
  3150. selector: "basicDelete:",
  3151. protocol: "accessing",
  3152. fn: function (aString){
  3153. var self=this,$self=this;
  3154. return $core.withContext(function($ctx1) {
  3155. delete self[aString]; return aString;
  3156. return self;
  3157. }, function($ctx1) {$ctx1.fill(self,"basicDelete:",{aString:aString},$globals.Object)});
  3158. },
  3159. args: ["aString"],
  3160. source: "basicDelete: aString\x0a\x09<inlineJS: 'delete self[aString]; return aString'>",
  3161. referencedClasses: [],
  3162. messageSends: []
  3163. }),
  3164. $globals.Object);
  3165. $core.addMethod(
  3166. $core.method({
  3167. selector: "basicPerform:",
  3168. protocol: "message handling",
  3169. fn: function (aString){
  3170. var self=this,$self=this;
  3171. return $core.withContext(function($ctx1) {
  3172. return $self._basicPerform_withArguments_(aString,[]);
  3173. }, function($ctx1) {$ctx1.fill(self,"basicPerform:",{aString:aString},$globals.Object)});
  3174. },
  3175. args: ["aString"],
  3176. source: "basicPerform: aString\x0a\x09^ self basicPerform: aString withArguments: #()",
  3177. referencedClasses: [],
  3178. messageSends: ["basicPerform:withArguments:"]
  3179. }),
  3180. $globals.Object);
  3181. $core.addMethod(
  3182. $core.method({
  3183. selector: "basicPerform:withArguments:",
  3184. protocol: "message handling",
  3185. fn: function (aString,aCollection){
  3186. var self=this,$self=this;
  3187. return $core.withContext(function($ctx1) {
  3188. return self[aString].apply(self, aCollection);;
  3189. return self;
  3190. }, function($ctx1) {$ctx1.fill(self,"basicPerform:withArguments:",{aString:aString,aCollection:aCollection},$globals.Object)});
  3191. },
  3192. args: ["aString", "aCollection"],
  3193. source: "basicPerform: aString withArguments: aCollection\x0a\x09<inlineJS: 'return self[aString].apply(self, aCollection);'>",
  3194. referencedClasses: [],
  3195. messageSends: []
  3196. }),
  3197. $globals.Object);
  3198. $core.addMethod(
  3199. $core.method({
  3200. selector: "browse",
  3201. protocol: "browsing",
  3202. fn: function (){
  3203. var self=this,$self=this;
  3204. return $core.withContext(function($ctx1) {
  3205. $recv($globals.Finder)._findClass_($self._class());
  3206. return self;
  3207. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.Object)});
  3208. },
  3209. args: [],
  3210. source: "browse\x0a\x09Finder findClass: self class",
  3211. referencedClasses: ["Finder"],
  3212. messageSends: ["findClass:", "class"]
  3213. }),
  3214. $globals.Object);
  3215. $core.addMethod(
  3216. $core.method({
  3217. selector: "copy",
  3218. protocol: "copying",
  3219. fn: function (){
  3220. var self=this,$self=this;
  3221. return $core.withContext(function($ctx1) {
  3222. return $recv($self._shallowCopy())._postCopy();
  3223. }, function($ctx1) {$ctx1.fill(self,"copy",{},$globals.Object)});
  3224. },
  3225. args: [],
  3226. source: "copy\x0a\x09^ self shallowCopy postCopy",
  3227. referencedClasses: [],
  3228. messageSends: ["postCopy", "shallowCopy"]
  3229. }),
  3230. $globals.Object);
  3231. $core.addMethod(
  3232. $core.method({
  3233. selector: "deepCopy",
  3234. protocol: "copying",
  3235. fn: function (){
  3236. var self=this,$self=this;
  3237. return $core.withContext(function($ctx1) {
  3238. var copy = self.a$cls._new();
  3239. Object.keys(self).forEach(function (i) {
  3240. if(/^@.+/.test(i)) {
  3241. copy[i] = $recv(self[i])._deepCopy();
  3242. }
  3243. });
  3244. return copy;
  3245. ;
  3246. return self;
  3247. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Object)});
  3248. },
  3249. args: [],
  3250. 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'>",
  3251. referencedClasses: [],
  3252. messageSends: []
  3253. }),
  3254. $globals.Object);
  3255. $core.addMethod(
  3256. $core.method({
  3257. selector: "deprecatedAPI",
  3258. protocol: "error handling",
  3259. fn: function (){
  3260. var self=this,$self=this;
  3261. return $core.withContext(function($ctx1) {
  3262. var $1,$6,$5,$4,$8,$7,$3,$2;
  3263. $1=console;
  3264. $6=$core.getThisContext()._home();
  3265. $ctx1.sendIdx["home"]=1;
  3266. $5=$recv($6)._asString();
  3267. $ctx1.sendIdx["asString"]=1;
  3268. $4=$recv($5).__comma(" is deprecated! (in ");
  3269. $8=$recv($core.getThisContext()._home())._home();
  3270. $ctx1.sendIdx["home"]=2;
  3271. $7=$recv($8)._asString();
  3272. $3=$recv($4).__comma($7);
  3273. $ctx1.sendIdx[","]=2;
  3274. $2=$recv($3).__comma(")");
  3275. $ctx1.sendIdx[","]=1;
  3276. $recv($1)._warn_($2);
  3277. return self;
  3278. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI",{},$globals.Object)});
  3279. },
  3280. args: [],
  3281. 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, ')'.",
  3282. referencedClasses: [],
  3283. messageSends: ["warn:", ",", "asString", "home"]
  3284. }),
  3285. $globals.Object);
  3286. $core.addMethod(
  3287. $core.method({
  3288. selector: "deprecatedAPI:",
  3289. protocol: "error handling",
  3290. fn: function (aString){
  3291. var self=this,$self=this;
  3292. return $core.withContext(function($ctx1) {
  3293. var $1,$6,$5,$4,$8,$7,$3,$2;
  3294. $1=console;
  3295. $6=$core.getThisContext()._home();
  3296. $ctx1.sendIdx["home"]=1;
  3297. $5=$recv($6)._asString();
  3298. $ctx1.sendIdx["asString"]=1;
  3299. $4=$recv($5).__comma(" is deprecated! (in ");
  3300. $8=$recv($core.getThisContext()._home())._home();
  3301. $ctx1.sendIdx["home"]=2;
  3302. $7=$recv($8)._asString();
  3303. $3=$recv($4).__comma($7);
  3304. $ctx1.sendIdx[","]=2;
  3305. $2=$recv($3).__comma(")");
  3306. $ctx1.sendIdx[","]=1;
  3307. $recv($1)._warn_($2);
  3308. $ctx1.sendIdx["warn:"]=1;
  3309. $recv(console)._warn_(aString);
  3310. return self;
  3311. }, function($ctx1) {$ctx1.fill(self,"deprecatedAPI:",{aString:aString},$globals.Object)});
  3312. },
  3313. args: ["aString"],
  3314. 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",
  3315. referencedClasses: [],
  3316. messageSends: ["warn:", ",", "asString", "home"]
  3317. }),
  3318. $globals.Object);
  3319. $core.addMethod(
  3320. $core.method({
  3321. selector: "error:",
  3322. protocol: "error handling",
  3323. fn: function (aString){
  3324. var self=this,$self=this;
  3325. return $core.withContext(function($ctx1) {
  3326. $recv($globals.Error)._signal_(aString);
  3327. return self;
  3328. }, function($ctx1) {$ctx1.fill(self,"error:",{aString:aString},$globals.Object)});
  3329. },
  3330. args: ["aString"],
  3331. source: "error: aString\x0a\x09Error signal: aString",
  3332. referencedClasses: ["Error"],
  3333. messageSends: ["signal:"]
  3334. }),
  3335. $globals.Object);
  3336. $core.addMethod(
  3337. $core.method({
  3338. selector: "halt",
  3339. protocol: "error handling",
  3340. fn: function (){
  3341. var self=this,$self=this;
  3342. return $core.withContext(function($ctx1) {
  3343. $recv($globals.Halt)._signal();
  3344. return self;
  3345. }, function($ctx1) {$ctx1.fill(self,"halt",{},$globals.Object)});
  3346. },
  3347. args: [],
  3348. source: "halt\x0a\x09Halt signal",
  3349. referencedClasses: ["Halt"],
  3350. messageSends: ["signal"]
  3351. }),
  3352. $globals.Object);
  3353. $core.addMethod(
  3354. $core.method({
  3355. selector: "in:",
  3356. protocol: "evaluating",
  3357. fn: function (aValuable){
  3358. var self=this,$self=this;
  3359. return $core.withContext(function($ctx1) {
  3360. return $recv(aValuable)._value_(self);
  3361. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.Object)});
  3362. },
  3363. args: ["aValuable"],
  3364. source: "in: aValuable\x0a\x09^ aValuable value: self",
  3365. referencedClasses: [],
  3366. messageSends: ["value:"]
  3367. }),
  3368. $globals.Object);
  3369. $core.addMethod(
  3370. $core.method({
  3371. selector: "isBehavior",
  3372. protocol: "testing",
  3373. fn: function (){
  3374. var self=this,$self=this;
  3375. return false;
  3376. },
  3377. args: [],
  3378. source: "isBehavior\x0a\x09^ false",
  3379. referencedClasses: [],
  3380. messageSends: []
  3381. }),
  3382. $globals.Object);
  3383. $core.addMethod(
  3384. $core.method({
  3385. selector: "isBoolean",
  3386. protocol: "testing",
  3387. fn: function (){
  3388. var self=this,$self=this;
  3389. return false;
  3390. },
  3391. args: [],
  3392. source: "isBoolean\x0a\x09^ false",
  3393. referencedClasses: [],
  3394. messageSends: []
  3395. }),
  3396. $globals.Object);
  3397. $core.addMethod(
  3398. $core.method({
  3399. selector: "isClass",
  3400. protocol: "testing",
  3401. fn: function (){
  3402. var self=this,$self=this;
  3403. return false;
  3404. },
  3405. args: [],
  3406. source: "isClass\x0a\x09^ false",
  3407. referencedClasses: [],
  3408. messageSends: []
  3409. }),
  3410. $globals.Object);
  3411. $core.addMethod(
  3412. $core.method({
  3413. selector: "isCompiledMethod",
  3414. protocol: "testing",
  3415. fn: function (){
  3416. var self=this,$self=this;
  3417. return false;
  3418. },
  3419. args: [],
  3420. source: "isCompiledMethod\x0a\x09^ false",
  3421. referencedClasses: [],
  3422. messageSends: []
  3423. }),
  3424. $globals.Object);
  3425. $core.addMethod(
  3426. $core.method({
  3427. selector: "isImmutable",
  3428. protocol: "testing",
  3429. fn: function (){
  3430. var self=this,$self=this;
  3431. return false;
  3432. },
  3433. args: [],
  3434. source: "isImmutable\x0a\x09^ false",
  3435. referencedClasses: [],
  3436. messageSends: []
  3437. }),
  3438. $globals.Object);
  3439. $core.addMethod(
  3440. $core.method({
  3441. selector: "isMemberOf:",
  3442. protocol: "testing",
  3443. fn: function (aClass){
  3444. var self=this,$self=this;
  3445. return $core.withContext(function($ctx1) {
  3446. return $recv($self._class()).__eq(aClass);
  3447. }, function($ctx1) {$ctx1.fill(self,"isMemberOf:",{aClass:aClass},$globals.Object)});
  3448. },
  3449. args: ["aClass"],
  3450. source: "isMemberOf: aClass\x0a\x09^ self class = aClass",
  3451. referencedClasses: [],
  3452. messageSends: ["=", "class"]
  3453. }),
  3454. $globals.Object);
  3455. $core.addMethod(
  3456. $core.method({
  3457. selector: "isMetaclass",
  3458. protocol: "testing",
  3459. fn: function (){
  3460. var self=this,$self=this;
  3461. return false;
  3462. },
  3463. args: [],
  3464. source: "isMetaclass\x0a\x09^ false",
  3465. referencedClasses: [],
  3466. messageSends: []
  3467. }),
  3468. $globals.Object);
  3469. $core.addMethod(
  3470. $core.method({
  3471. selector: "isNumber",
  3472. protocol: "testing",
  3473. fn: function (){
  3474. var self=this,$self=this;
  3475. return false;
  3476. },
  3477. args: [],
  3478. source: "isNumber\x0a\x09^ false",
  3479. referencedClasses: [],
  3480. messageSends: []
  3481. }),
  3482. $globals.Object);
  3483. $core.addMethod(
  3484. $core.method({
  3485. selector: "isPackage",
  3486. protocol: "testing",
  3487. fn: function (){
  3488. var self=this,$self=this;
  3489. return false;
  3490. },
  3491. args: [],
  3492. source: "isPackage\x0a\x09^ false",
  3493. referencedClasses: [],
  3494. messageSends: []
  3495. }),
  3496. $globals.Object);
  3497. $core.addMethod(
  3498. $core.method({
  3499. selector: "isParseFailure",
  3500. protocol: "testing",
  3501. fn: function (){
  3502. var self=this,$self=this;
  3503. return false;
  3504. },
  3505. args: [],
  3506. source: "isParseFailure\x0a\x09^ false",
  3507. referencedClasses: [],
  3508. messageSends: []
  3509. }),
  3510. $globals.Object);
  3511. $core.addMethod(
  3512. $core.method({
  3513. selector: "isString",
  3514. protocol: "testing",
  3515. fn: function (){
  3516. var self=this,$self=this;
  3517. return false;
  3518. },
  3519. args: [],
  3520. source: "isString\x0a\x09^ false",
  3521. referencedClasses: [],
  3522. messageSends: []
  3523. }),
  3524. $globals.Object);
  3525. $core.addMethod(
  3526. $core.method({
  3527. selector: "isSymbol",
  3528. protocol: "testing",
  3529. fn: function (){
  3530. var self=this,$self=this;
  3531. return false;
  3532. },
  3533. args: [],
  3534. source: "isSymbol\x0a\x09^ false",
  3535. referencedClasses: [],
  3536. messageSends: []
  3537. }),
  3538. $globals.Object);
  3539. $core.addMethod(
  3540. $core.method({
  3541. selector: "postCopy",
  3542. protocol: "copying",
  3543. fn: function (){
  3544. var self=this,$self=this;
  3545. return self;
  3546. },
  3547. args: [],
  3548. source: "postCopy",
  3549. referencedClasses: [],
  3550. messageSends: []
  3551. }),
  3552. $globals.Object);
  3553. $core.addMethod(
  3554. $core.method({
  3555. selector: "putOn:",
  3556. protocol: "streaming",
  3557. fn: function (aStream){
  3558. var self=this,$self=this;
  3559. return $core.withContext(function($ctx1) {
  3560. $recv(aStream)._nextPut_(self);
  3561. return self;
  3562. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Object)});
  3563. },
  3564. args: ["aStream"],
  3565. source: "putOn: aStream\x0a\x09aStream nextPut: self",
  3566. referencedClasses: [],
  3567. messageSends: ["nextPut:"]
  3568. }),
  3569. $globals.Object);
  3570. $core.addMethod(
  3571. $core.method({
  3572. selector: "respondsTo:",
  3573. protocol: "testing",
  3574. fn: function (aSelector){
  3575. var self=this,$self=this;
  3576. return $core.withContext(function($ctx1) {
  3577. return $recv($self._class())._canUnderstand_(aSelector);
  3578. }, function($ctx1) {$ctx1.fill(self,"respondsTo:",{aSelector:aSelector},$globals.Object)});
  3579. },
  3580. args: ["aSelector"],
  3581. source: "respondsTo: aSelector\x0a\x09^ self class canUnderstand: aSelector",
  3582. referencedClasses: [],
  3583. messageSends: ["canUnderstand:", "class"]
  3584. }),
  3585. $globals.Object);
  3586. $core.addMethod(
  3587. $core.method({
  3588. selector: "shallowCopy",
  3589. protocol: "copying",
  3590. fn: function (){
  3591. var self=this,$self=this;
  3592. return $core.withContext(function($ctx1) {
  3593. var copy = self.a$cls._new();
  3594. Object.keys(self).forEach(function(i) {
  3595. if(/^@.+/.test(i)) {
  3596. copy[i] = self[i];
  3597. }
  3598. });
  3599. return copy;
  3600. ;
  3601. return self;
  3602. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Object)});
  3603. },
  3604. args: [],
  3605. 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'>",
  3606. referencedClasses: [],
  3607. messageSends: []
  3608. }),
  3609. $globals.Object);
  3610. $core.addMethod(
  3611. $core.method({
  3612. selector: "shouldNotImplement",
  3613. protocol: "error handling",
  3614. fn: function (){
  3615. var self=this,$self=this;
  3616. return $core.withContext(function($ctx1) {
  3617. $self._error_("This method should not be implemented in ".__comma($recv($self._class())._name()));
  3618. return self;
  3619. }, function($ctx1) {$ctx1.fill(self,"shouldNotImplement",{},$globals.Object)});
  3620. },
  3621. args: [],
  3622. source: "shouldNotImplement\x0a\x09self error: 'This method should not be implemented in ', self class name",
  3623. referencedClasses: [],
  3624. messageSends: ["error:", ",", "name", "class"]
  3625. }),
  3626. $globals.Object);
  3627. $core.addMethod(
  3628. $core.method({
  3629. selector: "size",
  3630. protocol: "accessing",
  3631. fn: function (){
  3632. var self=this,$self=this;
  3633. return $core.withContext(function($ctx1) {
  3634. $self._error_("Object not indexable");
  3635. return self;
  3636. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Object)});
  3637. },
  3638. args: [],
  3639. source: "size\x0a\x09self error: 'Object not indexable'",
  3640. referencedClasses: [],
  3641. messageSends: ["error:"]
  3642. }),
  3643. $globals.Object);
  3644. $core.addMethod(
  3645. $core.method({
  3646. selector: "subclassResponsibility",
  3647. protocol: "error handling",
  3648. fn: function (){
  3649. var self=this,$self=this;
  3650. return $core.withContext(function($ctx1) {
  3651. $self._error_("This method is a responsibility of a subclass");
  3652. return self;
  3653. }, function($ctx1) {$ctx1.fill(self,"subclassResponsibility",{},$globals.Object)});
  3654. },
  3655. args: [],
  3656. source: "subclassResponsibility\x0a\x09self error: 'This method is a responsibility of a subclass'",
  3657. referencedClasses: [],
  3658. messageSends: ["error:"]
  3659. }),
  3660. $globals.Object);
  3661. $core.addMethod(
  3662. $core.method({
  3663. selector: "value",
  3664. protocol: "evaluating",
  3665. fn: function (){
  3666. var self=this,$self=this;
  3667. return $core.withContext(function($ctx1) {
  3668. return self.valueOf();
  3669. return self;
  3670. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Object)});
  3671. },
  3672. args: [],
  3673. source: "value\x0a\x09<inlineJS: 'return self.valueOf()'>",
  3674. referencedClasses: [],
  3675. messageSends: []
  3676. }),
  3677. $globals.Object);
  3678. $core.addMethod(
  3679. $core.method({
  3680. selector: "accessorProtocolWith:",
  3681. protocol: "helios",
  3682. fn: function (aGenerator){
  3683. var self=this,$self=this;
  3684. return $core.withContext(function($ctx1) {
  3685. $recv(aGenerator)._accessorProtocolForObject();
  3686. return self;
  3687. }, function($ctx1) {$ctx1.fill(self,"accessorProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3688. },
  3689. args: ["aGenerator"],
  3690. source: "accessorProtocolWith: aGenerator\x0a\x09aGenerator accessorProtocolForObject",
  3691. referencedClasses: [],
  3692. messageSends: ["accessorProtocolForObject"]
  3693. }),
  3694. $globals.Object.a$cls);
  3695. $core.addMethod(
  3696. $core.method({
  3697. selector: "accessorsSourceCodesWith:",
  3698. protocol: "helios",
  3699. fn: function (aGenerator){
  3700. var self=this,$self=this;
  3701. return $core.withContext(function($ctx1) {
  3702. $recv(aGenerator)._accessorsForObject();
  3703. return self;
  3704. }, function($ctx1) {$ctx1.fill(self,"accessorsSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3705. },
  3706. args: ["aGenerator"],
  3707. source: "accessorsSourceCodesWith: aGenerator\x0a\x09aGenerator accessorsForObject",
  3708. referencedClasses: [],
  3709. messageSends: ["accessorsForObject"]
  3710. }),
  3711. $globals.Object.a$cls);
  3712. $core.addMethod(
  3713. $core.method({
  3714. selector: "initialize",
  3715. protocol: "initialization",
  3716. fn: function (){
  3717. var self=this,$self=this;
  3718. return self;
  3719. },
  3720. args: [],
  3721. source: "initialize\x0a\x09\x22no op\x22",
  3722. referencedClasses: [],
  3723. messageSends: []
  3724. }),
  3725. $globals.Object.a$cls);
  3726. $core.addMethod(
  3727. $core.method({
  3728. selector: "initializeProtocolWith:",
  3729. protocol: "helios",
  3730. fn: function (aGenerator){
  3731. var self=this,$self=this;
  3732. return $core.withContext(function($ctx1) {
  3733. $recv(aGenerator)._initializeProtocolForObject();
  3734. return self;
  3735. }, function($ctx1) {$ctx1.fill(self,"initializeProtocolWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3736. },
  3737. args: ["aGenerator"],
  3738. source: "initializeProtocolWith: aGenerator\x0a\x09aGenerator initializeProtocolForObject",
  3739. referencedClasses: [],
  3740. messageSends: ["initializeProtocolForObject"]
  3741. }),
  3742. $globals.Object.a$cls);
  3743. $core.addMethod(
  3744. $core.method({
  3745. selector: "initializeSourceCodesWith:",
  3746. protocol: "helios",
  3747. fn: function (aGenerator){
  3748. var self=this,$self=this;
  3749. return $core.withContext(function($ctx1) {
  3750. $recv(aGenerator)._initializeForObject();
  3751. return self;
  3752. }, function($ctx1) {$ctx1.fill(self,"initializeSourceCodesWith:",{aGenerator:aGenerator},$globals.Object.a$cls)});
  3753. },
  3754. args: ["aGenerator"],
  3755. source: "initializeSourceCodesWith: aGenerator\x0a\x09aGenerator initializeForObject",
  3756. referencedClasses: [],
  3757. messageSends: ["initializeForObject"]
  3758. }),
  3759. $globals.Object.a$cls);
  3760. $core.addClass("Boolean", $globals.Object, [], "Kernel-Objects");
  3761. $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: [ ... ]";
  3762. $core.addMethod(
  3763. $core.method({
  3764. selector: "&",
  3765. protocol: "controlling",
  3766. fn: function (aBoolean){
  3767. var self=this,$self=this;
  3768. return $core.withContext(function($ctx1) {
  3769. if(self == true) {
  3770. return aBoolean;
  3771. } else {
  3772. return false;
  3773. }
  3774. ;
  3775. return self;
  3776. }, function($ctx1) {$ctx1.fill(self,"&",{aBoolean:aBoolean},$globals.Boolean)});
  3777. },
  3778. args: ["aBoolean"],
  3779. 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'>",
  3780. referencedClasses: [],
  3781. messageSends: []
  3782. }),
  3783. $globals.Boolean);
  3784. $core.addMethod(
  3785. $core.method({
  3786. selector: "==",
  3787. protocol: "comparing",
  3788. fn: function (aBoolean){
  3789. var self=this,$self=this;
  3790. return $core.withContext(function($ctx1) {
  3791. if (typeof aBoolean === "boolean") return (self == true) === aBoolean;
  3792. else if (aBoolean != null && typeof aBoolean === "object") return (self == true) === aBoolean.valueOf();
  3793. else return false;;
  3794. return self;
  3795. }, function($ctx1) {$ctx1.fill(self,"==",{aBoolean:aBoolean},$globals.Boolean)});
  3796. },
  3797. args: ["aBoolean"],
  3798. source: "== aBoolean\x0a<inlineJS: '\x0a\x09if (typeof aBoolean === \x22boolean\x22) return (self == true) === aBoolean;\x0a\x09else if (aBoolean != null && typeof aBoolean === \x22object\x22) return (self == true) === aBoolean.valueOf();\x0a\x09else return false;\x0a'>",
  3799. referencedClasses: [],
  3800. messageSends: []
  3801. }),
  3802. $globals.Boolean);
  3803. $core.addMethod(
  3804. $core.method({
  3805. selector: "and:",
  3806. protocol: "controlling",
  3807. fn: function (aBlock){
  3808. var self=this,$self=this;
  3809. return $core.withContext(function($ctx1) {
  3810. if($core.assert(self)){
  3811. return $recv(aBlock)._value();
  3812. } else {
  3813. return false;
  3814. }
  3815. }, function($ctx1) {$ctx1.fill(self,"and:",{aBlock:aBlock},$globals.Boolean)});
  3816. },
  3817. args: ["aBlock"],
  3818. source: "and: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ false ]",
  3819. referencedClasses: [],
  3820. messageSends: ["ifTrue:ifFalse:", "value"]
  3821. }),
  3822. $globals.Boolean);
  3823. $core.addMethod(
  3824. $core.method({
  3825. selector: "asBit",
  3826. protocol: "converting",
  3827. fn: function (){
  3828. var self=this,$self=this;
  3829. return $core.withContext(function($ctx1) {
  3830. if($core.assert(self)){
  3831. return (1);
  3832. } else {
  3833. return (0);
  3834. }
  3835. }, function($ctx1) {$ctx1.fill(self,"asBit",{},$globals.Boolean)});
  3836. },
  3837. args: [],
  3838. source: "asBit\x0a\x09^ self ifTrue: [ 1 ] ifFalse: [ 0 ]",
  3839. referencedClasses: [],
  3840. messageSends: ["ifTrue:ifFalse:"]
  3841. }),
  3842. $globals.Boolean);
  3843. $core.addMethod(
  3844. $core.method({
  3845. selector: "asJavaScriptObject",
  3846. protocol: "converting",
  3847. fn: function (){
  3848. var self=this,$self=this;
  3849. return self;
  3850. },
  3851. args: [],
  3852. source: "asJavaScriptObject\x0a\x09^ self",
  3853. referencedClasses: [],
  3854. messageSends: []
  3855. }),
  3856. $globals.Boolean);
  3857. $core.addMethod(
  3858. $core.method({
  3859. selector: "asString",
  3860. protocol: "converting",
  3861. fn: function (){
  3862. var self=this,$self=this;
  3863. return $core.withContext(function($ctx1) {
  3864. return self.toString();
  3865. return self;
  3866. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Boolean)});
  3867. },
  3868. args: [],
  3869. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  3870. referencedClasses: [],
  3871. messageSends: []
  3872. }),
  3873. $globals.Boolean);
  3874. $core.addMethod(
  3875. $core.method({
  3876. selector: "deepCopy",
  3877. protocol: "copying",
  3878. fn: function (){
  3879. var self=this,$self=this;
  3880. return self;
  3881. },
  3882. args: [],
  3883. source: "deepCopy\x0a\x09^ self",
  3884. referencedClasses: [],
  3885. messageSends: []
  3886. }),
  3887. $globals.Boolean);
  3888. $core.addMethod(
  3889. $core.method({
  3890. selector: "ifFalse:",
  3891. protocol: "controlling",
  3892. fn: function (aBlock){
  3893. var self=this,$self=this;
  3894. return $core.withContext(function($ctx1) {
  3895. return $self._ifTrue_ifFalse_((function(){
  3896. }),aBlock);
  3897. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{aBlock:aBlock},$globals.Boolean)});
  3898. },
  3899. args: ["aBlock"],
  3900. source: "ifFalse: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: [] ifFalse: aBlock",
  3901. referencedClasses: [],
  3902. messageSends: ["ifTrue:ifFalse:"]
  3903. }),
  3904. $globals.Boolean);
  3905. $core.addMethod(
  3906. $core.method({
  3907. selector: "ifFalse:ifTrue:",
  3908. protocol: "controlling",
  3909. fn: function (aBlock,anotherBlock){
  3910. var self=this,$self=this;
  3911. return $core.withContext(function($ctx1) {
  3912. return $self._ifTrue_ifFalse_(anotherBlock,aBlock);
  3913. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3914. },
  3915. args: ["aBlock", "anotherBlock"],
  3916. source: "ifFalse: aBlock ifTrue: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: anotherBlock ifFalse: aBlock",
  3917. referencedClasses: [],
  3918. messageSends: ["ifTrue:ifFalse:"]
  3919. }),
  3920. $globals.Boolean);
  3921. $core.addMethod(
  3922. $core.method({
  3923. selector: "ifTrue:",
  3924. protocol: "controlling",
  3925. fn: function (aBlock){
  3926. var self=this,$self=this;
  3927. return $core.withContext(function($ctx1) {
  3928. return $self._ifTrue_ifFalse_(aBlock,(function(){
  3929. }));
  3930. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{aBlock:aBlock},$globals.Boolean)});
  3931. },
  3932. args: ["aBlock"],
  3933. source: "ifTrue: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifTrue: aBlock ifFalse: []",
  3934. referencedClasses: [],
  3935. messageSends: ["ifTrue:ifFalse:"]
  3936. }),
  3937. $globals.Boolean);
  3938. $core.addMethod(
  3939. $core.method({
  3940. selector: "ifTrue:ifFalse:",
  3941. protocol: "controlling",
  3942. fn: function (aBlock,anotherBlock){
  3943. var self=this,$self=this;
  3944. return $core.withContext(function($ctx1) {
  3945. if(self == true) {
  3946. return aBlock._value();
  3947. } else {
  3948. return anotherBlock._value();
  3949. }
  3950. ;
  3951. return self;
  3952. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Boolean)});
  3953. },
  3954. args: ["aBlock", "anotherBlock"],
  3955. 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'>",
  3956. referencedClasses: [],
  3957. messageSends: []
  3958. }),
  3959. $globals.Boolean);
  3960. $core.addMethod(
  3961. $core.method({
  3962. selector: "isBoolean",
  3963. protocol: "testing",
  3964. fn: function (){
  3965. var self=this,$self=this;
  3966. return true;
  3967. },
  3968. args: [],
  3969. source: "isBoolean\x0a\x09^ true",
  3970. referencedClasses: [],
  3971. messageSends: []
  3972. }),
  3973. $globals.Boolean);
  3974. $core.addMethod(
  3975. $core.method({
  3976. selector: "isImmutable",
  3977. protocol: "testing",
  3978. fn: function (){
  3979. var self=this,$self=this;
  3980. return true;
  3981. },
  3982. args: [],
  3983. source: "isImmutable\x0a\x09^ true",
  3984. referencedClasses: [],
  3985. messageSends: []
  3986. }),
  3987. $globals.Boolean);
  3988. $core.addMethod(
  3989. $core.method({
  3990. selector: "not",
  3991. protocol: "controlling",
  3992. fn: function (){
  3993. var self=this,$self=this;
  3994. return $core.withContext(function($ctx1) {
  3995. return $self.__eq(false);
  3996. }, function($ctx1) {$ctx1.fill(self,"not",{},$globals.Boolean)});
  3997. },
  3998. args: [],
  3999. source: "not\x0a\x09^ self = false",
  4000. referencedClasses: [],
  4001. messageSends: ["="]
  4002. }),
  4003. $globals.Boolean);
  4004. $core.addMethod(
  4005. $core.method({
  4006. selector: "or:",
  4007. protocol: "controlling",
  4008. fn: function (aBlock){
  4009. var self=this,$self=this;
  4010. return $core.withContext(function($ctx1) {
  4011. if($core.assert(self)){
  4012. return true;
  4013. } else {
  4014. return $recv(aBlock)._value();
  4015. }
  4016. }, function($ctx1) {$ctx1.fill(self,"or:",{aBlock:aBlock},$globals.Boolean)});
  4017. },
  4018. args: ["aBlock"],
  4019. source: "or: aBlock\x0a\x09^ self\x0a\x09\x09ifTrue: [ true ]\x0a\x09\x09ifFalse: \x22aBlock\x22 [ aBlock value ]",
  4020. referencedClasses: [],
  4021. messageSends: ["ifTrue:ifFalse:", "value"]
  4022. }),
  4023. $globals.Boolean);
  4024. $core.addMethod(
  4025. $core.method({
  4026. selector: "printOn:",
  4027. protocol: "printing",
  4028. fn: function (aStream){
  4029. var self=this,$self=this;
  4030. return $core.withContext(function($ctx1) {
  4031. $recv(aStream)._nextPutAll_($self._asString());
  4032. return self;
  4033. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Boolean)});
  4034. },
  4035. args: ["aStream"],
  4036. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4037. referencedClasses: [],
  4038. messageSends: ["nextPutAll:", "asString"]
  4039. }),
  4040. $globals.Boolean);
  4041. $core.addMethod(
  4042. $core.method({
  4043. selector: "shallowCopy",
  4044. protocol: "copying",
  4045. fn: function (){
  4046. var self=this,$self=this;
  4047. return self;
  4048. },
  4049. args: [],
  4050. source: "shallowCopy\x0a\x09^ self",
  4051. referencedClasses: [],
  4052. messageSends: []
  4053. }),
  4054. $globals.Boolean);
  4055. $core.addMethod(
  4056. $core.method({
  4057. selector: "|",
  4058. protocol: "controlling",
  4059. fn: function (aBoolean){
  4060. var self=this,$self=this;
  4061. return $core.withContext(function($ctx1) {
  4062. if(self == true) {
  4063. return true;
  4064. } else {
  4065. return aBoolean;
  4066. }
  4067. ;
  4068. return self;
  4069. }, function($ctx1) {$ctx1.fill(self,"|",{aBoolean:aBoolean},$globals.Boolean)});
  4070. },
  4071. args: ["aBoolean"],
  4072. 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'>",
  4073. referencedClasses: [],
  4074. messageSends: []
  4075. }),
  4076. $globals.Boolean);
  4077. $core.addClass("Date", $globals.Object, [], "Kernel-Objects");
  4078. $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.).";
  4079. $core.addMethod(
  4080. $core.method({
  4081. selector: "+",
  4082. protocol: "arithmetic",
  4083. fn: function (aDate){
  4084. var self=this,$self=this;
  4085. return $core.withContext(function($ctx1) {
  4086. return self + aDate;
  4087. return self;
  4088. }, function($ctx1) {$ctx1.fill(self,"+",{aDate:aDate},$globals.Date)});
  4089. },
  4090. args: ["aDate"],
  4091. source: "+ aDate\x0a\x09<inlineJS: 'return self + aDate'>",
  4092. referencedClasses: [],
  4093. messageSends: []
  4094. }),
  4095. $globals.Date);
  4096. $core.addMethod(
  4097. $core.method({
  4098. selector: "-",
  4099. protocol: "arithmetic",
  4100. fn: function (aDate){
  4101. var self=this,$self=this;
  4102. return $core.withContext(function($ctx1) {
  4103. return self - aDate;
  4104. return self;
  4105. }, function($ctx1) {$ctx1.fill(self,"-",{aDate:aDate},$globals.Date)});
  4106. },
  4107. args: ["aDate"],
  4108. source: "- aDate\x0a\x09<inlineJS: 'return self - aDate'>",
  4109. referencedClasses: [],
  4110. messageSends: []
  4111. }),
  4112. $globals.Date);
  4113. $core.addMethod(
  4114. $core.method({
  4115. selector: "<",
  4116. protocol: "comparing",
  4117. fn: function (aDate){
  4118. var self=this,$self=this;
  4119. return $core.withContext(function($ctx1) {
  4120. return self < aDate;
  4121. return self;
  4122. }, function($ctx1) {$ctx1.fill(self,"<",{aDate:aDate},$globals.Date)});
  4123. },
  4124. args: ["aDate"],
  4125. source: "< aDate\x0a\x09<inlineJS: 'return self < aDate'>",
  4126. referencedClasses: [],
  4127. messageSends: []
  4128. }),
  4129. $globals.Date);
  4130. $core.addMethod(
  4131. $core.method({
  4132. selector: "<=",
  4133. protocol: "comparing",
  4134. fn: function (aDate){
  4135. var self=this,$self=this;
  4136. return $core.withContext(function($ctx1) {
  4137. return self <= aDate;
  4138. return self;
  4139. }, function($ctx1) {$ctx1.fill(self,"<=",{aDate:aDate},$globals.Date)});
  4140. },
  4141. args: ["aDate"],
  4142. source: "<= aDate\x0a\x09<inlineJS: 'return self <= aDate'>",
  4143. referencedClasses: [],
  4144. messageSends: []
  4145. }),
  4146. $globals.Date);
  4147. $core.addMethod(
  4148. $core.method({
  4149. selector: "=",
  4150. protocol: "comparing",
  4151. fn: function (aDate){
  4152. var self=this,$self=this;
  4153. return $core.withContext(function($ctx1) {
  4154. var $2,$1,$3;
  4155. $2=$recv(aDate)._class();
  4156. $ctx1.sendIdx["class"]=1;
  4157. $1=$recv($2).__eq_eq($self._class());
  4158. $ctx1.sendIdx["=="]=1;
  4159. return $recv($1)._and_((function(){
  4160. return $core.withContext(function($ctx2) {
  4161. $3=$self._asMilliseconds();
  4162. $ctx2.sendIdx["asMilliseconds"]=1;
  4163. return $recv($3).__eq_eq($recv(aDate)._asMilliseconds());
  4164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  4165. }));
  4166. }, function($ctx1) {$ctx1.fill(self,"=",{aDate:aDate},$globals.Date)});
  4167. },
  4168. args: ["aDate"],
  4169. source: "= aDate\x0a\x09^ (aDate class == self class) and: [ self asMilliseconds == aDate asMilliseconds ]",
  4170. referencedClasses: [],
  4171. messageSends: ["and:", "==", "class", "asMilliseconds"]
  4172. }),
  4173. $globals.Date);
  4174. $core.addMethod(
  4175. $core.method({
  4176. selector: ">",
  4177. protocol: "comparing",
  4178. fn: function (aDate){
  4179. var self=this,$self=this;
  4180. return $core.withContext(function($ctx1) {
  4181. return self > aDate;
  4182. return self;
  4183. }, function($ctx1) {$ctx1.fill(self,">",{aDate:aDate},$globals.Date)});
  4184. },
  4185. args: ["aDate"],
  4186. source: "> aDate\x0a\x09<inlineJS: 'return self > aDate'>",
  4187. referencedClasses: [],
  4188. messageSends: []
  4189. }),
  4190. $globals.Date);
  4191. $core.addMethod(
  4192. $core.method({
  4193. selector: ">=",
  4194. protocol: "comparing",
  4195. fn: function (aDate){
  4196. var self=this,$self=this;
  4197. return $core.withContext(function($ctx1) {
  4198. return self >= aDate;
  4199. return self;
  4200. }, function($ctx1) {$ctx1.fill(self,">=",{aDate:aDate},$globals.Date)});
  4201. },
  4202. args: ["aDate"],
  4203. source: ">= aDate\x0a\x09<inlineJS: 'return self >= aDate'>",
  4204. referencedClasses: [],
  4205. messageSends: []
  4206. }),
  4207. $globals.Date);
  4208. $core.addMethod(
  4209. $core.method({
  4210. selector: "asDateString",
  4211. protocol: "converting",
  4212. fn: function (){
  4213. var self=this,$self=this;
  4214. return $core.withContext(function($ctx1) {
  4215. return self.toDateString();
  4216. return self;
  4217. }, function($ctx1) {$ctx1.fill(self,"asDateString",{},$globals.Date)});
  4218. },
  4219. args: [],
  4220. source: "asDateString\x0a\x09<inlineJS: 'return self.toDateString()'>",
  4221. referencedClasses: [],
  4222. messageSends: []
  4223. }),
  4224. $globals.Date);
  4225. $core.addMethod(
  4226. $core.method({
  4227. selector: "asLocaleString",
  4228. protocol: "converting",
  4229. fn: function (){
  4230. var self=this,$self=this;
  4231. return $core.withContext(function($ctx1) {
  4232. return self.toLocaleString();
  4233. return self;
  4234. }, function($ctx1) {$ctx1.fill(self,"asLocaleString",{},$globals.Date)});
  4235. },
  4236. args: [],
  4237. source: "asLocaleString\x0a\x09<inlineJS: 'return self.toLocaleString()'>",
  4238. referencedClasses: [],
  4239. messageSends: []
  4240. }),
  4241. $globals.Date);
  4242. $core.addMethod(
  4243. $core.method({
  4244. selector: "asMilliseconds",
  4245. protocol: "converting",
  4246. fn: function (){
  4247. var self=this,$self=this;
  4248. return $core.withContext(function($ctx1) {
  4249. return $self._time();
  4250. }, function($ctx1) {$ctx1.fill(self,"asMilliseconds",{},$globals.Date)});
  4251. },
  4252. args: [],
  4253. source: "asMilliseconds\x0a\x09^ self time",
  4254. referencedClasses: [],
  4255. messageSends: ["time"]
  4256. }),
  4257. $globals.Date);
  4258. $core.addMethod(
  4259. $core.method({
  4260. selector: "asNumber",
  4261. protocol: "converting",
  4262. fn: function (){
  4263. var self=this,$self=this;
  4264. return $core.withContext(function($ctx1) {
  4265. return $self._asMilliseconds();
  4266. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.Date)});
  4267. },
  4268. args: [],
  4269. source: "asNumber\x0a\x09^ self asMilliseconds",
  4270. referencedClasses: [],
  4271. messageSends: ["asMilliseconds"]
  4272. }),
  4273. $globals.Date);
  4274. $core.addMethod(
  4275. $core.method({
  4276. selector: "asString",
  4277. protocol: "converting",
  4278. fn: function (){
  4279. var self=this,$self=this;
  4280. return $core.withContext(function($ctx1) {
  4281. return self.toString();
  4282. return self;
  4283. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Date)});
  4284. },
  4285. args: [],
  4286. source: "asString\x0a\x09<inlineJS: 'return self.toString()'>",
  4287. referencedClasses: [],
  4288. messageSends: []
  4289. }),
  4290. $globals.Date);
  4291. $core.addMethod(
  4292. $core.method({
  4293. selector: "asTimeString",
  4294. protocol: "converting",
  4295. fn: function (){
  4296. var self=this,$self=this;
  4297. return $core.withContext(function($ctx1) {
  4298. return self.toTimeString();
  4299. return self;
  4300. }, function($ctx1) {$ctx1.fill(self,"asTimeString",{},$globals.Date)});
  4301. },
  4302. args: [],
  4303. source: "asTimeString\x0a\x09<inlineJS: 'return self.toTimeString()'>",
  4304. referencedClasses: [],
  4305. messageSends: []
  4306. }),
  4307. $globals.Date);
  4308. $core.addMethod(
  4309. $core.method({
  4310. selector: "day",
  4311. protocol: "accessing",
  4312. fn: function (){
  4313. var self=this,$self=this;
  4314. return $core.withContext(function($ctx1) {
  4315. return $self._dayOfWeek();
  4316. }, function($ctx1) {$ctx1.fill(self,"day",{},$globals.Date)});
  4317. },
  4318. args: [],
  4319. source: "day\x0a\x09^ self dayOfWeek",
  4320. referencedClasses: [],
  4321. messageSends: ["dayOfWeek"]
  4322. }),
  4323. $globals.Date);
  4324. $core.addMethod(
  4325. $core.method({
  4326. selector: "day:",
  4327. protocol: "accessing",
  4328. fn: function (aNumber){
  4329. var self=this,$self=this;
  4330. return $core.withContext(function($ctx1) {
  4331. $self._dayOfWeek_(aNumber);
  4332. return self;
  4333. }, function($ctx1) {$ctx1.fill(self,"day:",{aNumber:aNumber},$globals.Date)});
  4334. },
  4335. args: ["aNumber"],
  4336. source: "day: aNumber\x0a\x09self dayOfWeek: aNumber",
  4337. referencedClasses: [],
  4338. messageSends: ["dayOfWeek:"]
  4339. }),
  4340. $globals.Date);
  4341. $core.addMethod(
  4342. $core.method({
  4343. selector: "dayOfMonth",
  4344. protocol: "accessing",
  4345. fn: function (){
  4346. var self=this,$self=this;
  4347. return $core.withContext(function($ctx1) {
  4348. return self.getDate();
  4349. return self;
  4350. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth",{},$globals.Date)});
  4351. },
  4352. args: [],
  4353. source: "dayOfMonth\x0a\x09<inlineJS: 'return self.getDate()'>",
  4354. referencedClasses: [],
  4355. messageSends: []
  4356. }),
  4357. $globals.Date);
  4358. $core.addMethod(
  4359. $core.method({
  4360. selector: "dayOfMonth:",
  4361. protocol: "accessing",
  4362. fn: function (aNumber){
  4363. var self=this,$self=this;
  4364. return $core.withContext(function($ctx1) {
  4365. self.setDate(aNumber);
  4366. return self;
  4367. }, function($ctx1) {$ctx1.fill(self,"dayOfMonth:",{aNumber:aNumber},$globals.Date)});
  4368. },
  4369. args: ["aNumber"],
  4370. source: "dayOfMonth: aNumber\x0a\x09<inlineJS: 'self.setDate(aNumber)'>",
  4371. referencedClasses: [],
  4372. messageSends: []
  4373. }),
  4374. $globals.Date);
  4375. $core.addMethod(
  4376. $core.method({
  4377. selector: "dayOfWeek",
  4378. protocol: "accessing",
  4379. fn: function (){
  4380. var self=this,$self=this;
  4381. return $core.withContext(function($ctx1) {
  4382. return self.getDay() + 1;
  4383. return self;
  4384. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek",{},$globals.Date)});
  4385. },
  4386. args: [],
  4387. source: "dayOfWeek\x0a\x09<inlineJS: 'return self.getDay() + 1'>",
  4388. referencedClasses: [],
  4389. messageSends: []
  4390. }),
  4391. $globals.Date);
  4392. $core.addMethod(
  4393. $core.method({
  4394. selector: "dayOfWeek:",
  4395. protocol: "accessing",
  4396. fn: function (aNumber){
  4397. var self=this,$self=this;
  4398. return $core.withContext(function($ctx1) {
  4399. return self.setDay(aNumber - 1);
  4400. return self;
  4401. }, function($ctx1) {$ctx1.fill(self,"dayOfWeek:",{aNumber:aNumber},$globals.Date)});
  4402. },
  4403. args: ["aNumber"],
  4404. source: "dayOfWeek: aNumber\x0a\x09<inlineJS: 'return self.setDay(aNumber - 1)'>",
  4405. referencedClasses: [],
  4406. messageSends: []
  4407. }),
  4408. $globals.Date);
  4409. $core.addMethod(
  4410. $core.method({
  4411. selector: "hours",
  4412. protocol: "accessing",
  4413. fn: function (){
  4414. var self=this,$self=this;
  4415. return $core.withContext(function($ctx1) {
  4416. return self.getHours();
  4417. return self;
  4418. }, function($ctx1) {$ctx1.fill(self,"hours",{},$globals.Date)});
  4419. },
  4420. args: [],
  4421. source: "hours\x0a\x09<inlineJS: 'return self.getHours()'>",
  4422. referencedClasses: [],
  4423. messageSends: []
  4424. }),
  4425. $globals.Date);
  4426. $core.addMethod(
  4427. $core.method({
  4428. selector: "hours:",
  4429. protocol: "accessing",
  4430. fn: function (aNumber){
  4431. var self=this,$self=this;
  4432. return $core.withContext(function($ctx1) {
  4433. self.setHours(aNumber);
  4434. return self;
  4435. }, function($ctx1) {$ctx1.fill(self,"hours:",{aNumber:aNumber},$globals.Date)});
  4436. },
  4437. args: ["aNumber"],
  4438. source: "hours: aNumber\x0a\x09<inlineJS: 'self.setHours(aNumber)'>",
  4439. referencedClasses: [],
  4440. messageSends: []
  4441. }),
  4442. $globals.Date);
  4443. $core.addMethod(
  4444. $core.method({
  4445. selector: "milliseconds",
  4446. protocol: "accessing",
  4447. fn: function (){
  4448. var self=this,$self=this;
  4449. return $core.withContext(function($ctx1) {
  4450. return self.getMilliseconds();
  4451. return self;
  4452. }, function($ctx1) {$ctx1.fill(self,"milliseconds",{},$globals.Date)});
  4453. },
  4454. args: [],
  4455. source: "milliseconds\x0a\x09<inlineJS: 'return self.getMilliseconds()'>",
  4456. referencedClasses: [],
  4457. messageSends: []
  4458. }),
  4459. $globals.Date);
  4460. $core.addMethod(
  4461. $core.method({
  4462. selector: "milliseconds:",
  4463. protocol: "accessing",
  4464. fn: function (aNumber){
  4465. var self=this,$self=this;
  4466. return $core.withContext(function($ctx1) {
  4467. self.setMilliseconds(aNumber);
  4468. return self;
  4469. }, function($ctx1) {$ctx1.fill(self,"milliseconds:",{aNumber:aNumber},$globals.Date)});
  4470. },
  4471. args: ["aNumber"],
  4472. source: "milliseconds: aNumber\x0a\x09<inlineJS: 'self.setMilliseconds(aNumber)'>",
  4473. referencedClasses: [],
  4474. messageSends: []
  4475. }),
  4476. $globals.Date);
  4477. $core.addMethod(
  4478. $core.method({
  4479. selector: "minutes",
  4480. protocol: "accessing",
  4481. fn: function (){
  4482. var self=this,$self=this;
  4483. return $core.withContext(function($ctx1) {
  4484. return self.getMinutes();
  4485. return self;
  4486. }, function($ctx1) {$ctx1.fill(self,"minutes",{},$globals.Date)});
  4487. },
  4488. args: [],
  4489. source: "minutes\x0a\x09<inlineJS: 'return self.getMinutes()'>",
  4490. referencedClasses: [],
  4491. messageSends: []
  4492. }),
  4493. $globals.Date);
  4494. $core.addMethod(
  4495. $core.method({
  4496. selector: "minutes:",
  4497. protocol: "accessing",
  4498. fn: function (aNumber){
  4499. var self=this,$self=this;
  4500. return $core.withContext(function($ctx1) {
  4501. self.setMinutes(aNumber);
  4502. return self;
  4503. }, function($ctx1) {$ctx1.fill(self,"minutes:",{aNumber:aNumber},$globals.Date)});
  4504. },
  4505. args: ["aNumber"],
  4506. source: "minutes: aNumber\x0a\x09<inlineJS: 'self.setMinutes(aNumber)'>",
  4507. referencedClasses: [],
  4508. messageSends: []
  4509. }),
  4510. $globals.Date);
  4511. $core.addMethod(
  4512. $core.method({
  4513. selector: "month",
  4514. protocol: "accessing",
  4515. fn: function (){
  4516. var self=this,$self=this;
  4517. return $core.withContext(function($ctx1) {
  4518. return self.getMonth() + 1;
  4519. return self;
  4520. }, function($ctx1) {$ctx1.fill(self,"month",{},$globals.Date)});
  4521. },
  4522. args: [],
  4523. source: "month\x0a\x09<inlineJS: 'return self.getMonth() + 1'>",
  4524. referencedClasses: [],
  4525. messageSends: []
  4526. }),
  4527. $globals.Date);
  4528. $core.addMethod(
  4529. $core.method({
  4530. selector: "month:",
  4531. protocol: "accessing",
  4532. fn: function (aNumber){
  4533. var self=this,$self=this;
  4534. return $core.withContext(function($ctx1) {
  4535. self.setMonth(aNumber - 1);
  4536. return self;
  4537. }, function($ctx1) {$ctx1.fill(self,"month:",{aNumber:aNumber},$globals.Date)});
  4538. },
  4539. args: ["aNumber"],
  4540. source: "month: aNumber\x0a\x09<inlineJS: 'self.setMonth(aNumber - 1)'>",
  4541. referencedClasses: [],
  4542. messageSends: []
  4543. }),
  4544. $globals.Date);
  4545. $core.addMethod(
  4546. $core.method({
  4547. selector: "printOn:",
  4548. protocol: "printing",
  4549. fn: function (aStream){
  4550. var self=this,$self=this;
  4551. return $core.withContext(function($ctx1) {
  4552. $recv(aStream)._nextPutAll_($self._asString());
  4553. return self;
  4554. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Date)});
  4555. },
  4556. args: ["aStream"],
  4557. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  4558. referencedClasses: [],
  4559. messageSends: ["nextPutAll:", "asString"]
  4560. }),
  4561. $globals.Date);
  4562. $core.addMethod(
  4563. $core.method({
  4564. selector: "seconds",
  4565. protocol: "accessing",
  4566. fn: function (){
  4567. var self=this,$self=this;
  4568. return $core.withContext(function($ctx1) {
  4569. return self.getSeconds();
  4570. return self;
  4571. }, function($ctx1) {$ctx1.fill(self,"seconds",{},$globals.Date)});
  4572. },
  4573. args: [],
  4574. source: "seconds\x0a\x09<inlineJS: 'return self.getSeconds()'>",
  4575. referencedClasses: [],
  4576. messageSends: []
  4577. }),
  4578. $globals.Date);
  4579. $core.addMethod(
  4580. $core.method({
  4581. selector: "seconds:",
  4582. protocol: "accessing",
  4583. fn: function (aNumber){
  4584. var self=this,$self=this;
  4585. return $core.withContext(function($ctx1) {
  4586. self.setSeconds(aNumber);
  4587. return self;
  4588. }, function($ctx1) {$ctx1.fill(self,"seconds:",{aNumber:aNumber},$globals.Date)});
  4589. },
  4590. args: ["aNumber"],
  4591. source: "seconds: aNumber\x0a\x09<inlineJS: 'self.setSeconds(aNumber)'>",
  4592. referencedClasses: [],
  4593. messageSends: []
  4594. }),
  4595. $globals.Date);
  4596. $core.addMethod(
  4597. $core.method({
  4598. selector: "time",
  4599. protocol: "accessing",
  4600. fn: function (){
  4601. var self=this,$self=this;
  4602. return $core.withContext(function($ctx1) {
  4603. return self.getTime();
  4604. return self;
  4605. }, function($ctx1) {$ctx1.fill(self,"time",{},$globals.Date)});
  4606. },
  4607. args: [],
  4608. source: "time\x0a\x09<inlineJS: 'return self.getTime()'>",
  4609. referencedClasses: [],
  4610. messageSends: []
  4611. }),
  4612. $globals.Date);
  4613. $core.addMethod(
  4614. $core.method({
  4615. selector: "time:",
  4616. protocol: "accessing",
  4617. fn: function (aNumber){
  4618. var self=this,$self=this;
  4619. return $core.withContext(function($ctx1) {
  4620. self.setTime(aNumber);
  4621. return self;
  4622. }, function($ctx1) {$ctx1.fill(self,"time:",{aNumber:aNumber},$globals.Date)});
  4623. },
  4624. args: ["aNumber"],
  4625. source: "time: aNumber\x0a\x09<inlineJS: 'self.setTime(aNumber)'>",
  4626. referencedClasses: [],
  4627. messageSends: []
  4628. }),
  4629. $globals.Date);
  4630. $core.addMethod(
  4631. $core.method({
  4632. selector: "year",
  4633. protocol: "accessing",
  4634. fn: function (){
  4635. var self=this,$self=this;
  4636. return $core.withContext(function($ctx1) {
  4637. return self.getFullYear();
  4638. return self;
  4639. }, function($ctx1) {$ctx1.fill(self,"year",{},$globals.Date)});
  4640. },
  4641. args: [],
  4642. source: "year\x0a\x09<inlineJS: 'return self.getFullYear()'>",
  4643. referencedClasses: [],
  4644. messageSends: []
  4645. }),
  4646. $globals.Date);
  4647. $core.addMethod(
  4648. $core.method({
  4649. selector: "year:",
  4650. protocol: "accessing",
  4651. fn: function (aNumber){
  4652. var self=this,$self=this;
  4653. return $core.withContext(function($ctx1) {
  4654. self.setFullYear(aNumber);
  4655. return self;
  4656. }, function($ctx1) {$ctx1.fill(self,"year:",{aNumber:aNumber},$globals.Date)});
  4657. },
  4658. args: ["aNumber"],
  4659. source: "year: aNumber\x0a\x09<inlineJS: 'self.setFullYear(aNumber)'>",
  4660. referencedClasses: [],
  4661. messageSends: []
  4662. }),
  4663. $globals.Date);
  4664. $core.addMethod(
  4665. $core.method({
  4666. selector: "classTag",
  4667. protocol: "accessing",
  4668. fn: function (){
  4669. var self=this,$self=this;
  4670. return "magnitude";
  4671. },
  4672. args: [],
  4673. 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'",
  4674. referencedClasses: [],
  4675. messageSends: []
  4676. }),
  4677. $globals.Date.a$cls);
  4678. $core.addMethod(
  4679. $core.method({
  4680. selector: "fromMilliseconds:",
  4681. protocol: "instance creation",
  4682. fn: function (aNumber){
  4683. var self=this,$self=this;
  4684. return $core.withContext(function($ctx1) {
  4685. return $self._new_(aNumber);
  4686. }, function($ctx1) {$ctx1.fill(self,"fromMilliseconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4687. },
  4688. args: ["aNumber"],
  4689. source: "fromMilliseconds: aNumber\x0a\x09^ self new: aNumber",
  4690. referencedClasses: [],
  4691. messageSends: ["new:"]
  4692. }),
  4693. $globals.Date.a$cls);
  4694. $core.addMethod(
  4695. $core.method({
  4696. selector: "fromSeconds:",
  4697. protocol: "instance creation",
  4698. fn: function (aNumber){
  4699. var self=this,$self=this;
  4700. return $core.withContext(function($ctx1) {
  4701. return $self._fromMilliseconds_($recv(aNumber).__star((1000)));
  4702. }, function($ctx1) {$ctx1.fill(self,"fromSeconds:",{aNumber:aNumber},$globals.Date.a$cls)});
  4703. },
  4704. args: ["aNumber"],
  4705. source: "fromSeconds: aNumber\x0a\x09^ self fromMilliseconds: aNumber * 1000",
  4706. referencedClasses: [],
  4707. messageSends: ["fromMilliseconds:", "*"]
  4708. }),
  4709. $globals.Date.a$cls);
  4710. $core.addMethod(
  4711. $core.method({
  4712. selector: "fromString:",
  4713. protocol: "instance creation",
  4714. fn: function (aString){
  4715. var self=this,$self=this;
  4716. return $core.withContext(function($ctx1) {
  4717. return $self._new_(aString);
  4718. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.Date.a$cls)});
  4719. },
  4720. args: ["aString"],
  4721. source: "fromString: aString\x0a\x09\x22Example: Date fromString('2011/04/15 00:00:00')\x22\x0a\x09^ self new: aString",
  4722. referencedClasses: [],
  4723. messageSends: ["new:"]
  4724. }),
  4725. $globals.Date.a$cls);
  4726. $core.addMethod(
  4727. $core.method({
  4728. selector: "millisecondsToRun:",
  4729. protocol: "instance creation",
  4730. fn: function (aBlock){
  4731. var self=this,$self=this;
  4732. var t;
  4733. return $core.withContext(function($ctx1) {
  4734. t=$recv($globals.Date)._now();
  4735. $ctx1.sendIdx["now"]=1;
  4736. $recv(aBlock)._value();
  4737. return $recv($recv($globals.Date)._now()).__minus(t);
  4738. }, function($ctx1) {$ctx1.fill(self,"millisecondsToRun:",{aBlock:aBlock,t:t},$globals.Date.a$cls)});
  4739. },
  4740. args: ["aBlock"],
  4741. source: "millisecondsToRun: aBlock\x0a\x09| t |\x0a\x09t := Date now.\x0a\x09aBlock value.\x0a\x09^ Date now - t",
  4742. referencedClasses: ["Date"],
  4743. messageSends: ["now", "value", "-"]
  4744. }),
  4745. $globals.Date.a$cls);
  4746. $core.addMethod(
  4747. $core.method({
  4748. selector: "new:",
  4749. protocol: "instance creation",
  4750. fn: function (anObject){
  4751. var self=this,$self=this;
  4752. return $core.withContext(function($ctx1) {
  4753. return new Date(anObject);
  4754. return self;
  4755. }, function($ctx1) {$ctx1.fill(self,"new:",{anObject:anObject},$globals.Date.a$cls)});
  4756. },
  4757. args: ["anObject"],
  4758. source: "new: anObject\x0a\x09<inlineJS: 'return new Date(anObject)'>",
  4759. referencedClasses: [],
  4760. messageSends: []
  4761. }),
  4762. $globals.Date.a$cls);
  4763. $core.addMethod(
  4764. $core.method({
  4765. selector: "now",
  4766. protocol: "instance creation",
  4767. fn: function (){
  4768. var self=this,$self=this;
  4769. return $core.withContext(function($ctx1) {
  4770. return $self._today();
  4771. }, function($ctx1) {$ctx1.fill(self,"now",{},$globals.Date.a$cls)});
  4772. },
  4773. args: [],
  4774. source: "now\x0a\x09^ self today",
  4775. referencedClasses: [],
  4776. messageSends: ["today"]
  4777. }),
  4778. $globals.Date.a$cls);
  4779. $core.addMethod(
  4780. $core.method({
  4781. selector: "today",
  4782. protocol: "instance creation",
  4783. fn: function (){
  4784. var self=this,$self=this;
  4785. return $core.withContext(function($ctx1) {
  4786. return $self._new();
  4787. }, function($ctx1) {$ctx1.fill(self,"today",{},$globals.Date.a$cls)});
  4788. },
  4789. args: [],
  4790. source: "today\x0a\x09^ self new",
  4791. referencedClasses: [],
  4792. messageSends: ["new"]
  4793. }),
  4794. $globals.Date.a$cls);
  4795. $core.addClass("Number", $globals.Object, [], "Kernel-Objects");
  4796. $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 ].";
  4797. $core.addMethod(
  4798. $core.method({
  4799. selector: "&",
  4800. protocol: "converting",
  4801. fn: function (aNumber){
  4802. var self=this,$self=this;
  4803. return $core.withContext(function($ctx1) {
  4804. return self & aNumber;
  4805. return self;
  4806. }, function($ctx1) {$ctx1.fill(self,"&",{aNumber:aNumber},$globals.Number)});
  4807. },
  4808. args: ["aNumber"],
  4809. source: "& aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  4810. referencedClasses: [],
  4811. messageSends: []
  4812. }),
  4813. $globals.Number);
  4814. $core.addMethod(
  4815. $core.method({
  4816. selector: "*",
  4817. protocol: "arithmetic",
  4818. fn: function (aNumber){
  4819. var self=this,$self=this;
  4820. return $core.withContext(function($ctx1) {
  4821. return self * aNumber;
  4822. return self;
  4823. }, function($ctx1) {$ctx1.fill(self,"*",{aNumber:aNumber},$globals.Number)});
  4824. },
  4825. args: ["aNumber"],
  4826. source: "* aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self * aNumber'>",
  4827. referencedClasses: [],
  4828. messageSends: []
  4829. }),
  4830. $globals.Number);
  4831. $core.addMethod(
  4832. $core.method({
  4833. selector: "**",
  4834. protocol: "mathematical functions",
  4835. fn: function (exponent){
  4836. var self=this,$self=this;
  4837. return $core.withContext(function($ctx1) {
  4838. return $self._raisedTo_(exponent);
  4839. }, function($ctx1) {$ctx1.fill(self,"**",{exponent:exponent},$globals.Number)});
  4840. },
  4841. args: ["exponent"],
  4842. source: "** exponent\x0a\x09^ self raisedTo: exponent",
  4843. referencedClasses: [],
  4844. messageSends: ["raisedTo:"]
  4845. }),
  4846. $globals.Number);
  4847. $core.addMethod(
  4848. $core.method({
  4849. selector: "+",
  4850. protocol: "arithmetic",
  4851. fn: function (aNumber){
  4852. var self=this,$self=this;
  4853. return $core.withContext(function($ctx1) {
  4854. return self + aNumber;
  4855. return self;
  4856. }, function($ctx1) {$ctx1.fill(self,"+",{aNumber:aNumber},$globals.Number)});
  4857. },
  4858. args: ["aNumber"],
  4859. source: "+ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self + aNumber'>",
  4860. referencedClasses: [],
  4861. messageSends: []
  4862. }),
  4863. $globals.Number);
  4864. $core.addMethod(
  4865. $core.method({
  4866. selector: "-",
  4867. protocol: "arithmetic",
  4868. fn: function (aNumber){
  4869. var self=this,$self=this;
  4870. return $core.withContext(function($ctx1) {
  4871. return self - aNumber;
  4872. return self;
  4873. }, function($ctx1) {$ctx1.fill(self,"-",{aNumber:aNumber},$globals.Number)});
  4874. },
  4875. args: ["aNumber"],
  4876. source: "- aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self - aNumber'>",
  4877. referencedClasses: [],
  4878. messageSends: []
  4879. }),
  4880. $globals.Number);
  4881. $core.addMethod(
  4882. $core.method({
  4883. selector: "/",
  4884. protocol: "arithmetic",
  4885. fn: function (aNumber){
  4886. var self=this,$self=this;
  4887. return $core.withContext(function($ctx1) {
  4888. return self / aNumber;
  4889. return self;
  4890. }, function($ctx1) {$ctx1.fill(self,"/",{aNumber:aNumber},$globals.Number)});
  4891. },
  4892. args: ["aNumber"],
  4893. source: "/ aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self / aNumber'>",
  4894. referencedClasses: [],
  4895. messageSends: []
  4896. }),
  4897. $globals.Number);
  4898. $core.addMethod(
  4899. $core.method({
  4900. selector: "//",
  4901. protocol: "arithmetic",
  4902. fn: function (aNumber){
  4903. var self=this,$self=this;
  4904. return $core.withContext(function($ctx1) {
  4905. return $recv($self.__slash(aNumber))._floor();
  4906. }, function($ctx1) {$ctx1.fill(self,"//",{aNumber:aNumber},$globals.Number)});
  4907. },
  4908. args: ["aNumber"],
  4909. source: "// aNumber\x0a\x09^ (self / aNumber) floor",
  4910. referencedClasses: [],
  4911. messageSends: ["floor", "/"]
  4912. }),
  4913. $globals.Number);
  4914. $core.addMethod(
  4915. $core.method({
  4916. selector: "<",
  4917. protocol: "comparing",
  4918. fn: function (aNumber){
  4919. var self=this,$self=this;
  4920. return $core.withContext(function($ctx1) {
  4921. return self < aNumber;
  4922. return self;
  4923. }, function($ctx1) {$ctx1.fill(self,"<",{aNumber:aNumber},$globals.Number)});
  4924. },
  4925. args: ["aNumber"],
  4926. source: "< aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self < aNumber'>",
  4927. referencedClasses: [],
  4928. messageSends: []
  4929. }),
  4930. $globals.Number);
  4931. $core.addMethod(
  4932. $core.method({
  4933. selector: "<=",
  4934. protocol: "comparing",
  4935. fn: function (aNumber){
  4936. var self=this,$self=this;
  4937. return $core.withContext(function($ctx1) {
  4938. return self <= aNumber;
  4939. return self;
  4940. }, function($ctx1) {$ctx1.fill(self,"<=",{aNumber:aNumber},$globals.Number)});
  4941. },
  4942. args: ["aNumber"],
  4943. source: "<= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self <= aNumber'>",
  4944. referencedClasses: [],
  4945. messageSends: []
  4946. }),
  4947. $globals.Number);
  4948. $core.addMethod(
  4949. $core.method({
  4950. selector: "==",
  4951. protocol: "comparing",
  4952. fn: function (aNumber){
  4953. var self=this,$self=this;
  4954. return $core.withContext(function($ctx1) {
  4955. if (typeof aNumber === "number") return Number(self) === aNumber;
  4956. else if (aNumber != null && typeof aNumber === "object") return Number(self) === aNumber.valueOf();
  4957. else return false;;
  4958. return self;
  4959. }, function($ctx1) {$ctx1.fill(self,"==",{aNumber:aNumber},$globals.Number)});
  4960. },
  4961. args: ["aNumber"],
  4962. 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'>",
  4963. referencedClasses: [],
  4964. messageSends: []
  4965. }),
  4966. $globals.Number);
  4967. $core.addMethod(
  4968. $core.method({
  4969. selector: ">",
  4970. protocol: "comparing",
  4971. fn: function (aNumber){
  4972. var self=this,$self=this;
  4973. return $core.withContext(function($ctx1) {
  4974. return self > aNumber;
  4975. return self;
  4976. }, function($ctx1) {$ctx1.fill(self,">",{aNumber:aNumber},$globals.Number)});
  4977. },
  4978. args: ["aNumber"],
  4979. source: "> aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self > aNumber'>",
  4980. referencedClasses: [],
  4981. messageSends: []
  4982. }),
  4983. $globals.Number);
  4984. $core.addMethod(
  4985. $core.method({
  4986. selector: ">=",
  4987. protocol: "comparing",
  4988. fn: function (aNumber){
  4989. var self=this,$self=this;
  4990. return $core.withContext(function($ctx1) {
  4991. return self >= aNumber;
  4992. return self;
  4993. }, function($ctx1) {$ctx1.fill(self,">=",{aNumber:aNumber},$globals.Number)});
  4994. },
  4995. args: ["aNumber"],
  4996. source: ">= aNumber\x0a\x09\x22Inlined in the Compiler\x22\x0a\x09<inlineJS: 'return self >= aNumber'>",
  4997. referencedClasses: [],
  4998. messageSends: []
  4999. }),
  5000. $globals.Number);
  5001. $core.addMethod(
  5002. $core.method({
  5003. selector: "@",
  5004. protocol: "converting",
  5005. fn: function (aNumber){
  5006. var self=this,$self=this;
  5007. return $core.withContext(function($ctx1) {
  5008. return $recv($globals.Point)._x_y_(self,aNumber);
  5009. }, function($ctx1) {$ctx1.fill(self,"@",{aNumber:aNumber},$globals.Number)});
  5010. },
  5011. args: ["aNumber"],
  5012. source: "@ aNumber\x0a\x09^ Point x: self y: aNumber",
  5013. referencedClasses: ["Point"],
  5014. messageSends: ["x:y:"]
  5015. }),
  5016. $globals.Number);
  5017. $core.addMethod(
  5018. $core.method({
  5019. selector: "\x5c\x5c",
  5020. protocol: "arithmetic",
  5021. fn: function (aNumber){
  5022. var self=this,$self=this;
  5023. return $core.withContext(function($ctx1) {
  5024. return self % aNumber;
  5025. return self;
  5026. }, function($ctx1) {$ctx1.fill(self,"\x5c\x5c",{aNumber:aNumber},$globals.Number)});
  5027. },
  5028. args: ["aNumber"],
  5029. source: "\x5c\x5c aNumber\x0a\x09<inlineJS: 'return self % aNumber'>",
  5030. referencedClasses: [],
  5031. messageSends: []
  5032. }),
  5033. $globals.Number);
  5034. $core.addMethod(
  5035. $core.method({
  5036. selector: "abs",
  5037. protocol: "arithmetic",
  5038. fn: function (){
  5039. var self=this,$self=this;
  5040. return $core.withContext(function($ctx1) {
  5041. return Math.abs(self);;
  5042. return self;
  5043. }, function($ctx1) {$ctx1.fill(self,"abs",{},$globals.Number)});
  5044. },
  5045. args: [],
  5046. source: "abs\x0a\x09<inlineJS: 'return Math.abs(self);'>",
  5047. referencedClasses: [],
  5048. messageSends: []
  5049. }),
  5050. $globals.Number);
  5051. $core.addMethod(
  5052. $core.method({
  5053. selector: "arcCos",
  5054. protocol: "mathematical functions",
  5055. fn: function (){
  5056. var self=this,$self=this;
  5057. return $core.withContext(function($ctx1) {
  5058. return Math.acos(self);;
  5059. return self;
  5060. }, function($ctx1) {$ctx1.fill(self,"arcCos",{},$globals.Number)});
  5061. },
  5062. args: [],
  5063. source: "arcCos\x0a\x09<inlineJS: 'return Math.acos(self);'>",
  5064. referencedClasses: [],
  5065. messageSends: []
  5066. }),
  5067. $globals.Number);
  5068. $core.addMethod(
  5069. $core.method({
  5070. selector: "arcSin",
  5071. protocol: "mathematical functions",
  5072. fn: function (){
  5073. var self=this,$self=this;
  5074. return $core.withContext(function($ctx1) {
  5075. return Math.asin(self);;
  5076. return self;
  5077. }, function($ctx1) {$ctx1.fill(self,"arcSin",{},$globals.Number)});
  5078. },
  5079. args: [],
  5080. source: "arcSin\x0a\x09<inlineJS: 'return Math.asin(self);'>",
  5081. referencedClasses: [],
  5082. messageSends: []
  5083. }),
  5084. $globals.Number);
  5085. $core.addMethod(
  5086. $core.method({
  5087. selector: "arcTan",
  5088. protocol: "mathematical functions",
  5089. fn: function (){
  5090. var self=this,$self=this;
  5091. return $core.withContext(function($ctx1) {
  5092. return Math.atan(self);;
  5093. return self;
  5094. }, function($ctx1) {$ctx1.fill(self,"arcTan",{},$globals.Number)});
  5095. },
  5096. args: [],
  5097. source: "arcTan\x0a\x09<inlineJS: 'return Math.atan(self);'>",
  5098. referencedClasses: [],
  5099. messageSends: []
  5100. }),
  5101. $globals.Number);
  5102. $core.addMethod(
  5103. $core.method({
  5104. selector: "arcTan:",
  5105. protocol: "mathematical functions",
  5106. fn: function (aNumber){
  5107. var self=this,$self=this;
  5108. return $core.withContext(function($ctx1) {
  5109. return Math.atan2(self, aNumber);;
  5110. return self;
  5111. }, function($ctx1) {$ctx1.fill(self,"arcTan:",{aNumber:aNumber},$globals.Number)});
  5112. },
  5113. args: ["aNumber"],
  5114. source: "arcTan: aNumber\x0a\x09<inlineJS: 'return Math.atan2(self, aNumber);'>",
  5115. referencedClasses: [],
  5116. messageSends: []
  5117. }),
  5118. $globals.Number);
  5119. $core.addMethod(
  5120. $core.method({
  5121. selector: "asJavaScriptObject",
  5122. protocol: "converting",
  5123. fn: function (){
  5124. var self=this,$self=this;
  5125. return self;
  5126. },
  5127. args: [],
  5128. source: "asJavaScriptObject\x0a\x09^ self",
  5129. referencedClasses: [],
  5130. messageSends: []
  5131. }),
  5132. $globals.Number);
  5133. $core.addMethod(
  5134. $core.method({
  5135. selector: "asJavaScriptSource",
  5136. protocol: "converting",
  5137. fn: function (){
  5138. var self=this,$self=this;
  5139. return $core.withContext(function($ctx1) {
  5140. var $1;
  5141. $1=$recv("(".__comma($self._printString())).__comma(")");
  5142. $ctx1.sendIdx[","]=1;
  5143. return $1;
  5144. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Number)});
  5145. },
  5146. args: [],
  5147. source: "asJavaScriptSource\x0a\x09^ '(', self printString, ')'",
  5148. referencedClasses: [],
  5149. messageSends: [",", "printString"]
  5150. }),
  5151. $globals.Number);
  5152. $core.addMethod(
  5153. $core.method({
  5154. selector: "asNumber",
  5155. protocol: "converting",
  5156. fn: function (){
  5157. var self=this,$self=this;
  5158. return self;
  5159. },
  5160. args: [],
  5161. source: "asNumber\x0a\x09^ self",
  5162. referencedClasses: [],
  5163. messageSends: []
  5164. }),
  5165. $globals.Number);
  5166. $core.addMethod(
  5167. $core.method({
  5168. selector: "asPoint",
  5169. protocol: "converting",
  5170. fn: function (){
  5171. var self=this,$self=this;
  5172. return $core.withContext(function($ctx1) {
  5173. return $recv($globals.Point)._x_y_(self,self);
  5174. }, function($ctx1) {$ctx1.fill(self,"asPoint",{},$globals.Number)});
  5175. },
  5176. args: [],
  5177. source: "asPoint\x0a\x09^ Point x: self y: self",
  5178. referencedClasses: ["Point"],
  5179. messageSends: ["x:y:"]
  5180. }),
  5181. $globals.Number);
  5182. $core.addMethod(
  5183. $core.method({
  5184. selector: "asString",
  5185. protocol: "converting",
  5186. fn: function (){
  5187. var self=this,$self=this;
  5188. return $core.withContext(function($ctx1) {
  5189. return String(self);
  5190. return self;
  5191. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.Number)});
  5192. },
  5193. args: [],
  5194. source: "asString\x0a\x09<inlineJS: 'return String(self)'>",
  5195. referencedClasses: [],
  5196. messageSends: []
  5197. }),
  5198. $globals.Number);
  5199. $core.addMethod(
  5200. $core.method({
  5201. selector: "atRandom",
  5202. protocol: "converting",
  5203. fn: function (){
  5204. var self=this,$self=this;
  5205. return $core.withContext(function($ctx1) {
  5206. return $recv($recv($recv($recv($recv($globals.Random)._new())._next()).__star(self))._truncated()).__plus((1));
  5207. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.Number)});
  5208. },
  5209. args: [],
  5210. source: "atRandom\x0a\x09^ (Random new next * self) truncated + 1",
  5211. referencedClasses: ["Random"],
  5212. messageSends: ["+", "truncated", "*", "next", "new"]
  5213. }),
  5214. $globals.Number);
  5215. $core.addMethod(
  5216. $core.method({
  5217. selector: "between:and:",
  5218. protocol: "testing",
  5219. fn: function (min,max){
  5220. var self=this,$self=this;
  5221. return $core.withContext(function($ctx1) {
  5222. return $recv($self.__gt_eq(min))._and_((function(){
  5223. return $core.withContext(function($ctx2) {
  5224. return $self.__lt_eq(max);
  5225. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5226. }));
  5227. }, function($ctx1) {$ctx1.fill(self,"between:and:",{min:min,max:max},$globals.Number)});
  5228. },
  5229. args: ["min", "max"],
  5230. source: "between: min and: max\x0a ^ self >= min and: [ self <= max ]",
  5231. referencedClasses: [],
  5232. messageSends: ["and:", ">=", "<="]
  5233. }),
  5234. $globals.Number);
  5235. $core.addMethod(
  5236. $core.method({
  5237. selector: "bitAnd:",
  5238. protocol: "converting",
  5239. fn: function (aNumber){
  5240. var self=this,$self=this;
  5241. return $core.withContext(function($ctx1) {
  5242. return self & aNumber;
  5243. return self;
  5244. }, function($ctx1) {$ctx1.fill(self,"bitAnd:",{aNumber:aNumber},$globals.Number)});
  5245. },
  5246. args: ["aNumber"],
  5247. source: "bitAnd: aNumber\x0a\x09<inlineJS: 'return self & aNumber'>",
  5248. referencedClasses: [],
  5249. messageSends: []
  5250. }),
  5251. $globals.Number);
  5252. $core.addMethod(
  5253. $core.method({
  5254. selector: "bitNot",
  5255. protocol: "converting",
  5256. fn: function (){
  5257. var self=this,$self=this;
  5258. return $core.withContext(function($ctx1) {
  5259. return ~self;
  5260. return self;
  5261. }, function($ctx1) {$ctx1.fill(self,"bitNot",{},$globals.Number)});
  5262. },
  5263. args: [],
  5264. source: "bitNot\x0a\x09<inlineJS: 'return ~self'>",
  5265. referencedClasses: [],
  5266. messageSends: []
  5267. }),
  5268. $globals.Number);
  5269. $core.addMethod(
  5270. $core.method({
  5271. selector: "bitOr:",
  5272. protocol: "converting",
  5273. fn: function (aNumber){
  5274. var self=this,$self=this;
  5275. return $core.withContext(function($ctx1) {
  5276. return self | aNumber;
  5277. return self;
  5278. }, function($ctx1) {$ctx1.fill(self,"bitOr:",{aNumber:aNumber},$globals.Number)});
  5279. },
  5280. args: ["aNumber"],
  5281. source: "bitOr: aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  5282. referencedClasses: [],
  5283. messageSends: []
  5284. }),
  5285. $globals.Number);
  5286. $core.addMethod(
  5287. $core.method({
  5288. selector: "bitXor:",
  5289. protocol: "converting",
  5290. fn: function (aNumber){
  5291. var self=this,$self=this;
  5292. return $core.withContext(function($ctx1) {
  5293. return self ^ aNumber;
  5294. return self;
  5295. }, function($ctx1) {$ctx1.fill(self,"bitXor:",{aNumber:aNumber},$globals.Number)});
  5296. },
  5297. args: ["aNumber"],
  5298. source: "bitXor: aNumber\x0a\x09<inlineJS: 'return self ^ aNumber'>",
  5299. referencedClasses: [],
  5300. messageSends: []
  5301. }),
  5302. $globals.Number);
  5303. $core.addMethod(
  5304. $core.method({
  5305. selector: "ceiling",
  5306. protocol: "converting",
  5307. fn: function (){
  5308. var self=this,$self=this;
  5309. return $core.withContext(function($ctx1) {
  5310. return Math.ceil(self);;
  5311. return self;
  5312. }, function($ctx1) {$ctx1.fill(self,"ceiling",{},$globals.Number)});
  5313. },
  5314. args: [],
  5315. source: "ceiling\x0a\x09<inlineJS: 'return Math.ceil(self);'>",
  5316. referencedClasses: [],
  5317. messageSends: []
  5318. }),
  5319. $globals.Number);
  5320. $core.addMethod(
  5321. $core.method({
  5322. selector: "copy",
  5323. protocol: "copying",
  5324. fn: function (){
  5325. var self=this,$self=this;
  5326. return self;
  5327. },
  5328. args: [],
  5329. source: "copy\x0a\x09^ self",
  5330. referencedClasses: [],
  5331. messageSends: []
  5332. }),
  5333. $globals.Number);
  5334. $core.addMethod(
  5335. $core.method({
  5336. selector: "cos",
  5337. protocol: "mathematical functions",
  5338. fn: function (){
  5339. var self=this,$self=this;
  5340. return $core.withContext(function($ctx1) {
  5341. return Math.cos(self);;
  5342. return self;
  5343. }, function($ctx1) {$ctx1.fill(self,"cos",{},$globals.Number)});
  5344. },
  5345. args: [],
  5346. source: "cos\x0a\x09<inlineJS: 'return Math.cos(self);'>",
  5347. referencedClasses: [],
  5348. messageSends: []
  5349. }),
  5350. $globals.Number);
  5351. $core.addMethod(
  5352. $core.method({
  5353. selector: "deepCopy",
  5354. protocol: "copying",
  5355. fn: function (){
  5356. var self=this,$self=this;
  5357. return $core.withContext(function($ctx1) {
  5358. return $self._copy();
  5359. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Number)});
  5360. },
  5361. args: [],
  5362. source: "deepCopy\x0a\x09^ self copy",
  5363. referencedClasses: [],
  5364. messageSends: ["copy"]
  5365. }),
  5366. $globals.Number);
  5367. $core.addMethod(
  5368. $core.method({
  5369. selector: "degreesToRadians",
  5370. protocol: "converting",
  5371. fn: function (){
  5372. var self=this,$self=this;
  5373. return $core.withContext(function($ctx1) {
  5374. return $self.__star($recv($globals.Number)._radiansPerDegree());
  5375. }, function($ctx1) {$ctx1.fill(self,"degreesToRadians",{},$globals.Number)});
  5376. },
  5377. args: [],
  5378. source: "degreesToRadians\x0a\x09^ self * Number radiansPerDegree",
  5379. referencedClasses: ["Number"],
  5380. messageSends: ["*", "radiansPerDegree"]
  5381. }),
  5382. $globals.Number);
  5383. $core.addMethod(
  5384. $core.method({
  5385. selector: "even",
  5386. protocol: "testing",
  5387. fn: function (){
  5388. var self=this,$self=this;
  5389. return $core.withContext(function($ctx1) {
  5390. return (0).__eq($self.__backslash_backslash((2)));
  5391. }, function($ctx1) {$ctx1.fill(self,"even",{},$globals.Number)});
  5392. },
  5393. args: [],
  5394. source: "even\x0a\x09^ 0 = (self \x5c\x5c 2)",
  5395. referencedClasses: [],
  5396. messageSends: ["=", "\x5c\x5c"]
  5397. }),
  5398. $globals.Number);
  5399. $core.addMethod(
  5400. $core.method({
  5401. selector: "floor",
  5402. protocol: "converting",
  5403. fn: function (){
  5404. var self=this,$self=this;
  5405. return $core.withContext(function($ctx1) {
  5406. return Math.floor(self);;
  5407. return self;
  5408. }, function($ctx1) {$ctx1.fill(self,"floor",{},$globals.Number)});
  5409. },
  5410. args: [],
  5411. source: "floor\x0a\x09<inlineJS: 'return Math.floor(self);'>",
  5412. referencedClasses: [],
  5413. messageSends: []
  5414. }),
  5415. $globals.Number);
  5416. $core.addMethod(
  5417. $core.method({
  5418. selector: "isImmutable",
  5419. protocol: "testing",
  5420. fn: function (){
  5421. var self=this,$self=this;
  5422. return true;
  5423. },
  5424. args: [],
  5425. source: "isImmutable\x0a\x09^ true",
  5426. referencedClasses: [],
  5427. messageSends: []
  5428. }),
  5429. $globals.Number);
  5430. $core.addMethod(
  5431. $core.method({
  5432. selector: "isNumber",
  5433. protocol: "testing",
  5434. fn: function (){
  5435. var self=this,$self=this;
  5436. return true;
  5437. },
  5438. args: [],
  5439. source: "isNumber\x0a\x09^ true",
  5440. referencedClasses: [],
  5441. messageSends: []
  5442. }),
  5443. $globals.Number);
  5444. $core.addMethod(
  5445. $core.method({
  5446. selector: "isZero",
  5447. protocol: "testing",
  5448. fn: function (){
  5449. var self=this,$self=this;
  5450. return $core.withContext(function($ctx1) {
  5451. return $self.__eq((0));
  5452. }, function($ctx1) {$ctx1.fill(self,"isZero",{},$globals.Number)});
  5453. },
  5454. args: [],
  5455. source: "isZero\x0a\x09^ self = 0",
  5456. referencedClasses: [],
  5457. messageSends: ["="]
  5458. }),
  5459. $globals.Number);
  5460. $core.addMethod(
  5461. $core.method({
  5462. selector: "ln",
  5463. protocol: "mathematical functions",
  5464. fn: function (){
  5465. var self=this,$self=this;
  5466. return $core.withContext(function($ctx1) {
  5467. return Math.log(self);;
  5468. return self;
  5469. }, function($ctx1) {$ctx1.fill(self,"ln",{},$globals.Number)});
  5470. },
  5471. args: [],
  5472. source: "ln\x0a\x09<inlineJS: 'return Math.log(self);'>",
  5473. referencedClasses: [],
  5474. messageSends: []
  5475. }),
  5476. $globals.Number);
  5477. $core.addMethod(
  5478. $core.method({
  5479. selector: "ln1p",
  5480. protocol: "mathematical functions",
  5481. fn: function (){
  5482. var self=this,$self=this;
  5483. return $core.withContext(function($ctx1) {
  5484. return Math.log1p(self);;
  5485. return self;
  5486. }, function($ctx1) {$ctx1.fill(self,"ln1p",{},$globals.Number)});
  5487. },
  5488. args: [],
  5489. source: "ln1p\x0a\x09<inlineJS: 'return Math.log1p(self);'>",
  5490. referencedClasses: [],
  5491. messageSends: []
  5492. }),
  5493. $globals.Number);
  5494. $core.addMethod(
  5495. $core.method({
  5496. selector: "log",
  5497. protocol: "mathematical functions",
  5498. fn: function (){
  5499. var self=this,$self=this;
  5500. return $core.withContext(function($ctx1) {
  5501. return Math.log(self) / Math.LN10;;
  5502. return self;
  5503. }, function($ctx1) {$ctx1.fill(self,"log",{},$globals.Number)});
  5504. },
  5505. args: [],
  5506. source: "log\x0a\x09<inlineJS: 'return Math.log(self) / Math.LN10;'>",
  5507. referencedClasses: [],
  5508. messageSends: []
  5509. }),
  5510. $globals.Number);
  5511. $core.addMethod(
  5512. $core.method({
  5513. selector: "log:",
  5514. protocol: "mathematical functions",
  5515. fn: function (aNumber){
  5516. var self=this,$self=this;
  5517. return $core.withContext(function($ctx1) {
  5518. return Math.log(self) / Math.log(aNumber);;
  5519. return self;
  5520. }, function($ctx1) {$ctx1.fill(self,"log:",{aNumber:aNumber},$globals.Number)});
  5521. },
  5522. args: ["aNumber"],
  5523. source: "log: aNumber\x0a\x09<inlineJS: 'return Math.log(self) / Math.log(aNumber);'>",
  5524. referencedClasses: [],
  5525. messageSends: []
  5526. }),
  5527. $globals.Number);
  5528. $core.addMethod(
  5529. $core.method({
  5530. selector: "max:",
  5531. protocol: "arithmetic",
  5532. fn: function (aNumber){
  5533. var self=this,$self=this;
  5534. return $core.withContext(function($ctx1) {
  5535. return Math.max(self, aNumber);;
  5536. return self;
  5537. }, function($ctx1) {$ctx1.fill(self,"max:",{aNumber:aNumber},$globals.Number)});
  5538. },
  5539. args: ["aNumber"],
  5540. source: "max: aNumber\x0a\x09<inlineJS: 'return Math.max(self, aNumber);'>",
  5541. referencedClasses: [],
  5542. messageSends: []
  5543. }),
  5544. $globals.Number);
  5545. $core.addMethod(
  5546. $core.method({
  5547. selector: "min:",
  5548. protocol: "arithmetic",
  5549. fn: function (aNumber){
  5550. var self=this,$self=this;
  5551. return $core.withContext(function($ctx1) {
  5552. return Math.min(self, aNumber);;
  5553. return self;
  5554. }, function($ctx1) {$ctx1.fill(self,"min:",{aNumber:aNumber},$globals.Number)});
  5555. },
  5556. args: ["aNumber"],
  5557. source: "min: aNumber\x0a\x09<inlineJS: 'return Math.min(self, aNumber);'>",
  5558. referencedClasses: [],
  5559. messageSends: []
  5560. }),
  5561. $globals.Number);
  5562. $core.addMethod(
  5563. $core.method({
  5564. selector: "min:max:",
  5565. protocol: "arithmetic",
  5566. fn: function (aMin,aMax){
  5567. var self=this,$self=this;
  5568. return $core.withContext(function($ctx1) {
  5569. return $recv($self._min_(aMin))._max_(aMax);
  5570. }, function($ctx1) {$ctx1.fill(self,"min:max:",{aMin:aMin,aMax:aMax},$globals.Number)});
  5571. },
  5572. args: ["aMin", "aMax"],
  5573. source: "min: aMin max: aMax\x0a\x09^ (self min: aMin) max: aMax",
  5574. referencedClasses: [],
  5575. messageSends: ["max:", "min:"]
  5576. }),
  5577. $globals.Number);
  5578. $core.addMethod(
  5579. $core.method({
  5580. selector: "negated",
  5581. protocol: "arithmetic",
  5582. fn: function (){
  5583. var self=this,$self=this;
  5584. return $core.withContext(function($ctx1) {
  5585. return (0).__minus(self);
  5586. }, function($ctx1) {$ctx1.fill(self,"negated",{},$globals.Number)});
  5587. },
  5588. args: [],
  5589. source: "negated\x0a\x09^ 0 - self",
  5590. referencedClasses: [],
  5591. messageSends: ["-"]
  5592. }),
  5593. $globals.Number);
  5594. $core.addMethod(
  5595. $core.method({
  5596. selector: "negative",
  5597. protocol: "testing",
  5598. fn: function (){
  5599. var self=this,$self=this;
  5600. return $core.withContext(function($ctx1) {
  5601. return $self.__lt((0));
  5602. }, function($ctx1) {$ctx1.fill(self,"negative",{},$globals.Number)});
  5603. },
  5604. args: [],
  5605. source: "negative\x0a\x09\x22Answer whether the receiver is mathematically negative.\x22\x0a\x0a\x09^ self < 0",
  5606. referencedClasses: [],
  5607. messageSends: ["<"]
  5608. }),
  5609. $globals.Number);
  5610. $core.addMethod(
  5611. $core.method({
  5612. selector: "odd",
  5613. protocol: "testing",
  5614. fn: function (){
  5615. var self=this,$self=this;
  5616. return $core.withContext(function($ctx1) {
  5617. return $recv($self._even())._not();
  5618. }, function($ctx1) {$ctx1.fill(self,"odd",{},$globals.Number)});
  5619. },
  5620. args: [],
  5621. source: "odd\x0a\x09^ self even not",
  5622. referencedClasses: [],
  5623. messageSends: ["not", "even"]
  5624. }),
  5625. $globals.Number);
  5626. $core.addMethod(
  5627. $core.method({
  5628. selector: "positive",
  5629. protocol: "testing",
  5630. fn: function (){
  5631. var self=this,$self=this;
  5632. return $core.withContext(function($ctx1) {
  5633. return $self.__gt_eq((0));
  5634. }, function($ctx1) {$ctx1.fill(self,"positive",{},$globals.Number)});
  5635. },
  5636. args: [],
  5637. source: "positive\x0a\x09\x22Answer whether the receiver is positive or equal to 0. (ST-80 protocol).\x22\x0a\x0a\x09^ self >= 0",
  5638. referencedClasses: [],
  5639. messageSends: [">="]
  5640. }),
  5641. $globals.Number);
  5642. $core.addMethod(
  5643. $core.method({
  5644. selector: "printOn:",
  5645. protocol: "printing",
  5646. fn: function (aStream){
  5647. var self=this,$self=this;
  5648. return $core.withContext(function($ctx1) {
  5649. $recv(aStream)._nextPutAll_($self._asString());
  5650. return self;
  5651. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Number)});
  5652. },
  5653. args: ["aStream"],
  5654. source: "printOn: aStream\x0a\x09aStream nextPutAll: self asString",
  5655. referencedClasses: [],
  5656. messageSends: ["nextPutAll:", "asString"]
  5657. }),
  5658. $globals.Number);
  5659. $core.addMethod(
  5660. $core.method({
  5661. selector: "printShowingDecimalPlaces:",
  5662. protocol: "printing",
  5663. fn: function (placesDesired){
  5664. var self=this,$self=this;
  5665. return $core.withContext(function($ctx1) {
  5666. return self.toFixed(placesDesired);
  5667. return self;
  5668. }, function($ctx1) {$ctx1.fill(self,"printShowingDecimalPlaces:",{placesDesired:placesDesired},$globals.Number)});
  5669. },
  5670. args: ["placesDesired"],
  5671. source: "printShowingDecimalPlaces: placesDesired\x0a\x09<inlineJS: 'return self.toFixed(placesDesired)'>",
  5672. referencedClasses: [],
  5673. messageSends: []
  5674. }),
  5675. $globals.Number);
  5676. $core.addMethod(
  5677. $core.method({
  5678. selector: "printStringBase:",
  5679. protocol: "converting",
  5680. fn: function (aBase){
  5681. var self=this,$self=this;
  5682. return $core.withContext(function($ctx1) {
  5683. return self.toString(aBase);
  5684. return self;
  5685. }, function($ctx1) {$ctx1.fill(self,"printStringBase:",{aBase:aBase},$globals.Number)});
  5686. },
  5687. args: ["aBase"],
  5688. source: "printStringBase: aBase\x0a\x09<inlineJS: 'return self.toString(aBase)'>",
  5689. referencedClasses: [],
  5690. messageSends: []
  5691. }),
  5692. $globals.Number);
  5693. $core.addMethod(
  5694. $core.method({
  5695. selector: "radiansToDegrees",
  5696. protocol: "converting",
  5697. fn: function (){
  5698. var self=this,$self=this;
  5699. return $core.withContext(function($ctx1) {
  5700. return $self.__slash($recv($globals.Number)._radiansPerDegree());
  5701. }, function($ctx1) {$ctx1.fill(self,"radiansToDegrees",{},$globals.Number)});
  5702. },
  5703. args: [],
  5704. source: "radiansToDegrees\x0a\x09^ self / Number radiansPerDegree",
  5705. referencedClasses: ["Number"],
  5706. messageSends: ["/", "radiansPerDegree"]
  5707. }),
  5708. $globals.Number);
  5709. $core.addMethod(
  5710. $core.method({
  5711. selector: "raisedTo:",
  5712. protocol: "mathematical functions",
  5713. fn: function (exponent){
  5714. var self=this,$self=this;
  5715. return $core.withContext(function($ctx1) {
  5716. return Math.pow(self, exponent);;
  5717. return self;
  5718. }, function($ctx1) {$ctx1.fill(self,"raisedTo:",{exponent:exponent},$globals.Number)});
  5719. },
  5720. args: ["exponent"],
  5721. source: "raisedTo: exponent\x0a\x09<inlineJS: 'return Math.pow(self, exponent);'>",
  5722. referencedClasses: [],
  5723. messageSends: []
  5724. }),
  5725. $globals.Number);
  5726. $core.addMethod(
  5727. $core.method({
  5728. selector: "rounded",
  5729. protocol: "converting",
  5730. fn: function (){
  5731. var self=this,$self=this;
  5732. return $core.withContext(function($ctx1) {
  5733. return Math.round(self);;
  5734. return self;
  5735. }, function($ctx1) {$ctx1.fill(self,"rounded",{},$globals.Number)});
  5736. },
  5737. args: [],
  5738. source: "rounded\x0a\x09<inlineJS: 'return Math.round(self);'>",
  5739. referencedClasses: [],
  5740. messageSends: []
  5741. }),
  5742. $globals.Number);
  5743. $core.addMethod(
  5744. $core.method({
  5745. selector: "sign",
  5746. protocol: "mathematical functions",
  5747. fn: function (){
  5748. var self=this,$self=this;
  5749. return $core.withContext(function($ctx1) {
  5750. var $1,$2;
  5751. $1=$self._isZero();
  5752. if($core.assert($1)){
  5753. return (0);
  5754. }
  5755. $2=$self._positive();
  5756. if($core.assert($2)){
  5757. return (1);
  5758. } else {
  5759. return (-1);
  5760. }
  5761. return self;
  5762. }, function($ctx1) {$ctx1.fill(self,"sign",{},$globals.Number)});
  5763. },
  5764. args: [],
  5765. source: "sign\x0a\x09self isZero \x0a\x09\x09ifTrue: [ ^ 0 ].\x0a\x09self positive\x0a\x09\x09ifTrue: [ ^ 1 ]\x0a\x09\x09ifFalse: [ ^ -1 ].",
  5766. referencedClasses: [],
  5767. messageSends: ["ifTrue:", "isZero", "ifTrue:ifFalse:", "positive"]
  5768. }),
  5769. $globals.Number);
  5770. $core.addMethod(
  5771. $core.method({
  5772. selector: "sin",
  5773. protocol: "mathematical functions",
  5774. fn: function (){
  5775. var self=this,$self=this;
  5776. return $core.withContext(function($ctx1) {
  5777. return Math.sin(self);;
  5778. return self;
  5779. }, function($ctx1) {$ctx1.fill(self,"sin",{},$globals.Number)});
  5780. },
  5781. args: [],
  5782. source: "sin\x0a\x09<inlineJS: 'return Math.sin(self);'>",
  5783. referencedClasses: [],
  5784. messageSends: []
  5785. }),
  5786. $globals.Number);
  5787. $core.addMethod(
  5788. $core.method({
  5789. selector: "sqrt",
  5790. protocol: "mathematical functions",
  5791. fn: function (){
  5792. var self=this,$self=this;
  5793. return $core.withContext(function($ctx1) {
  5794. return Math.sqrt(self);
  5795. return self;
  5796. }, function($ctx1) {$ctx1.fill(self,"sqrt",{},$globals.Number)});
  5797. },
  5798. args: [],
  5799. source: "sqrt\x0a\x09<inlineJS: 'return Math.sqrt(self)'>",
  5800. referencedClasses: [],
  5801. messageSends: []
  5802. }),
  5803. $globals.Number);
  5804. $core.addMethod(
  5805. $core.method({
  5806. selector: "squared",
  5807. protocol: "mathematical functions",
  5808. fn: function (){
  5809. var self=this,$self=this;
  5810. return $core.withContext(function($ctx1) {
  5811. return $self.__star(self);
  5812. }, function($ctx1) {$ctx1.fill(self,"squared",{},$globals.Number)});
  5813. },
  5814. args: [],
  5815. source: "squared\x0a\x09^ self * self",
  5816. referencedClasses: [],
  5817. messageSends: ["*"]
  5818. }),
  5819. $globals.Number);
  5820. $core.addMethod(
  5821. $core.method({
  5822. selector: "tan",
  5823. protocol: "mathematical functions",
  5824. fn: function (){
  5825. var self=this,$self=this;
  5826. return $core.withContext(function($ctx1) {
  5827. return Math.tan(self);;
  5828. return self;
  5829. }, function($ctx1) {$ctx1.fill(self,"tan",{},$globals.Number)});
  5830. },
  5831. args: [],
  5832. source: "tan\x0a\x09<inlineJS: 'return Math.tan(self);'>",
  5833. referencedClasses: [],
  5834. messageSends: []
  5835. }),
  5836. $globals.Number);
  5837. $core.addMethod(
  5838. $core.method({
  5839. selector: "timesRepeat:",
  5840. protocol: "enumerating",
  5841. fn: function (aBlock){
  5842. var self=this,$self=this;
  5843. var count;
  5844. return $core.withContext(function($ctx1) {
  5845. count=(1);
  5846. $recv((function(){
  5847. return $core.withContext(function($ctx2) {
  5848. return $recv(count).__gt(self);
  5849. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5850. }))._whileFalse_((function(){
  5851. return $core.withContext(function($ctx2) {
  5852. $recv(aBlock)._value();
  5853. count=$recv(count).__plus((1));
  5854. return count;
  5855. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  5856. }));
  5857. return self;
  5858. }, function($ctx1) {$ctx1.fill(self,"timesRepeat:",{aBlock:aBlock,count:count},$globals.Number)});
  5859. },
  5860. args: ["aBlock"],
  5861. source: "timesRepeat: aBlock\x0a\x09| count |\x0a\x09count := 1.\x0a\x09[ count > self ] whileFalse: [\x0a\x09\x09aBlock value.\x0a\x09\x09count := count + 1 ]",
  5862. referencedClasses: [],
  5863. messageSends: ["whileFalse:", ">", "value", "+"]
  5864. }),
  5865. $globals.Number);
  5866. $core.addMethod(
  5867. $core.method({
  5868. selector: "to:",
  5869. protocol: "converting",
  5870. fn: function (aNumber){
  5871. var self=this,$self=this;
  5872. var array,first,last,count;
  5873. return $core.withContext(function($ctx1) {
  5874. first=$self._truncated();
  5875. $ctx1.sendIdx["truncated"]=1;
  5876. last=$recv($recv(aNumber)._truncated()).__plus((1));
  5877. $ctx1.sendIdx["+"]=1;
  5878. count=(1);
  5879. array=$recv($globals.Array)._new();
  5880. $recv($recv(last).__minus(first))._timesRepeat_((function(){
  5881. return $core.withContext(function($ctx2) {
  5882. $recv(array)._at_put_(count,first);
  5883. count=$recv(count).__plus((1));
  5884. $ctx2.sendIdx["+"]=2;
  5885. first=$recv(first).__plus((1));
  5886. return first;
  5887. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  5888. }));
  5889. return array;
  5890. }, function($ctx1) {$ctx1.fill(self,"to:",{aNumber:aNumber,array:array,first:first,last:last,count:count},$globals.Number)});
  5891. },
  5892. args: ["aNumber"],
  5893. 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",
  5894. referencedClasses: ["Array"],
  5895. messageSends: ["truncated", "+", "new", "timesRepeat:", "-", "at:put:"]
  5896. }),
  5897. $globals.Number);
  5898. $core.addMethod(
  5899. $core.method({
  5900. selector: "to:by:",
  5901. protocol: "converting",
  5902. fn: function (stop,step){
  5903. var self=this,$self=this;
  5904. var array,value,pos;
  5905. return $core.withContext(function($ctx1) {
  5906. var $1,$2;
  5907. value=self;
  5908. array=$recv($globals.Array)._new();
  5909. pos=(1);
  5910. $1=$recv(step).__eq((0));
  5911. if($core.assert($1)){
  5912. $self._error_("step must be non-zero");
  5913. }
  5914. $2=$recv(step).__lt((0));
  5915. if($core.assert($2)){
  5916. $recv((function(){
  5917. return $core.withContext(function($ctx2) {
  5918. return $recv(value).__gt_eq(stop);
  5919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5920. }))._whileTrue_((function(){
  5921. return $core.withContext(function($ctx2) {
  5922. $recv(array)._at_put_(pos,value);
  5923. $ctx2.sendIdx["at:put:"]=1;
  5924. pos=$recv(pos).__plus((1));
  5925. $ctx2.sendIdx["+"]=1;
  5926. value=$recv(value).__plus(step);
  5927. $ctx2.sendIdx["+"]=2;
  5928. return value;
  5929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5930. }));
  5931. $ctx1.sendIdx["whileTrue:"]=1;
  5932. } else {
  5933. $recv((function(){
  5934. return $core.withContext(function($ctx2) {
  5935. return $recv(value).__lt_eq(stop);
  5936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5937. }))._whileTrue_((function(){
  5938. return $core.withContext(function($ctx2) {
  5939. $recv(array)._at_put_(pos,value);
  5940. pos=$recv(pos).__plus((1));
  5941. $ctx2.sendIdx["+"]=3;
  5942. value=$recv(value).__plus(step);
  5943. return value;
  5944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5945. }));
  5946. }
  5947. return array;
  5948. }, function($ctx1) {$ctx1.fill(self,"to:by:",{stop:stop,step:step,array:array,value:value,pos:pos},$globals.Number)});
  5949. },
  5950. args: ["stop", "step"],
  5951. 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",
  5952. referencedClasses: ["Array"],
  5953. messageSends: ["new", "ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "at:put:", "+", "<="]
  5954. }),
  5955. $globals.Number);
  5956. $core.addMethod(
  5957. $core.method({
  5958. selector: "to:by:do:",
  5959. protocol: "enumerating",
  5960. fn: function (stop,step,aBlock){
  5961. var self=this,$self=this;
  5962. var value;
  5963. return $core.withContext(function($ctx1) {
  5964. var $1,$2;
  5965. value=self;
  5966. $1=$recv(step).__eq((0));
  5967. if($core.assert($1)){
  5968. $self._error_("step must be non-zero");
  5969. }
  5970. $2=$recv(step).__lt((0));
  5971. if($core.assert($2)){
  5972. $recv((function(){
  5973. return $core.withContext(function($ctx2) {
  5974. return $recv(value).__gt_eq(stop);
  5975. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  5976. }))._whileTrue_((function(){
  5977. return $core.withContext(function($ctx2) {
  5978. $recv(aBlock)._value_(value);
  5979. $ctx2.sendIdx["value:"]=1;
  5980. value=$recv(value).__plus(step);
  5981. $ctx2.sendIdx["+"]=1;
  5982. return value;
  5983. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  5984. }));
  5985. $ctx1.sendIdx["whileTrue:"]=1;
  5986. } else {
  5987. $recv((function(){
  5988. return $core.withContext(function($ctx2) {
  5989. return $recv(value).__lt_eq(stop);
  5990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  5991. }))._whileTrue_((function(){
  5992. return $core.withContext(function($ctx2) {
  5993. $recv(aBlock)._value_(value);
  5994. value=$recv(value).__plus(step);
  5995. return value;
  5996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  5997. }));
  5998. }
  5999. return self;
  6000. }, function($ctx1) {$ctx1.fill(self,"to:by:do:",{stop:stop,step:step,aBlock:aBlock,value:value},$globals.Number)});
  6001. },
  6002. args: ["stop", "step", "aBlock"],
  6003. 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 ]]",
  6004. referencedClasses: [],
  6005. messageSends: ["ifTrue:", "=", "error:", "ifTrue:ifFalse:", "<", "whileTrue:", ">=", "value:", "+", "<="]
  6006. }),
  6007. $globals.Number);
  6008. $core.addMethod(
  6009. $core.method({
  6010. selector: "to:do:",
  6011. protocol: "enumerating",
  6012. fn: function (stop,aBlock){
  6013. var self=this,$self=this;
  6014. var nextValue;
  6015. return $core.withContext(function($ctx1) {
  6016. nextValue=self;
  6017. $recv((function(){
  6018. return $core.withContext(function($ctx2) {
  6019. return $recv(nextValue).__lt_eq(stop);
  6020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6021. }))._whileTrue_((function(){
  6022. return $core.withContext(function($ctx2) {
  6023. $recv(aBlock)._value_(nextValue);
  6024. nextValue=$recv(nextValue).__plus((1));
  6025. return nextValue;
  6026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  6027. }));
  6028. return self;
  6029. }, function($ctx1) {$ctx1.fill(self,"to:do:",{stop:stop,aBlock:aBlock,nextValue:nextValue},$globals.Number)});
  6030. },
  6031. args: ["stop", "aBlock"],
  6032. 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 ]",
  6033. referencedClasses: [],
  6034. messageSends: ["whileTrue:", "<=", "value:", "+"]
  6035. }),
  6036. $globals.Number);
  6037. $core.addMethod(
  6038. $core.method({
  6039. selector: "truncated",
  6040. protocol: "converting",
  6041. fn: function (){
  6042. var self=this,$self=this;
  6043. return $core.withContext(function($ctx1) {
  6044. if(self >= 0) {
  6045. return Math.floor(self);
  6046. } else {
  6047. return Math.floor(self * (-1)) * (-1);
  6048. };
  6049. ;
  6050. return self;
  6051. }, function($ctx1) {$ctx1.fill(self,"truncated",{},$globals.Number)});
  6052. },
  6053. args: [],
  6054. 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'>",
  6055. referencedClasses: [],
  6056. messageSends: []
  6057. }),
  6058. $globals.Number);
  6059. $core.addMethod(
  6060. $core.method({
  6061. selector: "|",
  6062. protocol: "converting",
  6063. fn: function (aNumber){
  6064. var self=this,$self=this;
  6065. return $core.withContext(function($ctx1) {
  6066. return self | aNumber;
  6067. return self;
  6068. }, function($ctx1) {$ctx1.fill(self,"|",{aNumber:aNumber},$globals.Number)});
  6069. },
  6070. args: ["aNumber"],
  6071. source: "| aNumber\x0a\x09<inlineJS: 'return self | aNumber'>",
  6072. referencedClasses: [],
  6073. messageSends: []
  6074. }),
  6075. $globals.Number);
  6076. $core.addMethod(
  6077. $core.method({
  6078. selector: "classTag",
  6079. protocol: "accessing",
  6080. fn: function (){
  6081. var self=this,$self=this;
  6082. return "magnitude";
  6083. },
  6084. args: [],
  6085. 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'",
  6086. referencedClasses: [],
  6087. messageSends: []
  6088. }),
  6089. $globals.Number.a$cls);
  6090. $core.addMethod(
  6091. $core.method({
  6092. selector: "e",
  6093. protocol: "instance creation",
  6094. fn: function (){
  6095. var self=this,$self=this;
  6096. return $core.withContext(function($ctx1) {
  6097. return Math.E;;
  6098. return self;
  6099. }, function($ctx1) {$ctx1.fill(self,"e",{},$globals.Number.a$cls)});
  6100. },
  6101. args: [],
  6102. source: "e\x0a\x09<inlineJS: 'return Math.E;'>",
  6103. referencedClasses: [],
  6104. messageSends: []
  6105. }),
  6106. $globals.Number.a$cls);
  6107. $core.addMethod(
  6108. $core.method({
  6109. selector: "pi",
  6110. protocol: "instance creation",
  6111. fn: function (){
  6112. var self=this,$self=this;
  6113. return $core.withContext(function($ctx1) {
  6114. return Math.PI;
  6115. return self;
  6116. }, function($ctx1) {$ctx1.fill(self,"pi",{},$globals.Number.a$cls)});
  6117. },
  6118. args: [],
  6119. source: "pi\x0a\x09<inlineJS: 'return Math.PI'>",
  6120. referencedClasses: [],
  6121. messageSends: []
  6122. }),
  6123. $globals.Number.a$cls);
  6124. $core.addMethod(
  6125. $core.method({
  6126. selector: "radiansPerDegree",
  6127. protocol: "instance creation",
  6128. fn: function (){
  6129. var self=this,$self=this;
  6130. return $core.withContext(function($ctx1) {
  6131. return $recv($self._pi()).__slash((180));
  6132. }, function($ctx1) {$ctx1.fill(self,"radiansPerDegree",{},$globals.Number.a$cls)});
  6133. },
  6134. args: [],
  6135. source: "radiansPerDegree\x0a\x09^ (self pi) / 180",
  6136. referencedClasses: [],
  6137. messageSends: ["/", "pi"]
  6138. }),
  6139. $globals.Number.a$cls);
  6140. $core.addClass("Point", $globals.Object, ["x", "y"], "Kernel-Objects");
  6141. $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";
  6142. $core.addMethod(
  6143. $core.method({
  6144. selector: "*",
  6145. protocol: "arithmetic",
  6146. fn: function (aPoint){
  6147. var self=this,$self=this;
  6148. return $core.withContext(function($ctx1) {
  6149. var $2,$4,$3,$1,$6,$5;
  6150. $2=$self._x();
  6151. $ctx1.sendIdx["x"]=1;
  6152. $4=$recv(aPoint)._asPoint();
  6153. $ctx1.sendIdx["asPoint"]=1;
  6154. $3=$recv($4)._x();
  6155. $1=$recv($2).__star($3);
  6156. $ctx1.sendIdx["*"]=1;
  6157. $6=$self._y();
  6158. $ctx1.sendIdx["y"]=1;
  6159. $5=$recv($6).__star($recv($recv(aPoint)._asPoint())._y());
  6160. return $recv($globals.Point)._x_y_($1,$5);
  6161. }, function($ctx1) {$ctx1.fill(self,"*",{aPoint:aPoint},$globals.Point)});
  6162. },
  6163. args: ["aPoint"],
  6164. source: "* aPoint\x0a\x09^ Point x: self x * aPoint asPoint x y: self y * aPoint asPoint y",
  6165. referencedClasses: ["Point"],
  6166. messageSends: ["x:y:", "*", "x", "asPoint", "y"]
  6167. }),
  6168. $globals.Point);
  6169. $core.addMethod(
  6170. $core.method({
  6171. selector: "+",
  6172. protocol: "arithmetic",
  6173. fn: function (aPoint){
  6174. var self=this,$self=this;
  6175. return $core.withContext(function($ctx1) {
  6176. var $2,$4,$3,$1,$6,$5;
  6177. $2=$self._x();
  6178. $ctx1.sendIdx["x"]=1;
  6179. $4=$recv(aPoint)._asPoint();
  6180. $ctx1.sendIdx["asPoint"]=1;
  6181. $3=$recv($4)._x();
  6182. $1=$recv($2).__plus($3);
  6183. $ctx1.sendIdx["+"]=1;
  6184. $6=$self._y();
  6185. $ctx1.sendIdx["y"]=1;
  6186. $5=$recv($6).__plus($recv($recv(aPoint)._asPoint())._y());
  6187. return $recv($globals.Point)._x_y_($1,$5);
  6188. }, function($ctx1) {$ctx1.fill(self,"+",{aPoint:aPoint},$globals.Point)});
  6189. },
  6190. args: ["aPoint"],
  6191. source: "+ aPoint\x0a\x09^ Point x: self x + aPoint asPoint x y: self y + aPoint asPoint y",
  6192. referencedClasses: ["Point"],
  6193. messageSends: ["x:y:", "+", "x", "asPoint", "y"]
  6194. }),
  6195. $globals.Point);
  6196. $core.addMethod(
  6197. $core.method({
  6198. selector: "-",
  6199. protocol: "arithmetic",
  6200. fn: function (aPoint){
  6201. var self=this,$self=this;
  6202. return $core.withContext(function($ctx1) {
  6203. var $2,$4,$3,$1,$6,$5;
  6204. $2=$self._x();
  6205. $ctx1.sendIdx["x"]=1;
  6206. $4=$recv(aPoint)._asPoint();
  6207. $ctx1.sendIdx["asPoint"]=1;
  6208. $3=$recv($4)._x();
  6209. $1=$recv($2).__minus($3);
  6210. $ctx1.sendIdx["-"]=1;
  6211. $6=$self._y();
  6212. $ctx1.sendIdx["y"]=1;
  6213. $5=$recv($6).__minus($recv($recv(aPoint)._asPoint())._y());
  6214. return $recv($globals.Point)._x_y_($1,$5);
  6215. }, function($ctx1) {$ctx1.fill(self,"-",{aPoint:aPoint},$globals.Point)});
  6216. },
  6217. args: ["aPoint"],
  6218. source: "- aPoint\x0a\x09^ Point x: self x - aPoint asPoint x y: self y - aPoint asPoint y",
  6219. referencedClasses: ["Point"],
  6220. messageSends: ["x:y:", "-", "x", "asPoint", "y"]
  6221. }),
  6222. $globals.Point);
  6223. $core.addMethod(
  6224. $core.method({
  6225. selector: "/",
  6226. protocol: "arithmetic",
  6227. fn: function (aPoint){
  6228. var self=this,$self=this;
  6229. return $core.withContext(function($ctx1) {
  6230. var $2,$4,$3,$1,$6,$5;
  6231. $2=$self._x();
  6232. $ctx1.sendIdx["x"]=1;
  6233. $4=$recv(aPoint)._asPoint();
  6234. $ctx1.sendIdx["asPoint"]=1;
  6235. $3=$recv($4)._x();
  6236. $1=$recv($2).__slash($3);
  6237. $ctx1.sendIdx["/"]=1;
  6238. $6=$self._y();
  6239. $ctx1.sendIdx["y"]=1;
  6240. $5=$recv($6).__slash($recv($recv(aPoint)._asPoint())._y());
  6241. return $recv($globals.Point)._x_y_($1,$5);
  6242. }, function($ctx1) {$ctx1.fill(self,"/",{aPoint:aPoint},$globals.Point)});
  6243. },
  6244. args: ["aPoint"],
  6245. source: "/ aPoint\x0a\x09^ Point x: self x / aPoint asPoint x y: self y / aPoint asPoint y",
  6246. referencedClasses: ["Point"],
  6247. messageSends: ["x:y:", "/", "x", "asPoint", "y"]
  6248. }),
  6249. $globals.Point);
  6250. $core.addMethod(
  6251. $core.method({
  6252. selector: "<",
  6253. protocol: "comparing",
  6254. fn: function (aPoint){
  6255. var self=this,$self=this;
  6256. return $core.withContext(function($ctx1) {
  6257. var $2,$1,$3;
  6258. $2=$self._x();
  6259. $ctx1.sendIdx["x"]=1;
  6260. $1=$recv($2).__lt($recv(aPoint)._x());
  6261. $ctx1.sendIdx["<"]=1;
  6262. return $recv($1)._and_((function(){
  6263. return $core.withContext(function($ctx2) {
  6264. $3=$self._y();
  6265. $ctx2.sendIdx["y"]=1;
  6266. return $recv($3).__lt($recv(aPoint)._y());
  6267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6268. }));
  6269. }, function($ctx1) {$ctx1.fill(self,"<",{aPoint:aPoint},$globals.Point)});
  6270. },
  6271. args: ["aPoint"],
  6272. source: "< aPoint\x0a\x09^ self x < aPoint x and: [\x0a\x09\x09self y < aPoint y ]",
  6273. referencedClasses: [],
  6274. messageSends: ["and:", "<", "x", "y"]
  6275. }),
  6276. $globals.Point);
  6277. $core.addMethod(
  6278. $core.method({
  6279. selector: "<=",
  6280. protocol: "comparing",
  6281. fn: function (aPoint){
  6282. var self=this,$self=this;
  6283. return $core.withContext(function($ctx1) {
  6284. var $2,$1,$3;
  6285. $2=$self._x();
  6286. $ctx1.sendIdx["x"]=1;
  6287. $1=$recv($2).__lt_eq($recv(aPoint)._x());
  6288. $ctx1.sendIdx["<="]=1;
  6289. return $recv($1)._and_((function(){
  6290. return $core.withContext(function($ctx2) {
  6291. $3=$self._y();
  6292. $ctx2.sendIdx["y"]=1;
  6293. return $recv($3).__lt_eq($recv(aPoint)._y());
  6294. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6295. }));
  6296. }, function($ctx1) {$ctx1.fill(self,"<=",{aPoint:aPoint},$globals.Point)});
  6297. },
  6298. args: ["aPoint"],
  6299. source: "<= aPoint\x0a\x09^ self x <= aPoint x and: [\x0a\x09\x09self y <= aPoint y ]",
  6300. referencedClasses: [],
  6301. messageSends: ["and:", "<=", "x", "y"]
  6302. }),
  6303. $globals.Point);
  6304. $core.addMethod(
  6305. $core.method({
  6306. selector: "=",
  6307. protocol: "comparing",
  6308. fn: function (aPoint){
  6309. var self=this,$self=this;
  6310. return $core.withContext(function($ctx1) {
  6311. var $2,$1,$4,$3,$6,$5;
  6312. $2=$recv(aPoint)._class();
  6313. $ctx1.sendIdx["class"]=1;
  6314. $1=$recv($2).__eq($self._class());
  6315. $ctx1.sendIdx["="]=1;
  6316. return $recv($1)._and_((function(){
  6317. return $core.withContext(function($ctx2) {
  6318. $4=$recv(aPoint)._x();
  6319. $ctx2.sendIdx["x"]=1;
  6320. $3=$recv($4).__eq($self._x());
  6321. $ctx2.sendIdx["="]=2;
  6322. $6=$recv(aPoint)._y();
  6323. $ctx2.sendIdx["y"]=1;
  6324. $5=$recv($6).__eq($self._y());
  6325. return $recv($3).__and($5);
  6326. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6327. }));
  6328. }, function($ctx1) {$ctx1.fill(self,"=",{aPoint:aPoint},$globals.Point)});
  6329. },
  6330. args: ["aPoint"],
  6331. source: "= aPoint\x0a\x09^ aPoint class = self class and: [\x0a\x09\x09(aPoint x = self x) & (aPoint y = self y) ]",
  6332. referencedClasses: [],
  6333. messageSends: ["and:", "=", "class", "&", "x", "y"]
  6334. }),
  6335. $globals.Point);
  6336. $core.addMethod(
  6337. $core.method({
  6338. selector: ">",
  6339. protocol: "comparing",
  6340. fn: function (aPoint){
  6341. var self=this,$self=this;
  6342. return $core.withContext(function($ctx1) {
  6343. var $2,$1,$3;
  6344. $2=$self._x();
  6345. $ctx1.sendIdx["x"]=1;
  6346. $1=$recv($2).__gt($recv(aPoint)._x());
  6347. $ctx1.sendIdx[">"]=1;
  6348. return $recv($1)._and_((function(){
  6349. return $core.withContext(function($ctx2) {
  6350. $3=$self._y();
  6351. $ctx2.sendIdx["y"]=1;
  6352. return $recv($3).__gt($recv(aPoint)._y());
  6353. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6354. }));
  6355. }, function($ctx1) {$ctx1.fill(self,">",{aPoint:aPoint},$globals.Point)});
  6356. },
  6357. args: ["aPoint"],
  6358. source: "> aPoint\x0a\x09^ self x > aPoint x and: [\x0a\x09\x09self y > aPoint y ]",
  6359. referencedClasses: [],
  6360. messageSends: ["and:", ">", "x", "y"]
  6361. }),
  6362. $globals.Point);
  6363. $core.addMethod(
  6364. $core.method({
  6365. selector: ">=",
  6366. protocol: "comparing",
  6367. fn: function (aPoint){
  6368. var self=this,$self=this;
  6369. return $core.withContext(function($ctx1) {
  6370. var $2,$1,$3;
  6371. $2=$self._x();
  6372. $ctx1.sendIdx["x"]=1;
  6373. $1=$recv($2).__gt_eq($recv(aPoint)._x());
  6374. $ctx1.sendIdx[">="]=1;
  6375. return $recv($1)._and_((function(){
  6376. return $core.withContext(function($ctx2) {
  6377. $3=$self._y();
  6378. $ctx2.sendIdx["y"]=1;
  6379. return $recv($3).__gt_eq($recv(aPoint)._y());
  6380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6381. }));
  6382. }, function($ctx1) {$ctx1.fill(self,">=",{aPoint:aPoint},$globals.Point)});
  6383. },
  6384. args: ["aPoint"],
  6385. source: ">= aPoint\x0a\x09^ self x >= aPoint x and: [\x0a\x09\x09self y >= aPoint y ]",
  6386. referencedClasses: [],
  6387. messageSends: ["and:", ">=", "x", "y"]
  6388. }),
  6389. $globals.Point);
  6390. $core.addMethod(
  6391. $core.method({
  6392. selector: "angle",
  6393. protocol: "geometry",
  6394. fn: function (){
  6395. var self=this,$self=this;
  6396. return $core.withContext(function($ctx1) {
  6397. return $recv($self._y())._arcTan_($self._x());
  6398. }, function($ctx1) {$ctx1.fill(self,"angle",{},$globals.Point)});
  6399. },
  6400. args: [],
  6401. source: "angle\x0a\x09^ self y arcTan: self x",
  6402. referencedClasses: [],
  6403. messageSends: ["arcTan:", "y", "x"]
  6404. }),
  6405. $globals.Point);
  6406. $core.addMethod(
  6407. $core.method({
  6408. selector: "asPoint",
  6409. protocol: "converting",
  6410. fn: function (){
  6411. var self=this,$self=this;
  6412. return self;
  6413. },
  6414. args: [],
  6415. source: "asPoint\x0a\x09^ self",
  6416. referencedClasses: [],
  6417. messageSends: []
  6418. }),
  6419. $globals.Point);
  6420. $core.addMethod(
  6421. $core.method({
  6422. selector: "corner:",
  6423. protocol: "rectangle creation",
  6424. fn: function (aPoint){
  6425. var self=this,$self=this;
  6426. return $core.withContext(function($ctx1) {
  6427. return $recv($globals.Rectangle)._origin_corner_(self,aPoint);
  6428. }, function($ctx1) {$ctx1.fill(self,"corner:",{aPoint:aPoint},$globals.Point)});
  6429. },
  6430. args: ["aPoint"],
  6431. source: "corner: aPoint\x0a\x09^ Rectangle origin: self corner: aPoint",
  6432. referencedClasses: ["Rectangle"],
  6433. messageSends: ["origin:corner:"]
  6434. }),
  6435. $globals.Point);
  6436. $core.addMethod(
  6437. $core.method({
  6438. selector: "dist:",
  6439. protocol: "transforming",
  6440. fn: function (aPoint){
  6441. var self=this,$self=this;
  6442. var dx,dy;
  6443. return $core.withContext(function($ctx1) {
  6444. var $2,$1;
  6445. dx=$recv($recv(aPoint)._x()).__minus($self["@x"]);
  6446. $ctx1.sendIdx["-"]=1;
  6447. dy=$recv($recv(aPoint)._y()).__minus($self["@y"]);
  6448. $2=$recv(dx).__star(dx);
  6449. $ctx1.sendIdx["*"]=1;
  6450. $1=$recv($2).__plus($recv(dy).__star(dy));
  6451. return $recv($1)._sqrt();
  6452. }, function($ctx1) {$ctx1.fill(self,"dist:",{aPoint:aPoint,dx:dx,dy:dy},$globals.Point)});
  6453. },
  6454. args: ["aPoint"],
  6455. 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",
  6456. referencedClasses: [],
  6457. messageSends: ["-", "x", "y", "sqrt", "+", "*"]
  6458. }),
  6459. $globals.Point);
  6460. $core.addMethod(
  6461. $core.method({
  6462. selector: "dotProduct:",
  6463. protocol: "point functions",
  6464. fn: function (aPoint){
  6465. var self=this,$self=this;
  6466. return $core.withContext(function($ctx1) {
  6467. var $1;
  6468. $1=$recv($self["@x"]).__star($recv(aPoint)._x());
  6469. $ctx1.sendIdx["*"]=1;
  6470. return $recv($1).__plus($recv($self["@y"]).__star($recv(aPoint)._y()));
  6471. }, function($ctx1) {$ctx1.fill(self,"dotProduct:",{aPoint:aPoint},$globals.Point)});
  6472. },
  6473. args: ["aPoint"],
  6474. source: "dotProduct: aPoint\x0a\x09^ (x * aPoint x) + (y * aPoint y)",
  6475. referencedClasses: [],
  6476. messageSends: ["+", "*", "x", "y"]
  6477. }),
  6478. $globals.Point);
  6479. $core.addMethod(
  6480. $core.method({
  6481. selector: "extent:",
  6482. protocol: "rectangle creation",
  6483. fn: function (aPoint){
  6484. var self=this,$self=this;
  6485. return $core.withContext(function($ctx1) {
  6486. return $recv($globals.Rectangle)._origin_extent_(self,aPoint);
  6487. }, function($ctx1) {$ctx1.fill(self,"extent:",{aPoint:aPoint},$globals.Point)});
  6488. },
  6489. args: ["aPoint"],
  6490. source: "extent: aPoint\x0a\x09^ Rectangle origin: self extent: aPoint",
  6491. referencedClasses: ["Rectangle"],
  6492. messageSends: ["origin:extent:"]
  6493. }),
  6494. $globals.Point);
  6495. $core.addMethod(
  6496. $core.method({
  6497. selector: "normal",
  6498. protocol: "point functions",
  6499. fn: function (){
  6500. var self=this,$self=this;
  6501. var n,d;
  6502. return $core.withContext(function($ctx1) {
  6503. var $4,$3,$6,$5,$2,$1;
  6504. n=$recv($recv($self["@y"])._negated()).__at($self["@x"]);
  6505. $ctx1.sendIdx["@"]=1;
  6506. $4=$recv(n)._x();
  6507. $ctx1.sendIdx["x"]=1;
  6508. $3=$recv($4).__star($recv(n)._x());
  6509. $ctx1.sendIdx["*"]=1;
  6510. $6=$recv(n)._y();
  6511. $ctx1.sendIdx["y"]=1;
  6512. $5=$recv($6).__star($recv(n)._y());
  6513. d=$recv($3).__plus($5);
  6514. $2=d;
  6515. $1=$recv($2).__eq((0));
  6516. if($core.assert($1)){
  6517. return (-1).__at((0));
  6518. }
  6519. return $recv(n).__slash($recv(d)._sqrt());
  6520. }, function($ctx1) {$ctx1.fill(self,"normal",{n:n,d:d},$globals.Point)});
  6521. },
  6522. args: [],
  6523. source: "normal\x0a\x09\x22Answer a Point representing the unit vector rotated 90 deg clockwise. For the zero point return -1@0.\x22\x0a\x0a\x09| n d |\x0a\x09n := y negated @ x.\x0a\x09(d := (n x * n x + (n y * n y))) = 0\x0a\x09\x09 ifTrue: [ ^ -1 @0 ].\x0a\x09^ n / d sqrt",
  6524. referencedClasses: [],
  6525. messageSends: ["@", "negated", "ifTrue:", "=", "+", "*", "x", "y", "/", "sqrt"]
  6526. }),
  6527. $globals.Point);
  6528. $core.addMethod(
  6529. $core.method({
  6530. selector: "normalized",
  6531. protocol: "point functions",
  6532. fn: function (){
  6533. var self=this,$self=this;
  6534. var r;
  6535. return $core.withContext(function($ctx1) {
  6536. var $1,$2,$3;
  6537. r=$self._r();
  6538. $1=$recv(r).__eq((0));
  6539. if($core.assert($1)){
  6540. $2=$recv($globals.Point)._x_y_((0),(0));
  6541. $ctx1.sendIdx["x:y:"]=1;
  6542. return $2;
  6543. } else {
  6544. $3=$recv($self["@x"]).__slash(r);
  6545. $ctx1.sendIdx["/"]=1;
  6546. return $recv($globals.Point)._x_y_($3,$recv($self["@y"]).__slash(r));
  6547. }
  6548. return self;
  6549. }, function($ctx1) {$ctx1.fill(self,"normalized",{r:r},$globals.Point)});
  6550. },
  6551. args: [],
  6552. source: "normalized\x0a\x09| r |\x0a\x09r := self r.\x0a\x09\x0a\x09r = 0\x0a\x09\x09ifTrue: [ ^ Point x: 0 y: 0 ]\x0a\x09\x09ifFalse: [ ^ Point x: x / r y: y / r ]",
  6553. referencedClasses: ["Point"],
  6554. messageSends: ["r", "ifTrue:ifFalse:", "=", "x:y:", "/"]
  6555. }),
  6556. $globals.Point);
  6557. $core.addMethod(
  6558. $core.method({
  6559. selector: "printOn:",
  6560. protocol: "printing",
  6561. fn: function (aStream){
  6562. var self=this,$self=this;
  6563. return $core.withContext(function($ctx1) {
  6564. var $1;
  6565. $recv($self["@x"])._printOn_(aStream);
  6566. $ctx1.sendIdx["printOn:"]=1;
  6567. $recv(aStream)._nextPutAll_("@");
  6568. $1=$recv($recv($self["@y"])._notNil())._and_((function(){
  6569. return $core.withContext(function($ctx2) {
  6570. return $recv($self["@y"])._negative();
  6571. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6572. }));
  6573. if($core.assert($1)){
  6574. $recv(aStream)._space();
  6575. }
  6576. $recv($self["@y"])._printOn_(aStream);
  6577. return self;
  6578. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Point)});
  6579. },
  6580. args: ["aStream"],
  6581. 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",
  6582. referencedClasses: [],
  6583. messageSends: ["printOn:", "nextPutAll:", "ifTrue:", "and:", "notNil", "negative", "space"]
  6584. }),
  6585. $globals.Point);
  6586. $core.addMethod(
  6587. $core.method({
  6588. selector: "r",
  6589. protocol: "polar coordinates",
  6590. fn: function (){
  6591. var self=this,$self=this;
  6592. return $core.withContext(function($ctx1) {
  6593. var $2,$1;
  6594. $2=$recv($self["@x"]).__star($self["@x"]);
  6595. $ctx1.sendIdx["*"]=1;
  6596. $1=$recv($2).__plus($recv($self["@y"]).__star($self["@y"]));
  6597. return $recv($1)._sqrt();
  6598. }, function($ctx1) {$ctx1.fill(self,"r",{},$globals.Point)});
  6599. },
  6600. args: [],
  6601. source: "r\x0a\x09^ ((x * x) + (y * y)) sqrt",
  6602. referencedClasses: [],
  6603. messageSends: ["sqrt", "+", "*"]
  6604. }),
  6605. $globals.Point);
  6606. $core.addMethod(
  6607. $core.method({
  6608. selector: "rectangle:",
  6609. protocol: "rectangle creation",
  6610. fn: function (aPoint){
  6611. var self=this,$self=this;
  6612. return $core.withContext(function($ctx1) {
  6613. return $recv($globals.Rectangle)._point_point_(self,aPoint);
  6614. }, function($ctx1) {$ctx1.fill(self,"rectangle:",{aPoint:aPoint},$globals.Point)});
  6615. },
  6616. args: ["aPoint"],
  6617. source: "rectangle: aPoint\x0a\x09^ Rectangle point: self point: aPoint",
  6618. referencedClasses: ["Rectangle"],
  6619. messageSends: ["point:point:"]
  6620. }),
  6621. $globals.Point);
  6622. $core.addMethod(
  6623. $core.method({
  6624. selector: "translateBy:",
  6625. protocol: "transforming",
  6626. fn: function (delta){
  6627. var self=this,$self=this;
  6628. return $core.withContext(function($ctx1) {
  6629. var $1;
  6630. $1=$recv($recv(delta)._x()).__plus($self["@x"]);
  6631. $ctx1.sendIdx["+"]=1;
  6632. return $recv($1).__at($recv($recv(delta)._y()).__plus($self["@y"]));
  6633. }, function($ctx1) {$ctx1.fill(self,"translateBy:",{delta:delta},$globals.Point)});
  6634. },
  6635. args: ["delta"],
  6636. source: "translateBy: delta\x0a\x09\x22Answer a Point translated by delta (an instance of Point).\x22\x0a\x09^ (delta x + x) @ (delta y + y)",
  6637. referencedClasses: [],
  6638. messageSends: ["@", "+", "x", "y"]
  6639. }),
  6640. $globals.Point);
  6641. $core.addMethod(
  6642. $core.method({
  6643. selector: "x",
  6644. protocol: "accessing",
  6645. fn: function (){
  6646. var self=this,$self=this;
  6647. return $self["@x"];
  6648. },
  6649. args: [],
  6650. source: "x\x0a\x09^ x",
  6651. referencedClasses: [],
  6652. messageSends: []
  6653. }),
  6654. $globals.Point);
  6655. $core.addMethod(
  6656. $core.method({
  6657. selector: "x:",
  6658. protocol: "accessing",
  6659. fn: function (aNumber){
  6660. var self=this,$self=this;
  6661. $self["@x"]=aNumber;
  6662. return self;
  6663. },
  6664. args: ["aNumber"],
  6665. source: "x: aNumber\x0a\x09x := aNumber",
  6666. referencedClasses: [],
  6667. messageSends: []
  6668. }),
  6669. $globals.Point);
  6670. $core.addMethod(
  6671. $core.method({
  6672. selector: "y",
  6673. protocol: "accessing",
  6674. fn: function (){
  6675. var self=this,$self=this;
  6676. return $self["@y"];
  6677. },
  6678. args: [],
  6679. source: "y\x0a\x09^ y",
  6680. referencedClasses: [],
  6681. messageSends: []
  6682. }),
  6683. $globals.Point);
  6684. $core.addMethod(
  6685. $core.method({
  6686. selector: "y:",
  6687. protocol: "accessing",
  6688. fn: function (aNumber){
  6689. var self=this,$self=this;
  6690. $self["@y"]=aNumber;
  6691. return self;
  6692. },
  6693. args: ["aNumber"],
  6694. source: "y: aNumber\x0a\x09y := aNumber",
  6695. referencedClasses: [],
  6696. messageSends: []
  6697. }),
  6698. $globals.Point);
  6699. $core.addMethod(
  6700. $core.method({
  6701. selector: "classTag",
  6702. protocol: "accessing",
  6703. fn: function (){
  6704. var self=this,$self=this;
  6705. return "magnitude";
  6706. },
  6707. args: [],
  6708. 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'",
  6709. referencedClasses: [],
  6710. messageSends: []
  6711. }),
  6712. $globals.Point.a$cls);
  6713. $core.addMethod(
  6714. $core.method({
  6715. selector: "x:y:",
  6716. protocol: "instance creation",
  6717. fn: function (aNumber,anotherNumber){
  6718. var self=this,$self=this;
  6719. return $core.withContext(function($ctx1) {
  6720. var $1;
  6721. $1=$self._new();
  6722. $recv($1)._x_(aNumber);
  6723. $recv($1)._y_(anotherNumber);
  6724. return $recv($1)._yourself();
  6725. }, function($ctx1) {$ctx1.fill(self,"x:y:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Point.a$cls)});
  6726. },
  6727. args: ["aNumber", "anotherNumber"],
  6728. source: "x: aNumber y: anotherNumber\x0a\x09^ self new\x0a\x09\x09x: aNumber;\x0a\x09\x09y: anotherNumber;\x0a\x09\x09yourself",
  6729. referencedClasses: [],
  6730. messageSends: ["x:", "new", "y:", "yourself"]
  6731. }),
  6732. $globals.Point.a$cls);
  6733. $core.addClass("Random", $globals.Object, [], "Kernel-Objects");
  6734. $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'`.";
  6735. $core.addMethod(
  6736. $core.method({
  6737. selector: "next",
  6738. protocol: "accessing",
  6739. fn: function (){
  6740. var self=this,$self=this;
  6741. return $core.withContext(function($ctx1) {
  6742. return Math.random();
  6743. return self;
  6744. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Random)});
  6745. },
  6746. args: [],
  6747. source: "next\x0a\x09<inlineJS: 'return Math.random()'>",
  6748. referencedClasses: [],
  6749. messageSends: []
  6750. }),
  6751. $globals.Random);
  6752. $core.addMethod(
  6753. $core.method({
  6754. selector: "next:",
  6755. protocol: "accessing",
  6756. fn: function (anInteger){
  6757. var self=this,$self=this;
  6758. return $core.withContext(function($ctx1) {
  6759. return $recv((1)._to_(anInteger))._collect_((function(each){
  6760. return $core.withContext(function($ctx2) {
  6761. return $self._next();
  6762. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  6763. }));
  6764. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger},$globals.Random)});
  6765. },
  6766. args: ["anInteger"],
  6767. source: "next: anInteger\x0a\x09^ (1 to: anInteger) collect: [ :each | self next ]",
  6768. referencedClasses: [],
  6769. messageSends: ["collect:", "to:", "next"]
  6770. }),
  6771. $globals.Random);
  6772. $core.addClass("Rectangle", $globals.Object, ["origin", "corner"], "Kernel-Objects");
  6773. $globals.Rectangle.comment="I represent a Rectangle defined by my two corners.\x0a\x0aThe simplest way to create an instance is using Point methods:\x0a\x0a 1@1 corner: 2@2\x0a\x0aWIll create a rectangle with 1@1 as the top left and 2@2 at the bottom right.\x0a\x0a 1@1 extent: 1@1\x0a\x0aWill create the same rectangle, defining an origin and a size instead of an origin and a corner.";
  6774. $core.addMethod(
  6775. $core.method({
  6776. selector: "=",
  6777. protocol: "testing",
  6778. fn: function (aRectangle){
  6779. var self=this,$self=this;
  6780. return $core.withContext(function($ctx1) {
  6781. var $1;
  6782. $1=$recv($self["@origin"]).__eq($recv(aRectangle)._origin());
  6783. $ctx1.sendIdx["="]=1;
  6784. return $recv($1)._and_((function(){
  6785. return $core.withContext(function($ctx2) {
  6786. return $recv($self["@corner"]).__eq($recv(aRectangle)._corner());
  6787. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6788. }));
  6789. }, function($ctx1) {$ctx1.fill(self,"=",{aRectangle:aRectangle},$globals.Rectangle)});
  6790. },
  6791. args: ["aRectangle"],
  6792. source: "= aRectangle\x0a\x09^ origin = aRectangle origin and: [ corner = aRectangle corner ]",
  6793. referencedClasses: [],
  6794. messageSends: ["and:", "=", "origin", "corner"]
  6795. }),
  6796. $globals.Rectangle);
  6797. $core.addMethod(
  6798. $core.method({
  6799. selector: "containsPoint:",
  6800. protocol: "testing",
  6801. fn: function (aPoint){
  6802. var self=this,$self=this;
  6803. return $core.withContext(function($ctx1) {
  6804. return $recv($recv($self["@origin"]).__lt_eq(aPoint))._and_((function(){
  6805. return $core.withContext(function($ctx2) {
  6806. return $recv($self["@corner"]).__gt_eq(aPoint);
  6807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6808. }));
  6809. }, function($ctx1) {$ctx1.fill(self,"containsPoint:",{aPoint:aPoint},$globals.Rectangle)});
  6810. },
  6811. args: ["aPoint"],
  6812. source: "containsPoint: aPoint\x0a\x09^ origin <= aPoint and: [ corner >= aPoint ]",
  6813. referencedClasses: [],
  6814. messageSends: ["and:", "<=", ">="]
  6815. }),
  6816. $globals.Rectangle);
  6817. $core.addMethod(
  6818. $core.method({
  6819. selector: "containsRect:",
  6820. protocol: "testing",
  6821. fn: function (aRect){
  6822. var self=this,$self=this;
  6823. return $core.withContext(function($ctx1) {
  6824. return $recv($recv($recv(aRect)._origin()).__gt_eq($self["@origin"]))._and_((function(){
  6825. return $core.withContext(function($ctx2) {
  6826. return $recv($recv(aRect)._corner()).__lt_eq($self["@corner"]);
  6827. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  6828. }));
  6829. }, function($ctx1) {$ctx1.fill(self,"containsRect:",{aRect:aRect},$globals.Rectangle)});
  6830. },
  6831. args: ["aRect"],
  6832. source: "containsRect: aRect\x0a\x09^ aRect origin >= origin and: [ aRect corner <= corner ]",
  6833. referencedClasses: [],
  6834. messageSends: ["and:", ">=", "origin", "<=", "corner"]
  6835. }),
  6836. $globals.Rectangle);
  6837. $core.addMethod(
  6838. $core.method({
  6839. selector: "corner",
  6840. protocol: "accessing",
  6841. fn: function (){
  6842. var self=this,$self=this;
  6843. return $self["@corner"];
  6844. },
  6845. args: [],
  6846. source: "corner\x0a\x09^ corner",
  6847. referencedClasses: [],
  6848. messageSends: []
  6849. }),
  6850. $globals.Rectangle);
  6851. $core.addMethod(
  6852. $core.method({
  6853. selector: "origin",
  6854. protocol: "accessing",
  6855. fn: function (){
  6856. var self=this,$self=this;
  6857. return $self["@origin"];
  6858. },
  6859. args: [],
  6860. source: "origin\x0a\x09^ origin",
  6861. referencedClasses: [],
  6862. messageSends: []
  6863. }),
  6864. $globals.Rectangle);
  6865. $core.addMethod(
  6866. $core.method({
  6867. selector: "printOn:",
  6868. protocol: "testing",
  6869. fn: function (aStream){
  6870. var self=this,$self=this;
  6871. return $core.withContext(function($ctx1) {
  6872. $recv($self["@origin"])._printOn_(aStream);
  6873. $ctx1.sendIdx["printOn:"]=1;
  6874. $recv(aStream)._nextPutAll_(" corner: ");
  6875. $recv($self["@corner"])._printOn_(aStream);
  6876. return self;
  6877. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Rectangle)});
  6878. },
  6879. args: ["aStream"],
  6880. source: "printOn: aStream\x0a\x09origin printOn: aStream.\x0a\x09aStream nextPutAll: ' corner: '.\x0a\x09corner printOn: aStream.",
  6881. referencedClasses: [],
  6882. messageSends: ["printOn:", "nextPutAll:"]
  6883. }),
  6884. $globals.Rectangle);
  6885. $core.addMethod(
  6886. $core.method({
  6887. selector: "setPoint:point:",
  6888. protocol: "private",
  6889. fn: function (pt1,pt2){
  6890. var self=this,$self=this;
  6891. return $core.withContext(function($ctx1) {
  6892. var $2,$3,$1,$5,$6,$4,$8,$7,$10,$9;
  6893. $2=$recv(pt1)._x();
  6894. $ctx1.sendIdx["x"]=1;
  6895. $3=$recv(pt2)._x();
  6896. $ctx1.sendIdx["x"]=2;
  6897. $1=$recv($2)._min_($3);
  6898. $ctx1.sendIdx["min:"]=1;
  6899. $5=$recv(pt1)._y();
  6900. $ctx1.sendIdx["y"]=1;
  6901. $6=$recv(pt2)._y();
  6902. $ctx1.sendIdx["y"]=2;
  6903. $4=$recv($5)._min_($6);
  6904. $self["@origin"]=$recv($1).__at($4);
  6905. $ctx1.sendIdx["@"]=1;
  6906. $8=$recv(pt1)._x();
  6907. $ctx1.sendIdx["x"]=3;
  6908. $7=$recv($8)._max_($recv(pt2)._x());
  6909. $ctx1.sendIdx["max:"]=1;
  6910. $10=$recv(pt1)._y();
  6911. $ctx1.sendIdx["y"]=3;
  6912. $9=$recv($10)._max_($recv(pt2)._y());
  6913. $self["@corner"]=$recv($7).__at($9);
  6914. return self;
  6915. }, function($ctx1) {$ctx1.fill(self,"setPoint:point:",{pt1:pt1,pt2:pt2},$globals.Rectangle)});
  6916. },
  6917. args: ["pt1", "pt2"],
  6918. source: "setPoint: pt1 point: pt2\x0a\x0a\x09origin := (pt1 x min: pt2 x)@(pt1 y min: pt2 y).\x0a\x09corner := (pt1 x max: pt2 x)@(pt1 y max: pt2 y).",
  6919. referencedClasses: [],
  6920. messageSends: ["@", "min:", "x", "y", "max:"]
  6921. }),
  6922. $globals.Rectangle);
  6923. $core.addMethod(
  6924. $core.method({
  6925. selector: "origin:corner:",
  6926. protocol: "instance creation",
  6927. fn: function (anOrigin,aCorner){
  6928. var self=this,$self=this;
  6929. return $core.withContext(function($ctx1) {
  6930. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6931. }, function($ctx1) {$ctx1.fill(self,"origin:corner:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6932. },
  6933. args: ["anOrigin", "aCorner"],
  6934. source: "origin: anOrigin corner: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6935. referencedClasses: [],
  6936. messageSends: ["setPoint:point:", "basicNew"]
  6937. }),
  6938. $globals.Rectangle.a$cls);
  6939. $core.addMethod(
  6940. $core.method({
  6941. selector: "origin:extent:",
  6942. protocol: "instance creation",
  6943. fn: function (anOrigin,anExtent){
  6944. var self=this,$self=this;
  6945. return $core.withContext(function($ctx1) {
  6946. return $recv($self._basicNew())._setPoint_point_(anOrigin,$recv(anOrigin).__plus(anExtent));
  6947. }, function($ctx1) {$ctx1.fill(self,"origin:extent:",{anOrigin:anOrigin,anExtent:anExtent},$globals.Rectangle.a$cls)});
  6948. },
  6949. args: ["anOrigin", "anExtent"],
  6950. source: "origin: anOrigin extent: anExtent\x0a\x09^ self basicNew setPoint: anOrigin point: anOrigin + anExtent.",
  6951. referencedClasses: [],
  6952. messageSends: ["setPoint:point:", "basicNew", "+"]
  6953. }),
  6954. $globals.Rectangle.a$cls);
  6955. $core.addMethod(
  6956. $core.method({
  6957. selector: "point:point:",
  6958. protocol: "instance creation",
  6959. fn: function (anOrigin,aCorner){
  6960. var self=this,$self=this;
  6961. return $core.withContext(function($ctx1) {
  6962. return $recv($self._basicNew())._setPoint_point_(anOrigin,aCorner);
  6963. }, function($ctx1) {$ctx1.fill(self,"point:point:",{anOrigin:anOrigin,aCorner:aCorner},$globals.Rectangle.a$cls)});
  6964. },
  6965. args: ["anOrigin", "aCorner"],
  6966. source: "point: anOrigin point: aCorner\x0a\x09^ self basicNew setPoint: anOrigin point: aCorner.",
  6967. referencedClasses: [],
  6968. messageSends: ["setPoint:point:", "basicNew"]
  6969. }),
  6970. $globals.Rectangle.a$cls);
  6971. $core.addClass("UndefinedObject", $globals.Object, [], "Kernel-Objects");
  6972. $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`.";
  6973. $core.addMethod(
  6974. $core.method({
  6975. selector: "==",
  6976. protocol: "testing",
  6977. fn: function (anObject){
  6978. var self=this,$self=this;
  6979. return $core.withContext(function($ctx1) {
  6980. return $recv(anObject)._isNil();
  6981. }, function($ctx1) {$ctx1.fill(self,"==",{anObject:anObject},$globals.UndefinedObject)});
  6982. },
  6983. args: ["anObject"],
  6984. source: "== anObject\x0a\x09^ anObject isNil",
  6985. referencedClasses: [],
  6986. messageSends: ["isNil"]
  6987. }),
  6988. $globals.UndefinedObject);
  6989. $core.addMethod(
  6990. $core.method({
  6991. selector: "asJavaScriptObject",
  6992. protocol: "converting",
  6993. fn: function (){
  6994. var self=this,$self=this;
  6995. return null;
  6996. },
  6997. args: [],
  6998. source: "asJavaScriptObject\x0a\x09^ null",
  6999. referencedClasses: [],
  7000. messageSends: []
  7001. }),
  7002. $globals.UndefinedObject);
  7003. $core.addMethod(
  7004. $core.method({
  7005. selector: "deepCopy",
  7006. protocol: "copying",
  7007. fn: function (){
  7008. var self=this,$self=this;
  7009. return self;
  7010. },
  7011. args: [],
  7012. source: "deepCopy\x0a\x09^ self",
  7013. referencedClasses: [],
  7014. messageSends: []
  7015. }),
  7016. $globals.UndefinedObject);
  7017. $core.addMethod(
  7018. $core.method({
  7019. selector: "identityHash",
  7020. protocol: "accessing",
  7021. fn: function (){
  7022. var self=this,$self=this;
  7023. return "NIL";
  7024. },
  7025. args: [],
  7026. source: "identityHash\x0a\x09^ 'NIL'",
  7027. referencedClasses: [],
  7028. messageSends: []
  7029. }),
  7030. $globals.UndefinedObject);
  7031. $core.addMethod(
  7032. $core.method({
  7033. selector: "ifNil:",
  7034. protocol: "testing",
  7035. fn: function (aBlock){
  7036. var self=this,$self=this;
  7037. return $core.withContext(function($ctx1) {
  7038. return $self._ifNil_ifNotNil_(aBlock,(function(){
  7039. }));
  7040. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{aBlock:aBlock},$globals.UndefinedObject)});
  7041. },
  7042. args: ["aBlock"],
  7043. source: "ifNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self ifNil: aBlock ifNotNil: []",
  7044. referencedClasses: [],
  7045. messageSends: ["ifNil:ifNotNil:"]
  7046. }),
  7047. $globals.UndefinedObject);
  7048. $core.addMethod(
  7049. $core.method({
  7050. selector: "ifNil:ifNotNil:",
  7051. protocol: "testing",
  7052. fn: function (aBlock,anotherBlock){
  7053. var self=this,$self=this;
  7054. return $core.withContext(function($ctx1) {
  7055. return $recv(aBlock)._value();
  7056. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7057. },
  7058. args: ["aBlock", "anotherBlock"],
  7059. source: "ifNil: aBlock ifNotNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ aBlock value",
  7060. referencedClasses: [],
  7061. messageSends: ["value"]
  7062. }),
  7063. $globals.UndefinedObject);
  7064. $core.addMethod(
  7065. $core.method({
  7066. selector: "ifNotNil:",
  7067. protocol: "testing",
  7068. fn: function (aBlock){
  7069. var self=this,$self=this;
  7070. return self;
  7071. },
  7072. args: ["aBlock"],
  7073. source: "ifNotNil: aBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ self",
  7074. referencedClasses: [],
  7075. messageSends: []
  7076. }),
  7077. $globals.UndefinedObject);
  7078. $core.addMethod(
  7079. $core.method({
  7080. selector: "ifNotNil:ifNil:",
  7081. protocol: "testing",
  7082. fn: function (aBlock,anotherBlock){
  7083. var self=this,$self=this;
  7084. return $core.withContext(function($ctx1) {
  7085. return $recv(anotherBlock)._value();
  7086. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.UndefinedObject)});
  7087. },
  7088. args: ["aBlock", "anotherBlock"],
  7089. source: "ifNotNil: aBlock ifNil: anotherBlock\x0a\x09\x22inlined in the Compiler\x22\x0a\x09^ anotherBlock value",
  7090. referencedClasses: [],
  7091. messageSends: ["value"]
  7092. }),
  7093. $globals.UndefinedObject);
  7094. $core.addMethod(
  7095. $core.method({
  7096. selector: "isImmutable",
  7097. protocol: "testing",
  7098. fn: function (){
  7099. var self=this,$self=this;
  7100. return true;
  7101. },
  7102. args: [],
  7103. source: "isImmutable\x0a\x09^ true",
  7104. referencedClasses: [],
  7105. messageSends: []
  7106. }),
  7107. $globals.UndefinedObject);
  7108. $core.addMethod(
  7109. $core.method({
  7110. selector: "isNil",
  7111. protocol: "testing",
  7112. fn: function (){
  7113. var self=this,$self=this;
  7114. return true;
  7115. },
  7116. args: [],
  7117. source: "isNil\x0a\x09^ true",
  7118. referencedClasses: [],
  7119. messageSends: []
  7120. }),
  7121. $globals.UndefinedObject);
  7122. $core.addMethod(
  7123. $core.method({
  7124. selector: "notNil",
  7125. protocol: "testing",
  7126. fn: function (){
  7127. var self=this,$self=this;
  7128. return false;
  7129. },
  7130. args: [],
  7131. source: "notNil\x0a\x09^ false",
  7132. referencedClasses: [],
  7133. messageSends: []
  7134. }),
  7135. $globals.UndefinedObject);
  7136. $core.addMethod(
  7137. $core.method({
  7138. selector: "printOn:",
  7139. protocol: "printing",
  7140. fn: function (aStream){
  7141. var self=this,$self=this;
  7142. return $core.withContext(function($ctx1) {
  7143. $recv(aStream)._nextPutAll_("nil");
  7144. return self;
  7145. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.UndefinedObject)});
  7146. },
  7147. args: ["aStream"],
  7148. source: "printOn: aStream\x0a\x09aStream nextPutAll: 'nil'",
  7149. referencedClasses: [],
  7150. messageSends: ["nextPutAll:"]
  7151. }),
  7152. $globals.UndefinedObject);
  7153. $core.addMethod(
  7154. $core.method({
  7155. selector: "shallowCopy",
  7156. protocol: "copying",
  7157. fn: function (){
  7158. var self=this,$self=this;
  7159. return self;
  7160. },
  7161. args: [],
  7162. source: "shallowCopy\x0a\x09^ self",
  7163. referencedClasses: [],
  7164. messageSends: []
  7165. }),
  7166. $globals.UndefinedObject);
  7167. $core.addMethod(
  7168. $core.method({
  7169. selector: "value",
  7170. protocol: "evaluating",
  7171. fn: function (){
  7172. var self=this,$self=this;
  7173. return $core.withContext(function($ctx1) {
  7174. return null;
  7175. return self;
  7176. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.UndefinedObject)});
  7177. },
  7178. args: [],
  7179. source: "value\x0a\x09<inlineJS: 'return null'>",
  7180. referencedClasses: [],
  7181. messageSends: []
  7182. }),
  7183. $globals.UndefinedObject);
  7184. $core.addMethod(
  7185. $core.method({
  7186. selector: "new",
  7187. protocol: "instance creation",
  7188. fn: function (){
  7189. var self=this,$self=this;
  7190. return $core.withContext(function($ctx1) {
  7191. $self._error_("You cannot create new instances of UndefinedObject. Use nil");
  7192. return self;
  7193. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.UndefinedObject.a$cls)});
  7194. },
  7195. args: [],
  7196. source: "new\x0a\x09\x09self error: 'You cannot create new instances of UndefinedObject. Use nil'",
  7197. referencedClasses: [],
  7198. messageSends: ["error:"]
  7199. }),
  7200. $globals.UndefinedObject.a$cls);
  7201. $core.setTraitComposition([{trait: $globals.TSubclassable}], $globals.UndefinedObject);
  7202. });
  7203. define('amber_core/Kernel-Collections',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  7204. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  7205. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  7206. $core.addPackage("Kernel-Collections");
  7207. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].innerEval = function (expr) { return eval(expr); };
  7208. ($core.packageDescriptors||$core.packages)["Kernel-Collections"].transport = {"type":"amd","amdNamespace":"amber_core"};
  7209. $core.addClass("Association", $globals.Object, ["key", "value"], "Kernel-Collections");
  7210. $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:`";
  7211. $core.addMethod(
  7212. $core.method({
  7213. selector: "=",
  7214. protocol: "comparing",
  7215. fn: function (anAssociation){
  7216. var self=this,$self=this;
  7217. return $core.withContext(function($ctx1) {
  7218. var $3,$2,$5,$4,$6,$1;
  7219. $3=$self._class();
  7220. $ctx1.sendIdx["class"]=1;
  7221. $2=$recv($3).__eq($recv(anAssociation)._class());
  7222. $ctx1.sendIdx["="]=1;
  7223. $1=$recv($2)._and_((function(){
  7224. return $core.withContext(function($ctx2) {
  7225. $5=$self._key();
  7226. $ctx2.sendIdx["key"]=1;
  7227. $4=$recv($5).__eq($recv(anAssociation)._key());
  7228. $ctx2.sendIdx["="]=2;
  7229. return $recv($4)._and_((function(){
  7230. return $core.withContext(function($ctx3) {
  7231. $6=$self._value();
  7232. $ctx3.sendIdx["value"]=1;
  7233. return $recv($6).__eq($recv(anAssociation)._value());
  7234. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  7235. }));
  7236. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7237. }));
  7238. $ctx1.sendIdx["and:"]=1;
  7239. return $1;
  7240. }, function($ctx1) {$ctx1.fill(self,"=",{anAssociation:anAssociation},$globals.Association)});
  7241. },
  7242. args: ["anAssociation"],
  7243. source: "= anAssociation\x0a\x09^ self class = anAssociation class and: [\x0a\x09\x09self key = anAssociation key and: [\x0a\x09\x09self value = anAssociation value ]]",
  7244. referencedClasses: [],
  7245. messageSends: ["and:", "=", "class", "key", "value"]
  7246. }),
  7247. $globals.Association);
  7248. $core.addMethod(
  7249. $core.method({
  7250. selector: "key",
  7251. protocol: "accessing",
  7252. fn: function (){
  7253. var self=this,$self=this;
  7254. return $self["@key"];
  7255. },
  7256. args: [],
  7257. source: "key\x0a\x09^ key",
  7258. referencedClasses: [],
  7259. messageSends: []
  7260. }),
  7261. $globals.Association);
  7262. $core.addMethod(
  7263. $core.method({
  7264. selector: "key:",
  7265. protocol: "accessing",
  7266. fn: function (aKey){
  7267. var self=this,$self=this;
  7268. $self["@key"]=aKey;
  7269. return self;
  7270. },
  7271. args: ["aKey"],
  7272. source: "key: aKey\x0a\x09key := aKey",
  7273. referencedClasses: [],
  7274. messageSends: []
  7275. }),
  7276. $globals.Association);
  7277. $core.addMethod(
  7278. $core.method({
  7279. selector: "printOn:",
  7280. protocol: "printing",
  7281. fn: function (aStream){
  7282. var self=this,$self=this;
  7283. return $core.withContext(function($ctx1) {
  7284. $recv($self._key())._printOn_(aStream);
  7285. $ctx1.sendIdx["printOn:"]=1;
  7286. $recv(aStream)._nextPutAll_(" -> ");
  7287. $recv($self._value())._printOn_(aStream);
  7288. return self;
  7289. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Association)});
  7290. },
  7291. args: ["aStream"],
  7292. source: "printOn: aStream\x0a\x09self key printOn: aStream.\x0a\x09aStream nextPutAll: ' -> '.\x0a\x09self value printOn: aStream",
  7293. referencedClasses: [],
  7294. messageSends: ["printOn:", "key", "nextPutAll:", "value"]
  7295. }),
  7296. $globals.Association);
  7297. $core.addMethod(
  7298. $core.method({
  7299. selector: "value",
  7300. protocol: "accessing",
  7301. fn: function (){
  7302. var self=this,$self=this;
  7303. return $self["@value"];
  7304. },
  7305. args: [],
  7306. source: "value\x0a\x09^ value",
  7307. referencedClasses: [],
  7308. messageSends: []
  7309. }),
  7310. $globals.Association);
  7311. $core.addMethod(
  7312. $core.method({
  7313. selector: "value:",
  7314. protocol: "accessing",
  7315. fn: function (aValue){
  7316. var self=this,$self=this;
  7317. $self["@value"]=aValue;
  7318. return self;
  7319. },
  7320. args: ["aValue"],
  7321. source: "value: aValue\x0a\x09value := aValue",
  7322. referencedClasses: [],
  7323. messageSends: []
  7324. }),
  7325. $globals.Association);
  7326. $core.addMethod(
  7327. $core.method({
  7328. selector: "key:value:",
  7329. protocol: "instance creation",
  7330. fn: function (aKey,aValue){
  7331. var self=this,$self=this;
  7332. return $core.withContext(function($ctx1) {
  7333. var $1;
  7334. $1=$self._new();
  7335. $recv($1)._key_(aKey);
  7336. $recv($1)._value_(aValue);
  7337. return $recv($1)._yourself();
  7338. }, function($ctx1) {$ctx1.fill(self,"key:value:",{aKey:aKey,aValue:aValue},$globals.Association.a$cls)});
  7339. },
  7340. args: ["aKey", "aValue"],
  7341. source: "key: aKey value: aValue\x0a\x09\x09^ self new\x0a\x09\x09key: aKey;\x0a\x09\x09value: aValue;\x0a\x09\x09yourself",
  7342. referencedClasses: [],
  7343. messageSends: ["key:", "new", "value:", "yourself"]
  7344. }),
  7345. $globals.Association.a$cls);
  7346. $core.addClass("BucketStore", $globals.Object, ["buckets", "hashBlock"], "Kernel-Collections");
  7347. $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`.";
  7348. $core.addMethod(
  7349. $core.method({
  7350. selector: "bucketOfElement:",
  7351. protocol: "accessing",
  7352. fn: function (anObject){
  7353. var self=this,$self=this;
  7354. return $core.withContext(function($ctx1) {
  7355. var hash = $self['@hashBlock'](anObject);
  7356. if (!hash) return null;
  7357. var buckets = $self['@buckets'],
  7358. bucket = buckets[hash];
  7359. if (!bucket) { bucket = buckets[hash] = $self._newBucket(); }
  7360. return bucket;
  7361. ;
  7362. return self;
  7363. }, function($ctx1) {$ctx1.fill(self,"bucketOfElement:",{anObject:anObject},$globals.BucketStore)});
  7364. },
  7365. args: ["anObject"],
  7366. 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'>",
  7367. referencedClasses: [],
  7368. messageSends: []
  7369. }),
  7370. $globals.BucketStore);
  7371. $core.addMethod(
  7372. $core.method({
  7373. selector: "do:",
  7374. protocol: "enumerating",
  7375. fn: function (aBlock){
  7376. var self=this,$self=this;
  7377. return $core.withContext(function($ctx1) {
  7378. var buckets = $self['@buckets'];
  7379. var keys = Object.keys(buckets);
  7380. for (var i = 0; i < keys.length; ++i) { buckets[keys[i]]._do_(aBlock); }
  7381. ;
  7382. return self;
  7383. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.BucketStore)});
  7384. },
  7385. args: ["aBlock"],
  7386. 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'>",
  7387. referencedClasses: [],
  7388. messageSends: []
  7389. }),
  7390. $globals.BucketStore);
  7391. $core.addMethod(
  7392. $core.method({
  7393. selector: "hashBlock:",
  7394. protocol: "accessing",
  7395. fn: function (aBlock){
  7396. var self=this,$self=this;
  7397. $self["@hashBlock"]=aBlock;
  7398. return self;
  7399. },
  7400. args: ["aBlock"],
  7401. source: "hashBlock: aBlock\x0a\x09hashBlock := aBlock",
  7402. referencedClasses: [],
  7403. messageSends: []
  7404. }),
  7405. $globals.BucketStore);
  7406. $core.addMethod(
  7407. $core.method({
  7408. selector: "initialize",
  7409. protocol: "initialization",
  7410. fn: function (){
  7411. var self=this,$self=this;
  7412. return $core.withContext(function($ctx1) {
  7413. (
  7414. $ctx1.supercall = true,
  7415. ($globals.BucketStore.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  7416. $ctx1.supercall = false;
  7417. $self._removeAll();
  7418. return self;
  7419. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BucketStore)});
  7420. },
  7421. args: [],
  7422. source: "initialize\x0a\x09super initialize.\x0a\x09self removeAll",
  7423. referencedClasses: [],
  7424. messageSends: ["initialize", "removeAll"]
  7425. }),
  7426. $globals.BucketStore);
  7427. $core.addMethod(
  7428. $core.method({
  7429. selector: "newBucket",
  7430. protocol: "private",
  7431. fn: function (){
  7432. var self=this,$self=this;
  7433. return $core.withContext(function($ctx1) {
  7434. $self._subclassResponsibility();
  7435. return self;
  7436. }, function($ctx1) {$ctx1.fill(self,"newBucket",{},$globals.BucketStore)});
  7437. },
  7438. args: [],
  7439. source: "newBucket\x0a\x09self subclassResponsibility",
  7440. referencedClasses: [],
  7441. messageSends: ["subclassResponsibility"]
  7442. }),
  7443. $globals.BucketStore);
  7444. $core.addMethod(
  7445. $core.method({
  7446. selector: "removeAll",
  7447. protocol: "adding/removing",
  7448. fn: function (){
  7449. var self=this,$self=this;
  7450. return $core.withContext(function($ctx1) {
  7451. $self['@buckets'] = Object.create(null);;
  7452. return self;
  7453. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.BucketStore)});
  7454. },
  7455. args: [],
  7456. source: "removeAll\x0a\x09<inlineJS: '$self[''@buckets''] = Object.create(null);'>",
  7457. referencedClasses: [],
  7458. messageSends: []
  7459. }),
  7460. $globals.BucketStore);
  7461. $core.addMethod(
  7462. $core.method({
  7463. selector: "hashBlock:",
  7464. protocol: "instance creation",
  7465. fn: function (aBlock){
  7466. var self=this,$self=this;
  7467. return $core.withContext(function($ctx1) {
  7468. var $1;
  7469. $1=$self._new();
  7470. $recv($1)._hashBlock_(aBlock);
  7471. return $recv($1)._yourself();
  7472. }, function($ctx1) {$ctx1.fill(self,"hashBlock:",{aBlock:aBlock},$globals.BucketStore.a$cls)});
  7473. },
  7474. args: ["aBlock"],
  7475. source: "hashBlock: aBlock\x0a\x09^ self new\x0a\x09\x09hashBlock: aBlock;\x0a\x09\x09yourself",
  7476. referencedClasses: [],
  7477. messageSends: ["hashBlock:", "new", "yourself"]
  7478. }),
  7479. $globals.BucketStore.a$cls);
  7480. $core.addClass("ArrayBucketStore", $globals.BucketStore, [], "Kernel-Collections");
  7481. $globals.ArrayBucketStore.comment="I am a concrete `BucketStore` with buckets being instance of `Array`.";
  7482. $core.addMethod(
  7483. $core.method({
  7484. selector: "newBucket",
  7485. protocol: "private",
  7486. fn: function (){
  7487. var self=this,$self=this;
  7488. return [];
  7489. },
  7490. args: [],
  7491. source: "newBucket\x0a\x09^ #()",
  7492. referencedClasses: [],
  7493. messageSends: []
  7494. }),
  7495. $globals.ArrayBucketStore);
  7496. $core.addClass("Collection", $globals.Object, [], "Kernel-Collections");
  7497. $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.";
  7498. $core.addMethod(
  7499. $core.method({
  7500. selector: ",",
  7501. protocol: "copying",
  7502. fn: function (aCollection){
  7503. var self=this,$self=this;
  7504. return $core.withContext(function($ctx1) {
  7505. var $1;
  7506. $1=$self._copy();
  7507. $recv($1)._addAll_(aCollection);
  7508. return $recv($1)._yourself();
  7509. }, function($ctx1) {$ctx1.fill(self,",",{aCollection:aCollection},$globals.Collection)});
  7510. },
  7511. args: ["aCollection"],
  7512. source: ", aCollection\x0a\x09^ self copy\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  7513. referencedClasses: [],
  7514. messageSends: ["addAll:", "copy", "yourself"]
  7515. }),
  7516. $globals.Collection);
  7517. $core.addMethod(
  7518. $core.method({
  7519. selector: "add:",
  7520. protocol: "adding/removing",
  7521. fn: function (anObject){
  7522. var self=this,$self=this;
  7523. return $core.withContext(function($ctx1) {
  7524. $self._subclassResponsibility();
  7525. return self;
  7526. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Collection)});
  7527. },
  7528. args: ["anObject"],
  7529. source: "add: anObject\x0a\x09self subclassResponsibility",
  7530. referencedClasses: [],
  7531. messageSends: ["subclassResponsibility"]
  7532. }),
  7533. $globals.Collection);
  7534. $core.addMethod(
  7535. $core.method({
  7536. selector: "addAll:",
  7537. protocol: "adding/removing",
  7538. fn: function (aCollection){
  7539. var self=this,$self=this;
  7540. return $core.withContext(function($ctx1) {
  7541. $recv(aCollection)._do_((function(each){
  7542. return $core.withContext(function($ctx2) {
  7543. return $self._add_(each);
  7544. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7545. }));
  7546. return aCollection;
  7547. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Collection)});
  7548. },
  7549. args: ["aCollection"],
  7550. source: "addAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self add: each ].\x0a\x09^ aCollection",
  7551. referencedClasses: [],
  7552. messageSends: ["do:", "add:"]
  7553. }),
  7554. $globals.Collection);
  7555. $core.addMethod(
  7556. $core.method({
  7557. selector: "allSatisfy:",
  7558. protocol: "enumerating",
  7559. fn: function (aBlock){
  7560. var self=this,$self=this;
  7561. return $core.withContext(function($ctx1) {
  7562. var $1;
  7563. var $early={};
  7564. try {
  7565. $self._do_((function(each){
  7566. return $core.withContext(function($ctx2) {
  7567. $1=$recv(aBlock)._value_(each);
  7568. if(!$core.assert($1)){
  7569. throw $early=[false];
  7570. }
  7571. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7572. }));
  7573. return true;
  7574. }
  7575. catch(e) {if(e===$early)return e[0]; throw e}
  7576. }, function($ctx1) {$ctx1.fill(self,"allSatisfy:",{aBlock:aBlock},$globals.Collection)});
  7577. },
  7578. args: ["aBlock"],
  7579. 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",
  7580. referencedClasses: [],
  7581. messageSends: ["do:", "ifFalse:", "value:"]
  7582. }),
  7583. $globals.Collection);
  7584. $core.addMethod(
  7585. $core.method({
  7586. selector: "anyOne",
  7587. protocol: "accessing",
  7588. fn: function (){
  7589. var self=this,$self=this;
  7590. return $core.withContext(function($ctx1) {
  7591. var $early={};
  7592. try {
  7593. $self._ifEmpty_((function(){
  7594. return $core.withContext(function($ctx2) {
  7595. return $self._error_("Collection is empty");
  7596. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7597. }));
  7598. $self._do_((function(each){
  7599. throw $early=[each];
  7600. }));
  7601. return self;
  7602. }
  7603. catch(e) {if(e===$early)return e[0]; throw e}
  7604. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.Collection)});
  7605. },
  7606. args: [],
  7607. 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 ]",
  7608. referencedClasses: [],
  7609. messageSends: ["ifEmpty:", "error:", "do:"]
  7610. }),
  7611. $globals.Collection);
  7612. $core.addMethod(
  7613. $core.method({
  7614. selector: "anySatisfy:",
  7615. protocol: "enumerating",
  7616. fn: function (aBlock){
  7617. var self=this,$self=this;
  7618. return $core.withContext(function($ctx1) {
  7619. var $1;
  7620. var $early={};
  7621. try {
  7622. $self._do_((function(each){
  7623. return $core.withContext(function($ctx2) {
  7624. $1=$recv(aBlock)._value_(each);
  7625. if($core.assert($1)){
  7626. throw $early=[true];
  7627. }
  7628. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7629. }));
  7630. return false;
  7631. }
  7632. catch(e) {if(e===$early)return e[0]; throw e}
  7633. }, function($ctx1) {$ctx1.fill(self,"anySatisfy:",{aBlock:aBlock},$globals.Collection)});
  7634. },
  7635. args: ["aBlock"],
  7636. 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",
  7637. referencedClasses: [],
  7638. messageSends: ["do:", "ifTrue:", "value:"]
  7639. }),
  7640. $globals.Collection);
  7641. $core.addMethod(
  7642. $core.method({
  7643. selector: "asArray",
  7644. protocol: "converting",
  7645. fn: function (){
  7646. var self=this,$self=this;
  7647. return $core.withContext(function($ctx1) {
  7648. return $recv($globals.Array)._withAll_(self);
  7649. }, function($ctx1) {$ctx1.fill(self,"asArray",{},$globals.Collection)});
  7650. },
  7651. args: [],
  7652. source: "asArray\x0a\x09^ Array withAll: self",
  7653. referencedClasses: ["Array"],
  7654. messageSends: ["withAll:"]
  7655. }),
  7656. $globals.Collection);
  7657. $core.addMethod(
  7658. $core.method({
  7659. selector: "asJavaScriptObject",
  7660. protocol: "converting",
  7661. fn: function (){
  7662. var self=this,$self=this;
  7663. return $core.withContext(function($ctx1) {
  7664. return $recv($self._asArray())._collect_((function(each){
  7665. return $core.withContext(function($ctx2) {
  7666. return $recv(each)._asJavaScriptObject();
  7667. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7668. }));
  7669. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.Collection)});
  7670. },
  7671. args: [],
  7672. source: "asJavaScriptObject\x0a\x09^ self asArray collect: [ :each | each asJavaScriptObject ]",
  7673. referencedClasses: [],
  7674. messageSends: ["collect:", "asArray", "asJavaScriptObject"]
  7675. }),
  7676. $globals.Collection);
  7677. $core.addMethod(
  7678. $core.method({
  7679. selector: "asOrderedCollection",
  7680. protocol: "converting",
  7681. fn: function (){
  7682. var self=this,$self=this;
  7683. return $core.withContext(function($ctx1) {
  7684. return $self._asArray();
  7685. }, function($ctx1) {$ctx1.fill(self,"asOrderedCollection",{},$globals.Collection)});
  7686. },
  7687. args: [],
  7688. source: "asOrderedCollection\x0a\x09^ self asArray",
  7689. referencedClasses: [],
  7690. messageSends: ["asArray"]
  7691. }),
  7692. $globals.Collection);
  7693. $core.addMethod(
  7694. $core.method({
  7695. selector: "asSet",
  7696. protocol: "converting",
  7697. fn: function (){
  7698. var self=this,$self=this;
  7699. return $core.withContext(function($ctx1) {
  7700. return $recv($globals.Set)._withAll_(self);
  7701. }, function($ctx1) {$ctx1.fill(self,"asSet",{},$globals.Collection)});
  7702. },
  7703. args: [],
  7704. source: "asSet\x0a\x09^ Set withAll: self",
  7705. referencedClasses: ["Set"],
  7706. messageSends: ["withAll:"]
  7707. }),
  7708. $globals.Collection);
  7709. $core.addMethod(
  7710. $core.method({
  7711. selector: "collect:",
  7712. protocol: "enumerating",
  7713. fn: function (aBlock){
  7714. var self=this,$self=this;
  7715. var stream;
  7716. return $core.withContext(function($ctx1) {
  7717. stream=$recv($recv($self._class())._new())._writeStream();
  7718. $self._do_((function(each){
  7719. return $core.withContext(function($ctx2) {
  7720. return $recv(stream)._nextPut_($recv(aBlock)._value_(each));
  7721. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7722. }));
  7723. return $recv(stream)._contents();
  7724. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  7725. },
  7726. args: ["aBlock"],
  7727. 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",
  7728. referencedClasses: [],
  7729. messageSends: ["writeStream", "new", "class", "do:", "nextPut:", "value:", "contents"]
  7730. }),
  7731. $globals.Collection);
  7732. $core.addMethod(
  7733. $core.method({
  7734. selector: "copyWith:",
  7735. protocol: "copying",
  7736. fn: function (anObject){
  7737. var self=this,$self=this;
  7738. return $core.withContext(function($ctx1) {
  7739. var $1;
  7740. $1=$self._copy();
  7741. $recv($1)._add_(anObject);
  7742. return $recv($1)._yourself();
  7743. }, function($ctx1) {$ctx1.fill(self,"copyWith:",{anObject:anObject},$globals.Collection)});
  7744. },
  7745. args: ["anObject"],
  7746. source: "copyWith: anObject\x0a\x09^ self copy add: anObject; yourself",
  7747. referencedClasses: [],
  7748. messageSends: ["add:", "copy", "yourself"]
  7749. }),
  7750. $globals.Collection);
  7751. $core.addMethod(
  7752. $core.method({
  7753. selector: "copyWithAll:",
  7754. protocol: "copying",
  7755. fn: function (aCollection){
  7756. var self=this,$self=this;
  7757. return $core.withContext(function($ctx1) {
  7758. var $1;
  7759. $1=$self._copy();
  7760. $recv($1)._addAll_(aCollection);
  7761. return $recv($1)._yourself();
  7762. }, function($ctx1) {$ctx1.fill(self,"copyWithAll:",{aCollection:aCollection},$globals.Collection)});
  7763. },
  7764. args: ["aCollection"],
  7765. source: "copyWithAll: aCollection\x0a\x09^ self copy addAll: aCollection; yourself",
  7766. referencedClasses: [],
  7767. messageSends: ["addAll:", "copy", "yourself"]
  7768. }),
  7769. $globals.Collection);
  7770. $core.addMethod(
  7771. $core.method({
  7772. selector: "copyWithout:",
  7773. protocol: "copying",
  7774. fn: function (anObject){
  7775. var self=this,$self=this;
  7776. return $core.withContext(function($ctx1) {
  7777. return $self._reject_((function(each){
  7778. return $core.withContext(function($ctx2) {
  7779. return $recv(each).__eq(anObject);
  7780. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7781. }));
  7782. }, function($ctx1) {$ctx1.fill(self,"copyWithout:",{anObject:anObject},$globals.Collection)});
  7783. },
  7784. args: ["anObject"],
  7785. 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 ]",
  7786. referencedClasses: [],
  7787. messageSends: ["reject:", "="]
  7788. }),
  7789. $globals.Collection);
  7790. $core.addMethod(
  7791. $core.method({
  7792. selector: "copyWithoutAll:",
  7793. protocol: "copying",
  7794. fn: function (aCollection){
  7795. var self=this,$self=this;
  7796. return $core.withContext(function($ctx1) {
  7797. return $self._reject_((function(each){
  7798. return $core.withContext(function($ctx2) {
  7799. return $recv(aCollection)._includes_(each);
  7800. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7801. }));
  7802. }, function($ctx1) {$ctx1.fill(self,"copyWithoutAll:",{aCollection:aCollection},$globals.Collection)});
  7803. },
  7804. args: ["aCollection"],
  7805. 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 ]",
  7806. referencedClasses: [],
  7807. messageSends: ["reject:", "includes:"]
  7808. }),
  7809. $globals.Collection);
  7810. $core.addMethod(
  7811. $core.method({
  7812. selector: "deepCopy",
  7813. protocol: "copying",
  7814. fn: function (){
  7815. var self=this,$self=this;
  7816. return $core.withContext(function($ctx1) {
  7817. return $self._collect_((function(each){
  7818. return $core.withContext(function($ctx2) {
  7819. return $recv(each)._deepCopy();
  7820. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  7821. }));
  7822. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.Collection)});
  7823. },
  7824. args: [],
  7825. source: "deepCopy\x0a\x09^ self collect: [ :each | each deepCopy ]",
  7826. referencedClasses: [],
  7827. messageSends: ["collect:", "deepCopy"]
  7828. }),
  7829. $globals.Collection);
  7830. $core.addMethod(
  7831. $core.method({
  7832. selector: "detect:",
  7833. protocol: "enumerating",
  7834. fn: function (aBlock){
  7835. var self=this,$self=this;
  7836. return $core.withContext(function($ctx1) {
  7837. return $self._detect_ifNone_(aBlock,(function(){
  7838. return $core.withContext(function($ctx2) {
  7839. return $self._errorNotFound();
  7840. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  7841. }));
  7842. }, function($ctx1) {$ctx1.fill(self,"detect:",{aBlock:aBlock},$globals.Collection)});
  7843. },
  7844. args: ["aBlock"],
  7845. source: "detect: aBlock\x0a\x09^ self detect: aBlock ifNone: [ self errorNotFound ]",
  7846. referencedClasses: [],
  7847. messageSends: ["detect:ifNone:", "errorNotFound"]
  7848. }),
  7849. $globals.Collection);
  7850. $core.addMethod(
  7851. $core.method({
  7852. selector: "detect:ifNone:",
  7853. protocol: "enumerating",
  7854. fn: function (aBlock,anotherBlock){
  7855. var self=this,$self=this;
  7856. return $core.withContext(function($ctx1) {
  7857. $self._subclassResponsibility();
  7858. return self;
  7859. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7860. },
  7861. args: ["aBlock", "anotherBlock"],
  7862. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self subclassResponsibility",
  7863. referencedClasses: [],
  7864. messageSends: ["subclassResponsibility"]
  7865. }),
  7866. $globals.Collection);
  7867. $core.addMethod(
  7868. $core.method({
  7869. selector: "do:",
  7870. protocol: "enumerating",
  7871. fn: function (aBlock){
  7872. var self=this,$self=this;
  7873. return $core.withContext(function($ctx1) {
  7874. $self._subclassResponsibility();
  7875. return self;
  7876. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Collection)});
  7877. },
  7878. args: ["aBlock"],
  7879. source: "do: aBlock\x0a\x09self subclassResponsibility",
  7880. referencedClasses: [],
  7881. messageSends: ["subclassResponsibility"]
  7882. }),
  7883. $globals.Collection);
  7884. $core.addMethod(
  7885. $core.method({
  7886. selector: "do:separatedBy:",
  7887. protocol: "enumerating",
  7888. fn: function (aBlock,anotherBlock){
  7889. var self=this,$self=this;
  7890. var actionBeforeElement;
  7891. return $core.withContext(function($ctx1) {
  7892. actionBeforeElement=(function(){
  7893. actionBeforeElement=anotherBlock;
  7894. return actionBeforeElement;
  7895. });
  7896. $self._do_((function(each){
  7897. return $core.withContext(function($ctx2) {
  7898. $recv(actionBeforeElement)._value();
  7899. return $recv(aBlock)._value_(each);
  7900. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  7901. }));
  7902. return self;
  7903. }, function($ctx1) {$ctx1.fill(self,"do:separatedBy:",{aBlock:aBlock,anotherBlock:anotherBlock,actionBeforeElement:actionBeforeElement},$globals.Collection)});
  7904. },
  7905. args: ["aBlock", "anotherBlock"],
  7906. 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 ]",
  7907. referencedClasses: [],
  7908. messageSends: ["do:", "value", "value:"]
  7909. }),
  7910. $globals.Collection);
  7911. $core.addMethod(
  7912. $core.method({
  7913. selector: "errorNotFound",
  7914. protocol: "error handling",
  7915. fn: function (){
  7916. var self=this,$self=this;
  7917. return $core.withContext(function($ctx1) {
  7918. $self._error_("Object is not in the collection");
  7919. return self;
  7920. }, function($ctx1) {$ctx1.fill(self,"errorNotFound",{},$globals.Collection)});
  7921. },
  7922. args: [],
  7923. source: "errorNotFound\x0a\x09self error: 'Object is not in the collection'",
  7924. referencedClasses: [],
  7925. messageSends: ["error:"]
  7926. }),
  7927. $globals.Collection);
  7928. $core.addMethod(
  7929. $core.method({
  7930. selector: "ifEmpty:",
  7931. protocol: "testing",
  7932. fn: function (aBlock){
  7933. var self=this,$self=this;
  7934. return $core.withContext(function($ctx1) {
  7935. var $1;
  7936. $1=$self._isEmpty();
  7937. if($core.assert($1)){
  7938. return $recv(aBlock)._value();
  7939. } else {
  7940. return self;
  7941. }
  7942. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:",{aBlock:aBlock},$globals.Collection)});
  7943. },
  7944. args: ["aBlock"],
  7945. 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 ]",
  7946. referencedClasses: [],
  7947. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value"]
  7948. }),
  7949. $globals.Collection);
  7950. $core.addMethod(
  7951. $core.method({
  7952. selector: "ifEmpty:ifNotEmpty:",
  7953. protocol: "testing",
  7954. fn: function (aBlock,anotherBlock){
  7955. var self=this,$self=this;
  7956. return $core.withContext(function($ctx1) {
  7957. var $1;
  7958. $1=$self._isEmpty();
  7959. if($core.assert($1)){
  7960. return $recv(aBlock)._value();
  7961. } else {
  7962. return $recv(anotherBlock)._value_(self);
  7963. }
  7964. }, function($ctx1) {$ctx1.fill(self,"ifEmpty:ifNotEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  7965. },
  7966. args: ["aBlock", "anotherBlock"],
  7967. source: "ifEmpty: aBlock ifNotEmpty: anotherBlock\x0a\x09^ self isEmpty\x0a\x09\x09ifTrue: \x22aBlock\x22 [ aBlock value ]\x0a\x09\x09ifFalse: [ anotherBlock value: self ]",
  7968. referencedClasses: [],
  7969. messageSends: ["ifTrue:ifFalse:", "isEmpty", "value", "value:"]
  7970. }),
  7971. $globals.Collection);
  7972. $core.addMethod(
  7973. $core.method({
  7974. selector: "ifNotEmpty:",
  7975. protocol: "testing",
  7976. fn: function (aBlock){
  7977. var self=this,$self=this;
  7978. return $core.withContext(function($ctx1) {
  7979. var $1;
  7980. $1=$self._notEmpty();
  7981. if($core.assert($1)){
  7982. return $recv(aBlock)._value_(self);
  7983. } else {
  7984. return self;
  7985. }
  7986. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:",{aBlock:aBlock},$globals.Collection)});
  7987. },
  7988. args: ["aBlock"],
  7989. source: "ifNotEmpty: aBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: [ self ]",
  7990. referencedClasses: [],
  7991. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:"]
  7992. }),
  7993. $globals.Collection);
  7994. $core.addMethod(
  7995. $core.method({
  7996. selector: "ifNotEmpty:ifEmpty:",
  7997. protocol: "testing",
  7998. fn: function (aBlock,anotherBlock){
  7999. var self=this,$self=this;
  8000. return $core.withContext(function($ctx1) {
  8001. var $1;
  8002. $1=$self._notEmpty();
  8003. if($core.assert($1)){
  8004. return $recv(aBlock)._value_(self);
  8005. } else {
  8006. return $recv(anotherBlock)._value();
  8007. }
  8008. }, function($ctx1) {$ctx1.fill(self,"ifNotEmpty:ifEmpty:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Collection)});
  8009. },
  8010. args: ["aBlock", "anotherBlock"],
  8011. source: "ifNotEmpty: aBlock ifEmpty: anotherBlock\x0a\x09^ self notEmpty\x0a\x09\x09ifTrue: [ aBlock value: self ]\x0a\x09\x09ifFalse: \x22anotherBlock\x22 [ anotherBlock value ]",
  8012. referencedClasses: [],
  8013. messageSends: ["ifTrue:ifFalse:", "notEmpty", "value:", "value"]
  8014. }),
  8015. $globals.Collection);
  8016. $core.addMethod(
  8017. $core.method({
  8018. selector: "includes:",
  8019. protocol: "testing",
  8020. fn: function (anObject){
  8021. var self=this,$self=this;
  8022. return $core.withContext(function($ctx1) {
  8023. return $self._anySatisfy_((function(each){
  8024. return $core.withContext(function($ctx2) {
  8025. return $recv(each).__eq(anObject);
  8026. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8027. }));
  8028. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.Collection)});
  8029. },
  8030. args: ["anObject"],
  8031. source: "includes: anObject\x0a\x09^ self anySatisfy: [ :each | each = anObject ]",
  8032. referencedClasses: [],
  8033. messageSends: ["anySatisfy:", "="]
  8034. }),
  8035. $globals.Collection);
  8036. $core.addMethod(
  8037. $core.method({
  8038. selector: "inject:into:",
  8039. protocol: "enumerating",
  8040. fn: function (anObject,aBlock){
  8041. var self=this,$self=this;
  8042. var result;
  8043. return $core.withContext(function($ctx1) {
  8044. result=anObject;
  8045. $self._do_((function(each){
  8046. return $core.withContext(function($ctx2) {
  8047. result=$recv(aBlock)._value_value_(result,each);
  8048. return result;
  8049. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8050. }));
  8051. return result;
  8052. }, function($ctx1) {$ctx1.fill(self,"inject:into:",{anObject:anObject,aBlock:aBlock,result:result},$globals.Collection)});
  8053. },
  8054. args: ["anObject", "aBlock"],
  8055. 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",
  8056. referencedClasses: [],
  8057. messageSends: ["do:", "value:value:"]
  8058. }),
  8059. $globals.Collection);
  8060. $core.addMethod(
  8061. $core.method({
  8062. selector: "intersection:",
  8063. protocol: "enumerating",
  8064. fn: function (aCollection){
  8065. var self=this,$self=this;
  8066. var set,outputSet;
  8067. return $core.withContext(function($ctx1) {
  8068. var $2,$1;
  8069. set=$self._asSet();
  8070. outputSet=$recv($globals.Set)._new();
  8071. $recv(aCollection)._do_((function(each){
  8072. return $core.withContext(function($ctx2) {
  8073. $2=$recv(set)._includes_(each);
  8074. $ctx2.sendIdx["includes:"]=1;
  8075. $1=$recv($2)._and_((function(){
  8076. return $core.withContext(function($ctx3) {
  8077. return $recv($recv(outputSet)._includes_(each))._not();
  8078. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  8079. }));
  8080. if($core.assert($1)){
  8081. return $recv(outputSet)._add_(each);
  8082. }
  8083. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8084. }));
  8085. return $recv($self._class())._withAll_($recv(outputSet)._asArray());
  8086. }, function($ctx1) {$ctx1.fill(self,"intersection:",{aCollection:aCollection,set:set,outputSet:outputSet},$globals.Collection)});
  8087. },
  8088. args: ["aCollection"],
  8089. 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",
  8090. referencedClasses: ["Set"],
  8091. messageSends: ["asSet", "new", "do:", "ifTrue:", "and:", "includes:", "not", "add:", "withAll:", "class", "asArray"]
  8092. }),
  8093. $globals.Collection);
  8094. $core.addMethod(
  8095. $core.method({
  8096. selector: "isEmpty",
  8097. protocol: "testing",
  8098. fn: function (){
  8099. var self=this,$self=this;
  8100. return $core.withContext(function($ctx1) {
  8101. return $recv($self._size()).__eq((0));
  8102. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Collection)});
  8103. },
  8104. args: [],
  8105. source: "isEmpty\x0a\x09^ self size = 0",
  8106. referencedClasses: [],
  8107. messageSends: ["=", "size"]
  8108. }),
  8109. $globals.Collection);
  8110. $core.addMethod(
  8111. $core.method({
  8112. selector: "noneSatisfy:",
  8113. protocol: "enumerating",
  8114. fn: function (aBlock){
  8115. var self=this,$self=this;
  8116. return $core.withContext(function($ctx1) {
  8117. var $1;
  8118. var $early={};
  8119. try {
  8120. $self._do_((function(item){
  8121. return $core.withContext(function($ctx2) {
  8122. $1=$recv(aBlock)._value_(item);
  8123. if($core.assert($1)){
  8124. throw $early=[false];
  8125. }
  8126. }, function($ctx2) {$ctx2.fillBlock({item:item},$ctx1,1)});
  8127. }));
  8128. return true;
  8129. }
  8130. catch(e) {if(e===$early)return e[0]; throw e}
  8131. }, function($ctx1) {$ctx1.fill(self,"noneSatisfy:",{aBlock:aBlock},$globals.Collection)});
  8132. },
  8133. args: ["aBlock"],
  8134. 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",
  8135. referencedClasses: [],
  8136. messageSends: ["do:", "ifTrue:", "value:"]
  8137. }),
  8138. $globals.Collection);
  8139. $core.addMethod(
  8140. $core.method({
  8141. selector: "notEmpty",
  8142. protocol: "testing",
  8143. fn: function (){
  8144. var self=this,$self=this;
  8145. return $core.withContext(function($ctx1) {
  8146. return $recv($self._isEmpty())._not();
  8147. }, function($ctx1) {$ctx1.fill(self,"notEmpty",{},$globals.Collection)});
  8148. },
  8149. args: [],
  8150. source: "notEmpty\x0a\x09^ self isEmpty not",
  8151. referencedClasses: [],
  8152. messageSends: ["not", "isEmpty"]
  8153. }),
  8154. $globals.Collection);
  8155. $core.addMethod(
  8156. $core.method({
  8157. selector: "occurrencesOf:",
  8158. protocol: "accessing",
  8159. fn: function (anObject){
  8160. var self=this,$self=this;
  8161. var tally;
  8162. return $core.withContext(function($ctx1) {
  8163. var $1;
  8164. tally=(0);
  8165. $self._do_((function(each){
  8166. return $core.withContext(function($ctx2) {
  8167. $1=$recv(anObject).__eq(each);
  8168. if($core.assert($1)){
  8169. tally=$recv(tally).__plus((1));
  8170. return tally;
  8171. }
  8172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8173. }));
  8174. return tally;
  8175. }, function($ctx1) {$ctx1.fill(self,"occurrencesOf:",{anObject:anObject,tally:tally},$globals.Collection)});
  8176. },
  8177. args: ["anObject"],
  8178. 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",
  8179. referencedClasses: [],
  8180. messageSends: ["do:", "ifTrue:", "=", "+"]
  8181. }),
  8182. $globals.Collection);
  8183. $core.addMethod(
  8184. $core.method({
  8185. selector: "putOn:",
  8186. protocol: "streaming",
  8187. fn: function (aStream){
  8188. var self=this,$self=this;
  8189. return $core.withContext(function($ctx1) {
  8190. $self._do_((function(each){
  8191. return $core.withContext(function($ctx2) {
  8192. return $recv(each)._putOn_(aStream);
  8193. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8194. }));
  8195. return self;
  8196. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.Collection)});
  8197. },
  8198. args: ["aStream"],
  8199. source: "putOn: aStream\x0a\x09self do: [ :each | each putOn: aStream ]",
  8200. referencedClasses: [],
  8201. messageSends: ["do:", "putOn:"]
  8202. }),
  8203. $globals.Collection);
  8204. $core.addMethod(
  8205. $core.method({
  8206. selector: "reject:",
  8207. protocol: "enumerating",
  8208. fn: function (aBlock){
  8209. var self=this,$self=this;
  8210. return $core.withContext(function($ctx1) {
  8211. return $self._select_((function(each){
  8212. return $core.withContext(function($ctx2) {
  8213. return $recv($recv(aBlock)._value_(each)).__eq(false);
  8214. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8215. }));
  8216. }, function($ctx1) {$ctx1.fill(self,"reject:",{aBlock:aBlock},$globals.Collection)});
  8217. },
  8218. args: ["aBlock"],
  8219. source: "reject: aBlock\x0a\x09^ self select: [ :each | (aBlock value: each) = false ]",
  8220. referencedClasses: [],
  8221. messageSends: ["select:", "=", "value:"]
  8222. }),
  8223. $globals.Collection);
  8224. $core.addMethod(
  8225. $core.method({
  8226. selector: "remove:",
  8227. protocol: "adding/removing",
  8228. fn: function (anObject){
  8229. var self=this,$self=this;
  8230. return $core.withContext(function($ctx1) {
  8231. return $self._remove_ifAbsent_(anObject,(function(){
  8232. return $core.withContext(function($ctx2) {
  8233. return $self._errorNotFound();
  8234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8235. }));
  8236. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.Collection)});
  8237. },
  8238. args: ["anObject"],
  8239. source: "remove: anObject\x0a\x09^ self remove: anObject ifAbsent: [ self errorNotFound ]",
  8240. referencedClasses: [],
  8241. messageSends: ["remove:ifAbsent:", "errorNotFound"]
  8242. }),
  8243. $globals.Collection);
  8244. $core.addMethod(
  8245. $core.method({
  8246. selector: "remove:ifAbsent:",
  8247. protocol: "adding/removing",
  8248. fn: function (anObject,aBlock){
  8249. var self=this,$self=this;
  8250. return $core.withContext(function($ctx1) {
  8251. $self._subclassResponsibility();
  8252. return self;
  8253. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.Collection)});
  8254. },
  8255. args: ["anObject", "aBlock"],
  8256. source: "remove: anObject ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  8257. referencedClasses: [],
  8258. messageSends: ["subclassResponsibility"]
  8259. }),
  8260. $globals.Collection);
  8261. $core.addMethod(
  8262. $core.method({
  8263. selector: "removeAll",
  8264. protocol: "adding/removing",
  8265. fn: function (){
  8266. var self=this,$self=this;
  8267. return $core.withContext(function($ctx1) {
  8268. $self._subclassResponsibility();
  8269. return self;
  8270. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Collection)});
  8271. },
  8272. args: [],
  8273. source: "removeAll\x0a\x09self subclassResponsibility",
  8274. referencedClasses: [],
  8275. messageSends: ["subclassResponsibility"]
  8276. }),
  8277. $globals.Collection);
  8278. $core.addMethod(
  8279. $core.method({
  8280. selector: "select:",
  8281. protocol: "enumerating",
  8282. fn: function (aBlock){
  8283. var self=this,$self=this;
  8284. var stream;
  8285. return $core.withContext(function($ctx1) {
  8286. var $1;
  8287. stream=$recv($recv($self._class())._new())._writeStream();
  8288. $self._do_((function(each){
  8289. return $core.withContext(function($ctx2) {
  8290. $1=$recv(aBlock)._value_(each);
  8291. if($core.assert($1)){
  8292. return $recv(stream)._nextPut_(each);
  8293. }
  8294. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8295. }));
  8296. return $recv(stream)._contents();
  8297. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,stream:stream},$globals.Collection)});
  8298. },
  8299. args: ["aBlock"],
  8300. 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",
  8301. referencedClasses: [],
  8302. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8303. }),
  8304. $globals.Collection);
  8305. $core.addMethod(
  8306. $core.method({
  8307. selector: "select:thenCollect:",
  8308. protocol: "enumerating",
  8309. fn: function (selectBlock,collectBlock){
  8310. var self=this,$self=this;
  8311. var stream;
  8312. return $core.withContext(function($ctx1) {
  8313. var $1;
  8314. stream=$recv($recv($self._class())._new())._writeStream();
  8315. $self._do_((function(each){
  8316. return $core.withContext(function($ctx2) {
  8317. $1=$recv(selectBlock)._value_(each);
  8318. $ctx2.sendIdx["value:"]=1;
  8319. if($core.assert($1)){
  8320. return $recv(stream)._nextPut_($recv(collectBlock)._value_(each));
  8321. }
  8322. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8323. }));
  8324. return $recv(stream)._contents();
  8325. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,stream:stream},$globals.Collection)});
  8326. },
  8327. args: ["selectBlock", "collectBlock"],
  8328. 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",
  8329. referencedClasses: [],
  8330. messageSends: ["writeStream", "new", "class", "do:", "ifTrue:", "value:", "nextPut:", "contents"]
  8331. }),
  8332. $globals.Collection);
  8333. $core.addMethod(
  8334. $core.method({
  8335. selector: "shallowCopy",
  8336. protocol: "copying",
  8337. fn: function (){
  8338. var self=this,$self=this;
  8339. return $core.withContext(function($ctx1) {
  8340. return $self._collect_((function(each){
  8341. return each;
  8342. }));
  8343. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Collection)});
  8344. },
  8345. args: [],
  8346. source: "shallowCopy\x0a\x09^ self collect: [ :each | each ]",
  8347. referencedClasses: [],
  8348. messageSends: ["collect:"]
  8349. }),
  8350. $globals.Collection);
  8351. $core.addMethod(
  8352. $core.method({
  8353. selector: "single",
  8354. protocol: "accessing",
  8355. fn: function (){
  8356. var self=this,$self=this;
  8357. return $core.withContext(function($ctx1) {
  8358. var $1;
  8359. $self._ifEmpty_((function(){
  8360. return $core.withContext(function($ctx2) {
  8361. return $self._error_("Collection is empty");
  8362. $ctx2.sendIdx["error:"]=1;
  8363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8364. }));
  8365. $1=$recv($self._size()).__gt((1));
  8366. if($core.assert($1)){
  8367. $self._error_("Collection holds more than one element");
  8368. }
  8369. return $self._anyOne();
  8370. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.Collection)});
  8371. },
  8372. args: [],
  8373. 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",
  8374. referencedClasses: [],
  8375. messageSends: ["ifEmpty:", "error:", "ifTrue:", ">", "size", "anyOne"]
  8376. }),
  8377. $globals.Collection);
  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. $self._subclassResponsibility();
  8386. return self;
  8387. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Collection)});
  8388. },
  8389. args: [],
  8390. source: "size\x0a\x09self subclassResponsibility",
  8391. referencedClasses: [],
  8392. messageSends: ["subclassResponsibility"]
  8393. }),
  8394. $globals.Collection);
  8395. $core.addMethod(
  8396. $core.method({
  8397. selector: "classTag",
  8398. protocol: "accessing",
  8399. fn: function (){
  8400. var self=this,$self=this;
  8401. return "collection";
  8402. },
  8403. args: [],
  8404. 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'",
  8405. referencedClasses: [],
  8406. messageSends: []
  8407. }),
  8408. $globals.Collection.a$cls);
  8409. $core.addMethod(
  8410. $core.method({
  8411. selector: "new:",
  8412. protocol: "instance creation",
  8413. fn: function (anInteger){
  8414. var self=this,$self=this;
  8415. return $core.withContext(function($ctx1) {
  8416. return $self._new();
  8417. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Collection.a$cls)});
  8418. },
  8419. args: ["anInteger"],
  8420. source: "new: anInteger\x0a\x09^ self new",
  8421. referencedClasses: [],
  8422. messageSends: ["new"]
  8423. }),
  8424. $globals.Collection.a$cls);
  8425. $core.addMethod(
  8426. $core.method({
  8427. selector: "with:",
  8428. protocol: "instance creation",
  8429. fn: function (anObject){
  8430. var self=this,$self=this;
  8431. return $core.withContext(function($ctx1) {
  8432. var $1;
  8433. $1=$self._new();
  8434. $recv($1)._add_(anObject);
  8435. return $recv($1)._yourself();
  8436. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Collection.a$cls)});
  8437. },
  8438. args: ["anObject"],
  8439. source: "with: anObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09yourself",
  8440. referencedClasses: [],
  8441. messageSends: ["add:", "new", "yourself"]
  8442. }),
  8443. $globals.Collection.a$cls);
  8444. $core.addMethod(
  8445. $core.method({
  8446. selector: "with:with:",
  8447. protocol: "instance creation",
  8448. fn: function (anObject,anotherObject){
  8449. var self=this,$self=this;
  8450. return $core.withContext(function($ctx1) {
  8451. var $1;
  8452. $1=$self._new();
  8453. $recv($1)._add_(anObject);
  8454. $ctx1.sendIdx["add:"]=1;
  8455. $recv($1)._add_(anotherObject);
  8456. return $recv($1)._yourself();
  8457. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anotherObject:anotherObject},$globals.Collection.a$cls)});
  8458. },
  8459. args: ["anObject", "anotherObject"],
  8460. source: "with: anObject with: anotherObject\x0a\x09\x09^ self new\x0a\x09\x09add: anObject;\x0a\x09\x09add: anotherObject;\x0a\x09\x09yourself",
  8461. referencedClasses: [],
  8462. messageSends: ["add:", "new", "yourself"]
  8463. }),
  8464. $globals.Collection.a$cls);
  8465. $core.addMethod(
  8466. $core.method({
  8467. selector: "with:with:with:",
  8468. protocol: "instance creation",
  8469. fn: function (firstObject,secondObject,thirdObject){
  8470. var self=this,$self=this;
  8471. return $core.withContext(function($ctx1) {
  8472. var $1;
  8473. $1=$self._new();
  8474. $recv($1)._add_(firstObject);
  8475. $ctx1.sendIdx["add:"]=1;
  8476. $recv($1)._add_(secondObject);
  8477. $ctx1.sendIdx["add:"]=2;
  8478. $recv($1)._add_(thirdObject);
  8479. return $recv($1)._yourself();
  8480. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{firstObject:firstObject,secondObject:secondObject,thirdObject:thirdObject},$globals.Collection.a$cls)});
  8481. },
  8482. args: ["firstObject", "secondObject", "thirdObject"],
  8483. 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",
  8484. referencedClasses: [],
  8485. messageSends: ["add:", "new", "yourself"]
  8486. }),
  8487. $globals.Collection.a$cls);
  8488. $core.addMethod(
  8489. $core.method({
  8490. selector: "withAll:",
  8491. protocol: "instance creation",
  8492. fn: function (aCollection){
  8493. var self=this,$self=this;
  8494. return $core.withContext(function($ctx1) {
  8495. var $1;
  8496. $1=$self._new();
  8497. $recv($1)._addAll_(aCollection);
  8498. return $recv($1)._yourself();
  8499. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection},$globals.Collection.a$cls)});
  8500. },
  8501. args: ["aCollection"],
  8502. source: "withAll: aCollection\x0a\x09\x09^ self new\x0a\x09\x09addAll: aCollection;\x0a\x09\x09yourself",
  8503. referencedClasses: [],
  8504. messageSends: ["addAll:", "new", "yourself"]
  8505. }),
  8506. $globals.Collection.a$cls);
  8507. $core.addClass("IndexableCollection", $globals.Collection, [], "Kernel-Collections");
  8508. $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.";
  8509. $core.addMethod(
  8510. $core.method({
  8511. selector: "at:",
  8512. protocol: "accessing",
  8513. fn: function (anIndex){
  8514. var self=this,$self=this;
  8515. return $core.withContext(function($ctx1) {
  8516. return $self._at_ifAbsent_(anIndex,(function(){
  8517. return $core.withContext(function($ctx2) {
  8518. return $self._errorNotFound();
  8519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8520. }));
  8521. }, function($ctx1) {$ctx1.fill(self,"at:",{anIndex:anIndex},$globals.IndexableCollection)});
  8522. },
  8523. args: ["anIndex"],
  8524. 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 ]",
  8525. referencedClasses: [],
  8526. messageSends: ["at:ifAbsent:", "errorNotFound"]
  8527. }),
  8528. $globals.IndexableCollection);
  8529. $core.addMethod(
  8530. $core.method({
  8531. selector: "at:ifAbsent:",
  8532. protocol: "accessing",
  8533. fn: function (anIndex,aBlock){
  8534. var self=this,$self=this;
  8535. return $core.withContext(function($ctx1) {
  8536. $self._subclassResponsibility();
  8537. return self;
  8538. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8539. },
  8540. args: ["anIndex", "aBlock"],
  8541. 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",
  8542. referencedClasses: [],
  8543. messageSends: ["subclassResponsibility"]
  8544. }),
  8545. $globals.IndexableCollection);
  8546. $core.addMethod(
  8547. $core.method({
  8548. selector: "at:ifAbsentPut:",
  8549. protocol: "accessing",
  8550. fn: function (aKey,aBlock){
  8551. var self=this,$self=this;
  8552. return $core.withContext(function($ctx1) {
  8553. return $self._at_ifAbsent_(aKey,(function(){
  8554. return $core.withContext(function($ctx2) {
  8555. return $self._at_put_(aKey,$recv(aBlock)._value());
  8556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8557. }));
  8558. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsentPut:",{aKey:aKey,aBlock:aBlock},$globals.IndexableCollection)});
  8559. },
  8560. args: ["aKey", "aBlock"],
  8561. source: "at: aKey ifAbsentPut: aBlock\x0a\x09^ self at: aKey ifAbsent: [\x0a\x09\x09self at: aKey put: aBlock value ]",
  8562. referencedClasses: [],
  8563. messageSends: ["at:ifAbsent:", "at:put:", "value"]
  8564. }),
  8565. $globals.IndexableCollection);
  8566. $core.addMethod(
  8567. $core.method({
  8568. selector: "at:ifPresent:",
  8569. protocol: "accessing",
  8570. fn: function (anIndex,aBlock){
  8571. var self=this,$self=this;
  8572. return $core.withContext(function($ctx1) {
  8573. return $self._at_ifPresent_ifAbsent_(anIndex,aBlock,(function(){
  8574. return nil;
  8575. }));
  8576. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{anIndex:anIndex,aBlock:aBlock},$globals.IndexableCollection)});
  8577. },
  8578. args: ["anIndex", "aBlock"],
  8579. 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 ]",
  8580. referencedClasses: [],
  8581. messageSends: ["at:ifPresent:ifAbsent:"]
  8582. }),
  8583. $globals.IndexableCollection);
  8584. $core.addMethod(
  8585. $core.method({
  8586. selector: "at:ifPresent:ifAbsent:",
  8587. protocol: "accessing",
  8588. fn: function (anIndex,aBlock,anotherBlock){
  8589. var self=this,$self=this;
  8590. return $core.withContext(function($ctx1) {
  8591. $self._subclassResponsibility();
  8592. return self;
  8593. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.IndexableCollection)});
  8594. },
  8595. args: ["anIndex", "aBlock", "anotherBlock"],
  8596. 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",
  8597. referencedClasses: [],
  8598. messageSends: ["subclassResponsibility"]
  8599. }),
  8600. $globals.IndexableCollection);
  8601. $core.addMethod(
  8602. $core.method({
  8603. selector: "at:put:",
  8604. protocol: "accessing",
  8605. fn: function (anIndex,anObject){
  8606. var self=this,$self=this;
  8607. return $core.withContext(function($ctx1) {
  8608. $self._subclassResponsibility();
  8609. return self;
  8610. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.IndexableCollection)});
  8611. },
  8612. args: ["anIndex", "anObject"],
  8613. source: "at: anIndex put: anObject\x0a\x09\x22Store anObject under the given index in the receiver.\x22\x0a\x0a\x09self subclassResponsibility",
  8614. referencedClasses: [],
  8615. messageSends: ["subclassResponsibility"]
  8616. }),
  8617. $globals.IndexableCollection);
  8618. $core.addMethod(
  8619. $core.method({
  8620. selector: "indexOf:",
  8621. protocol: "accessing",
  8622. fn: function (anObject){
  8623. var self=this,$self=this;
  8624. return $core.withContext(function($ctx1) {
  8625. return $self._indexOf_ifAbsent_(anObject,(function(){
  8626. return $core.withContext(function($ctx2) {
  8627. return $self._errorNotFound();
  8628. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  8629. }));
  8630. }, function($ctx1) {$ctx1.fill(self,"indexOf:",{anObject:anObject},$globals.IndexableCollection)});
  8631. },
  8632. args: ["anObject"],
  8633. 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 ]",
  8634. referencedClasses: [],
  8635. messageSends: ["indexOf:ifAbsent:", "errorNotFound"]
  8636. }),
  8637. $globals.IndexableCollection);
  8638. $core.addMethod(
  8639. $core.method({
  8640. selector: "indexOf:ifAbsent:",
  8641. protocol: "accessing",
  8642. fn: function (anObject,aBlock){
  8643. var self=this,$self=this;
  8644. return $core.withContext(function($ctx1) {
  8645. $self._subclassResponsibility();
  8646. return self;
  8647. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.IndexableCollection)});
  8648. },
  8649. args: ["anObject", "aBlock"],
  8650. 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",
  8651. referencedClasses: [],
  8652. messageSends: ["subclassResponsibility"]
  8653. }),
  8654. $globals.IndexableCollection);
  8655. $core.addMethod(
  8656. $core.method({
  8657. selector: "with:do:",
  8658. protocol: "enumerating",
  8659. fn: function (anotherCollection,aBlock){
  8660. var self=this,$self=this;
  8661. return $core.withContext(function($ctx1) {
  8662. $self._withIndexDo_((function(each,index){
  8663. return $core.withContext(function($ctx2) {
  8664. return $recv(aBlock)._value_value_(each,$recv(anotherCollection)._at_(index));
  8665. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  8666. }));
  8667. return self;
  8668. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.IndexableCollection)});
  8669. },
  8670. args: ["anotherCollection", "aBlock"],
  8671. 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) ]",
  8672. referencedClasses: [],
  8673. messageSends: ["withIndexDo:", "value:value:", "at:"]
  8674. }),
  8675. $globals.IndexableCollection);
  8676. $core.addMethod(
  8677. $core.method({
  8678. selector: "withIndexDo:",
  8679. protocol: "enumerating",
  8680. fn: function (aBlock){
  8681. var self=this,$self=this;
  8682. return $core.withContext(function($ctx1) {
  8683. $self._subclassResponsibility();
  8684. return self;
  8685. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.IndexableCollection)});
  8686. },
  8687. args: ["aBlock"],
  8688. 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",
  8689. referencedClasses: [],
  8690. messageSends: ["subclassResponsibility"]
  8691. }),
  8692. $globals.IndexableCollection);
  8693. $core.addClass("AssociativeCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  8694. $globals.AssociativeCollection.comment="I am a base class for object-indexed collections (Dictionary et.al.).";
  8695. $core.addMethod(
  8696. $core.method({
  8697. selector: "=",
  8698. protocol: "comparing",
  8699. fn: function (anAssocitativeCollection){
  8700. var self=this,$self=this;
  8701. return $core.withContext(function($ctx1) {
  8702. var $2,$1,$4,$3,$5;
  8703. $2=$self._class();
  8704. $ctx1.sendIdx["class"]=1;
  8705. $1=$recv($2).__eq($recv(anAssocitativeCollection)._class());
  8706. $ctx1.sendIdx["="]=1;
  8707. if(!$core.assert($1)){
  8708. return false;
  8709. }
  8710. $4=$self._size();
  8711. $ctx1.sendIdx["size"]=1;
  8712. $3=$recv($4).__eq($recv(anAssocitativeCollection)._size());
  8713. $ctx1.sendIdx["="]=2;
  8714. if(!$core.assert($3)){
  8715. return false;
  8716. }
  8717. $5=$self._associations();
  8718. $ctx1.sendIdx["associations"]=1;
  8719. return $recv($5).__eq($recv(anAssocitativeCollection)._associations());
  8720. }, function($ctx1) {$ctx1.fill(self,"=",{anAssocitativeCollection:anAssocitativeCollection},$globals.AssociativeCollection)});
  8721. },
  8722. args: ["anAssocitativeCollection"],
  8723. source: "= anAssocitativeCollection\x0a\x09self class = anAssocitativeCollection class ifFalse: [ ^ false ].\x0a\x09self size = anAssocitativeCollection size ifFalse: [ ^ false ].\x0a\x09^ self associations = anAssocitativeCollection associations",
  8724. referencedClasses: [],
  8725. messageSends: ["ifFalse:", "=", "class", "size", "associations"]
  8726. }),
  8727. $globals.AssociativeCollection);
  8728. $core.addMethod(
  8729. $core.method({
  8730. selector: "add:",
  8731. protocol: "adding/removing",
  8732. fn: function (anAssociation){
  8733. var self=this,$self=this;
  8734. return $core.withContext(function($ctx1) {
  8735. $self._at_put_($recv(anAssociation)._key(),$recv(anAssociation)._value());
  8736. return self;
  8737. }, function($ctx1) {$ctx1.fill(self,"add:",{anAssociation:anAssociation},$globals.AssociativeCollection)});
  8738. },
  8739. args: ["anAssociation"],
  8740. source: "add: anAssociation\x0a\x09self at: anAssociation key put: anAssociation value",
  8741. referencedClasses: [],
  8742. messageSends: ["at:put:", "key", "value"]
  8743. }),
  8744. $globals.AssociativeCollection);
  8745. $core.addMethod(
  8746. $core.method({
  8747. selector: "addAll:",
  8748. protocol: "adding/removing",
  8749. fn: function (anAssociativeCollection){
  8750. var self=this,$self=this;
  8751. return $core.withContext(function($ctx1) {
  8752. (
  8753. $ctx1.supercall = true,
  8754. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._addAll_.apply($self, [$recv(anAssociativeCollection)._associations()]));
  8755. $ctx1.supercall = false;
  8756. return anAssociativeCollection;
  8757. }, function($ctx1) {$ctx1.fill(self,"addAll:",{anAssociativeCollection:anAssociativeCollection},$globals.AssociativeCollection)});
  8758. },
  8759. args: ["anAssociativeCollection"],
  8760. source: "addAll: anAssociativeCollection\x0a\x09super addAll: anAssociativeCollection associations.\x0a\x09^ anAssociativeCollection",
  8761. referencedClasses: [],
  8762. messageSends: ["addAll:", "associations"]
  8763. }),
  8764. $globals.AssociativeCollection);
  8765. $core.addMethod(
  8766. $core.method({
  8767. selector: "asDictionary",
  8768. protocol: "converting",
  8769. fn: function (){
  8770. var self=this,$self=this;
  8771. return $core.withContext(function($ctx1) {
  8772. return $recv($globals.Dictionary)._from_($self._associations());
  8773. }, function($ctx1) {$ctx1.fill(self,"asDictionary",{},$globals.AssociativeCollection)});
  8774. },
  8775. args: [],
  8776. source: "asDictionary\x0a\x09^ Dictionary from: self associations",
  8777. referencedClasses: ["Dictionary"],
  8778. messageSends: ["from:", "associations"]
  8779. }),
  8780. $globals.AssociativeCollection);
  8781. $core.addMethod(
  8782. $core.method({
  8783. selector: "asHashedCollection",
  8784. protocol: "converting",
  8785. fn: function (){
  8786. var self=this,$self=this;
  8787. return $core.withContext(function($ctx1) {
  8788. return $recv($globals.HashedCollection)._from_($self._associations());
  8789. }, function($ctx1) {$ctx1.fill(self,"asHashedCollection",{},$globals.AssociativeCollection)});
  8790. },
  8791. args: [],
  8792. source: "asHashedCollection\x0a\x09^ HashedCollection from: self associations",
  8793. referencedClasses: ["HashedCollection"],
  8794. messageSends: ["from:", "associations"]
  8795. }),
  8796. $globals.AssociativeCollection);
  8797. $core.addMethod(
  8798. $core.method({
  8799. selector: "asJavaScriptObject",
  8800. protocol: "converting",
  8801. fn: function (){
  8802. var self=this,$self=this;
  8803. var hash;
  8804. return $core.withContext(function($ctx1) {
  8805. hash=$recv($globals.HashedCollection)._new();
  8806. $self._keysAndValuesDo_((function(key,value){
  8807. return $core.withContext(function($ctx2) {
  8808. return $recv(hash)._at_put_(key,$recv(value)._asJavaScriptObject());
  8809. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8810. }));
  8811. return hash;
  8812. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{hash:hash},$globals.AssociativeCollection)});
  8813. },
  8814. args: [],
  8815. 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",
  8816. referencedClasses: ["HashedCollection"],
  8817. messageSends: ["new", "keysAndValuesDo:", "at:put:", "asJavaScriptObject"]
  8818. }),
  8819. $globals.AssociativeCollection);
  8820. $core.addMethod(
  8821. $core.method({
  8822. selector: "associations",
  8823. protocol: "accessing",
  8824. fn: function (){
  8825. var self=this,$self=this;
  8826. var associations;
  8827. return $core.withContext(function($ctx1) {
  8828. associations=[];
  8829. $self._associationsDo_((function(each){
  8830. return $core.withContext(function($ctx2) {
  8831. return $recv(associations)._add_(each);
  8832. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  8833. }));
  8834. return associations;
  8835. }, function($ctx1) {$ctx1.fill(self,"associations",{associations:associations},$globals.AssociativeCollection)});
  8836. },
  8837. args: [],
  8838. source: "associations\x0a\x09| associations |\x0a\x09associations := #().\x0a\x09self associationsDo: [ :each | associations add: each ].\x0a\x09^ associations",
  8839. referencedClasses: [],
  8840. messageSends: ["associationsDo:", "add:"]
  8841. }),
  8842. $globals.AssociativeCollection);
  8843. $core.addMethod(
  8844. $core.method({
  8845. selector: "associationsDo:",
  8846. protocol: "enumerating",
  8847. fn: function (aBlock){
  8848. var self=this,$self=this;
  8849. return $core.withContext(function($ctx1) {
  8850. $self._keysAndValuesDo_((function(key,value){
  8851. return $core.withContext(function($ctx2) {
  8852. return $recv(aBlock)._value_($recv($globals.Association)._key_value_(key,value));
  8853. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8854. }));
  8855. return self;
  8856. }, function($ctx1) {$ctx1.fill(self,"associationsDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8857. },
  8858. args: ["aBlock"],
  8859. source: "associationsDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value |\x0a\x09\x09aBlock value: (Association key: key value: value) ]",
  8860. referencedClasses: ["Association"],
  8861. messageSends: ["keysAndValuesDo:", "value:", "key:value:"]
  8862. }),
  8863. $globals.AssociativeCollection);
  8864. $core.addMethod(
  8865. $core.method({
  8866. selector: "at:ifPresent:ifAbsent:",
  8867. protocol: "accessing",
  8868. fn: function (aKey,aBlock,anotherBlock){
  8869. var self=this,$self=this;
  8870. return $core.withContext(function($ctx1) {
  8871. var $1;
  8872. $1=$self._includesKey_(aKey);
  8873. if($core.assert($1)){
  8874. return $recv(aBlock)._value_($self._at_(aKey));
  8875. } else {
  8876. return $recv(anotherBlock)._value();
  8877. }
  8878. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aKey:aKey,aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8879. },
  8880. args: ["aKey", "aBlock", "anotherBlock"],
  8881. 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 ]",
  8882. referencedClasses: [],
  8883. messageSends: ["ifTrue:ifFalse:", "includesKey:", "value:", "at:", "value"]
  8884. }),
  8885. $globals.AssociativeCollection);
  8886. $core.addMethod(
  8887. $core.method({
  8888. selector: "collect:",
  8889. protocol: "enumerating",
  8890. fn: function (aBlock){
  8891. var self=this,$self=this;
  8892. var newDict;
  8893. return $core.withContext(function($ctx1) {
  8894. newDict=$recv($self._class())._new();
  8895. $self._keysAndValuesDo_((function(key,value){
  8896. return $core.withContext(function($ctx2) {
  8897. return $recv(newDict)._at_put_(key,$recv(aBlock)._value_(value));
  8898. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8899. }));
  8900. return newDict;
  8901. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  8902. },
  8903. args: ["aBlock"],
  8904. 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",
  8905. referencedClasses: [],
  8906. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "value:"]
  8907. }),
  8908. $globals.AssociativeCollection);
  8909. $core.addMethod(
  8910. $core.method({
  8911. selector: "deepCopy",
  8912. protocol: "copying",
  8913. fn: function (){
  8914. var self=this,$self=this;
  8915. var copy;
  8916. return $core.withContext(function($ctx1) {
  8917. copy=$recv($self._class())._new();
  8918. $self._keysAndValuesDo_((function(key,value){
  8919. return $core.withContext(function($ctx2) {
  8920. return $recv(copy)._at_put_(key,$recv(value)._deepCopy());
  8921. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  8922. }));
  8923. return copy;
  8924. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{copy:copy},$globals.AssociativeCollection)});
  8925. },
  8926. args: [],
  8927. 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",
  8928. referencedClasses: [],
  8929. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:", "deepCopy"]
  8930. }),
  8931. $globals.AssociativeCollection);
  8932. $core.addMethod(
  8933. $core.method({
  8934. selector: "detect:ifNone:",
  8935. protocol: "enumerating",
  8936. fn: function (aBlock,anotherBlock){
  8937. var self=this,$self=this;
  8938. return $core.withContext(function($ctx1) {
  8939. return $recv($self._values())._detect_ifNone_(aBlock,anotherBlock);
  8940. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.AssociativeCollection)});
  8941. },
  8942. args: ["aBlock", "anotherBlock"],
  8943. source: "detect: aBlock ifNone: anotherBlock\x0a\x09^ self values detect: aBlock ifNone: anotherBlock",
  8944. referencedClasses: [],
  8945. messageSends: ["detect:ifNone:", "values"]
  8946. }),
  8947. $globals.AssociativeCollection);
  8948. $core.addMethod(
  8949. $core.method({
  8950. selector: "do:",
  8951. protocol: "enumerating",
  8952. fn: function (aBlock){
  8953. var self=this,$self=this;
  8954. return $core.withContext(function($ctx1) {
  8955. $self._valuesDo_(aBlock);
  8956. return self;
  8957. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.AssociativeCollection)});
  8958. },
  8959. args: ["aBlock"],
  8960. source: "do: aBlock\x0a\x09self valuesDo: aBlock",
  8961. referencedClasses: [],
  8962. messageSends: ["valuesDo:"]
  8963. }),
  8964. $globals.AssociativeCollection);
  8965. $core.addMethod(
  8966. $core.method({
  8967. selector: "includes:",
  8968. protocol: "enumerating",
  8969. fn: function (anObject){
  8970. var self=this,$self=this;
  8971. return $core.withContext(function($ctx1) {
  8972. return $recv($self._values())._includes_(anObject);
  8973. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.AssociativeCollection)});
  8974. },
  8975. args: ["anObject"],
  8976. source: "includes: anObject\x0a\x09^ self values includes: anObject",
  8977. referencedClasses: [],
  8978. messageSends: ["includes:", "values"]
  8979. }),
  8980. $globals.AssociativeCollection);
  8981. $core.addMethod(
  8982. $core.method({
  8983. selector: "includesKey:",
  8984. protocol: "testing",
  8985. fn: function (aKey){
  8986. var self=this,$self=this;
  8987. return $core.withContext(function($ctx1) {
  8988. $self._subclassResponsibility();
  8989. return self;
  8990. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.AssociativeCollection)});
  8991. },
  8992. args: ["aKey"],
  8993. source: "includesKey: aKey\x0a\x09self subclassResponsibility",
  8994. referencedClasses: [],
  8995. messageSends: ["subclassResponsibility"]
  8996. }),
  8997. $globals.AssociativeCollection);
  8998. $core.addMethod(
  8999. $core.method({
  9000. selector: "indexOf:ifAbsent:",
  9001. protocol: "accessing",
  9002. fn: function (anObject,aBlock){
  9003. var self=this,$self=this;
  9004. return $core.withContext(function($ctx1) {
  9005. return $recv($self._keys())._detect_ifNone_((function(each){
  9006. return $core.withContext(function($ctx2) {
  9007. return $recv($self._at_(each)).__eq(anObject);
  9008. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9009. }),aBlock);
  9010. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9011. },
  9012. args: ["anObject", "aBlock"],
  9013. source: "indexOf: anObject ifAbsent: aBlock\x0a\x09^ self keys \x0a\x09\x09detect: [ :each | (self at: each) = anObject ] \x0a\x09\x09ifNone: aBlock",
  9014. referencedClasses: [],
  9015. messageSends: ["detect:ifNone:", "keys", "=", "at:"]
  9016. }),
  9017. $globals.AssociativeCollection);
  9018. $core.addMethod(
  9019. $core.method({
  9020. selector: "keyAtValue:",
  9021. protocol: "accessing",
  9022. fn: function (anObject){
  9023. var self=this,$self=this;
  9024. return $core.withContext(function($ctx1) {
  9025. return $self._keyAtValue_ifAbsent_(anObject,(function(){
  9026. return $core.withContext(function($ctx2) {
  9027. return $self._errorNotFound();
  9028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9029. }));
  9030. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:",{anObject:anObject},$globals.AssociativeCollection)});
  9031. },
  9032. args: ["anObject"],
  9033. source: "keyAtValue: anObject\x0a\x09^ self keyAtValue: anObject ifAbsent: [ self errorNotFound ]",
  9034. referencedClasses: [],
  9035. messageSends: ["keyAtValue:ifAbsent:", "errorNotFound"]
  9036. }),
  9037. $globals.AssociativeCollection);
  9038. $core.addMethod(
  9039. $core.method({
  9040. selector: "keyAtValue:ifAbsent:",
  9041. protocol: "accessing",
  9042. fn: function (anObject,aBlock){
  9043. var self=this,$self=this;
  9044. return $core.withContext(function($ctx1) {
  9045. return $self._indexOf_ifAbsent_(anObject,aBlock);
  9046. }, function($ctx1) {$ctx1.fill(self,"keyAtValue:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.AssociativeCollection)});
  9047. },
  9048. args: ["anObject", "aBlock"],
  9049. source: "keyAtValue: anObject ifAbsent: aBlock\x0a\x09^ self indexOf: anObject ifAbsent: aBlock",
  9050. referencedClasses: [],
  9051. messageSends: ["indexOf:ifAbsent:"]
  9052. }),
  9053. $globals.AssociativeCollection);
  9054. $core.addMethod(
  9055. $core.method({
  9056. selector: "keys",
  9057. protocol: "accessing",
  9058. fn: function (){
  9059. var self=this,$self=this;
  9060. return $core.withContext(function($ctx1) {
  9061. $self._subclassResponsibility();
  9062. return self;
  9063. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.AssociativeCollection)});
  9064. },
  9065. args: [],
  9066. source: "keys\x0a\x09self subclassResponsibility",
  9067. referencedClasses: [],
  9068. messageSends: ["subclassResponsibility"]
  9069. }),
  9070. $globals.AssociativeCollection);
  9071. $core.addMethod(
  9072. $core.method({
  9073. selector: "keysAndValuesDo:",
  9074. protocol: "enumerating",
  9075. fn: function (aBlock){
  9076. var self=this,$self=this;
  9077. return $core.withContext(function($ctx1) {
  9078. $self._keysDo_((function(each){
  9079. return $core.withContext(function($ctx2) {
  9080. return $recv(aBlock)._value_value_(each,$self._at_(each));
  9081. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9082. }));
  9083. return self;
  9084. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9085. },
  9086. args: ["aBlock"],
  9087. source: "keysAndValuesDo: aBlock\x0a\x09self keysDo: [ :each |\x0a\x09\x09aBlock value: each value: (self at: each) ]",
  9088. referencedClasses: [],
  9089. messageSends: ["keysDo:", "value:value:", "at:"]
  9090. }),
  9091. $globals.AssociativeCollection);
  9092. $core.addMethod(
  9093. $core.method({
  9094. selector: "keysDo:",
  9095. protocol: "enumerating",
  9096. fn: function (aBlock){
  9097. var self=this,$self=this;
  9098. return $core.withContext(function($ctx1) {
  9099. $self._subclassResponsibility();
  9100. return self;
  9101. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9102. },
  9103. args: ["aBlock"],
  9104. source: "keysDo: aBlock\x0a\x09self subclassResponsibility",
  9105. referencedClasses: [],
  9106. messageSends: ["subclassResponsibility"]
  9107. }),
  9108. $globals.AssociativeCollection);
  9109. $core.addMethod(
  9110. $core.method({
  9111. selector: "printOn:",
  9112. protocol: "printing",
  9113. fn: function (aStream){
  9114. var self=this,$self=this;
  9115. return $core.withContext(function($ctx1) {
  9116. (
  9117. $ctx1.supercall = true,
  9118. ($globals.AssociativeCollection.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  9119. $ctx1.supercall = false;
  9120. $ctx1.sendIdx["printOn:"]=1;
  9121. $recv(aStream)._nextPutAll_(" (");
  9122. $ctx1.sendIdx["nextPutAll:"]=1;
  9123. $recv($self._associations())._do_separatedBy_((function(each){
  9124. return $core.withContext(function($ctx2) {
  9125. return $recv(each)._printOn_(aStream);
  9126. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9127. }),(function(){
  9128. return $core.withContext(function($ctx2) {
  9129. return $recv(aStream)._nextPutAll_(" , ");
  9130. $ctx2.sendIdx["nextPutAll:"]=2;
  9131. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9132. }));
  9133. $recv(aStream)._nextPutAll_(")");
  9134. return self;
  9135. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AssociativeCollection)});
  9136. },
  9137. args: ["aStream"],
  9138. 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: ')'",
  9139. referencedClasses: [],
  9140. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:", "associations"]
  9141. }),
  9142. $globals.AssociativeCollection);
  9143. $core.addMethod(
  9144. $core.method({
  9145. selector: "remove:ifAbsent:",
  9146. protocol: "adding/removing",
  9147. fn: function (aKey,aBlock){
  9148. var self=this,$self=this;
  9149. return $core.withContext(function($ctx1) {
  9150. return $self._removeKey_ifAbsent_(aKey,aBlock);
  9151. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9152. },
  9153. args: ["aKey", "aBlock"],
  9154. source: "remove: aKey ifAbsent: aBlock\x0a\x09^ self removeKey: aKey ifAbsent: aBlock",
  9155. referencedClasses: [],
  9156. messageSends: ["removeKey:ifAbsent:"]
  9157. }),
  9158. $globals.AssociativeCollection);
  9159. $core.addMethod(
  9160. $core.method({
  9161. selector: "removeAll",
  9162. protocol: "adding/removing",
  9163. fn: function (){
  9164. var self=this,$self=this;
  9165. return $core.withContext(function($ctx1) {
  9166. return $recv($self._keys())._do_((function(each){
  9167. return $core.withContext(function($ctx2) {
  9168. return $self._removeKey_(each);
  9169. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9170. }));
  9171. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.AssociativeCollection)});
  9172. },
  9173. args: [],
  9174. source: "removeAll\x0a\x09^ self keys do: [ :each | self removeKey: each ]",
  9175. referencedClasses: [],
  9176. messageSends: ["do:", "keys", "removeKey:"]
  9177. }),
  9178. $globals.AssociativeCollection);
  9179. $core.addMethod(
  9180. $core.method({
  9181. selector: "removeKey:",
  9182. protocol: "adding/removing",
  9183. fn: function (aKey){
  9184. var self=this,$self=this;
  9185. return $core.withContext(function($ctx1) {
  9186. return $self._remove_(aKey);
  9187. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aKey:aKey},$globals.AssociativeCollection)});
  9188. },
  9189. args: ["aKey"],
  9190. source: "removeKey: aKey\x0a\x09^ self remove: aKey",
  9191. referencedClasses: [],
  9192. messageSends: ["remove:"]
  9193. }),
  9194. $globals.AssociativeCollection);
  9195. $core.addMethod(
  9196. $core.method({
  9197. selector: "removeKey:ifAbsent:",
  9198. protocol: "adding/removing",
  9199. fn: function (aKey,aBlock){
  9200. var self=this,$self=this;
  9201. return $core.withContext(function($ctx1) {
  9202. $self._subclassResponsibility();
  9203. return self;
  9204. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.AssociativeCollection)});
  9205. },
  9206. args: ["aKey", "aBlock"],
  9207. source: "removeKey: aKey ifAbsent: aBlock\x0a\x09self subclassResponsibility",
  9208. referencedClasses: [],
  9209. messageSends: ["subclassResponsibility"]
  9210. }),
  9211. $globals.AssociativeCollection);
  9212. $core.addMethod(
  9213. $core.method({
  9214. selector: "select:",
  9215. protocol: "enumerating",
  9216. fn: function (aBlock){
  9217. var self=this,$self=this;
  9218. var newDict;
  9219. return $core.withContext(function($ctx1) {
  9220. var $1;
  9221. newDict=$recv($self._class())._new();
  9222. $self._keysAndValuesDo_((function(key,value){
  9223. return $core.withContext(function($ctx2) {
  9224. $1=$recv(aBlock)._value_(value);
  9225. if($core.assert($1)){
  9226. return $recv(newDict)._at_put_(key,value);
  9227. }
  9228. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9229. }));
  9230. return newDict;
  9231. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,newDict:newDict},$globals.AssociativeCollection)});
  9232. },
  9233. args: ["aBlock"],
  9234. 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",
  9235. referencedClasses: [],
  9236. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9237. }),
  9238. $globals.AssociativeCollection);
  9239. $core.addMethod(
  9240. $core.method({
  9241. selector: "select:thenCollect:",
  9242. protocol: "enumerating",
  9243. fn: function (selectBlock,collectBlock){
  9244. var self=this,$self=this;
  9245. var newDict;
  9246. return $core.withContext(function($ctx1) {
  9247. var $1;
  9248. newDict=$recv($self._class())._new();
  9249. $self._keysAndValuesDo_((function(key,value){
  9250. return $core.withContext(function($ctx2) {
  9251. $1=$recv(selectBlock)._value_(value);
  9252. $ctx2.sendIdx["value:"]=1;
  9253. if($core.assert($1)){
  9254. return $recv(newDict)._at_put_(key,$recv(collectBlock)._value_(value));
  9255. }
  9256. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9257. }));
  9258. return newDict;
  9259. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,newDict:newDict},$globals.AssociativeCollection)});
  9260. },
  9261. args: ["selectBlock", "collectBlock"],
  9262. 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",
  9263. referencedClasses: [],
  9264. messageSends: ["new", "class", "keysAndValuesDo:", "ifTrue:", "value:", "at:put:"]
  9265. }),
  9266. $globals.AssociativeCollection);
  9267. $core.addMethod(
  9268. $core.method({
  9269. selector: "shallowCopy",
  9270. protocol: "copying",
  9271. fn: function (){
  9272. var self=this,$self=this;
  9273. var copy;
  9274. return $core.withContext(function($ctx1) {
  9275. copy=$recv($self._class())._new();
  9276. $self._keysAndValuesDo_((function(key,value){
  9277. return $core.withContext(function($ctx2) {
  9278. return $recv(copy)._at_put_(key,value);
  9279. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9280. }));
  9281. return copy;
  9282. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{copy:copy},$globals.AssociativeCollection)});
  9283. },
  9284. args: [],
  9285. 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",
  9286. referencedClasses: [],
  9287. messageSends: ["new", "class", "keysAndValuesDo:", "at:put:"]
  9288. }),
  9289. $globals.AssociativeCollection);
  9290. $core.addMethod(
  9291. $core.method({
  9292. selector: "size",
  9293. protocol: "accessing",
  9294. fn: function (){
  9295. var self=this,$self=this;
  9296. return $core.withContext(function($ctx1) {
  9297. return $recv($self._keys())._size();
  9298. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.AssociativeCollection)});
  9299. },
  9300. args: [],
  9301. source: "size\x0a\x09^ self keys size",
  9302. referencedClasses: [],
  9303. messageSends: ["size", "keys"]
  9304. }),
  9305. $globals.AssociativeCollection);
  9306. $core.addMethod(
  9307. $core.method({
  9308. selector: "values",
  9309. protocol: "accessing",
  9310. fn: function (){
  9311. var self=this,$self=this;
  9312. return $core.withContext(function($ctx1) {
  9313. $self._subclassResponsibility();
  9314. return self;
  9315. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.AssociativeCollection)});
  9316. },
  9317. args: [],
  9318. source: "values\x0a\x09self subclassResponsibility",
  9319. referencedClasses: [],
  9320. messageSends: ["subclassResponsibility"]
  9321. }),
  9322. $globals.AssociativeCollection);
  9323. $core.addMethod(
  9324. $core.method({
  9325. selector: "valuesDo:",
  9326. protocol: "enumerating",
  9327. fn: function (aBlock){
  9328. var self=this,$self=this;
  9329. return $core.withContext(function($ctx1) {
  9330. $self._subclassResponsibility();
  9331. return self;
  9332. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9333. },
  9334. args: ["aBlock"],
  9335. source: "valuesDo: aBlock\x0a\x09self subclassResponsibility",
  9336. referencedClasses: [],
  9337. messageSends: ["subclassResponsibility"]
  9338. }),
  9339. $globals.AssociativeCollection);
  9340. $core.addMethod(
  9341. $core.method({
  9342. selector: "withIndexDo:",
  9343. protocol: "enumerating",
  9344. fn: function (aBlock){
  9345. var self=this,$self=this;
  9346. return $core.withContext(function($ctx1) {
  9347. $self._keysAndValuesDo_((function(key,value){
  9348. return $core.withContext(function($ctx2) {
  9349. return $recv(aBlock)._value_value_(value,key);
  9350. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  9351. }));
  9352. return self;
  9353. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.AssociativeCollection)});
  9354. },
  9355. args: ["aBlock"],
  9356. source: "withIndexDo: aBlock\x0a\x09self keysAndValuesDo: [ :key :value | aBlock value: value value: key ]",
  9357. referencedClasses: [],
  9358. messageSends: ["keysAndValuesDo:", "value:value:"]
  9359. }),
  9360. $globals.AssociativeCollection);
  9361. $core.addMethod(
  9362. $core.method({
  9363. selector: "from:",
  9364. protocol: "instance creation",
  9365. fn: function (aCollection){
  9366. var self=this,$self=this;
  9367. var newCollection;
  9368. return $core.withContext(function($ctx1) {
  9369. newCollection=$self._new();
  9370. $recv(aCollection)._do_((function(each){
  9371. return $core.withContext(function($ctx2) {
  9372. return $recv(newCollection)._add_(each);
  9373. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  9374. }));
  9375. return newCollection;
  9376. }, function($ctx1) {$ctx1.fill(self,"from:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9377. },
  9378. args: ["aCollection"],
  9379. source: "from: aCollection\x0a\x09| newCollection |\x0a\x09newCollection := self new.\x0a\x09aCollection do: [ :each | newCollection add: each ].\x0a\x09^ newCollection",
  9380. referencedClasses: [],
  9381. messageSends: ["new", "do:", "add:"]
  9382. }),
  9383. $globals.AssociativeCollection.a$cls);
  9384. $core.addMethod(
  9385. $core.method({
  9386. selector: "fromPairs:",
  9387. protocol: "instance creation",
  9388. fn: function (aCollection){
  9389. var self=this,$self=this;
  9390. return $core.withContext(function($ctx1) {
  9391. return $self._from_(aCollection);
  9392. }, function($ctx1) {$ctx1.fill(self,"fromPairs:",{aCollection:aCollection},$globals.AssociativeCollection.a$cls)});
  9393. },
  9394. args: ["aCollection"],
  9395. source: "fromPairs: aCollection\x0a\x09\x22This message is poorly named and has been replaced by #from:\x22\x0a\x09^ self from: aCollection",
  9396. referencedClasses: [],
  9397. messageSends: ["from:"]
  9398. }),
  9399. $globals.AssociativeCollection.a$cls);
  9400. $core.addMethod(
  9401. $core.method({
  9402. selector: "newFromPairs:",
  9403. protocol: "instance creation",
  9404. fn: function (aCollection){
  9405. var self=this,$self=this;
  9406. var newCollection;
  9407. return $core.withContext(function($ctx1) {
  9408. var $2,$1,$3,$4;
  9409. $2=$recv(aCollection)._size();
  9410. $ctx1.sendIdx["size"]=1;
  9411. $1=$recv($2)._even();
  9412. if(!$core.assert($1)){
  9413. $self._error_("#newFromPairs only accepts arrays of an even length");
  9414. }
  9415. newCollection=$self._new();
  9416. $recv((1)._to_by_($recv(aCollection)._size(),(2)))._do_((function(each){
  9417. return $core.withContext(function($ctx2) {
  9418. $3=newCollection;
  9419. $4=$recv(aCollection)._at_(each);
  9420. $ctx2.sendIdx["at:"]=1;
  9421. return $recv($3)._at_put_($4,$recv(aCollection)._at_($recv(each).__plus((1))));
  9422. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  9423. }));
  9424. return newCollection;
  9425. }, function($ctx1) {$ctx1.fill(self,"newFromPairs:",{aCollection:aCollection,newCollection:newCollection},$globals.AssociativeCollection.a$cls)});
  9426. },
  9427. args: ["aCollection"],
  9428. 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",
  9429. referencedClasses: [],
  9430. messageSends: ["ifFalse:", "even", "size", "error:", "new", "do:", "to:by:", "at:put:", "at:", "+"]
  9431. }),
  9432. $globals.AssociativeCollection.a$cls);
  9433. $core.addClass("Dictionary", $globals.AssociativeCollection, ["keys", "values"], "Kernel-Collections");
  9434. $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.";
  9435. $core.addMethod(
  9436. $core.method({
  9437. selector: "at:ifAbsent:",
  9438. protocol: "accessing",
  9439. fn: function (aKey,aBlock){
  9440. var self=this,$self=this;
  9441. return $core.withContext(function($ctx1) {
  9442. var index = $self._positionOfKey_(aKey);
  9443. return index >=0 ? $self['@values'][index] : aBlock._value();
  9444. ;
  9445. return self;
  9446. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9447. },
  9448. args: ["aKey", "aBlock"],
  9449. 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'>",
  9450. referencedClasses: [],
  9451. messageSends: []
  9452. }),
  9453. $globals.Dictionary);
  9454. $core.addMethod(
  9455. $core.method({
  9456. selector: "at:put:",
  9457. protocol: "accessing",
  9458. fn: function (aKey,aValue){
  9459. var self=this,$self=this;
  9460. return $core.withContext(function($ctx1) {
  9461. var index = $self._positionOfKey_(aKey);
  9462. if(index === -1) {
  9463. var keys = $self['@keys'];
  9464. index = keys.length;
  9465. keys.push(aKey);
  9466. }
  9467. return $self['@values'][index] = aValue;
  9468. ;
  9469. return self;
  9470. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.Dictionary)});
  9471. },
  9472. args: ["aKey", "aValue"],
  9473. 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'>",
  9474. referencedClasses: [],
  9475. messageSends: []
  9476. }),
  9477. $globals.Dictionary);
  9478. $core.addMethod(
  9479. $core.method({
  9480. selector: "includesKey:",
  9481. protocol: "testing",
  9482. fn: function (aKey){
  9483. var self=this,$self=this;
  9484. return $core.withContext(function($ctx1) {
  9485. return $self._positionOfKey_(aKey) >= 0;;
  9486. return self;
  9487. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.Dictionary)});
  9488. },
  9489. args: ["aKey"],
  9490. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $self._positionOfKey_(aKey) >= 0;'>",
  9491. referencedClasses: [],
  9492. messageSends: []
  9493. }),
  9494. $globals.Dictionary);
  9495. $core.addMethod(
  9496. $core.method({
  9497. selector: "indexOf:ifAbsent:",
  9498. protocol: "accessing",
  9499. fn: function (anObject,aBlock){
  9500. var self=this,$self=this;
  9501. var index;
  9502. return $core.withContext(function($ctx1) {
  9503. var $1;
  9504. index=$recv($self["@values"])._indexOf_ifAbsent_(anObject,(function(){
  9505. return (0);
  9506. }));
  9507. $1=$recv(index).__eq((0));
  9508. if($core.assert($1)){
  9509. return $recv(aBlock)._value();
  9510. } else {
  9511. return $recv($self["@keys"])._at_(index);
  9512. }
  9513. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Dictionary)});
  9514. },
  9515. args: ["anObject", "aBlock"],
  9516. 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 ]",
  9517. referencedClasses: [],
  9518. messageSends: ["indexOf:ifAbsent:", "ifTrue:ifFalse:", "=", "value", "at:"]
  9519. }),
  9520. $globals.Dictionary);
  9521. $core.addMethod(
  9522. $core.method({
  9523. selector: "initialize",
  9524. protocol: "initialization",
  9525. fn: function (){
  9526. var self=this,$self=this;
  9527. return $core.withContext(function($ctx1) {
  9528. (
  9529. $ctx1.supercall = true,
  9530. ($globals.Dictionary.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  9531. $ctx1.supercall = false;
  9532. $self["@keys"]=[];
  9533. $self["@values"]=[];
  9534. return self;
  9535. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Dictionary)});
  9536. },
  9537. args: [],
  9538. source: "initialize\x0a\x09super initialize.\x0a\x09keys := #().\x0a\x09values := #()",
  9539. referencedClasses: [],
  9540. messageSends: ["initialize"]
  9541. }),
  9542. $globals.Dictionary);
  9543. $core.addMethod(
  9544. $core.method({
  9545. selector: "keys",
  9546. protocol: "accessing",
  9547. fn: function (){
  9548. var self=this,$self=this;
  9549. return $core.withContext(function($ctx1) {
  9550. return $recv($self["@keys"])._copy();
  9551. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.Dictionary)});
  9552. },
  9553. args: [],
  9554. source: "keys\x0a\x09^ keys copy",
  9555. referencedClasses: [],
  9556. messageSends: ["copy"]
  9557. }),
  9558. $globals.Dictionary);
  9559. $core.addMethod(
  9560. $core.method({
  9561. selector: "keysAndValuesDo:",
  9562. protocol: "enumerating",
  9563. fn: function (aBlock){
  9564. var self=this,$self=this;
  9565. return $core.withContext(function($ctx1) {
  9566. return $recv($self["@keys"])._with_do_($self["@values"],aBlock);
  9567. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9568. },
  9569. args: ["aBlock"],
  9570. source: "keysAndValuesDo: aBlock\x0a\x09^ keys with: values do: aBlock",
  9571. referencedClasses: [],
  9572. messageSends: ["with:do:"]
  9573. }),
  9574. $globals.Dictionary);
  9575. $core.addMethod(
  9576. $core.method({
  9577. selector: "keysDo:",
  9578. protocol: "enumerating",
  9579. fn: function (aBlock){
  9580. var self=this,$self=this;
  9581. return $core.withContext(function($ctx1) {
  9582. return $recv($self["@keys"])._do_(aBlock);
  9583. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.Dictionary)});
  9584. },
  9585. args: ["aBlock"],
  9586. source: "keysDo: aBlock\x0a\x09^ keys do: aBlock",
  9587. referencedClasses: [],
  9588. messageSends: ["do:"]
  9589. }),
  9590. $globals.Dictionary);
  9591. $core.addMethod(
  9592. $core.method({
  9593. selector: "positionOfKey:",
  9594. protocol: "private",
  9595. fn: function (anObject){
  9596. var self=this,$self=this;
  9597. return $core.withContext(function($ctx1) {
  9598. var keys = $self['@keys'];
  9599. for(var i=0;i<keys.length;i++){
  9600. if(keys[i].__eq(anObject)) { return i;}
  9601. }
  9602. return -1;
  9603. ;
  9604. return self;
  9605. }, function($ctx1) {$ctx1.fill(self,"positionOfKey:",{anObject:anObject},$globals.Dictionary)});
  9606. },
  9607. args: ["anObject"],
  9608. 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'>",
  9609. referencedClasses: [],
  9610. messageSends: []
  9611. }),
  9612. $globals.Dictionary);
  9613. $core.addMethod(
  9614. $core.method({
  9615. selector: "removeAll",
  9616. protocol: "adding/removing",
  9617. fn: function (){
  9618. var self=this,$self=this;
  9619. return $core.withContext(function($ctx1) {
  9620. $recv($self["@keys"])._removeAll();
  9621. $ctx1.sendIdx["removeAll"]=1;
  9622. $recv($self["@values"])._removeAll();
  9623. return self;
  9624. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Dictionary)});
  9625. },
  9626. args: [],
  9627. source: "removeAll\x0a\x09keys removeAll.\x0a\x09values removeAll",
  9628. referencedClasses: [],
  9629. messageSends: ["removeAll"]
  9630. }),
  9631. $globals.Dictionary);
  9632. $core.addMethod(
  9633. $core.method({
  9634. selector: "removeKey:ifAbsent:",
  9635. protocol: "adding/removing",
  9636. fn: function (aKey,aBlock){
  9637. var self=this,$self=this;
  9638. return $core.withContext(function($ctx1) {
  9639. var index = $self._positionOfKey_(aKey);
  9640. if(index === -1) {
  9641. return aBlock._value()
  9642. } else {
  9643. var keys = $self['@keys'], values = $self['@values'];
  9644. var value = values[index], l = keys.length;
  9645. keys[index] = keys[l-1];
  9646. keys.pop();
  9647. values[index] = values[l-1];
  9648. values.pop();
  9649. return value;
  9650. }
  9651. ;
  9652. return self;
  9653. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.Dictionary)});
  9654. },
  9655. args: ["aKey", "aBlock"],
  9656. 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'>",
  9657. referencedClasses: [],
  9658. messageSends: []
  9659. }),
  9660. $globals.Dictionary);
  9661. $core.addMethod(
  9662. $core.method({
  9663. selector: "values",
  9664. protocol: "accessing",
  9665. fn: function (){
  9666. var self=this,$self=this;
  9667. return $self["@values"];
  9668. },
  9669. args: [],
  9670. source: "values\x0a\x09^ values",
  9671. referencedClasses: [],
  9672. messageSends: []
  9673. }),
  9674. $globals.Dictionary);
  9675. $core.addMethod(
  9676. $core.method({
  9677. selector: "valuesDo:",
  9678. protocol: "enumerating",
  9679. fn: function (aBlock){
  9680. var self=this,$self=this;
  9681. return $core.withContext(function($ctx1) {
  9682. return $recv($self["@values"])._do_(aBlock);
  9683. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.Dictionary)});
  9684. },
  9685. args: ["aBlock"],
  9686. source: "valuesDo: aBlock\x0a\x09^ values do: aBlock",
  9687. referencedClasses: [],
  9688. messageSends: ["do:"]
  9689. }),
  9690. $globals.Dictionary);
  9691. $core.addClass("HashedCollection", $globals.AssociativeCollection, [], "Kernel-Collections");
  9692. $globals.HashedCollection.comment="I am a traditional JavaScript object, or a Smalltalk `Dictionary`.\x0a\x0aUnlike a `Dictionary`, I can only have strings as keys.";
  9693. $core.addMethod(
  9694. $core.method({
  9695. selector: "at:ifAbsent:",
  9696. protocol: "accessing",
  9697. fn: function (aKey,aBlock){
  9698. var self=this,$self=this;
  9699. return $core.withContext(function($ctx1) {
  9700. var $1;
  9701. $1=$self._includesKey_(aKey);
  9702. if($core.assert($1)){
  9703. return $self._basicAt_(aKey);
  9704. } else {
  9705. return $recv(aBlock)._value();
  9706. }
  9707. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9708. },
  9709. args: ["aKey", "aBlock"],
  9710. source: "at: aKey ifAbsent: aBlock\x0a\x09^ (self includesKey: aKey)\x0a\x09\x09ifTrue: [ self basicAt: aKey ]\x0a\x09\x09ifFalse: [ aBlock value ]",
  9711. referencedClasses: [],
  9712. messageSends: ["ifTrue:ifFalse:", "includesKey:", "basicAt:", "value"]
  9713. }),
  9714. $globals.HashedCollection);
  9715. $core.addMethod(
  9716. $core.method({
  9717. selector: "at:put:",
  9718. protocol: "accessing",
  9719. fn: function (aKey,aValue){
  9720. var self=this,$self=this;
  9721. return $core.withContext(function($ctx1) {
  9722. return $self._basicAt_put_(aKey,aValue);
  9723. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aKey:aKey,aValue:aValue},$globals.HashedCollection)});
  9724. },
  9725. args: ["aKey", "aValue"],
  9726. source: "at: aKey put: aValue\x0a\x09^ self basicAt: aKey put: aValue",
  9727. referencedClasses: [],
  9728. messageSends: ["basicAt:put:"]
  9729. }),
  9730. $globals.HashedCollection);
  9731. $core.addMethod(
  9732. $core.method({
  9733. selector: "includesKey:",
  9734. protocol: "testing",
  9735. fn: function (aKey){
  9736. var self=this,$self=this;
  9737. return $core.withContext(function($ctx1) {
  9738. return self.hasOwnProperty(aKey);
  9739. return self;
  9740. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.HashedCollection)});
  9741. },
  9742. args: ["aKey"],
  9743. source: "includesKey: aKey\x0a\x09<inlineJS: 'return self.hasOwnProperty(aKey)'>",
  9744. referencedClasses: [],
  9745. messageSends: []
  9746. }),
  9747. $globals.HashedCollection);
  9748. $core.addMethod(
  9749. $core.method({
  9750. selector: "keys",
  9751. protocol: "accessing",
  9752. fn: function (){
  9753. var self=this,$self=this;
  9754. return $core.withContext(function($ctx1) {
  9755. return Object.keys(self);
  9756. return self;
  9757. }, function($ctx1) {$ctx1.fill(self,"keys",{},$globals.HashedCollection)});
  9758. },
  9759. args: [],
  9760. source: "keys\x0a\x09<inlineJS: 'return Object.keys(self)'>",
  9761. referencedClasses: [],
  9762. messageSends: []
  9763. }),
  9764. $globals.HashedCollection);
  9765. $core.addMethod(
  9766. $core.method({
  9767. selector: "keysDo:",
  9768. protocol: "enumerating",
  9769. fn: function (aBlock){
  9770. var self=this,$self=this;
  9771. return $core.withContext(function($ctx1) {
  9772. $recv($self._keys())._do_(aBlock);
  9773. return self;
  9774. }, function($ctx1) {$ctx1.fill(self,"keysDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9775. },
  9776. args: ["aBlock"],
  9777. source: "keysDo: aBlock\x0a\x09self keys do: aBlock",
  9778. referencedClasses: [],
  9779. messageSends: ["do:", "keys"]
  9780. }),
  9781. $globals.HashedCollection);
  9782. $core.addMethod(
  9783. $core.method({
  9784. selector: "removeKey:ifAbsent:",
  9785. protocol: "adding/removing",
  9786. fn: function (aKey,aBlock){
  9787. var self=this,$self=this;
  9788. return $core.withContext(function($ctx1) {
  9789. return $self._at_ifPresent_ifAbsent_(aKey,(function(removed){
  9790. return $core.withContext(function($ctx2) {
  9791. $self._basicDelete_(aKey);
  9792. return removed;
  9793. }, function($ctx2) {$ctx2.fillBlock({removed:removed},$ctx1,1)});
  9794. }),(function(){
  9795. return $core.withContext(function($ctx2) {
  9796. return $recv(aBlock)._value();
  9797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  9798. }));
  9799. }, function($ctx1) {$ctx1.fill(self,"removeKey:ifAbsent:",{aKey:aKey,aBlock:aBlock},$globals.HashedCollection)});
  9800. },
  9801. args: ["aKey", "aBlock"],
  9802. 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 ]",
  9803. referencedClasses: [],
  9804. messageSends: ["at:ifPresent:ifAbsent:", "basicDelete:", "value"]
  9805. }),
  9806. $globals.HashedCollection);
  9807. $core.addMethod(
  9808. $core.method({
  9809. selector: "values",
  9810. protocol: "accessing",
  9811. fn: function (){
  9812. var self=this,$self=this;
  9813. return $core.withContext(function($ctx1) {
  9814. return $self._keys().map(function(key){
  9815. return $self._at_(key);
  9816. });
  9817. ;
  9818. return self;
  9819. }, function($ctx1) {$ctx1.fill(self,"values",{},$globals.HashedCollection)});
  9820. },
  9821. args: [],
  9822. 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'>",
  9823. referencedClasses: [],
  9824. messageSends: []
  9825. }),
  9826. $globals.HashedCollection);
  9827. $core.addMethod(
  9828. $core.method({
  9829. selector: "valuesDo:",
  9830. protocol: "enumerating",
  9831. fn: function (aBlock){
  9832. var self=this,$self=this;
  9833. return $core.withContext(function($ctx1) {
  9834. $recv($self._values())._do_(aBlock);
  9835. return self;
  9836. }, function($ctx1) {$ctx1.fill(self,"valuesDo:",{aBlock:aBlock},$globals.HashedCollection)});
  9837. },
  9838. args: ["aBlock"],
  9839. source: "valuesDo: aBlock\x0a\x09self values do: aBlock",
  9840. referencedClasses: [],
  9841. messageSends: ["do:", "values"]
  9842. }),
  9843. $globals.HashedCollection);
  9844. $core.addClass("SequenceableCollection", $globals.IndexableCollection, [], "Kernel-Collections");
  9845. $globals.SequenceableCollection.comment="I am an IndexableCollection\x0awith numeric indexes starting with 1.";
  9846. $core.addMethod(
  9847. $core.method({
  9848. selector: "=",
  9849. protocol: "comparing",
  9850. fn: function (aCollection){
  9851. var self=this,$self=this;
  9852. return $core.withContext(function($ctx1) {
  9853. var $3,$2,$4,$1,$5;
  9854. var $early={};
  9855. try {
  9856. $3=$self._class();
  9857. $ctx1.sendIdx["class"]=1;
  9858. $2=$recv($3).__eq($recv(aCollection)._class());
  9859. $ctx1.sendIdx["="]=1;
  9860. $1=$recv($2)._and_((function(){
  9861. return $core.withContext(function($ctx2) {
  9862. $4=$self._size();
  9863. $ctx2.sendIdx["size"]=1;
  9864. return $recv($4).__eq($recv(aCollection)._size());
  9865. $ctx2.sendIdx["="]=2;
  9866. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  9867. }));
  9868. if(!$core.assert($1)){
  9869. return false;
  9870. }
  9871. $self._withIndexDo_((function(each,i){
  9872. return $core.withContext(function($ctx2) {
  9873. $5=$recv($recv(aCollection)._at_(i)).__eq(each);
  9874. if(!$core.assert($5)){
  9875. throw $early=[false];
  9876. }
  9877. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  9878. }));
  9879. return true;
  9880. }
  9881. catch(e) {if(e===$early)return e[0]; throw e}
  9882. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.SequenceableCollection)});
  9883. },
  9884. args: ["aCollection"],
  9885. 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",
  9886. referencedClasses: [],
  9887. messageSends: ["ifFalse:", "and:", "=", "class", "size", "withIndexDo:", "at:"]
  9888. }),
  9889. $globals.SequenceableCollection);
  9890. $core.addMethod(
  9891. $core.method({
  9892. selector: "addLast:",
  9893. protocol: "adding/removing",
  9894. fn: function (anObject){
  9895. var self=this,$self=this;
  9896. return $core.withContext(function($ctx1) {
  9897. $self._add_(anObject);
  9898. return self;
  9899. }, function($ctx1) {$ctx1.fill(self,"addLast:",{anObject:anObject},$globals.SequenceableCollection)});
  9900. },
  9901. args: ["anObject"],
  9902. source: "addLast: anObject\x0a\x09self add: anObject",
  9903. referencedClasses: [],
  9904. messageSends: ["add:"]
  9905. }),
  9906. $globals.SequenceableCollection);
  9907. $core.addMethod(
  9908. $core.method({
  9909. selector: "allButFirst",
  9910. protocol: "accessing",
  9911. fn: function (){
  9912. var self=this,$self=this;
  9913. return $core.withContext(function($ctx1) {
  9914. return $self._copyFrom_to_((2),$self._size());
  9915. }, function($ctx1) {$ctx1.fill(self,"allButFirst",{},$globals.SequenceableCollection)});
  9916. },
  9917. args: [],
  9918. source: "allButFirst\x0a\x09^ self copyFrom: 2 to: self size",
  9919. referencedClasses: [],
  9920. messageSends: ["copyFrom:to:", "size"]
  9921. }),
  9922. $globals.SequenceableCollection);
  9923. $core.addMethod(
  9924. $core.method({
  9925. selector: "allButLast",
  9926. protocol: "accessing",
  9927. fn: function (){
  9928. var self=this,$self=this;
  9929. return $core.withContext(function($ctx1) {
  9930. return $self._copyFrom_to_((1),$recv($self._size()).__minus((1)));
  9931. }, function($ctx1) {$ctx1.fill(self,"allButLast",{},$globals.SequenceableCollection)});
  9932. },
  9933. args: [],
  9934. source: "allButLast\x0a\x09^ self copyFrom: 1 to: self size - 1",
  9935. referencedClasses: [],
  9936. messageSends: ["copyFrom:to:", "-", "size"]
  9937. }),
  9938. $globals.SequenceableCollection);
  9939. $core.addMethod(
  9940. $core.method({
  9941. selector: "anyOne",
  9942. protocol: "accessing",
  9943. fn: function (){
  9944. var self=this,$self=this;
  9945. return $core.withContext(function($ctx1) {
  9946. return $self._at_((1));
  9947. }, function($ctx1) {$ctx1.fill(self,"anyOne",{},$globals.SequenceableCollection)});
  9948. },
  9949. args: [],
  9950. source: "anyOne\x0a\x09^ self at: 1",
  9951. referencedClasses: [],
  9952. messageSends: ["at:"]
  9953. }),
  9954. $globals.SequenceableCollection);
  9955. $core.addMethod(
  9956. $core.method({
  9957. selector: "atRandom",
  9958. protocol: "accessing",
  9959. fn: function (){
  9960. var self=this,$self=this;
  9961. return $core.withContext(function($ctx1) {
  9962. return $self._at_($recv($self._size())._atRandom());
  9963. }, function($ctx1) {$ctx1.fill(self,"atRandom",{},$globals.SequenceableCollection)});
  9964. },
  9965. args: [],
  9966. source: "atRandom\x0a\x09^ self at: self size atRandom",
  9967. referencedClasses: [],
  9968. messageSends: ["at:", "atRandom", "size"]
  9969. }),
  9970. $globals.SequenceableCollection);
  9971. $core.addMethod(
  9972. $core.method({
  9973. selector: "beginsWith:",
  9974. protocol: "testing",
  9975. fn: function (prefix){
  9976. var self=this,$self=this;
  9977. return $core.withContext(function($ctx1) {
  9978. var $2,$3,$1;
  9979. $2=$self._size();
  9980. $ctx1.sendIdx["size"]=1;
  9981. $3=$recv(prefix)._size();
  9982. $ctx1.sendIdx["size"]=2;
  9983. $1=$recv($2).__lt($3);
  9984. if($core.assert($1)){
  9985. return false;
  9986. }
  9987. return $recv($self._first_($recv(prefix)._size())).__eq(prefix);
  9988. }, function($ctx1) {$ctx1.fill(self,"beginsWith:",{prefix:prefix},$globals.SequenceableCollection)});
  9989. },
  9990. args: ["prefix"],
  9991. source: "beginsWith: prefix\x0a\x09self size < prefix size ifTrue: [ ^ false ].\x0a\x09^ (self first: prefix size) = prefix",
  9992. referencedClasses: [],
  9993. messageSends: ["ifTrue:", "<", "size", "=", "first:"]
  9994. }),
  9995. $globals.SequenceableCollection);
  9996. $core.addMethod(
  9997. $core.method({
  9998. selector: "copyFrom:to:",
  9999. protocol: "copying",
  10000. fn: function (anIndex,anotherIndex){
  10001. var self=this,$self=this;
  10002. return $core.withContext(function($ctx1) {
  10003. $self._subclassResponsibility();
  10004. return self;
  10005. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.SequenceableCollection)});
  10006. },
  10007. args: ["anIndex", "anotherIndex"],
  10008. source: "copyFrom: anIndex to: anotherIndex\x0a\x09self subclassResponsibility",
  10009. referencedClasses: [],
  10010. messageSends: ["subclassResponsibility"]
  10011. }),
  10012. $globals.SequenceableCollection);
  10013. $core.addMethod(
  10014. $core.method({
  10015. selector: "detect:ifNone:",
  10016. protocol: "enumerating",
  10017. fn: function (aBlock,anotherBlock){
  10018. var self=this,$self=this;
  10019. return $core.withContext(function($ctx1) {
  10020. var nself = $self._numericallyIndexable();
  10021. for(var i = 0; i < nself.length; i++)
  10022. if(aBlock._value_(nself[i]))
  10023. return nself[i];
  10024. return anotherBlock._value();
  10025. ;
  10026. return self;
  10027. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.SequenceableCollection)});
  10028. },
  10029. args: ["aBlock", "anotherBlock"],
  10030. 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'>",
  10031. referencedClasses: [],
  10032. messageSends: []
  10033. }),
  10034. $globals.SequenceableCollection);
  10035. $core.addMethod(
  10036. $core.method({
  10037. selector: "do:",
  10038. protocol: "enumerating",
  10039. fn: function (aBlock){
  10040. var self=this,$self=this;
  10041. return $core.withContext(function($ctx1) {
  10042. var nself = $self._numericallyIndexable();
  10043. for(var i=0; i < nself.length; i++) {
  10044. aBlock._value_(nself[i]);
  10045. }
  10046. ;
  10047. return self;
  10048. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10049. },
  10050. args: ["aBlock"],
  10051. 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'>",
  10052. referencedClasses: [],
  10053. messageSends: []
  10054. }),
  10055. $globals.SequenceableCollection);
  10056. $core.addMethod(
  10057. $core.method({
  10058. selector: "endsWith:",
  10059. protocol: "testing",
  10060. fn: function (suffix){
  10061. var self=this,$self=this;
  10062. return $core.withContext(function($ctx1) {
  10063. var $2,$3,$1;
  10064. $2=$self._size();
  10065. $ctx1.sendIdx["size"]=1;
  10066. $3=$recv(suffix)._size();
  10067. $ctx1.sendIdx["size"]=2;
  10068. $1=$recv($2).__lt($3);
  10069. if($core.assert($1)){
  10070. return false;
  10071. }
  10072. return $recv($self._last_($recv(suffix)._size())).__eq(suffix);
  10073. }, function($ctx1) {$ctx1.fill(self,"endsWith:",{suffix:suffix},$globals.SequenceableCollection)});
  10074. },
  10075. args: ["suffix"],
  10076. source: "endsWith: suffix\x0a\x09self size < suffix size ifTrue: [ ^ false ].\x0a\x09^ (self last: suffix size) = suffix",
  10077. referencedClasses: [],
  10078. messageSends: ["ifTrue:", "<", "size", "=", "last:"]
  10079. }),
  10080. $globals.SequenceableCollection);
  10081. $core.addMethod(
  10082. $core.method({
  10083. selector: "first",
  10084. protocol: "accessing",
  10085. fn: function (){
  10086. var self=this,$self=this;
  10087. return $core.withContext(function($ctx1) {
  10088. return $self._at_((1));
  10089. }, function($ctx1) {$ctx1.fill(self,"first",{},$globals.SequenceableCollection)});
  10090. },
  10091. args: [],
  10092. source: "first\x0a\x09^ self at: 1",
  10093. referencedClasses: [],
  10094. messageSends: ["at:"]
  10095. }),
  10096. $globals.SequenceableCollection);
  10097. $core.addMethod(
  10098. $core.method({
  10099. selector: "first:",
  10100. protocol: "accessing",
  10101. fn: function (aNumber){
  10102. var self=this,$self=this;
  10103. return $core.withContext(function($ctx1) {
  10104. var $1;
  10105. $1=$recv($self._size()).__lt(aNumber);
  10106. if($core.assert($1)){
  10107. $self._error_("Invalid number of elements");
  10108. }
  10109. return $self._copyFrom_to_((1),aNumber);
  10110. }, function($ctx1) {$ctx1.fill(self,"first:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10111. },
  10112. args: ["aNumber"],
  10113. 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",
  10114. referencedClasses: [],
  10115. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:"]
  10116. }),
  10117. $globals.SequenceableCollection);
  10118. $core.addMethod(
  10119. $core.method({
  10120. selector: "fourth",
  10121. protocol: "accessing",
  10122. fn: function (){
  10123. var self=this,$self=this;
  10124. return $core.withContext(function($ctx1) {
  10125. return $self._at_((4));
  10126. }, function($ctx1) {$ctx1.fill(self,"fourth",{},$globals.SequenceableCollection)});
  10127. },
  10128. args: [],
  10129. source: "fourth\x0a\x09^ self at: 4",
  10130. referencedClasses: [],
  10131. messageSends: ["at:"]
  10132. }),
  10133. $globals.SequenceableCollection);
  10134. $core.addMethod(
  10135. $core.method({
  10136. selector: "includes:",
  10137. protocol: "testing",
  10138. fn: function (anObject){
  10139. var self=this,$self=this;
  10140. return $core.withContext(function($ctx1) {
  10141. return $recv($self._indexOf_ifAbsent_(anObject,(function(){
  10142. return nil;
  10143. })))._notNil();
  10144. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject},$globals.SequenceableCollection)});
  10145. },
  10146. args: ["anObject"],
  10147. source: "includes: anObject\x0a\x09^ (self indexOf: anObject ifAbsent: [ nil ]) notNil",
  10148. referencedClasses: [],
  10149. messageSends: ["notNil", "indexOf:ifAbsent:"]
  10150. }),
  10151. $globals.SequenceableCollection);
  10152. $core.addMethod(
  10153. $core.method({
  10154. selector: "indexOf:ifAbsent:",
  10155. protocol: "accessing",
  10156. fn: function (anObject,aBlock){
  10157. var self=this,$self=this;
  10158. return $core.withContext(function($ctx1) {
  10159. var nself = $self._numericallyIndexable();
  10160. for(var i=0; i < nself.length; i++) {
  10161. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10162. };
  10163. return aBlock._value();
  10164. ;
  10165. return self;
  10166. }, function($ctx1) {$ctx1.fill(self,"indexOf:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.SequenceableCollection)});
  10167. },
  10168. args: ["anObject", "aBlock"],
  10169. 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'>",
  10170. referencedClasses: [],
  10171. messageSends: []
  10172. }),
  10173. $globals.SequenceableCollection);
  10174. $core.addMethod(
  10175. $core.method({
  10176. selector: "indexOf:startingAt:",
  10177. protocol: "accessing",
  10178. fn: function (anObject,start){
  10179. var self=this,$self=this;
  10180. return $core.withContext(function($ctx1) {
  10181. return $self._indexOf_startingAt_ifAbsent_(anObject,start,(function(){
  10182. return (0);
  10183. }));
  10184. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:",{anObject:anObject,start:start},$globals.SequenceableCollection)});
  10185. },
  10186. args: ["anObject", "start"],
  10187. 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 ]",
  10188. referencedClasses: [],
  10189. messageSends: ["indexOf:startingAt:ifAbsent:"]
  10190. }),
  10191. $globals.SequenceableCollection);
  10192. $core.addMethod(
  10193. $core.method({
  10194. selector: "indexOf:startingAt:ifAbsent:",
  10195. protocol: "accessing",
  10196. fn: function (anObject,start,aBlock){
  10197. var self=this,$self=this;
  10198. return $core.withContext(function($ctx1) {
  10199. var nself = $self._numericallyIndexable();
  10200. for(var i=start - 1; i < nself.length; i++){
  10201. if($recv(nself[i]).__eq(anObject)) {return i+1}
  10202. }
  10203. return aBlock._value();
  10204. ;
  10205. return self;
  10206. }, function($ctx1) {$ctx1.fill(self,"indexOf:startingAt:ifAbsent:",{anObject:anObject,start:start,aBlock:aBlock},$globals.SequenceableCollection)});
  10207. },
  10208. args: ["anObject", "start", "aBlock"],
  10209. 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'>",
  10210. referencedClasses: [],
  10211. messageSends: []
  10212. }),
  10213. $globals.SequenceableCollection);
  10214. $core.addMethod(
  10215. $core.method({
  10216. selector: "last",
  10217. protocol: "accessing",
  10218. fn: function (){
  10219. var self=this,$self=this;
  10220. return $core.withContext(function($ctx1) {
  10221. return $self._at_($self._size());
  10222. }, function($ctx1) {$ctx1.fill(self,"last",{},$globals.SequenceableCollection)});
  10223. },
  10224. args: [],
  10225. source: "last\x0a\x09^ self at: self size",
  10226. referencedClasses: [],
  10227. messageSends: ["at:", "size"]
  10228. }),
  10229. $globals.SequenceableCollection);
  10230. $core.addMethod(
  10231. $core.method({
  10232. selector: "last:",
  10233. protocol: "accessing",
  10234. fn: function (aNumber){
  10235. var self=this,$self=this;
  10236. return $core.withContext(function($ctx1) {
  10237. var $2,$1,$5,$4,$3;
  10238. $2=$self._size();
  10239. $ctx1.sendIdx["size"]=1;
  10240. $1=$recv($2).__lt(aNumber);
  10241. if($core.assert($1)){
  10242. $self._error_("Invalid number of elements");
  10243. }
  10244. $5=$self._size();
  10245. $ctx1.sendIdx["size"]=2;
  10246. $4=$recv($5).__minus(aNumber);
  10247. $3=$recv($4).__plus((1));
  10248. return $self._copyFrom_to_($3,$self._size());
  10249. }, function($ctx1) {$ctx1.fill(self,"last:",{aNumber:aNumber},$globals.SequenceableCollection)});
  10250. },
  10251. args: ["aNumber"],
  10252. 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",
  10253. referencedClasses: [],
  10254. messageSends: ["ifTrue:", "<", "size", "error:", "copyFrom:to:", "+", "-"]
  10255. }),
  10256. $globals.SequenceableCollection);
  10257. $core.addMethod(
  10258. $core.method({
  10259. selector: "newStream",
  10260. protocol: "streaming",
  10261. fn: function (){
  10262. var self=this,$self=this;
  10263. return $core.withContext(function($ctx1) {
  10264. return $recv($self._streamClass())._on_(self);
  10265. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.SequenceableCollection)});
  10266. },
  10267. args: [],
  10268. source: "newStream\x0a\x09^ self streamClass on: self",
  10269. referencedClasses: [],
  10270. messageSends: ["on:", "streamClass"]
  10271. }),
  10272. $globals.SequenceableCollection);
  10273. $core.addMethod(
  10274. $core.method({
  10275. selector: "numericallyIndexable",
  10276. protocol: "private",
  10277. fn: function (){
  10278. var self=this,$self=this;
  10279. return $core.withContext(function($ctx1) {
  10280. $self._subclassResponsibility();
  10281. return self;
  10282. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.SequenceableCollection)});
  10283. },
  10284. args: [],
  10285. 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",
  10286. referencedClasses: [],
  10287. messageSends: ["subclassResponsibility"]
  10288. }),
  10289. $globals.SequenceableCollection);
  10290. $core.addMethod(
  10291. $core.method({
  10292. selector: "readStream",
  10293. protocol: "streaming",
  10294. fn: function (){
  10295. var self=this,$self=this;
  10296. return $core.withContext(function($ctx1) {
  10297. return $self._stream();
  10298. }, function($ctx1) {$ctx1.fill(self,"readStream",{},$globals.SequenceableCollection)});
  10299. },
  10300. args: [],
  10301. source: "readStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10302. referencedClasses: [],
  10303. messageSends: ["stream"]
  10304. }),
  10305. $globals.SequenceableCollection);
  10306. $core.addMethod(
  10307. $core.method({
  10308. selector: "removeLast",
  10309. protocol: "adding/removing",
  10310. fn: function (){
  10311. var self=this,$self=this;
  10312. return $core.withContext(function($ctx1) {
  10313. return $self._remove_($self._last());
  10314. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.SequenceableCollection)});
  10315. },
  10316. args: [],
  10317. source: "removeLast\x0a\x09^ self remove: self last",
  10318. referencedClasses: [],
  10319. messageSends: ["remove:", "last"]
  10320. }),
  10321. $globals.SequenceableCollection);
  10322. $core.addMethod(
  10323. $core.method({
  10324. selector: "reverseDo:",
  10325. protocol: "enumerating",
  10326. fn: function (aBlock){
  10327. var self=this,$self=this;
  10328. return $core.withContext(function($ctx1) {
  10329. $recv($self._reversed())._do_(aBlock);
  10330. return self;
  10331. }, function($ctx1) {$ctx1.fill(self,"reverseDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10332. },
  10333. args: ["aBlock"],
  10334. source: "reverseDo: aBlock\x0a\x09self reversed do: aBlock",
  10335. referencedClasses: [],
  10336. messageSends: ["do:", "reversed"]
  10337. }),
  10338. $globals.SequenceableCollection);
  10339. $core.addMethod(
  10340. $core.method({
  10341. selector: "reversed",
  10342. protocol: "converting",
  10343. fn: function (){
  10344. var self=this,$self=this;
  10345. return $core.withContext(function($ctx1) {
  10346. $self._subclassResponsibility();
  10347. return self;
  10348. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.SequenceableCollection)});
  10349. },
  10350. args: [],
  10351. source: "reversed\x0a\x09self subclassResponsibility",
  10352. referencedClasses: [],
  10353. messageSends: ["subclassResponsibility"]
  10354. }),
  10355. $globals.SequenceableCollection);
  10356. $core.addMethod(
  10357. $core.method({
  10358. selector: "second",
  10359. protocol: "accessing",
  10360. fn: function (){
  10361. var self=this,$self=this;
  10362. return $core.withContext(function($ctx1) {
  10363. return $self._at_((2));
  10364. }, function($ctx1) {$ctx1.fill(self,"second",{},$globals.SequenceableCollection)});
  10365. },
  10366. args: [],
  10367. source: "second\x0a\x09^ self at: 2",
  10368. referencedClasses: [],
  10369. messageSends: ["at:"]
  10370. }),
  10371. $globals.SequenceableCollection);
  10372. $core.addMethod(
  10373. $core.method({
  10374. selector: "single",
  10375. protocol: "accessing",
  10376. fn: function (){
  10377. var self=this,$self=this;
  10378. return $core.withContext(function($ctx1) {
  10379. if (self.length == 0) throw new Error("Collection is empty");
  10380. if (self.length > 1) throw new Error("Collection holds more than one element.");
  10381. return $self._numericallyIndexable()[0];;
  10382. return self;
  10383. }, function($ctx1) {$ctx1.fill(self,"single",{},$globals.SequenceableCollection)});
  10384. },
  10385. args: [],
  10386. 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'>",
  10387. referencedClasses: [],
  10388. messageSends: []
  10389. }),
  10390. $globals.SequenceableCollection);
  10391. $core.addMethod(
  10392. $core.method({
  10393. selector: "stream",
  10394. protocol: "streaming",
  10395. fn: function (){
  10396. var self=this,$self=this;
  10397. return $core.withContext(function($ctx1) {
  10398. return $self._newStream();
  10399. }, function($ctx1) {$ctx1.fill(self,"stream",{},$globals.SequenceableCollection)});
  10400. },
  10401. args: [],
  10402. source: "stream\x0a\x09^ self newStream",
  10403. referencedClasses: [],
  10404. messageSends: ["newStream"]
  10405. }),
  10406. $globals.SequenceableCollection);
  10407. $core.addMethod(
  10408. $core.method({
  10409. selector: "streamClass",
  10410. protocol: "streaming",
  10411. fn: function (){
  10412. var self=this,$self=this;
  10413. return $core.withContext(function($ctx1) {
  10414. return $recv($self._class())._streamClass();
  10415. }, function($ctx1) {$ctx1.fill(self,"streamClass",{},$globals.SequenceableCollection)});
  10416. },
  10417. args: [],
  10418. source: "streamClass\x0a\x09^ self class streamClass",
  10419. referencedClasses: [],
  10420. messageSends: ["streamClass", "class"]
  10421. }),
  10422. $globals.SequenceableCollection);
  10423. $core.addMethod(
  10424. $core.method({
  10425. selector: "third",
  10426. protocol: "accessing",
  10427. fn: function (){
  10428. var self=this,$self=this;
  10429. return $core.withContext(function($ctx1) {
  10430. return $self._at_((3));
  10431. }, function($ctx1) {$ctx1.fill(self,"third",{},$globals.SequenceableCollection)});
  10432. },
  10433. args: [],
  10434. source: "third\x0a\x09^ self at: 3",
  10435. referencedClasses: [],
  10436. messageSends: ["at:"]
  10437. }),
  10438. $globals.SequenceableCollection);
  10439. $core.addMethod(
  10440. $core.method({
  10441. selector: "with:do:",
  10442. protocol: "enumerating",
  10443. fn: function (anotherCollection,aBlock){
  10444. var self=this,$self=this;
  10445. return $core.withContext(function($ctx1) {
  10446. var nself = $self._numericallyIndexable();
  10447. anotherCollection = anotherCollection._numericallyIndexable();
  10448. for(var i=0; i<nself.length; i++) {
  10449. aBlock._value_value_(nself[i], anotherCollection[i]);
  10450. }
  10451. ;
  10452. return self;
  10453. }, function($ctx1) {$ctx1.fill(self,"with:do:",{anotherCollection:anotherCollection,aBlock:aBlock},$globals.SequenceableCollection)});
  10454. },
  10455. args: ["anotherCollection", "aBlock"],
  10456. 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'>",
  10457. referencedClasses: [],
  10458. messageSends: []
  10459. }),
  10460. $globals.SequenceableCollection);
  10461. $core.addMethod(
  10462. $core.method({
  10463. selector: "withIndexDo:",
  10464. protocol: "enumerating",
  10465. fn: function (aBlock){
  10466. var self=this,$self=this;
  10467. return $core.withContext(function($ctx1) {
  10468. var nself = $self._numericallyIndexable();
  10469. for(var i=0; i < nself.length; i++) {
  10470. aBlock._value_value_(nself[i], i+1);
  10471. }
  10472. ;
  10473. return self;
  10474. }, function($ctx1) {$ctx1.fill(self,"withIndexDo:",{aBlock:aBlock},$globals.SequenceableCollection)});
  10475. },
  10476. args: ["aBlock"],
  10477. 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'>",
  10478. referencedClasses: [],
  10479. messageSends: []
  10480. }),
  10481. $globals.SequenceableCollection);
  10482. $core.addMethod(
  10483. $core.method({
  10484. selector: "writeStream",
  10485. protocol: "streaming",
  10486. fn: function (){
  10487. var self=this,$self=this;
  10488. return $core.withContext(function($ctx1) {
  10489. return $self._stream();
  10490. }, function($ctx1) {$ctx1.fill(self,"writeStream",{},$globals.SequenceableCollection)});
  10491. },
  10492. args: [],
  10493. source: "writeStream\x0a\x09\x22For Pharo compatibility\x22\x0a\x09\x0a\x09^ self stream",
  10494. referencedClasses: [],
  10495. messageSends: ["stream"]
  10496. }),
  10497. $globals.SequenceableCollection);
  10498. $core.addMethod(
  10499. $core.method({
  10500. selector: "streamClass",
  10501. protocol: "accessing",
  10502. fn: function (){
  10503. var self=this,$self=this;
  10504. return $globals.Stream;
  10505. },
  10506. args: [],
  10507. source: "streamClass\x0a\x09\x09^ Stream",
  10508. referencedClasses: ["Stream"],
  10509. messageSends: []
  10510. }),
  10511. $globals.SequenceableCollection.a$cls);
  10512. $core.addMethod(
  10513. $core.method({
  10514. selector: "streamContents:",
  10515. protocol: "streaming",
  10516. fn: function (aBlock){
  10517. var self=this,$self=this;
  10518. var stream;
  10519. return $core.withContext(function($ctx1) {
  10520. stream=$recv($self._streamClass())._on_($self._new());
  10521. $recv(aBlock)._value_(stream);
  10522. return $recv(stream)._contents();
  10523. }, function($ctx1) {$ctx1.fill(self,"streamContents:",{aBlock:aBlock,stream:stream},$globals.SequenceableCollection.a$cls)});
  10524. },
  10525. args: ["aBlock"],
  10526. source: "streamContents: aBlock\x0a\x09| stream |\x0a\x09stream := (self streamClass on: self new).\x0a\x09aBlock value: stream.\x0a\x09^ stream contents",
  10527. referencedClasses: [],
  10528. messageSends: ["on:", "streamClass", "new", "value:", "contents"]
  10529. }),
  10530. $globals.SequenceableCollection.a$cls);
  10531. $core.addClass("Array", $globals.SequenceableCollection, [], "Kernel-Collections");
  10532. $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`.";
  10533. $core.addMethod(
  10534. $core.method({
  10535. selector: "add:",
  10536. protocol: "adding/removing",
  10537. fn: function (anObject){
  10538. var self=this,$self=this;
  10539. return $core.withContext(function($ctx1) {
  10540. self.push(anObject); return anObject;;
  10541. return self;
  10542. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.Array)});
  10543. },
  10544. args: ["anObject"],
  10545. source: "add: anObject\x0a\x09<inlineJS: 'self.push(anObject); return anObject;'>",
  10546. referencedClasses: [],
  10547. messageSends: []
  10548. }),
  10549. $globals.Array);
  10550. $core.addMethod(
  10551. $core.method({
  10552. selector: "addAll:",
  10553. protocol: "adding/removing",
  10554. fn: function (aCollection){
  10555. var self=this,$self=this;
  10556. return $core.withContext(function($ctx1) {
  10557. if (Array.isArray(aCollection) && aCollection.length < 65000) self.push.apply(self, aCollection);
  10558. else $globals.Array.superclass.fn.prototype._addAll_.call($self, aCollection);
  10559. return aCollection;;
  10560. return self;
  10561. }, function($ctx1) {$ctx1.fill(self,"addAll:",{aCollection:aCollection},$globals.Array)});
  10562. },
  10563. args: ["aCollection"],
  10564. 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'>",
  10565. referencedClasses: [],
  10566. messageSends: []
  10567. }),
  10568. $globals.Array);
  10569. $core.addMethod(
  10570. $core.method({
  10571. selector: "addFirst:",
  10572. protocol: "adding/removing",
  10573. fn: function (anObject){
  10574. var self=this,$self=this;
  10575. return $core.withContext(function($ctx1) {
  10576. self.unshift(anObject); return anObject;;
  10577. return self;
  10578. }, function($ctx1) {$ctx1.fill(self,"addFirst:",{anObject:anObject},$globals.Array)});
  10579. },
  10580. args: ["anObject"],
  10581. source: "addFirst: anObject\x0a\x09<inlineJS: 'self.unshift(anObject); return anObject;'>",
  10582. referencedClasses: [],
  10583. messageSends: []
  10584. }),
  10585. $globals.Array);
  10586. $core.addMethod(
  10587. $core.method({
  10588. selector: "asJavaScriptSource",
  10589. protocol: "converting",
  10590. fn: function (){
  10591. var self=this,$self=this;
  10592. return $core.withContext(function($ctx1) {
  10593. var $1;
  10594. $1=$recv("[".__comma($recv($self._collect_((function(each){
  10595. return $core.withContext(function($ctx2) {
  10596. return $recv(each)._asJavaScriptSource();
  10597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10598. })))._join_(", "))).__comma("]");
  10599. $ctx1.sendIdx[","]=1;
  10600. return $1;
  10601. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Array)});
  10602. },
  10603. args: [],
  10604. source: "asJavaScriptSource\x0a\x09^ '[', ((self collect: [:each | each asJavaScriptSource ]) join: ', '), ']'",
  10605. referencedClasses: [],
  10606. messageSends: [",", "join:", "collect:", "asJavaScriptSource"]
  10607. }),
  10608. $globals.Array);
  10609. $core.addMethod(
  10610. $core.method({
  10611. selector: "at:ifAbsent:",
  10612. protocol: "accessing",
  10613. fn: function (anIndex,aBlock){
  10614. var self=this,$self=this;
  10615. return $core.withContext(function($ctx1) {
  10616. return anIndex >= 1 && anIndex <= self.length
  10617. ? self[anIndex - 1]
  10618. : aBlock._value()
  10619. ;
  10620. return self;
  10621. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.Array)});
  10622. },
  10623. args: ["anIndex", "aBlock"],
  10624. 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'>",
  10625. referencedClasses: [],
  10626. messageSends: []
  10627. }),
  10628. $globals.Array);
  10629. $core.addMethod(
  10630. $core.method({
  10631. selector: "at:ifPresent:ifAbsent:",
  10632. protocol: "accessing",
  10633. fn: function (anIndex,aBlock,anotherBlock){
  10634. var self=this,$self=this;
  10635. return $core.withContext(function($ctx1) {
  10636. return anIndex >= 1 && anIndex <= self.length
  10637. ? aBlock._value_(self[anIndex - 1])
  10638. : anotherBlock._value()
  10639. ;
  10640. return self;
  10641. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Array)});
  10642. },
  10643. args: ["anIndex", "aBlock", "anotherBlock"],
  10644. 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'>",
  10645. referencedClasses: [],
  10646. messageSends: []
  10647. }),
  10648. $globals.Array);
  10649. $core.addMethod(
  10650. $core.method({
  10651. selector: "at:put:",
  10652. protocol: "accessing",
  10653. fn: function (anIndex,anObject){
  10654. var self=this,$self=this;
  10655. return $core.withContext(function($ctx1) {
  10656. return self[anIndex - 1] = anObject;
  10657. return self;
  10658. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.Array)});
  10659. },
  10660. args: ["anIndex", "anObject"],
  10661. source: "at: anIndex put: anObject\x0a\x09<inlineJS: 'return self[anIndex - 1] = anObject'>",
  10662. referencedClasses: [],
  10663. messageSends: []
  10664. }),
  10665. $globals.Array);
  10666. $core.addMethod(
  10667. $core.method({
  10668. selector: "collect:",
  10669. protocol: "enumerating",
  10670. fn: function (aBlock){
  10671. var self=this,$self=this;
  10672. return $core.withContext(function($ctx1) {
  10673. return self.map(function(each) {return aBlock._value_(each)});
  10674. return self;
  10675. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock},$globals.Array)});
  10676. },
  10677. args: ["aBlock"],
  10678. source: "collect: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.map(function(each) {return aBlock._value_(each)})'>",
  10679. referencedClasses: [],
  10680. messageSends: []
  10681. }),
  10682. $globals.Array);
  10683. $core.addMethod(
  10684. $core.method({
  10685. selector: "copyFrom:to:",
  10686. protocol: "copying",
  10687. fn: function (anIndex,anotherIndex){
  10688. var self=this,$self=this;
  10689. return $core.withContext(function($ctx1) {
  10690. if (anIndex >= 1 && anotherIndex <= self.length) {
  10691. return self.slice(anIndex - 1, anotherIndex);
  10692. } else {
  10693. self._at_(anIndex);
  10694. self._at_(self.length + 1);
  10695. throw new Error("Incorrect indexes in #copyFrom:to: not caught by #at:");
  10696. };
  10697. return self;
  10698. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.Array)});
  10699. },
  10700. args: ["anIndex", "anotherIndex"],
  10701. 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'>",
  10702. referencedClasses: [],
  10703. messageSends: []
  10704. }),
  10705. $globals.Array);
  10706. $core.addMethod(
  10707. $core.method({
  10708. selector: "join:",
  10709. protocol: "enumerating",
  10710. fn: function (aString){
  10711. var self=this,$self=this;
  10712. return $core.withContext(function($ctx1) {
  10713. return self.join(aString);
  10714. return self;
  10715. }, function($ctx1) {$ctx1.fill(self,"join:",{aString:aString},$globals.Array)});
  10716. },
  10717. args: ["aString"],
  10718. source: "join: aString\x0a\x09<inlineJS: 'return self.join(aString)'>",
  10719. referencedClasses: [],
  10720. messageSends: []
  10721. }),
  10722. $globals.Array);
  10723. $core.addMethod(
  10724. $core.method({
  10725. selector: "numericallyIndexable",
  10726. protocol: "private",
  10727. fn: function (){
  10728. var self=this,$self=this;
  10729. return self;
  10730. },
  10731. args: [],
  10732. source: "numericallyIndexable\x0a\x09^ self",
  10733. referencedClasses: [],
  10734. messageSends: []
  10735. }),
  10736. $globals.Array);
  10737. $core.addMethod(
  10738. $core.method({
  10739. selector: "printOn:",
  10740. protocol: "printing",
  10741. fn: function (aStream){
  10742. var self=this,$self=this;
  10743. return $core.withContext(function($ctx1) {
  10744. (
  10745. $ctx1.supercall = true,
  10746. ($globals.Array.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  10747. $ctx1.supercall = false;
  10748. $ctx1.sendIdx["printOn:"]=1;
  10749. $recv(aStream)._nextPutAll_(" (");
  10750. $ctx1.sendIdx["nextPutAll:"]=1;
  10751. $self._do_separatedBy_((function(each){
  10752. return $core.withContext(function($ctx2) {
  10753. return $recv(each)._printOn_(aStream);
  10754. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  10755. }),(function(){
  10756. return $core.withContext(function($ctx2) {
  10757. return $recv(aStream)._nextPutAll_(" ");
  10758. $ctx2.sendIdx["nextPutAll:"]=2;
  10759. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  10760. }));
  10761. $recv(aStream)._nextPutAll_(")");
  10762. return self;
  10763. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Array)});
  10764. },
  10765. args: ["aStream"],
  10766. 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: ')'",
  10767. referencedClasses: [],
  10768. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  10769. }),
  10770. $globals.Array);
  10771. $core.addMethod(
  10772. $core.method({
  10773. selector: "remove:ifAbsent:",
  10774. protocol: "adding/removing",
  10775. fn: function (anObject,aBlock){
  10776. var self=this,$self=this;
  10777. var index;
  10778. return $core.withContext(function($ctx1) {
  10779. var $1;
  10780. index=$self._indexOf_ifAbsent_(anObject,(function(){
  10781. return (0);
  10782. }));
  10783. $1=$recv(index).__eq((0));
  10784. if($core.assert($1)){
  10785. return $recv(aBlock)._value();
  10786. } else {
  10787. $self._removeIndex_(index);
  10788. return anObject;
  10789. }
  10790. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,index:index},$globals.Array)});
  10791. },
  10792. args: ["anObject", "aBlock"],
  10793. 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 ]",
  10794. referencedClasses: [],
  10795. messageSends: ["indexOf:ifAbsent:", "ifFalse:ifTrue:", "=", "removeIndex:", "value"]
  10796. }),
  10797. $globals.Array);
  10798. $core.addMethod(
  10799. $core.method({
  10800. selector: "removeAll",
  10801. protocol: "adding/removing",
  10802. fn: function (){
  10803. var self=this,$self=this;
  10804. return $core.withContext(function($ctx1) {
  10805. self.length = 0;
  10806. return self;
  10807. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Array)});
  10808. },
  10809. args: [],
  10810. source: "removeAll\x0a\x09<inlineJS: 'self.length = 0'>",
  10811. referencedClasses: [],
  10812. messageSends: []
  10813. }),
  10814. $globals.Array);
  10815. $core.addMethod(
  10816. $core.method({
  10817. selector: "removeFrom:to:",
  10818. protocol: "adding/removing",
  10819. fn: function (aNumber,anotherNumber){
  10820. var self=this,$self=this;
  10821. return $core.withContext(function($ctx1) {
  10822. self.splice(aNumber -1, anotherNumber - aNumber + 1);
  10823. return self;
  10824. }, function($ctx1) {$ctx1.fill(self,"removeFrom:to:",{aNumber:aNumber,anotherNumber:anotherNumber},$globals.Array)});
  10825. },
  10826. args: ["aNumber", "anotherNumber"],
  10827. source: "removeFrom: aNumber to: anotherNumber\x0a\x09<inlineJS: 'self.splice(aNumber -1, anotherNumber - aNumber + 1)'>",
  10828. referencedClasses: [],
  10829. messageSends: []
  10830. }),
  10831. $globals.Array);
  10832. $core.addMethod(
  10833. $core.method({
  10834. selector: "removeIndex:",
  10835. protocol: "adding/removing",
  10836. fn: function (anInteger){
  10837. var self=this,$self=this;
  10838. return $core.withContext(function($ctx1) {
  10839. self.splice(anInteger - 1, 1);
  10840. return self;
  10841. }, function($ctx1) {$ctx1.fill(self,"removeIndex:",{anInteger:anInteger},$globals.Array)});
  10842. },
  10843. args: ["anInteger"],
  10844. source: "removeIndex: anInteger\x0a\x09<inlineJS: 'self.splice(anInteger - 1, 1)'>",
  10845. referencedClasses: [],
  10846. messageSends: []
  10847. }),
  10848. $globals.Array);
  10849. $core.addMethod(
  10850. $core.method({
  10851. selector: "removeLast",
  10852. protocol: "adding/removing",
  10853. fn: function (){
  10854. var self=this,$self=this;
  10855. return $core.withContext(function($ctx1) {
  10856. return self.pop();;
  10857. return self;
  10858. }, function($ctx1) {$ctx1.fill(self,"removeLast",{},$globals.Array)});
  10859. },
  10860. args: [],
  10861. source: "removeLast\x0a\x09<inlineJS: 'return self.pop();'>",
  10862. referencedClasses: [],
  10863. messageSends: []
  10864. }),
  10865. $globals.Array);
  10866. $core.addMethod(
  10867. $core.method({
  10868. selector: "reversed",
  10869. protocol: "converting",
  10870. fn: function (){
  10871. var self=this,$self=this;
  10872. return $core.withContext(function($ctx1) {
  10873. return self.slice().reverse();
  10874. return self;
  10875. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.Array)});
  10876. },
  10877. args: [],
  10878. source: "reversed\x0a\x09<inlineJS: 'return self.slice().reverse()'>",
  10879. referencedClasses: [],
  10880. messageSends: []
  10881. }),
  10882. $globals.Array);
  10883. $core.addMethod(
  10884. $core.method({
  10885. selector: "select:",
  10886. protocol: "enumerating",
  10887. fn: function (aBlock){
  10888. var self=this,$self=this;
  10889. return $core.withContext(function($ctx1) {
  10890. return self.filter(function(each) {return aBlock._value_(each)});
  10891. return self;
  10892. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock},$globals.Array)});
  10893. },
  10894. args: ["aBlock"],
  10895. source: "select: aBlock\x0a\x09\x22Optimized version\x22\x0a\x09\x0a\x09<inlineJS: 'return self.filter(function(each) {return aBlock._value_(each)})'>",
  10896. referencedClasses: [],
  10897. messageSends: []
  10898. }),
  10899. $globals.Array);
  10900. $core.addMethod(
  10901. $core.method({
  10902. selector: "shallowCopy",
  10903. protocol: "copying",
  10904. fn: function (){
  10905. var self=this,$self=this;
  10906. return $core.withContext(function($ctx1) {
  10907. return self.slice();
  10908. return self;
  10909. }, function($ctx1) {$ctx1.fill(self,"shallowCopy",{},$globals.Array)});
  10910. },
  10911. args: [],
  10912. source: "shallowCopy\x0a\x09<inlineJS: 'return self.slice()'>",
  10913. referencedClasses: [],
  10914. messageSends: []
  10915. }),
  10916. $globals.Array);
  10917. $core.addMethod(
  10918. $core.method({
  10919. selector: "size",
  10920. protocol: "accessing",
  10921. fn: function (){
  10922. var self=this,$self=this;
  10923. return $core.withContext(function($ctx1) {
  10924. return self.length;
  10925. return self;
  10926. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Array)});
  10927. },
  10928. args: [],
  10929. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  10930. referencedClasses: [],
  10931. messageSends: []
  10932. }),
  10933. $globals.Array);
  10934. $core.addMethod(
  10935. $core.method({
  10936. selector: "sort",
  10937. protocol: "enumerating",
  10938. fn: function (){
  10939. var self=this,$self=this;
  10940. return $core.withContext(function($ctx1) {
  10941. return $self._sort_((function(a,b){
  10942. return $core.withContext(function($ctx2) {
  10943. return $recv(a).__lt(b);
  10944. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  10945. }));
  10946. }, function($ctx1) {$ctx1.fill(self,"sort",{},$globals.Array)});
  10947. },
  10948. args: [],
  10949. source: "sort\x0a\x09^ self sort: [ :a :b | a < b ]",
  10950. referencedClasses: [],
  10951. messageSends: ["sort:", "<"]
  10952. }),
  10953. $globals.Array);
  10954. $core.addMethod(
  10955. $core.method({
  10956. selector: "sort:",
  10957. protocol: "enumerating",
  10958. fn: function (aBlock){
  10959. var self=this,$self=this;
  10960. return $core.withContext(function($ctx1) {
  10961. return self.sort(function(a, b) {
  10962. if(aBlock._value_value_(a,b)) {return -1} else {return 1}
  10963. })
  10964. ;
  10965. return self;
  10966. }, function($ctx1) {$ctx1.fill(self,"sort:",{aBlock:aBlock},$globals.Array)});
  10967. },
  10968. args: ["aBlock"],
  10969. 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'>",
  10970. referencedClasses: [],
  10971. messageSends: []
  10972. }),
  10973. $globals.Array);
  10974. $core.addMethod(
  10975. $core.method({
  10976. selector: "sorted",
  10977. protocol: "enumerating",
  10978. fn: function (){
  10979. var self=this,$self=this;
  10980. return $core.withContext(function($ctx1) {
  10981. return $recv($self._copy())._sort();
  10982. }, function($ctx1) {$ctx1.fill(self,"sorted",{},$globals.Array)});
  10983. },
  10984. args: [],
  10985. source: "sorted\x0a\x09^ self copy sort",
  10986. referencedClasses: [],
  10987. messageSends: ["sort", "copy"]
  10988. }),
  10989. $globals.Array);
  10990. $core.addMethod(
  10991. $core.method({
  10992. selector: "sorted:",
  10993. protocol: "enumerating",
  10994. fn: function (aBlock){
  10995. var self=this,$self=this;
  10996. return $core.withContext(function($ctx1) {
  10997. return $recv($self._copy())._sort_(aBlock);
  10998. }, function($ctx1) {$ctx1.fill(self,"sorted:",{aBlock:aBlock},$globals.Array)});
  10999. },
  11000. args: ["aBlock"],
  11001. source: "sorted: aBlock\x0a\x09^ self copy sort: aBlock",
  11002. referencedClasses: [],
  11003. messageSends: ["sort:", "copy"]
  11004. }),
  11005. $globals.Array);
  11006. $core.addMethod(
  11007. $core.method({
  11008. selector: "new:",
  11009. protocol: "instance creation",
  11010. fn: function (anInteger){
  11011. var self=this,$self=this;
  11012. return $core.withContext(function($ctx1) {
  11013. return new Array(anInteger);
  11014. return self;
  11015. }, function($ctx1) {$ctx1.fill(self,"new:",{anInteger:anInteger},$globals.Array.a$cls)});
  11016. },
  11017. args: ["anInteger"],
  11018. source: "new: anInteger\x0a\x09<inlineJS: 'return new Array(anInteger)'>",
  11019. referencedClasses: [],
  11020. messageSends: []
  11021. }),
  11022. $globals.Array.a$cls);
  11023. $core.addMethod(
  11024. $core.method({
  11025. selector: "with:",
  11026. protocol: "instance creation",
  11027. fn: function (anObject){
  11028. var self=this,$self=this;
  11029. return $core.withContext(function($ctx1) {
  11030. var $1;
  11031. $1=$self._new_((1));
  11032. $recv($1)._at_put_((1),anObject);
  11033. return $recv($1)._yourself();
  11034. }, function($ctx1) {$ctx1.fill(self,"with:",{anObject:anObject},$globals.Array.a$cls)});
  11035. },
  11036. args: ["anObject"],
  11037. source: "with: anObject\x0a\x09\x09^ (self new: 1)\x0a\x09\x09at: 1 put: anObject;\x0a\x09\x09yourself",
  11038. referencedClasses: [],
  11039. messageSends: ["at:put:", "new:", "yourself"]
  11040. }),
  11041. $globals.Array.a$cls);
  11042. $core.addMethod(
  11043. $core.method({
  11044. selector: "with:with:",
  11045. protocol: "instance creation",
  11046. fn: function (anObject,anObject2){
  11047. var self=this,$self=this;
  11048. return $core.withContext(function($ctx1) {
  11049. var $1;
  11050. $1=$self._new_((2));
  11051. $recv($1)._at_put_((1),anObject);
  11052. $ctx1.sendIdx["at:put:"]=1;
  11053. $recv($1)._at_put_((2),anObject2);
  11054. return $recv($1)._yourself();
  11055. }, function($ctx1) {$ctx1.fill(self,"with:with:",{anObject:anObject,anObject2:anObject2},$globals.Array.a$cls)});
  11056. },
  11057. args: ["anObject", "anObject2"],
  11058. 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",
  11059. referencedClasses: [],
  11060. messageSends: ["at:put:", "new:", "yourself"]
  11061. }),
  11062. $globals.Array.a$cls);
  11063. $core.addMethod(
  11064. $core.method({
  11065. selector: "with:with:with:",
  11066. protocol: "instance creation",
  11067. fn: function (anObject,anObject2,anObject3){
  11068. var self=this,$self=this;
  11069. return $core.withContext(function($ctx1) {
  11070. var $1;
  11071. $1=$self._new_((3));
  11072. $recv($1)._at_put_((1),anObject);
  11073. $ctx1.sendIdx["at:put:"]=1;
  11074. $recv($1)._at_put_((2),anObject2);
  11075. $ctx1.sendIdx["at:put:"]=2;
  11076. $recv($1)._at_put_((3),anObject3);
  11077. return $recv($1)._yourself();
  11078. }, function($ctx1) {$ctx1.fill(self,"with:with:with:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.Array.a$cls)});
  11079. },
  11080. args: ["anObject", "anObject2", "anObject3"],
  11081. 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",
  11082. referencedClasses: [],
  11083. messageSends: ["at:put:", "new:", "yourself"]
  11084. }),
  11085. $globals.Array.a$cls);
  11086. $core.addMethod(
  11087. $core.method({
  11088. selector: "withAll:",
  11089. protocol: "instance creation",
  11090. fn: function (aCollection){
  11091. var self=this,$self=this;
  11092. var instance,index;
  11093. return $core.withContext(function($ctx1) {
  11094. index=(1);
  11095. instance=$self._new_($recv(aCollection)._size());
  11096. $recv(aCollection)._do_((function(each){
  11097. return $core.withContext(function($ctx2) {
  11098. $recv(instance)._at_put_(index,each);
  11099. index=$recv(index).__plus((1));
  11100. return index;
  11101. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  11102. }));
  11103. return instance;
  11104. }, function($ctx1) {$ctx1.fill(self,"withAll:",{aCollection:aCollection,instance:instance,index:index},$globals.Array.a$cls)});
  11105. },
  11106. args: ["aCollection"],
  11107. 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",
  11108. referencedClasses: [],
  11109. messageSends: ["new:", "size", "do:", "at:put:", "+"]
  11110. }),
  11111. $globals.Array.a$cls);
  11112. $core.addClass("CharacterArray", $globals.SequenceableCollection, [], "Kernel-Collections");
  11113. $globals.CharacterArray.comment="I am the abstract superclass of string-like collections.";
  11114. $core.addMethod(
  11115. $core.method({
  11116. selector: ",",
  11117. protocol: "copying",
  11118. fn: function (aString){
  11119. var self=this,$self=this;
  11120. return $core.withContext(function($ctx1) {
  11121. var $1;
  11122. $1=$self._asString();
  11123. $ctx1.sendIdx["asString"]=1;
  11124. return $recv($1).__comma($recv(aString)._asString());
  11125. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.CharacterArray)});
  11126. },
  11127. args: ["aString"],
  11128. source: ", aString\x0a\x09^ self asString, aString asString",
  11129. referencedClasses: [],
  11130. messageSends: [",", "asString"]
  11131. }),
  11132. $globals.CharacterArray);
  11133. $core.addMethod(
  11134. $core.method({
  11135. selector: "add:",
  11136. protocol: "adding/removing",
  11137. fn: function (anObject){
  11138. var self=this,$self=this;
  11139. return $core.withContext(function($ctx1) {
  11140. $self._errorReadOnly();
  11141. return self;
  11142. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.CharacterArray)});
  11143. },
  11144. args: ["anObject"],
  11145. source: "add: anObject\x0a\x09self errorReadOnly",
  11146. referencedClasses: [],
  11147. messageSends: ["errorReadOnly"]
  11148. }),
  11149. $globals.CharacterArray);
  11150. $core.addMethod(
  11151. $core.method({
  11152. selector: "asLowercase",
  11153. protocol: "converting",
  11154. fn: function (){
  11155. var self=this,$self=this;
  11156. return $core.withContext(function($ctx1) {
  11157. return $recv($self._class())._fromString_($recv($self._asString())._asLowercase());
  11158. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.CharacterArray)});
  11159. },
  11160. args: [],
  11161. source: "asLowercase\x0a\x09^ self class fromString: self asString asLowercase",
  11162. referencedClasses: [],
  11163. messageSends: ["fromString:", "class", "asLowercase", "asString"]
  11164. }),
  11165. $globals.CharacterArray);
  11166. $core.addMethod(
  11167. $core.method({
  11168. selector: "asNumber",
  11169. protocol: "converting",
  11170. fn: function (){
  11171. var self=this,$self=this;
  11172. return $core.withContext(function($ctx1) {
  11173. return $recv($self._asString())._asNumber();
  11174. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.CharacterArray)});
  11175. },
  11176. args: [],
  11177. source: "asNumber\x0a\x09^ self asString asNumber",
  11178. referencedClasses: [],
  11179. messageSends: ["asNumber", "asString"]
  11180. }),
  11181. $globals.CharacterArray);
  11182. $core.addMethod(
  11183. $core.method({
  11184. selector: "asString",
  11185. protocol: "converting",
  11186. fn: function (){
  11187. var self=this,$self=this;
  11188. return $core.withContext(function($ctx1) {
  11189. return $self._subclassResponsibility();
  11190. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.CharacterArray)});
  11191. },
  11192. args: [],
  11193. source: "asString\x0a\x09^ self subclassResponsibility",
  11194. referencedClasses: [],
  11195. messageSends: ["subclassResponsibility"]
  11196. }),
  11197. $globals.CharacterArray);
  11198. $core.addMethod(
  11199. $core.method({
  11200. selector: "asSymbol",
  11201. protocol: "converting",
  11202. fn: function (){
  11203. var self=this,$self=this;
  11204. return $core.withContext(function($ctx1) {
  11205. return $self._asString();
  11206. }, function($ctx1) {$ctx1.fill(self,"asSymbol",{},$globals.CharacterArray)});
  11207. },
  11208. args: [],
  11209. source: "asSymbol\x0a\x09^ self asString",
  11210. referencedClasses: [],
  11211. messageSends: ["asString"]
  11212. }),
  11213. $globals.CharacterArray);
  11214. $core.addMethod(
  11215. $core.method({
  11216. selector: "asSymbolPrintOn:",
  11217. protocol: "printing",
  11218. fn: function (aStream){
  11219. var self=this,$self=this;
  11220. return $core.withContext(function($ctx1) {
  11221. var $1;
  11222. $recv(aStream)._nextPutAll_("#");
  11223. $1=$recv($self._asString())._isSelector();
  11224. if($core.assert($1)){
  11225. $recv(aStream)._nextPut_(self);
  11226. } else {
  11227. $self._printOn_(aStream);
  11228. }
  11229. return self;
  11230. }, function($ctx1) {$ctx1.fill(self,"asSymbolPrintOn:",{aStream:aStream},$globals.CharacterArray)});
  11231. },
  11232. args: ["aStream"],
  11233. source: "asSymbolPrintOn: aStream\x0a\x09aStream nextPutAll: '#'.\x0a\x09self asString isSelector\x0a\x09\x09ifTrue: [ aStream nextPut: self ]\x0a\x09\x09ifFalse: [ self printOn: aStream ]",
  11234. referencedClasses: [],
  11235. messageSends: ["nextPutAll:", "ifTrue:ifFalse:", "isSelector", "asString", "nextPut:", "printOn:"]
  11236. }),
  11237. $globals.CharacterArray);
  11238. $core.addMethod(
  11239. $core.method({
  11240. selector: "asUppercase",
  11241. protocol: "converting",
  11242. fn: function (){
  11243. var self=this,$self=this;
  11244. return $core.withContext(function($ctx1) {
  11245. return $recv($self._class())._fromString_($recv($self._asString())._asUppercase());
  11246. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.CharacterArray)});
  11247. },
  11248. args: [],
  11249. source: "asUppercase\x0a\x09^ self class fromString: self asString asUppercase",
  11250. referencedClasses: [],
  11251. messageSends: ["fromString:", "class", "asUppercase", "asString"]
  11252. }),
  11253. $globals.CharacterArray);
  11254. $core.addMethod(
  11255. $core.method({
  11256. selector: "at:put:",
  11257. protocol: "accessing",
  11258. fn: function (anIndex,anObject){
  11259. var self=this,$self=this;
  11260. return $core.withContext(function($ctx1) {
  11261. $self._errorReadOnly();
  11262. return self;
  11263. }, function($ctx1) {$ctx1.fill(self,"at:put:",{anIndex:anIndex,anObject:anObject},$globals.CharacterArray)});
  11264. },
  11265. args: ["anIndex", "anObject"],
  11266. source: "at: anIndex put: anObject\x0a\x09self errorReadOnly",
  11267. referencedClasses: [],
  11268. messageSends: ["errorReadOnly"]
  11269. }),
  11270. $globals.CharacterArray);
  11271. $core.addMethod(
  11272. $core.method({
  11273. selector: "errorReadOnly",
  11274. protocol: "error handling",
  11275. fn: function (){
  11276. var self=this,$self=this;
  11277. return $core.withContext(function($ctx1) {
  11278. $self._error_("Object is read-only");
  11279. return self;
  11280. }, function($ctx1) {$ctx1.fill(self,"errorReadOnly",{},$globals.CharacterArray)});
  11281. },
  11282. args: [],
  11283. source: "errorReadOnly\x0a\x09self error: 'Object is read-only'",
  11284. referencedClasses: [],
  11285. messageSends: ["error:"]
  11286. }),
  11287. $globals.CharacterArray);
  11288. $core.addMethod(
  11289. $core.method({
  11290. selector: "printOn:",
  11291. protocol: "printing",
  11292. fn: function (aStream){
  11293. var self=this,$self=this;
  11294. return $core.withContext(function($ctx1) {
  11295. $recv($self._asString())._printOn_(aStream);
  11296. return self;
  11297. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.CharacterArray)});
  11298. },
  11299. args: ["aStream"],
  11300. source: "printOn: aStream\x0a\x09self asString printOn: aStream",
  11301. referencedClasses: [],
  11302. messageSends: ["printOn:", "asString"]
  11303. }),
  11304. $globals.CharacterArray);
  11305. $core.addMethod(
  11306. $core.method({
  11307. selector: "putOn:",
  11308. protocol: "streaming",
  11309. fn: function (aStream){
  11310. var self=this,$self=this;
  11311. return $core.withContext(function($ctx1) {
  11312. $recv(aStream)._nextPutString_(self);
  11313. return self;
  11314. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.CharacterArray)});
  11315. },
  11316. args: ["aStream"],
  11317. source: "putOn: aStream\x0a\x09aStream nextPutString: self",
  11318. referencedClasses: [],
  11319. messageSends: ["nextPutString:"]
  11320. }),
  11321. $globals.CharacterArray);
  11322. $core.addMethod(
  11323. $core.method({
  11324. selector: "remove:",
  11325. protocol: "adding/removing",
  11326. fn: function (anObject){
  11327. var self=this,$self=this;
  11328. return $core.withContext(function($ctx1) {
  11329. $self._errorReadOnly();
  11330. return self;
  11331. }, function($ctx1) {$ctx1.fill(self,"remove:",{anObject:anObject},$globals.CharacterArray)});
  11332. },
  11333. args: ["anObject"],
  11334. source: "remove: anObject\x0a\x09self errorReadOnly",
  11335. referencedClasses: [],
  11336. messageSends: ["errorReadOnly"]
  11337. }),
  11338. $globals.CharacterArray);
  11339. $core.addMethod(
  11340. $core.method({
  11341. selector: "remove:ifAbsent:",
  11342. protocol: "adding/removing",
  11343. fn: function (anObject,aBlock){
  11344. var self=this,$self=this;
  11345. return $core.withContext(function($ctx1) {
  11346. $self._errorReadOnly();
  11347. return self;
  11348. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock},$globals.CharacterArray)});
  11349. },
  11350. args: ["anObject", "aBlock"],
  11351. source: "remove: anObject ifAbsent: aBlock\x0a\x09self errorReadOnly",
  11352. referencedClasses: [],
  11353. messageSends: ["errorReadOnly"]
  11354. }),
  11355. $globals.CharacterArray);
  11356. $core.addMethod(
  11357. $core.method({
  11358. selector: "symbolPrintString",
  11359. protocol: "printing",
  11360. fn: function (){
  11361. var self=this,$self=this;
  11362. return $core.withContext(function($ctx1) {
  11363. return $recv($globals.String)._streamContents_((function(str){
  11364. return $core.withContext(function($ctx2) {
  11365. return $self._asSymbolPrintOn_(str);
  11366. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  11367. }));
  11368. }, function($ctx1) {$ctx1.fill(self,"symbolPrintString",{},$globals.CharacterArray)});
  11369. },
  11370. args: [],
  11371. source: "symbolPrintString\x0a\x09^ String streamContents: [ :str | self asSymbolPrintOn: str ]",
  11372. referencedClasses: ["String"],
  11373. messageSends: ["streamContents:", "asSymbolPrintOn:"]
  11374. }),
  11375. $globals.CharacterArray);
  11376. $core.addMethod(
  11377. $core.method({
  11378. selector: "fromString:",
  11379. protocol: "instance creation",
  11380. fn: function (aString){
  11381. var self=this,$self=this;
  11382. return $core.withContext(function($ctx1) {
  11383. $self._subclassResponsibility();
  11384. return self;
  11385. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.CharacterArray.a$cls)});
  11386. },
  11387. args: ["aString"],
  11388. source: "fromString: aString\x0a\x09self subclassResponsibility",
  11389. referencedClasses: [],
  11390. messageSends: ["subclassResponsibility"]
  11391. }),
  11392. $globals.CharacterArray.a$cls);
  11393. $core.addClass("String", $globals.CharacterArray, [], "Kernel-Collections");
  11394. $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 >> #,`";
  11395. $core.addMethod(
  11396. $core.method({
  11397. selector: ",",
  11398. protocol: "copying",
  11399. fn: function (aString){
  11400. var self=this,$self=this;
  11401. return $core.withContext(function($ctx1) {
  11402. return String(self) + aString;
  11403. return self;
  11404. }, function($ctx1) {$ctx1.fill(self,",",{aString:aString},$globals.String)});
  11405. },
  11406. args: ["aString"],
  11407. source: ", aString\x0a\x09<inlineJS: 'return String(self) + aString'>",
  11408. referencedClasses: [],
  11409. messageSends: []
  11410. }),
  11411. $globals.String);
  11412. $core.addMethod(
  11413. $core.method({
  11414. selector: "<",
  11415. protocol: "comparing",
  11416. fn: function (aString){
  11417. var self=this,$self=this;
  11418. return $core.withContext(function($ctx1) {
  11419. return String(self) < aString._asString();
  11420. return self;
  11421. }, function($ctx1) {$ctx1.fill(self,"<",{aString:aString},$globals.String)});
  11422. },
  11423. args: ["aString"],
  11424. source: "< aString\x0a\x09<inlineJS: 'return String(self) < aString._asString()'>",
  11425. referencedClasses: [],
  11426. messageSends: []
  11427. }),
  11428. $globals.String);
  11429. $core.addMethod(
  11430. $core.method({
  11431. selector: "<=",
  11432. protocol: "comparing",
  11433. fn: function (aString){
  11434. var self=this,$self=this;
  11435. return $core.withContext(function($ctx1) {
  11436. return String(self) <= aString._asString();
  11437. return self;
  11438. }, function($ctx1) {$ctx1.fill(self,"<=",{aString:aString},$globals.String)});
  11439. },
  11440. args: ["aString"],
  11441. source: "<= aString\x0a\x09<inlineJS: 'return String(self) <= aString._asString()'>",
  11442. referencedClasses: [],
  11443. messageSends: []
  11444. }),
  11445. $globals.String);
  11446. $core.addMethod(
  11447. $core.method({
  11448. selector: "=",
  11449. protocol: "comparing",
  11450. fn: function (aString){
  11451. var self=this,$self=this;
  11452. return $core.withContext(function($ctx1) {
  11453. return aString != null && String(self) === (typeof aString === "string" ? aString : aString.valueOf());
  11454. return self;
  11455. }, function($ctx1) {$ctx1.fill(self,"=",{aString:aString},$globals.String)});
  11456. },
  11457. args: ["aString"],
  11458. source: "= aString\x0a<inlineJS:\x0a\x09'return aString != null && String(self) === (typeof aString === \x22string\x22 ? aString : aString.valueOf())'>",
  11459. referencedClasses: [],
  11460. messageSends: []
  11461. }),
  11462. $globals.String);
  11463. $core.addMethod(
  11464. $core.method({
  11465. selector: "==",
  11466. protocol: "comparing",
  11467. fn: function (aString){
  11468. var self=this,$self=this;
  11469. return $core.withContext(function($ctx1) {
  11470. if (typeof aString === "string") return String(self) === aString;
  11471. else if (aString != null && typeof aString === "object") return String(self) === aString.valueOf();
  11472. else return false;;
  11473. return self;
  11474. }, function($ctx1) {$ctx1.fill(self,"==",{aString:aString},$globals.String)});
  11475. },
  11476. args: ["aString"],
  11477. 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'>",
  11478. referencedClasses: [],
  11479. messageSends: []
  11480. }),
  11481. $globals.String);
  11482. $core.addMethod(
  11483. $core.method({
  11484. selector: ">",
  11485. protocol: "comparing",
  11486. fn: function (aString){
  11487. var self=this,$self=this;
  11488. return $core.withContext(function($ctx1) {
  11489. return String(self) > aString._asString();
  11490. return self;
  11491. }, function($ctx1) {$ctx1.fill(self,">",{aString:aString},$globals.String)});
  11492. },
  11493. args: ["aString"],
  11494. source: "> aString\x0a\x09<inlineJS: 'return String(self) > aString._asString()'>",
  11495. referencedClasses: [],
  11496. messageSends: []
  11497. }),
  11498. $globals.String);
  11499. $core.addMethod(
  11500. $core.method({
  11501. selector: ">=",
  11502. protocol: "comparing",
  11503. fn: function (aString){
  11504. var self=this,$self=this;
  11505. return $core.withContext(function($ctx1) {
  11506. return String(self) >= aString._asString();
  11507. return self;
  11508. }, function($ctx1) {$ctx1.fill(self,">=",{aString:aString},$globals.String)});
  11509. },
  11510. args: ["aString"],
  11511. source: ">= aString\x0a\x09<inlineJS: 'return String(self) >= aString._asString()'>",
  11512. referencedClasses: [],
  11513. messageSends: []
  11514. }),
  11515. $globals.String);
  11516. $core.addMethod(
  11517. $core.method({
  11518. selector: "asJavaScriptMethodName",
  11519. protocol: "converting",
  11520. fn: function (){
  11521. var self=this,$self=this;
  11522. return $core.withContext(function($ctx1) {
  11523. return $core.st2js(self);
  11524. return self;
  11525. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptMethodName",{},$globals.String)});
  11526. },
  11527. args: [],
  11528. source: "asJavaScriptMethodName\x0a\x09<inlineJS: 'return $core.st2js(self)'>",
  11529. referencedClasses: [],
  11530. messageSends: []
  11531. }),
  11532. $globals.String);
  11533. $core.addMethod(
  11534. $core.method({
  11535. selector: "asJavaScriptObject",
  11536. protocol: "converting",
  11537. fn: function (){
  11538. var self=this,$self=this;
  11539. return self;
  11540. },
  11541. args: [],
  11542. source: "asJavaScriptObject\x0a\x09^ self",
  11543. referencedClasses: [],
  11544. messageSends: []
  11545. }),
  11546. $globals.String);
  11547. $core.addMethod(
  11548. $core.method({
  11549. selector: "asJavaScriptSource",
  11550. protocol: "converting",
  11551. fn: function (){
  11552. var self=this,$self=this;
  11553. return $core.withContext(function($ctx1) {
  11554. if(self.search(/^[a-zA-Z0-9_:.$ ]*$/) == -1)
  11555. return "\"" + self.replace(/[\x00-\x1f"\\\x7f-\x9f]/g, function(ch){var c=ch.charCodeAt(0);return "\\x"+("0"+c.toString(16)).slice(-2)}) + "\"";
  11556. else
  11557. return "\"" + self + "\"";
  11558. ;
  11559. return self;
  11560. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.String)});
  11561. },
  11562. args: [],
  11563. 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'>",
  11564. referencedClasses: [],
  11565. messageSends: []
  11566. }),
  11567. $globals.String);
  11568. $core.addMethod(
  11569. $core.method({
  11570. selector: "asLowercase",
  11571. protocol: "converting",
  11572. fn: function (){
  11573. var self=this,$self=this;
  11574. return $core.withContext(function($ctx1) {
  11575. return self.toLowerCase();
  11576. return self;
  11577. }, function($ctx1) {$ctx1.fill(self,"asLowercase",{},$globals.String)});
  11578. },
  11579. args: [],
  11580. source: "asLowercase\x0a\x09<inlineJS: 'return self.toLowerCase()'>",
  11581. referencedClasses: [],
  11582. messageSends: []
  11583. }),
  11584. $globals.String);
  11585. $core.addMethod(
  11586. $core.method({
  11587. selector: "asMutator",
  11588. protocol: "converting",
  11589. fn: function (){
  11590. var self=this,$self=this;
  11591. return $core.withContext(function($ctx1) {
  11592. var $1;
  11593. $1=$recv($self._last()).__eq(":");
  11594. if(!$core.assert($1)){
  11595. return $self.__comma(":");
  11596. }
  11597. return self;
  11598. }, function($ctx1) {$ctx1.fill(self,"asMutator",{},$globals.String)});
  11599. },
  11600. args: [],
  11601. 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",
  11602. referencedClasses: [],
  11603. messageSends: ["ifFalse:", "=", "last", ","]
  11604. }),
  11605. $globals.String);
  11606. $core.addMethod(
  11607. $core.method({
  11608. selector: "asNumber",
  11609. protocol: "converting",
  11610. fn: function (){
  11611. var self=this,$self=this;
  11612. return $core.withContext(function($ctx1) {
  11613. return Number(self);
  11614. return self;
  11615. }, function($ctx1) {$ctx1.fill(self,"asNumber",{},$globals.String)});
  11616. },
  11617. args: [],
  11618. source: "asNumber\x0a\x09<inlineJS: 'return Number(self)'>",
  11619. referencedClasses: [],
  11620. messageSends: []
  11621. }),
  11622. $globals.String);
  11623. $core.addMethod(
  11624. $core.method({
  11625. selector: "asRegexp",
  11626. protocol: "converting",
  11627. fn: function (){
  11628. var self=this,$self=this;
  11629. return $core.withContext(function($ctx1) {
  11630. return $recv($globals.RegularExpression)._fromString_(self);
  11631. }, function($ctx1) {$ctx1.fill(self,"asRegexp",{},$globals.String)});
  11632. },
  11633. args: [],
  11634. source: "asRegexp\x0a\x09^ RegularExpression fromString: self",
  11635. referencedClasses: ["RegularExpression"],
  11636. messageSends: ["fromString:"]
  11637. }),
  11638. $globals.String);
  11639. $core.addMethod(
  11640. $core.method({
  11641. selector: "asString",
  11642. protocol: "converting",
  11643. fn: function (){
  11644. var self=this,$self=this;
  11645. return self;
  11646. },
  11647. args: [],
  11648. source: "asString\x0a\x09^ self",
  11649. referencedClasses: [],
  11650. messageSends: []
  11651. }),
  11652. $globals.String);
  11653. $core.addMethod(
  11654. $core.method({
  11655. selector: "asSymbol",
  11656. protocol: "converting",
  11657. fn: function (){
  11658. var self=this,$self=this;
  11659. return self;
  11660. },
  11661. args: [],
  11662. source: "asSymbol\x0a\x09^ self",
  11663. referencedClasses: [],
  11664. messageSends: []
  11665. }),
  11666. $globals.String);
  11667. $core.addMethod(
  11668. $core.method({
  11669. selector: "asUppercase",
  11670. protocol: "converting",
  11671. fn: function (){
  11672. var self=this,$self=this;
  11673. return $core.withContext(function($ctx1) {
  11674. return self.toUpperCase();
  11675. return self;
  11676. }, function($ctx1) {$ctx1.fill(self,"asUppercase",{},$globals.String)});
  11677. },
  11678. args: [],
  11679. source: "asUppercase\x0a\x09<inlineJS: 'return self.toUpperCase()'>",
  11680. referencedClasses: [],
  11681. messageSends: []
  11682. }),
  11683. $globals.String);
  11684. $core.addMethod(
  11685. $core.method({
  11686. selector: "asciiValue",
  11687. protocol: "accessing",
  11688. fn: function (){
  11689. var self=this,$self=this;
  11690. return $core.withContext(function($ctx1) {
  11691. return self.charCodeAt(0);;
  11692. return self;
  11693. }, function($ctx1) {$ctx1.fill(self,"asciiValue",{},$globals.String)});
  11694. },
  11695. args: [],
  11696. source: "asciiValue\x0a\x09<inlineJS: 'return self.charCodeAt(0);'>",
  11697. referencedClasses: [],
  11698. messageSends: []
  11699. }),
  11700. $globals.String);
  11701. $core.addMethod(
  11702. $core.method({
  11703. selector: "at:ifAbsent:",
  11704. protocol: "accessing",
  11705. fn: function (anIndex,aBlock){
  11706. var self=this,$self=this;
  11707. return $core.withContext(function($ctx1) {
  11708. return String(self)[anIndex - 1] || aBlock._value();
  11709. return self;
  11710. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{anIndex:anIndex,aBlock:aBlock},$globals.String)});
  11711. },
  11712. args: ["anIndex", "aBlock"],
  11713. source: "at: anIndex ifAbsent: aBlock\x0a\x09<inlineJS: 'return String(self)[anIndex - 1] || aBlock._value()'>",
  11714. referencedClasses: [],
  11715. messageSends: []
  11716. }),
  11717. $globals.String);
  11718. $core.addMethod(
  11719. $core.method({
  11720. selector: "at:ifPresent:ifAbsent:",
  11721. protocol: "accessing",
  11722. fn: function (anIndex,aBlock,anotherBlock){
  11723. var self=this,$self=this;
  11724. return $core.withContext(function($ctx1) {
  11725. var result = String(self)[anIndex - 1];
  11726. return result ? aBlock._value_(result) : anotherBlock._value();
  11727. ;
  11728. return self;
  11729. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{anIndex:anIndex,aBlock:aBlock,anotherBlock:anotherBlock},$globals.String)});
  11730. },
  11731. args: ["anIndex", "aBlock", "anotherBlock"],
  11732. 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'>",
  11733. referencedClasses: [],
  11734. messageSends: []
  11735. }),
  11736. $globals.String);
  11737. $core.addMethod(
  11738. $core.method({
  11739. selector: "capitalized",
  11740. protocol: "converting",
  11741. fn: function (){
  11742. var self=this,$self=this;
  11743. return $core.withContext(function($ctx1) {
  11744. return $self._ifNotEmpty_((function(){
  11745. return $core.withContext(function($ctx2) {
  11746. return $recv($recv($self._first())._asUppercase()).__comma($self._allButFirst());
  11747. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11748. }));
  11749. }, function($ctx1) {$ctx1.fill(self,"capitalized",{},$globals.String)});
  11750. },
  11751. args: [],
  11752. source: "capitalized\x0a\x09^ self ifNotEmpty: [ self first asUppercase, self allButFirst ]",
  11753. referencedClasses: [],
  11754. messageSends: ["ifNotEmpty:", ",", "asUppercase", "first", "allButFirst"]
  11755. }),
  11756. $globals.String);
  11757. $core.addMethod(
  11758. $core.method({
  11759. selector: "charCodeAt:",
  11760. protocol: "accessing",
  11761. fn: function (anInteger){
  11762. var self=this,$self=this;
  11763. return $core.withContext(function($ctx1) {
  11764. return self.charCodeAt(anInteger - 1);
  11765. return self;
  11766. }, function($ctx1) {$ctx1.fill(self,"charCodeAt:",{anInteger:anInteger},$globals.String)});
  11767. },
  11768. args: ["anInteger"],
  11769. source: "charCodeAt: anInteger\x0a\x09<inlineJS: 'return self.charCodeAt(anInteger - 1)'>",
  11770. referencedClasses: [],
  11771. messageSends: []
  11772. }),
  11773. $globals.String);
  11774. $core.addMethod(
  11775. $core.method({
  11776. selector: "copyFrom:to:",
  11777. protocol: "copying",
  11778. fn: function (anIndex,anotherIndex){
  11779. var self=this,$self=this;
  11780. return $core.withContext(function($ctx1) {
  11781. return self.substring(anIndex - 1, anotherIndex);
  11782. return self;
  11783. }, function($ctx1) {$ctx1.fill(self,"copyFrom:to:",{anIndex:anIndex,anotherIndex:anotherIndex},$globals.String)});
  11784. },
  11785. args: ["anIndex", "anotherIndex"],
  11786. source: "copyFrom: anIndex to: anotherIndex\x0a\x09<inlineJS: 'return self.substring(anIndex - 1, anotherIndex)'>",
  11787. referencedClasses: [],
  11788. messageSends: []
  11789. }),
  11790. $globals.String);
  11791. $core.addMethod(
  11792. $core.method({
  11793. selector: "crlfSanitized",
  11794. protocol: "converting",
  11795. fn: function (){
  11796. var self=this,$self=this;
  11797. return $core.withContext(function($ctx1) {
  11798. return $recv($self._lines())._join_($recv($globals.String)._lf());
  11799. }, function($ctx1) {$ctx1.fill(self,"crlfSanitized",{},$globals.String)});
  11800. },
  11801. args: [],
  11802. source: "crlfSanitized\x0a\x09^ self lines join: String lf",
  11803. referencedClasses: ["String"],
  11804. messageSends: ["join:", "lines", "lf"]
  11805. }),
  11806. $globals.String);
  11807. $core.addMethod(
  11808. $core.method({
  11809. selector: "deepCopy",
  11810. protocol: "copying",
  11811. fn: function (){
  11812. var self=this,$self=this;
  11813. return $core.withContext(function($ctx1) {
  11814. return $self._shallowCopy();
  11815. }, function($ctx1) {$ctx1.fill(self,"deepCopy",{},$globals.String)});
  11816. },
  11817. args: [],
  11818. source: "deepCopy\x0a\x09^ self shallowCopy",
  11819. referencedClasses: [],
  11820. messageSends: ["shallowCopy"]
  11821. }),
  11822. $globals.String);
  11823. $core.addMethod(
  11824. $core.method({
  11825. selector: "escaped",
  11826. protocol: "converting",
  11827. fn: function (){
  11828. var self=this,$self=this;
  11829. return $core.withContext(function($ctx1) {
  11830. return escape(self);
  11831. return self;
  11832. }, function($ctx1) {$ctx1.fill(self,"escaped",{},$globals.String)});
  11833. },
  11834. args: [],
  11835. source: "escaped\x0a\x09<inlineJS: 'return escape(self)'>",
  11836. referencedClasses: [],
  11837. messageSends: []
  11838. }),
  11839. $globals.String);
  11840. $core.addMethod(
  11841. $core.method({
  11842. selector: "includesSubString:",
  11843. protocol: "testing",
  11844. fn: function (subString){
  11845. var self=this,$self=this;
  11846. return $core.withContext(function($ctx1) {
  11847. return self.indexOf(subString) != -1;
  11848. return self;
  11849. }, function($ctx1) {$ctx1.fill(self,"includesSubString:",{subString:subString},$globals.String)});
  11850. },
  11851. args: ["subString"],
  11852. source: "includesSubString: subString\x0a\x09<inlineJS: 'return self.indexOf(subString) != -1'>",
  11853. referencedClasses: [],
  11854. messageSends: []
  11855. }),
  11856. $globals.String);
  11857. $core.addMethod(
  11858. $core.method({
  11859. selector: "isCapitalized",
  11860. protocol: "testing",
  11861. fn: function (){
  11862. var self=this,$self=this;
  11863. return $core.withContext(function($ctx1) {
  11864. var $2,$1;
  11865. $2=$self._first();
  11866. $ctx1.sendIdx["first"]=1;
  11867. $1=$recv($2)._asUppercase();
  11868. return $recv($1).__eq_eq($self._first());
  11869. }, function($ctx1) {$ctx1.fill(self,"isCapitalized",{},$globals.String)});
  11870. },
  11871. args: [],
  11872. source: "isCapitalized\x0a\x09^ self first asUppercase == self first",
  11873. referencedClasses: [],
  11874. messageSends: ["==", "asUppercase", "first"]
  11875. }),
  11876. $globals.String);
  11877. $core.addMethod(
  11878. $core.method({
  11879. selector: "isImmutable",
  11880. protocol: "testing",
  11881. fn: function (){
  11882. var self=this,$self=this;
  11883. return true;
  11884. },
  11885. args: [],
  11886. source: "isImmutable\x0a\x09^ true",
  11887. referencedClasses: [],
  11888. messageSends: []
  11889. }),
  11890. $globals.String);
  11891. $core.addMethod(
  11892. $core.method({
  11893. selector: "isSelector",
  11894. protocol: "testing",
  11895. fn: function (){
  11896. var self=this,$self=this;
  11897. return $core.withContext(function($ctx1) {
  11898. return !!self.match(/^([a-zA-Z][a-zA-Z0-9]*|[\\+*/=><,@%~|&-]+|([a-zA-Z][a-zA-Z0-9]*\:)+)$/);
  11899. return self;
  11900. }, function($ctx1) {$ctx1.fill(self,"isSelector",{},$globals.String)});
  11901. },
  11902. args: [],
  11903. 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>",
  11904. referencedClasses: [],
  11905. messageSends: []
  11906. }),
  11907. $globals.String);
  11908. $core.addMethod(
  11909. $core.method({
  11910. selector: "isString",
  11911. protocol: "testing",
  11912. fn: function (){
  11913. var self=this,$self=this;
  11914. return true;
  11915. },
  11916. args: [],
  11917. source: "isString\x0a\x09^ true",
  11918. referencedClasses: [],
  11919. messageSends: []
  11920. }),
  11921. $globals.String);
  11922. $core.addMethod(
  11923. $core.method({
  11924. selector: "isVowel",
  11925. protocol: "testing",
  11926. fn: function (){
  11927. var self=this,$self=this;
  11928. return $core.withContext(function($ctx1) {
  11929. return $recv($recv($self._size()).__eq((1)))._and_((function(){
  11930. return $core.withContext(function($ctx2) {
  11931. return "aeiou"._includes_($self._asLowercase());
  11932. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11933. }));
  11934. }, function($ctx1) {$ctx1.fill(self,"isVowel",{},$globals.String)});
  11935. },
  11936. args: [],
  11937. 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 ]",
  11938. referencedClasses: [],
  11939. messageSends: ["and:", "=", "size", "includes:", "asLowercase"]
  11940. }),
  11941. $globals.String);
  11942. $core.addMethod(
  11943. $core.method({
  11944. selector: "join:",
  11945. protocol: "split join",
  11946. fn: function (aCollection){
  11947. var self=this,$self=this;
  11948. return $core.withContext(function($ctx1) {
  11949. return $recv($globals.String)._streamContents_((function(stream){
  11950. return $core.withContext(function($ctx2) {
  11951. return $recv(aCollection)._do_separatedBy_((function(each){
  11952. return $core.withContext(function($ctx3) {
  11953. return $recv(stream)._nextPutAll_($recv(each)._asString());
  11954. $ctx3.sendIdx["nextPutAll:"]=1;
  11955. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  11956. }),(function(){
  11957. return $core.withContext(function($ctx3) {
  11958. return $recv(stream)._nextPutAll_(self);
  11959. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  11960. }));
  11961. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  11962. }));
  11963. }, function($ctx1) {$ctx1.fill(self,"join:",{aCollection:aCollection},$globals.String)});
  11964. },
  11965. args: ["aCollection"],
  11966. 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 ]]",
  11967. referencedClasses: ["String"],
  11968. messageSends: ["streamContents:", "do:separatedBy:", "nextPutAll:", "asString"]
  11969. }),
  11970. $globals.String);
  11971. $core.addMethod(
  11972. $core.method({
  11973. selector: "lineIndicesDo:",
  11974. protocol: "split join",
  11975. fn: function (aBlock){
  11976. var self=this,$self=this;
  11977. var cr,lf,start,sz,nextLF,nextCR;
  11978. return $core.withContext(function($ctx1) {
  11979. var $2,$1,$4,$5,$3,$6,$7,$9,$8,$10,$11;
  11980. var $early={};
  11981. try {
  11982. start=(1);
  11983. sz=$self._size();
  11984. cr=$recv($globals.String)._cr();
  11985. nextCR=$self._indexOf_startingAt_(cr,(1));
  11986. $ctx1.sendIdx["indexOf:startingAt:"]=1;
  11987. lf=$recv($globals.String)._lf();
  11988. nextLF=$self._indexOf_startingAt_(lf,(1));
  11989. $ctx1.sendIdx["indexOf:startingAt:"]=2;
  11990. $recv((function(){
  11991. return $core.withContext(function($ctx2) {
  11992. return $recv(start).__lt_eq(sz);
  11993. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  11994. }))._whileTrue_((function(){
  11995. return $core.withContext(function($ctx2) {
  11996. $2=$recv(nextLF).__eq((0));
  11997. $ctx2.sendIdx["="]=1;
  11998. $1=$recv($2)._and_((function(){
  11999. return $core.withContext(function($ctx3) {
  12000. return $recv(nextCR).__eq((0));
  12001. $ctx3.sendIdx["="]=2;
  12002. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  12003. }));
  12004. $ctx2.sendIdx["and:"]=1;
  12005. if($core.assert($1)){
  12006. $recv(aBlock)._value_value_value_(start,sz,sz);
  12007. $ctx2.sendIdx["value:value:value:"]=1;
  12008. throw $early=[self];
  12009. }
  12010. $4=$recv(nextCR).__eq((0));
  12011. $ctx2.sendIdx["="]=3;
  12012. $3=$recv($4)._or_((function(){
  12013. return $core.withContext(function($ctx3) {
  12014. $5=(0).__lt(nextLF);
  12015. $ctx3.sendIdx["<"]=1;
  12016. return $recv($5)._and_((function(){
  12017. return $core.withContext(function($ctx4) {
  12018. return $recv(nextLF).__lt(nextCR);
  12019. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,6)});
  12020. }));
  12021. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  12022. }));
  12023. if($core.assert($3)){
  12024. $6=start;
  12025. $7=$recv(nextLF).__minus((1));
  12026. $ctx2.sendIdx["-"]=1;
  12027. $recv(aBlock)._value_value_value_($6,$7,nextLF);
  12028. $ctx2.sendIdx["value:value:value:"]=2;
  12029. start=(1).__plus(nextLF);
  12030. $ctx2.sendIdx["+"]=1;
  12031. nextLF=$self._indexOf_startingAt_(lf,start);
  12032. $ctx2.sendIdx["indexOf:startingAt:"]=3;
  12033. return nextLF;
  12034. } else {
  12035. $9=(1).__plus(nextCR);
  12036. $ctx2.sendIdx["+"]=2;
  12037. $8=$recv($9).__eq(nextLF);
  12038. if($core.assert($8)){
  12039. $10=start;
  12040. $11=$recv(nextCR).__minus((1));
  12041. $ctx2.sendIdx["-"]=2;
  12042. $recv(aBlock)._value_value_value_($10,$11,nextLF);
  12043. $ctx2.sendIdx["value:value:value:"]=3;
  12044. start=(1).__plus(nextLF);
  12045. $ctx2.sendIdx["+"]=3;
  12046. nextCR=$self._indexOf_startingAt_(cr,start);
  12047. $ctx2.sendIdx["indexOf:startingAt:"]=4;
  12048. nextLF=$self._indexOf_startingAt_(lf,start);
  12049. $ctx2.sendIdx["indexOf:startingAt:"]=5;
  12050. return nextLF;
  12051. } else {
  12052. $recv(aBlock)._value_value_value_(start,$recv(nextCR).__minus((1)),nextCR);
  12053. start=(1).__plus(nextCR);
  12054. nextCR=$self._indexOf_startingAt_(cr,start);
  12055. return nextCR;
  12056. }
  12057. }
  12058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12059. }));
  12060. return self;
  12061. }
  12062. catch(e) {if(e===$early)return e[0]; throw e}
  12063. }, function($ctx1) {$ctx1.fill(self,"lineIndicesDo:",{aBlock:aBlock,cr:cr,lf:lf,start:start,sz:sz,nextLF:nextLF,nextCR:nextCR},$globals.String)});
  12064. },
  12065. args: ["aBlock"],
  12066. 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 ] ]]",
  12067. referencedClasses: ["String"],
  12068. messageSends: ["size", "cr", "indexOf:startingAt:", "lf", "whileTrue:", "<=", "ifTrue:", "and:", "=", "value:value:value:", "ifTrue:ifFalse:", "or:", "<", "-", "+"]
  12069. }),
  12070. $globals.String);
  12071. $core.addMethod(
  12072. $core.method({
  12073. selector: "lineNumber:",
  12074. protocol: "split join",
  12075. fn: function (anIndex){
  12076. var self=this,$self=this;
  12077. var lineCount;
  12078. return $core.withContext(function($ctx1) {
  12079. var $2,$1;
  12080. var $early={};
  12081. try {
  12082. lineCount=(0);
  12083. $self._lineIndicesDo_((function(start,endWithoutDelimiters,end){
  12084. return $core.withContext(function($ctx2) {
  12085. lineCount=$recv(lineCount).__plus((1));
  12086. $2=lineCount;
  12087. $1=$recv($2).__eq(anIndex);
  12088. if($core.assert($1)){
  12089. throw $early=[$self._copyFrom_to_(start,endWithoutDelimiters)];
  12090. }
  12091. }, function($ctx2) {$ctx2.fillBlock({start:start,endWithoutDelimiters:endWithoutDelimiters,end:end},$ctx1,1)});
  12092. }));
  12093. return nil;
  12094. }
  12095. catch(e) {if(e===$early)return e[0]; throw e}
  12096. }, function($ctx1) {$ctx1.fill(self,"lineNumber:",{anIndex:anIndex,lineCount:lineCount},$globals.String)});
  12097. },
  12098. args: ["anIndex"],
  12099. 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",
  12100. referencedClasses: [],
  12101. messageSends: ["lineIndicesDo:", "ifTrue:", "=", "+", "copyFrom:to:"]
  12102. }),
  12103. $globals.String);
  12104. $core.addMethod(
  12105. $core.method({
  12106. selector: "lines",
  12107. protocol: "split join",
  12108. fn: function (){
  12109. var self=this,$self=this;
  12110. return $core.withContext(function($ctx1) {
  12111. var result = self.split(/\r\n|\r|\n/);
  12112. if (!result[result.length-1]) result.pop();
  12113. return result;;
  12114. return self;
  12115. }, function($ctx1) {$ctx1.fill(self,"lines",{},$globals.String)});
  12116. },
  12117. args: [],
  12118. 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'>",
  12119. referencedClasses: [],
  12120. messageSends: []
  12121. }),
  12122. $globals.String);
  12123. $core.addMethod(
  12124. $core.method({
  12125. selector: "linesDo:",
  12126. protocol: "split join",
  12127. fn: function (aBlock){
  12128. var self=this,$self=this;
  12129. return $core.withContext(function($ctx1) {
  12130. $recv($self._lines())._do_(aBlock);
  12131. return self;
  12132. }, function($ctx1) {$ctx1.fill(self,"linesDo:",{aBlock:aBlock},$globals.String)});
  12133. },
  12134. args: ["aBlock"],
  12135. 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",
  12136. referencedClasses: [],
  12137. messageSends: ["do:", "lines"]
  12138. }),
  12139. $globals.String);
  12140. $core.addMethod(
  12141. $core.method({
  12142. selector: "match:",
  12143. protocol: "regular expressions",
  12144. fn: function (aRegexp){
  12145. var self=this,$self=this;
  12146. return $core.withContext(function($ctx1) {
  12147. return self.search(aRegexp) != -1;
  12148. return self;
  12149. }, function($ctx1) {$ctx1.fill(self,"match:",{aRegexp:aRegexp},$globals.String)});
  12150. },
  12151. args: ["aRegexp"],
  12152. source: "match: aRegexp\x0a\x09<inlineJS: 'return self.search(aRegexp) != -1'>",
  12153. referencedClasses: [],
  12154. messageSends: []
  12155. }),
  12156. $globals.String);
  12157. $core.addMethod(
  12158. $core.method({
  12159. selector: "matchesOf:",
  12160. protocol: "regular expressions",
  12161. fn: function (aRegularExpression){
  12162. var self=this,$self=this;
  12163. return $core.withContext(function($ctx1) {
  12164. return self.match(aRegularExpression);
  12165. return self;
  12166. }, function($ctx1) {$ctx1.fill(self,"matchesOf:",{aRegularExpression:aRegularExpression},$globals.String)});
  12167. },
  12168. args: ["aRegularExpression"],
  12169. source: "matchesOf: aRegularExpression\x0a\x09<inlineJS: 'return self.match(aRegularExpression)'>",
  12170. referencedClasses: [],
  12171. messageSends: []
  12172. }),
  12173. $globals.String);
  12174. $core.addMethod(
  12175. $core.method({
  12176. selector: "numericallyIndexable",
  12177. protocol: "private",
  12178. fn: function (){
  12179. var self=this,$self=this;
  12180. return $core.withContext(function($ctx1) {
  12181. return String(self);
  12182. return self;
  12183. }, function($ctx1) {$ctx1.fill(self,"numericallyIndexable",{},$globals.String)});
  12184. },
  12185. args: [],
  12186. source: "numericallyIndexable\x0a\x09<inlineJS: 'return String(self)'>",
  12187. referencedClasses: [],
  12188. messageSends: []
  12189. }),
  12190. $globals.String);
  12191. $core.addMethod(
  12192. $core.method({
  12193. selector: "printNl",
  12194. protocol: "printing",
  12195. fn: function (){
  12196. var self=this,$self=this;
  12197. return $core.withContext(function($ctx1) {
  12198. console.log(self);
  12199. return self;
  12200. }, function($ctx1) {$ctx1.fill(self,"printNl",{},$globals.String)});
  12201. },
  12202. args: [],
  12203. source: "printNl\x0a\x09<inlineJS: 'console.log(self)'>",
  12204. referencedClasses: [],
  12205. messageSends: []
  12206. }),
  12207. $globals.String);
  12208. $core.addMethod(
  12209. $core.method({
  12210. selector: "printOn:",
  12211. protocol: "printing",
  12212. fn: function (aStream){
  12213. var self=this,$self=this;
  12214. return $core.withContext(function($ctx1) {
  12215. $recv(aStream)._nextPutAll_("'");
  12216. $ctx1.sendIdx["nextPutAll:"]=1;
  12217. $recv(aStream)._nextPutAll_($self._replace_with_("'","''"));
  12218. $ctx1.sendIdx["nextPutAll:"]=2;
  12219. $recv(aStream)._nextPutAll_("'");
  12220. return self;
  12221. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.String)});
  12222. },
  12223. args: ["aStream"],
  12224. source: "printOn: aStream\x0a\x09aStream \x0a\x09\x09nextPutAll: '''';\x0a\x09\x09nextPutAll: (self replace: '''' with: '''''');\x0a\x09\x09nextPutAll: ''''",
  12225. referencedClasses: [],
  12226. messageSends: ["nextPutAll:", "replace:with:"]
  12227. }),
  12228. $globals.String);
  12229. $core.addMethod(
  12230. $core.method({
  12231. selector: "replace:with:",
  12232. protocol: "regular expressions",
  12233. fn: function (aString,anotherString){
  12234. var self=this,$self=this;
  12235. return $core.withContext(function($ctx1) {
  12236. return $self._replaceRegexp_with_($recv($globals.RegularExpression)._fromString_flag_(aString,"g"),anotherString);
  12237. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{aString:aString,anotherString:anotherString},$globals.String)});
  12238. },
  12239. args: ["aString", "anotherString"],
  12240. source: "replace: aString with: anotherString\x0a\x09^ self replaceRegexp: (RegularExpression fromString: aString flag: 'g') with: anotherString",
  12241. referencedClasses: ["RegularExpression"],
  12242. messageSends: ["replaceRegexp:with:", "fromString:flag:"]
  12243. }),
  12244. $globals.String);
  12245. $core.addMethod(
  12246. $core.method({
  12247. selector: "replaceRegexp:with:",
  12248. protocol: "regular expressions",
  12249. fn: function (aRegexp,aString){
  12250. var self=this,$self=this;
  12251. return $core.withContext(function($ctx1) {
  12252. return self.replace(aRegexp, aString);
  12253. return self;
  12254. }, function($ctx1) {$ctx1.fill(self,"replaceRegexp:with:",{aRegexp:aRegexp,aString:aString},$globals.String)});
  12255. },
  12256. args: ["aRegexp", "aString"],
  12257. source: "replaceRegexp: aRegexp with: aString\x0a\x09<inlineJS: 'return self.replace(aRegexp, aString)'>",
  12258. referencedClasses: [],
  12259. messageSends: []
  12260. }),
  12261. $globals.String);
  12262. $core.addMethod(
  12263. $core.method({
  12264. selector: "reversed",
  12265. protocol: "converting",
  12266. fn: function (){
  12267. var self=this,$self=this;
  12268. return $core.withContext(function($ctx1) {
  12269. return self.split("").reverse().join("");
  12270. return self;
  12271. }, function($ctx1) {$ctx1.fill(self,"reversed",{},$globals.String)});
  12272. },
  12273. args: [],
  12274. source: "reversed\x0a\x09<inlineJS: 'return self.split(\x22\x22).reverse().join(\x22\x22)'>",
  12275. referencedClasses: [],
  12276. messageSends: []
  12277. }),
  12278. $globals.String);
  12279. $core.addMethod(
  12280. $core.method({
  12281. selector: "shallowCopy",
  12282. protocol: "copying",
  12283. fn: function (){
  12284. var self=this,$self=this;
  12285. return self;
  12286. },
  12287. args: [],
  12288. source: "shallowCopy\x0a\x09^ self",
  12289. referencedClasses: [],
  12290. messageSends: []
  12291. }),
  12292. $globals.String);
  12293. $core.addMethod(
  12294. $core.method({
  12295. selector: "size",
  12296. protocol: "accessing",
  12297. fn: function (){
  12298. var self=this,$self=this;
  12299. return $core.withContext(function($ctx1) {
  12300. return self.length;
  12301. return self;
  12302. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.String)});
  12303. },
  12304. args: [],
  12305. source: "size\x0a\x09<inlineJS: 'return self.length'>",
  12306. referencedClasses: [],
  12307. messageSends: []
  12308. }),
  12309. $globals.String);
  12310. $core.addMethod(
  12311. $core.method({
  12312. selector: "subStrings:",
  12313. protocol: "split join",
  12314. fn: function (aString){
  12315. var self=this,$self=this;
  12316. return $core.withContext(function($ctx1) {
  12317. return $self._tokenize_(aString);
  12318. }, function($ctx1) {$ctx1.fill(self,"subStrings:",{aString:aString},$globals.String)});
  12319. },
  12320. args: ["aString"],
  12321. source: "subStrings: aString\x0a\x09^ self tokenize: aString",
  12322. referencedClasses: [],
  12323. messageSends: ["tokenize:"]
  12324. }),
  12325. $globals.String);
  12326. $core.addMethod(
  12327. $core.method({
  12328. selector: "tokenize:",
  12329. protocol: "split join",
  12330. fn: function (aString){
  12331. var self=this,$self=this;
  12332. return $core.withContext(function($ctx1) {
  12333. return self.split(aString);
  12334. return self;
  12335. }, function($ctx1) {$ctx1.fill(self,"tokenize:",{aString:aString},$globals.String)});
  12336. },
  12337. args: ["aString"],
  12338. source: "tokenize: aString\x0a\x09<inlineJS: 'return self.split(aString)'>",
  12339. referencedClasses: [],
  12340. messageSends: []
  12341. }),
  12342. $globals.String);
  12343. $core.addMethod(
  12344. $core.method({
  12345. selector: "trimBoth",
  12346. protocol: "regular expressions",
  12347. fn: function (){
  12348. var self=this,$self=this;
  12349. return $core.withContext(function($ctx1) {
  12350. return $self._trimBoth_("\x5cs");
  12351. }, function($ctx1) {$ctx1.fill(self,"trimBoth",{},$globals.String)});
  12352. },
  12353. args: [],
  12354. source: "trimBoth\x0a\x09^ self trimBoth: '\x5cs'",
  12355. referencedClasses: [],
  12356. messageSends: ["trimBoth:"]
  12357. }),
  12358. $globals.String);
  12359. $core.addMethod(
  12360. $core.method({
  12361. selector: "trimBoth:",
  12362. protocol: "regular expressions",
  12363. fn: function (separators){
  12364. var self=this,$self=this;
  12365. return $core.withContext(function($ctx1) {
  12366. return $recv($self._trimLeft_(separators))._trimRight_(separators);
  12367. }, function($ctx1) {$ctx1.fill(self,"trimBoth:",{separators:separators},$globals.String)});
  12368. },
  12369. args: ["separators"],
  12370. source: "trimBoth: separators\x0a\x09^ (self trimLeft: separators) trimRight: separators",
  12371. referencedClasses: [],
  12372. messageSends: ["trimRight:", "trimLeft:"]
  12373. }),
  12374. $globals.String);
  12375. $core.addMethod(
  12376. $core.method({
  12377. selector: "trimLeft",
  12378. protocol: "regular expressions",
  12379. fn: function (){
  12380. var self=this,$self=this;
  12381. return $core.withContext(function($ctx1) {
  12382. return $self._trimLeft_("\x5cs");
  12383. }, function($ctx1) {$ctx1.fill(self,"trimLeft",{},$globals.String)});
  12384. },
  12385. args: [],
  12386. source: "trimLeft\x0a\x09^ self trimLeft: '\x5cs'",
  12387. referencedClasses: [],
  12388. messageSends: ["trimLeft:"]
  12389. }),
  12390. $globals.String);
  12391. $core.addMethod(
  12392. $core.method({
  12393. selector: "trimLeft:",
  12394. protocol: "regular expressions",
  12395. fn: function (separators){
  12396. var self=this,$self=this;
  12397. return $core.withContext(function($ctx1) {
  12398. var $2,$1;
  12399. $2=$recv("^[".__comma(separators)).__comma("]+");
  12400. $ctx1.sendIdx[","]=1;
  12401. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12402. return $self._replaceRegexp_with_($1,"");
  12403. }, function($ctx1) {$ctx1.fill(self,"trimLeft:",{separators:separators},$globals.String)});
  12404. },
  12405. args: ["separators"],
  12406. source: "trimLeft: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '^[', separators, ']+' flag: 'g') with: ''",
  12407. referencedClasses: ["RegularExpression"],
  12408. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12409. }),
  12410. $globals.String);
  12411. $core.addMethod(
  12412. $core.method({
  12413. selector: "trimRight",
  12414. protocol: "regular expressions",
  12415. fn: function (){
  12416. var self=this,$self=this;
  12417. return $core.withContext(function($ctx1) {
  12418. return $self._trimRight_("\x5cs");
  12419. }, function($ctx1) {$ctx1.fill(self,"trimRight",{},$globals.String)});
  12420. },
  12421. args: [],
  12422. source: "trimRight\x0a\x09^ self trimRight: '\x5cs'",
  12423. referencedClasses: [],
  12424. messageSends: ["trimRight:"]
  12425. }),
  12426. $globals.String);
  12427. $core.addMethod(
  12428. $core.method({
  12429. selector: "trimRight:",
  12430. protocol: "regular expressions",
  12431. fn: function (separators){
  12432. var self=this,$self=this;
  12433. return $core.withContext(function($ctx1) {
  12434. var $2,$1;
  12435. $2=$recv("[".__comma(separators)).__comma("]+$");
  12436. $ctx1.sendIdx[","]=1;
  12437. $1=$recv($globals.RegularExpression)._fromString_flag_($2,"g");
  12438. return $self._replaceRegexp_with_($1,"");
  12439. }, function($ctx1) {$ctx1.fill(self,"trimRight:",{separators:separators},$globals.String)});
  12440. },
  12441. args: ["separators"],
  12442. source: "trimRight: separators\x0a\x09^ self replaceRegexp: (RegularExpression fromString: '[', separators, ']+$' flag: 'g') with: ''",
  12443. referencedClasses: ["RegularExpression"],
  12444. messageSends: ["replaceRegexp:with:", "fromString:flag:", ","]
  12445. }),
  12446. $globals.String);
  12447. $core.addMethod(
  12448. $core.method({
  12449. selector: "unescaped",
  12450. protocol: "converting",
  12451. fn: function (){
  12452. var self=this,$self=this;
  12453. return $core.withContext(function($ctx1) {
  12454. return unescape(self);
  12455. return self;
  12456. }, function($ctx1) {$ctx1.fill(self,"unescaped",{},$globals.String)});
  12457. },
  12458. args: [],
  12459. source: "unescaped\x0a\x09<inlineJS: 'return unescape(self)'>",
  12460. referencedClasses: [],
  12461. messageSends: []
  12462. }),
  12463. $globals.String);
  12464. $core.addMethod(
  12465. $core.method({
  12466. selector: "uriComponentDecoded",
  12467. protocol: "converting",
  12468. fn: function (){
  12469. var self=this,$self=this;
  12470. return $core.withContext(function($ctx1) {
  12471. return decodeURIComponent(self);
  12472. return self;
  12473. }, function($ctx1) {$ctx1.fill(self,"uriComponentDecoded",{},$globals.String)});
  12474. },
  12475. args: [],
  12476. source: "uriComponentDecoded\x0a\x09<inlineJS: 'return decodeURIComponent(self)'>",
  12477. referencedClasses: [],
  12478. messageSends: []
  12479. }),
  12480. $globals.String);
  12481. $core.addMethod(
  12482. $core.method({
  12483. selector: "uriComponentEncoded",
  12484. protocol: "converting",
  12485. fn: function (){
  12486. var self=this,$self=this;
  12487. return $core.withContext(function($ctx1) {
  12488. return encodeURIComponent(self);
  12489. return self;
  12490. }, function($ctx1) {$ctx1.fill(self,"uriComponentEncoded",{},$globals.String)});
  12491. },
  12492. args: [],
  12493. source: "uriComponentEncoded\x0a\x09<inlineJS: 'return encodeURIComponent(self)'>",
  12494. referencedClasses: [],
  12495. messageSends: []
  12496. }),
  12497. $globals.String);
  12498. $core.addMethod(
  12499. $core.method({
  12500. selector: "uriDecoded",
  12501. protocol: "converting",
  12502. fn: function (){
  12503. var self=this,$self=this;
  12504. return $core.withContext(function($ctx1) {
  12505. return decodeURI(self);
  12506. return self;
  12507. }, function($ctx1) {$ctx1.fill(self,"uriDecoded",{},$globals.String)});
  12508. },
  12509. args: [],
  12510. source: "uriDecoded\x0a\x09<inlineJS: 'return decodeURI(self)'>",
  12511. referencedClasses: [],
  12512. messageSends: []
  12513. }),
  12514. $globals.String);
  12515. $core.addMethod(
  12516. $core.method({
  12517. selector: "uriEncoded",
  12518. protocol: "converting",
  12519. fn: function (){
  12520. var self=this,$self=this;
  12521. return $core.withContext(function($ctx1) {
  12522. return encodeURI(self);
  12523. return self;
  12524. }, function($ctx1) {$ctx1.fill(self,"uriEncoded",{},$globals.String)});
  12525. },
  12526. args: [],
  12527. source: "uriEncoded\x0a\x09<inlineJS: 'return encodeURI(self)'>",
  12528. referencedClasses: [],
  12529. messageSends: []
  12530. }),
  12531. $globals.String);
  12532. $core.addMethod(
  12533. $core.method({
  12534. selector: "value:",
  12535. protocol: "evaluating",
  12536. fn: function (anObject){
  12537. var self=this,$self=this;
  12538. return $core.withContext(function($ctx1) {
  12539. return $recv(anObject)._perform_(self);
  12540. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.String)});
  12541. },
  12542. args: ["anObject"],
  12543. source: "value: anObject \x0a\x09^ anObject perform: self",
  12544. referencedClasses: [],
  12545. messageSends: ["perform:"]
  12546. }),
  12547. $globals.String);
  12548. $core.addMethod(
  12549. $core.method({
  12550. selector: "cr",
  12551. protocol: "accessing",
  12552. fn: function (){
  12553. var self=this,$self=this;
  12554. return $core.withContext(function($ctx1) {
  12555. return "\r";
  12556. return self;
  12557. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.String.a$cls)});
  12558. },
  12559. args: [],
  12560. source: "cr\x0a\x09<inlineJS: 'return \x22\x5cr\x22'>",
  12561. referencedClasses: [],
  12562. messageSends: []
  12563. }),
  12564. $globals.String.a$cls);
  12565. $core.addMethod(
  12566. $core.method({
  12567. selector: "crlf",
  12568. protocol: "accessing",
  12569. fn: function (){
  12570. var self=this,$self=this;
  12571. return $core.withContext(function($ctx1) {
  12572. return "\r\n";
  12573. return self;
  12574. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.String.a$cls)});
  12575. },
  12576. args: [],
  12577. source: "crlf\x0a\x09<inlineJS: 'return \x22\x5cr\x5cn\x22'>",
  12578. referencedClasses: [],
  12579. messageSends: []
  12580. }),
  12581. $globals.String.a$cls);
  12582. $core.addMethod(
  12583. $core.method({
  12584. selector: "esc",
  12585. protocol: "accessing",
  12586. fn: function (){
  12587. var self=this,$self=this;
  12588. return $core.withContext(function($ctx1) {
  12589. return $self._fromCharCode_((27));
  12590. }, function($ctx1) {$ctx1.fill(self,"esc",{},$globals.String.a$cls)});
  12591. },
  12592. args: [],
  12593. source: "esc\x0a\x09^ self fromCharCode: 27",
  12594. referencedClasses: [],
  12595. messageSends: ["fromCharCode:"]
  12596. }),
  12597. $globals.String.a$cls);
  12598. $core.addMethod(
  12599. $core.method({
  12600. selector: "fromCharCode:",
  12601. protocol: "instance creation",
  12602. fn: function (anInteger){
  12603. var self=this,$self=this;
  12604. return $core.withContext(function($ctx1) {
  12605. return String.fromCharCode(anInteger);
  12606. return self;
  12607. }, function($ctx1) {$ctx1.fill(self,"fromCharCode:",{anInteger:anInteger},$globals.String.a$cls)});
  12608. },
  12609. args: ["anInteger"],
  12610. source: "fromCharCode: anInteger\x0a\x09<inlineJS: 'return String.fromCharCode(anInteger)'>",
  12611. referencedClasses: [],
  12612. messageSends: []
  12613. }),
  12614. $globals.String.a$cls);
  12615. $core.addMethod(
  12616. $core.method({
  12617. selector: "fromString:",
  12618. protocol: "instance creation",
  12619. fn: function (aString){
  12620. var self=this,$self=this;
  12621. return $core.withContext(function($ctx1) {
  12622. return String(aString);
  12623. return self;
  12624. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.String.a$cls)});
  12625. },
  12626. args: ["aString"],
  12627. source: "fromString: aString\x0a\x09\x09<inlineJS: 'return String(aString)'>",
  12628. referencedClasses: [],
  12629. messageSends: []
  12630. }),
  12631. $globals.String.a$cls);
  12632. $core.addMethod(
  12633. $core.method({
  12634. selector: "lf",
  12635. protocol: "accessing",
  12636. fn: function (){
  12637. var self=this,$self=this;
  12638. return $core.withContext(function($ctx1) {
  12639. return "\n";
  12640. return self;
  12641. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.String.a$cls)});
  12642. },
  12643. args: [],
  12644. source: "lf\x0a\x09<inlineJS: 'return \x22\x5cn\x22'>",
  12645. referencedClasses: [],
  12646. messageSends: []
  12647. }),
  12648. $globals.String.a$cls);
  12649. $core.addMethod(
  12650. $core.method({
  12651. selector: "random",
  12652. protocol: "random",
  12653. fn: function (){
  12654. var self=this,$self=this;
  12655. return $core.withContext(function($ctx1) {
  12656. return (Math.random()*(22/32)+(10/32)).toString(32).slice(2);;
  12657. return self;
  12658. }, function($ctx1) {$ctx1.fill(self,"random",{},$globals.String.a$cls)});
  12659. },
  12660. args: [],
  12661. 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);'>",
  12662. referencedClasses: [],
  12663. messageSends: []
  12664. }),
  12665. $globals.String.a$cls);
  12666. $core.addMethod(
  12667. $core.method({
  12668. selector: "randomNotIn:",
  12669. protocol: "random",
  12670. fn: function (aString){
  12671. var self=this,$self=this;
  12672. var result;
  12673. return $core.withContext(function($ctx1) {
  12674. $recv((function(){
  12675. return $core.withContext(function($ctx2) {
  12676. result=$self._random();
  12677. return $recv(aString)._includesSubString_(result);
  12678. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  12679. }))._whileTrue();
  12680. return result;
  12681. }, function($ctx1) {$ctx1.fill(self,"randomNotIn:",{aString:aString,result:result},$globals.String.a$cls)});
  12682. },
  12683. args: ["aString"],
  12684. source: "randomNotIn: aString\x0a\x09| result |\x0a\x09[ result := self random. aString includesSubString: result ] whileTrue.\x0a\x09^ result",
  12685. referencedClasses: [],
  12686. messageSends: ["whileTrue", "random", "includesSubString:"]
  12687. }),
  12688. $globals.String.a$cls);
  12689. $core.addMethod(
  12690. $core.method({
  12691. selector: "space",
  12692. protocol: "accessing",
  12693. fn: function (){
  12694. var self=this,$self=this;
  12695. return $core.withContext(function($ctx1) {
  12696. return " ";
  12697. return self;
  12698. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.String.a$cls)});
  12699. },
  12700. args: [],
  12701. source: "space\x0a\x09<inlineJS: 'return \x22 \x22'>",
  12702. referencedClasses: [],
  12703. messageSends: []
  12704. }),
  12705. $globals.String.a$cls);
  12706. $core.addMethod(
  12707. $core.method({
  12708. selector: "streamClass",
  12709. protocol: "accessing",
  12710. fn: function (){
  12711. var self=this,$self=this;
  12712. return $globals.StringStream;
  12713. },
  12714. args: [],
  12715. source: "streamClass\x0a\x09\x09^ StringStream",
  12716. referencedClasses: ["StringStream"],
  12717. messageSends: []
  12718. }),
  12719. $globals.String.a$cls);
  12720. $core.addMethod(
  12721. $core.method({
  12722. selector: "tab",
  12723. protocol: "accessing",
  12724. fn: function (){
  12725. var self=this,$self=this;
  12726. return $core.withContext(function($ctx1) {
  12727. return "\t";
  12728. return self;
  12729. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.String.a$cls)});
  12730. },
  12731. args: [],
  12732. source: "tab\x0a\x09<inlineJS: 'return \x22\x5ct\x22'>",
  12733. referencedClasses: [],
  12734. messageSends: []
  12735. }),
  12736. $globals.String.a$cls);
  12737. $core.addMethod(
  12738. $core.method({
  12739. selector: "value:",
  12740. protocol: "instance creation",
  12741. fn: function (aUTFCharCode){
  12742. var self=this,$self=this;
  12743. return $core.withContext(function($ctx1) {
  12744. return String.fromCharCode(aUTFCharCode);;
  12745. return self;
  12746. }, function($ctx1) {$ctx1.fill(self,"value:",{aUTFCharCode:aUTFCharCode},$globals.String.a$cls)});
  12747. },
  12748. args: ["aUTFCharCode"],
  12749. source: "value: aUTFCharCode\x0a\x0a\x09<inlineJS: 'return String.fromCharCode(aUTFCharCode);'>",
  12750. referencedClasses: [],
  12751. messageSends: []
  12752. }),
  12753. $globals.String.a$cls);
  12754. $core.addClass("Set", $globals.Collection, ["defaultBucket", "slowBucketStores", "fastBuckets", "size"], "Kernel-Collections");
  12755. $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`.";
  12756. $core.addMethod(
  12757. $core.method({
  12758. selector: "=",
  12759. protocol: "comparing",
  12760. fn: function (aCollection){
  12761. var self=this,$self=this;
  12762. return $core.withContext(function($ctx1) {
  12763. var $2,$1,$4,$3,$5;
  12764. var $early={};
  12765. try {
  12766. $2=$self._class();
  12767. $ctx1.sendIdx["class"]=1;
  12768. $1=$recv($2).__eq($recv(aCollection)._class());
  12769. $ctx1.sendIdx["="]=1;
  12770. if(!$core.assert($1)){
  12771. return false;
  12772. }
  12773. $4=$self._size();
  12774. $ctx1.sendIdx["size"]=1;
  12775. $3=$recv($4).__eq($recv(aCollection)._size());
  12776. if(!$core.assert($3)){
  12777. return false;
  12778. }
  12779. $self._do_((function(each){
  12780. return $core.withContext(function($ctx2) {
  12781. $5=$recv(aCollection)._includes_(each);
  12782. if(!$core.assert($5)){
  12783. throw $early=[false];
  12784. }
  12785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  12786. }));
  12787. return true;
  12788. }
  12789. catch(e) {if(e===$early)return e[0]; throw e}
  12790. }, function($ctx1) {$ctx1.fill(self,"=",{aCollection:aCollection},$globals.Set)});
  12791. },
  12792. args: ["aCollection"],
  12793. 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",
  12794. referencedClasses: [],
  12795. messageSends: ["ifFalse:", "=", "class", "size", "do:", "includes:"]
  12796. }),
  12797. $globals.Set);
  12798. $core.addMethod(
  12799. $core.method({
  12800. selector: "add:",
  12801. protocol: "adding/removing",
  12802. fn: function (anObject){
  12803. var self=this,$self=this;
  12804. var bucket;
  12805. return $core.withContext(function($ctx1) {
  12806. var $1,$receiver;
  12807. bucket=$self._bucketsOfElement_(anObject);
  12808. $1=$recv(bucket)._second();
  12809. if(($receiver = $1) == null || $receiver.a$nil){
  12810. var object,slowBucket;
  12811. object=$recv(bucket)._first();
  12812. $ctx1.sendIdx["first"]=1;
  12813. slowBucket=$recv(bucket)._third();
  12814. $recv(slowBucket)._indexOf_ifAbsent_(object,(function(){
  12815. return $core.withContext(function($ctx2) {
  12816. $recv(slowBucket)._add_(object);
  12817. $self["@size"]=$recv($self["@size"]).__plus((1));
  12818. return $self["@size"];
  12819. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  12820. }));
  12821. return object;
  12822. } else {
  12823. var primitiveBucket;
  12824. primitiveBucket=$receiver;
  12825. return $self._add_in_($recv(bucket)._first(),primitiveBucket);
  12826. }
  12827. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject,bucket:bucket},$globals.Set)});
  12828. },
  12829. args: ["anObject"],
  12830. 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 ]",
  12831. referencedClasses: [],
  12832. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "first", "third", "indexOf:ifAbsent:", "add:", "+", "add:in:"]
  12833. }),
  12834. $globals.Set);
  12835. $core.addMethod(
  12836. $core.method({
  12837. selector: "add:in:",
  12838. protocol: "private",
  12839. fn: function (anObject,anotherObject){
  12840. var self=this,$self=this;
  12841. return $core.withContext(function($ctx1) {
  12842. if (anObject in anotherObject.store) { return false; }
  12843. $self['@size']++;
  12844. anotherObject.store[anObject] = true;
  12845. return anObject;
  12846. ;
  12847. return self;
  12848. }, function($ctx1) {$ctx1.fill(self,"add:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  12849. },
  12850. args: ["anObject", "anotherObject"],
  12851. 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'>",
  12852. referencedClasses: [],
  12853. messageSends: []
  12854. }),
  12855. $globals.Set);
  12856. $core.addMethod(
  12857. $core.method({
  12858. selector: "bucketsOfElement:",
  12859. protocol: "private",
  12860. fn: function (anObject){
  12861. var self=this,$self=this;
  12862. return $core.withContext(function($ctx1) {
  12863. // include nil to well-known objects under "boolean" fastBucket
  12864. if (anObject == null || anObject.a$nil) return [ null, $self['@fastBuckets'].boolean ];
  12865. var prim = anObject.valueOf();
  12866. if (typeof prim === "object" || typeof prim === "function" || !$self['@fastBuckets'][typeof prim]) {
  12867. var bucket = null;
  12868. $self['@slowBucketStores'].some(function (store) {
  12869. return bucket = store._bucketOfElement_(anObject);
  12870. });
  12871. return [ anObject, null, bucket || $self['@defaultBucket'] ];
  12872. }
  12873. return [ prim, $self['@fastBuckets'][typeof prim] ];
  12874. ;
  12875. return self;
  12876. }, function($ctx1) {$ctx1.fill(self,"bucketsOfElement:",{anObject:anObject},$globals.Set)});
  12877. },
  12878. args: ["anObject"],
  12879. 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'>",
  12880. referencedClasses: [],
  12881. messageSends: []
  12882. }),
  12883. $globals.Set);
  12884. $core.addMethod(
  12885. $core.method({
  12886. selector: "classNameOf:",
  12887. protocol: "private",
  12888. fn: function (anObject){
  12889. var self=this,$self=this;
  12890. return $core.withContext(function($ctx1) {
  12891. return anObject.a$cls != null && anObject.a$cls.name;
  12892. return self;
  12893. }, function($ctx1) {$ctx1.fill(self,"classNameOf:",{anObject:anObject},$globals.Set)});
  12894. },
  12895. args: ["anObject"],
  12896. 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.name'>",
  12897. referencedClasses: [],
  12898. messageSends: []
  12899. }),
  12900. $globals.Set);
  12901. $core.addMethod(
  12902. $core.method({
  12903. selector: "collect:",
  12904. protocol: "enumerating",
  12905. fn: function (aBlock){
  12906. var self=this,$self=this;
  12907. var collection;
  12908. return $core.withContext(function($ctx1) {
  12909. collection=$recv($self._class())._new();
  12910. $self._do_((function(each){
  12911. return $core.withContext(function($ctx2) {
  12912. return $recv(collection)._add_($recv(aBlock)._value_(each));
  12913. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12914. }));
  12915. return collection;
  12916. }, function($ctx1) {$ctx1.fill(self,"collect:",{aBlock:aBlock,collection:collection},$globals.Set)});
  12917. },
  12918. args: ["aBlock"],
  12919. source: "collect: aBlock\x0a\x09| collection |\x0a\x09collection := self class new.\x0a\x09self do: [ :each | collection add: (aBlock value: each) ].\x0a\x09^ collection",
  12920. referencedClasses: [],
  12921. messageSends: ["new", "class", "do:", "add:", "value:"]
  12922. }),
  12923. $globals.Set);
  12924. $core.addMethod(
  12925. $core.method({
  12926. selector: "detect:ifNone:",
  12927. protocol: "enumerating",
  12928. fn: function (aBlock,anotherBlock){
  12929. var self=this,$self=this;
  12930. return $core.withContext(function($ctx1) {
  12931. var $1;
  12932. var $early={};
  12933. try {
  12934. $self._do_((function(each){
  12935. return $core.withContext(function($ctx2) {
  12936. $1=$recv(aBlock)._value_(each);
  12937. if($core.assert($1)){
  12938. throw $early=[each];
  12939. }
  12940. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  12941. }));
  12942. return $recv(anotherBlock)._value();
  12943. }
  12944. catch(e) {if(e===$early)return e[0]; throw e}
  12945. }, function($ctx1) {$ctx1.fill(self,"detect:ifNone:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.Set)});
  12946. },
  12947. args: ["aBlock", "anotherBlock"],
  12948. source: "detect: aBlock ifNone: anotherBlock\x0a\x09self do: [ :each | (aBlock value: each) ifTrue: [ ^each ] ].\x0a\x09^ anotherBlock value",
  12949. referencedClasses: [],
  12950. messageSends: ["do:", "ifTrue:", "value:", "value"]
  12951. }),
  12952. $globals.Set);
  12953. $core.addMethod(
  12954. $core.method({
  12955. selector: "do:",
  12956. protocol: "enumerating",
  12957. fn: function (aBlock){
  12958. var self=this,$self=this;
  12959. return $core.withContext(function($ctx1) {
  12960. var el, keys, i;
  12961. el = $self['@fastBuckets'];
  12962. keys = Object.keys(el);
  12963. for (i = 0; i < keys.length; ++i) {
  12964. var fastBucket = el[keys[i]], fn = fastBucket.fn, store = Object.keys(fastBucket.store);
  12965. if (fn) { for (var j = 0; j < store.length; ++j) { aBlock._value_(fn(store[j])); } }
  12966. else { store._do_(aBlock); }
  12967. }
  12968. el = $self['@slowBucketStores'];
  12969. for (i = 0; i < el.length; ++i) { el[i]._do_(aBlock); }
  12970. $self['@defaultBucket']._do_(aBlock);
  12971. ;
  12972. return self;
  12973. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.Set)});
  12974. },
  12975. args: ["aBlock"],
  12976. 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'>",
  12977. referencedClasses: [],
  12978. messageSends: []
  12979. }),
  12980. $globals.Set);
  12981. $core.addMethod(
  12982. $core.method({
  12983. selector: "includes:",
  12984. protocol: "testing",
  12985. fn: function (anObject){
  12986. var self=this,$self=this;
  12987. var bucket;
  12988. return $core.withContext(function($ctx1) {
  12989. var $1,$2,$3,$receiver;
  12990. bucket=$self._bucketsOfElement_(anObject);
  12991. $1=$recv(bucket)._second();
  12992. if(($receiver = $1) == null || $receiver.a$nil){
  12993. $2=$recv(bucket)._third();
  12994. $3=$recv(bucket)._first();
  12995. $ctx1.sendIdx["first"]=1;
  12996. return $recv($2)._includes_($3);
  12997. } else {
  12998. var primitiveBucket;
  12999. primitiveBucket=$receiver;
  13000. return $self._includes_in_($recv(bucket)._first(),primitiveBucket);
  13001. }
  13002. }, function($ctx1) {$ctx1.fill(self,"includes:",{anObject:anObject,bucket:bucket},$globals.Set)});
  13003. },
  13004. args: ["anObject"],
  13005. 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 ]",
  13006. referencedClasses: [],
  13007. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "includes:", "third", "first", "includes:in:"]
  13008. }),
  13009. $globals.Set);
  13010. $core.addMethod(
  13011. $core.method({
  13012. selector: "includes:in:",
  13013. protocol: "private",
  13014. fn: function (anObject,anotherObject){
  13015. var self=this,$self=this;
  13016. return $core.withContext(function($ctx1) {
  13017. return anObject in anotherObject.store;
  13018. return self;
  13019. }, function($ctx1) {$ctx1.fill(self,"includes:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13020. },
  13021. args: ["anObject", "anotherObject"],
  13022. source: "includes: anObject in: anotherObject\x0a\x09<inlineJS: 'return anObject in anotherObject.store'>",
  13023. referencedClasses: [],
  13024. messageSends: []
  13025. }),
  13026. $globals.Set);
  13027. $core.addMethod(
  13028. $core.method({
  13029. selector: "initialize",
  13030. protocol: "initialization",
  13031. fn: function (){
  13032. var self=this,$self=this;
  13033. return $core.withContext(function($ctx1) {
  13034. (
  13035. $ctx1.supercall = true,
  13036. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  13037. $ctx1.supercall = false;
  13038. $self["@defaultBucket"]=[];
  13039. $self._initializeSlowBucketStores();
  13040. $self._removeAll();
  13041. return self;
  13042. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Set)});
  13043. },
  13044. args: [],
  13045. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09defaultBucket := #().\x0a\x09self\x0a\x09\x09initializeSlowBucketStores;\x0a\x09\x09removeAll",
  13046. referencedClasses: [],
  13047. messageSends: ["initialize", "initializeSlowBucketStores", "removeAll"]
  13048. }),
  13049. $globals.Set);
  13050. $core.addMethod(
  13051. $core.method({
  13052. selector: "initializeSlowBucketStores",
  13053. protocol: "initialization",
  13054. fn: function (){
  13055. var self=this,$self=this;
  13056. return $core.withContext(function($ctx1) {
  13057. var $1;
  13058. $1=$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13059. return $core.withContext(function($ctx2) {
  13060. return $self._classNameOf_(x);
  13061. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  13062. }));
  13063. $ctx1.sendIdx["hashBlock:"]=1;
  13064. $self["@slowBucketStores"]=[$1,$recv($globals.ArrayBucketStore)._hashBlock_((function(x){
  13065. return $core.withContext(function($ctx2) {
  13066. return $self._jsConstructorNameOf_(x);
  13067. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  13068. }))];
  13069. return self;
  13070. }, function($ctx1) {$ctx1.fill(self,"initializeSlowBucketStores",{},$globals.Set)});
  13071. },
  13072. args: [],
  13073. source: "initializeSlowBucketStores\x0a\x09slowBucketStores := {\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self classNameOf: x ].\x0a\x09\x09ArrayBucketStore hashBlock: [ :x | self jsConstructorNameOf: x ]\x0a\x09}",
  13074. referencedClasses: ["ArrayBucketStore"],
  13075. messageSends: ["hashBlock:", "classNameOf:", "jsConstructorNameOf:"]
  13076. }),
  13077. $globals.Set);
  13078. $core.addMethod(
  13079. $core.method({
  13080. selector: "jsConstructorNameOf:",
  13081. protocol: "private",
  13082. fn: function (anObject){
  13083. var self=this,$self=this;
  13084. return $core.withContext(function($ctx1) {
  13085. return anObject.constructor && anObject.constructor.name;
  13086. return self;
  13087. }, function($ctx1) {$ctx1.fill(self,"jsConstructorNameOf:",{anObject:anObject},$globals.Set)});
  13088. },
  13089. args: ["anObject"],
  13090. source: "jsConstructorNameOf: anObject\x0a\x09<inlineJS: 'return anObject.constructor && anObject.constructor.name'>",
  13091. referencedClasses: [],
  13092. messageSends: []
  13093. }),
  13094. $globals.Set);
  13095. $core.addMethod(
  13096. $core.method({
  13097. selector: "printOn:",
  13098. protocol: "printing",
  13099. fn: function (aStream){
  13100. var self=this,$self=this;
  13101. return $core.withContext(function($ctx1) {
  13102. (
  13103. $ctx1.supercall = true,
  13104. ($globals.Set.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  13105. $ctx1.supercall = false;
  13106. $ctx1.sendIdx["printOn:"]=1;
  13107. $recv(aStream)._nextPutAll_(" (");
  13108. $ctx1.sendIdx["nextPutAll:"]=1;
  13109. $self._do_separatedBy_((function(each){
  13110. return $core.withContext(function($ctx2) {
  13111. return $recv(each)._printOn_(aStream);
  13112. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13113. }),(function(){
  13114. return $core.withContext(function($ctx2) {
  13115. return $recv(aStream)._nextPutAll_(" ");
  13116. $ctx2.sendIdx["nextPutAll:"]=2;
  13117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13118. }));
  13119. $recv(aStream)._nextPutAll_(")");
  13120. return self;
  13121. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Set)});
  13122. },
  13123. args: ["aStream"],
  13124. 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: ')'",
  13125. referencedClasses: [],
  13126. messageSends: ["printOn:", "nextPutAll:", "do:separatedBy:"]
  13127. }),
  13128. $globals.Set);
  13129. $core.addMethod(
  13130. $core.method({
  13131. selector: "remove:ifAbsent:",
  13132. protocol: "adding/removing",
  13133. fn: function (anObject,aBlock){
  13134. var self=this,$self=this;
  13135. var bucket;
  13136. return $core.withContext(function($ctx1) {
  13137. var $1,$2,$3,$receiver;
  13138. var $early={};
  13139. try {
  13140. bucket=$self._bucketsOfElement_(anObject);
  13141. $1=$recv(bucket)._second();
  13142. if(($receiver = $1) == null || $receiver.a$nil){
  13143. $2=$recv(bucket)._third();
  13144. $3=$recv(bucket)._first();
  13145. $ctx1.sendIdx["first"]=1;
  13146. $recv($2)._remove_ifAbsent_($3,(function(){
  13147. return $core.withContext(function($ctx2) {
  13148. throw $early=[$recv(aBlock)._value()];
  13149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13150. }));
  13151. $self["@size"]=$recv($self["@size"]).__minus((1));
  13152. return $self["@size"];
  13153. } else {
  13154. var primitiveBucket;
  13155. primitiveBucket=$receiver;
  13156. return $self._remove_in_($recv(bucket)._first(),primitiveBucket);
  13157. }
  13158. }
  13159. catch(e) {if(e===$early)return e[0]; throw e}
  13160. }, function($ctx1) {$ctx1.fill(self,"remove:ifAbsent:",{anObject:anObject,aBlock:aBlock,bucket:bucket},$globals.Set)});
  13161. },
  13162. args: ["anObject", "aBlock"],
  13163. 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 ]",
  13164. referencedClasses: [],
  13165. messageSends: ["bucketsOfElement:", "ifNil:ifNotNil:", "second", "remove:ifAbsent:", "third", "first", "value", "-", "remove:in:"]
  13166. }),
  13167. $globals.Set);
  13168. $core.addMethod(
  13169. $core.method({
  13170. selector: "remove:in:",
  13171. protocol: "private",
  13172. fn: function (anObject,anotherObject){
  13173. var self=this,$self=this;
  13174. return $core.withContext(function($ctx1) {
  13175. if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self['@size']--; };
  13176. return self;
  13177. }, function($ctx1) {$ctx1.fill(self,"remove:in:",{anObject:anObject,anotherObject:anotherObject},$globals.Set)});
  13178. },
  13179. args: ["anObject", "anotherObject"],
  13180. source: "remove: anObject in: anotherObject\x0a\x09<inlineJS: 'if (anObject in anotherObject.store) { delete anotherObject.store[anObject]; $self[''@size'']--; }'>",
  13181. referencedClasses: [],
  13182. messageSends: []
  13183. }),
  13184. $globals.Set);
  13185. $core.addMethod(
  13186. $core.method({
  13187. selector: "removeAll",
  13188. protocol: "adding/removing",
  13189. fn: function (){
  13190. var self=this,$self=this;
  13191. return $core.withContext(function($ctx1) {
  13192. $self['@fastBuckets'] = {
  13193. "boolean": { store: Object.create(null), fn: function (x) { return {"true": true, "false": false, "null": null}[x]; } },
  13194. "number": { store: Object.create(null), fn: Number },
  13195. "string": { store: Object.create(null) }
  13196. };
  13197. $self['@slowBucketStores'].forEach(function (x) { x._removeAll(); });
  13198. $self['@defaultBucket']._removeAll();
  13199. $self['@size'] = 0;
  13200. ;
  13201. return self;
  13202. }, function($ctx1) {$ctx1.fill(self,"removeAll",{},$globals.Set)});
  13203. },
  13204. args: [],
  13205. 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'>",
  13206. referencedClasses: [],
  13207. messageSends: []
  13208. }),
  13209. $globals.Set);
  13210. $core.addMethod(
  13211. $core.method({
  13212. selector: "select:",
  13213. protocol: "enumerating",
  13214. fn: function (aBlock){
  13215. var self=this,$self=this;
  13216. var collection;
  13217. return $core.withContext(function($ctx1) {
  13218. var $1;
  13219. collection=$recv($self._class())._new();
  13220. $self._do_((function(each){
  13221. return $core.withContext(function($ctx2) {
  13222. $1=$recv(aBlock)._value_(each);
  13223. if($core.assert($1)){
  13224. return $recv(collection)._add_(each);
  13225. }
  13226. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13227. }));
  13228. return collection;
  13229. }, function($ctx1) {$ctx1.fill(self,"select:",{aBlock:aBlock,collection:collection},$globals.Set)});
  13230. },
  13231. args: ["aBlock"],
  13232. 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",
  13233. referencedClasses: [],
  13234. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13235. }),
  13236. $globals.Set);
  13237. $core.addMethod(
  13238. $core.method({
  13239. selector: "select:thenCollect:",
  13240. protocol: "enumerating",
  13241. fn: function (selectBlock,collectBlock){
  13242. var self=this,$self=this;
  13243. var collection;
  13244. return $core.withContext(function($ctx1) {
  13245. var $1;
  13246. collection=$recv($self._class())._new();
  13247. $self._do_((function(each){
  13248. return $core.withContext(function($ctx2) {
  13249. $1=$recv(selectBlock)._value_(each);
  13250. $ctx2.sendIdx["value:"]=1;
  13251. if($core.assert($1)){
  13252. return $recv(collection)._add_($recv(collectBlock)._value_(each));
  13253. }
  13254. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13255. }));
  13256. return collection;
  13257. }, function($ctx1) {$ctx1.fill(self,"select:thenCollect:",{selectBlock:selectBlock,collectBlock:collectBlock,collection:collection},$globals.Set)});
  13258. },
  13259. args: ["selectBlock", "collectBlock"],
  13260. 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",
  13261. referencedClasses: [],
  13262. messageSends: ["new", "class", "do:", "ifTrue:", "value:", "add:"]
  13263. }),
  13264. $globals.Set);
  13265. $core.addMethod(
  13266. $core.method({
  13267. selector: "size",
  13268. protocol: "accessing",
  13269. fn: function (){
  13270. var self=this,$self=this;
  13271. return $self["@size"];
  13272. },
  13273. args: [],
  13274. source: "size\x0a\x09^ size",
  13275. referencedClasses: [],
  13276. messageSends: []
  13277. }),
  13278. $globals.Set);
  13279. $core.addClass("ProtoStream", $globals.Object, [], "Kernel-Collections");
  13280. $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.";
  13281. $core.addMethod(
  13282. $core.method({
  13283. selector: "<<",
  13284. protocol: "writing",
  13285. fn: function (anObject){
  13286. var self=this,$self=this;
  13287. return $core.withContext(function($ctx1) {
  13288. $self._write_(anObject);
  13289. return self;
  13290. }, function($ctx1) {$ctx1.fill(self,"<<",{anObject:anObject},$globals.ProtoStream)});
  13291. },
  13292. args: ["anObject"],
  13293. source: "<< anObject\x0a\x09self write: anObject",
  13294. referencedClasses: [],
  13295. messageSends: ["write:"]
  13296. }),
  13297. $globals.ProtoStream);
  13298. $core.addMethod(
  13299. $core.method({
  13300. selector: "atEnd",
  13301. protocol: "testing",
  13302. fn: function (){
  13303. var self=this,$self=this;
  13304. return $core.withContext(function($ctx1) {
  13305. $self._subclassResponsibility();
  13306. return self;
  13307. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ProtoStream)});
  13308. },
  13309. args: [],
  13310. source: "atEnd\x0a\x09self subclassResponsibility",
  13311. referencedClasses: [],
  13312. messageSends: ["subclassResponsibility"]
  13313. }),
  13314. $globals.ProtoStream);
  13315. $core.addMethod(
  13316. $core.method({
  13317. selector: "atStart",
  13318. protocol: "testing",
  13319. fn: function (){
  13320. var self=this,$self=this;
  13321. return $core.withContext(function($ctx1) {
  13322. $self._subclassResponsibility();
  13323. return self;
  13324. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.ProtoStream)});
  13325. },
  13326. args: [],
  13327. source: "atStart\x0a\x09self subclassResponsibility",
  13328. referencedClasses: [],
  13329. messageSends: ["subclassResponsibility"]
  13330. }),
  13331. $globals.ProtoStream);
  13332. $core.addMethod(
  13333. $core.method({
  13334. selector: "contents",
  13335. protocol: "accessing",
  13336. fn: function (){
  13337. var self=this,$self=this;
  13338. return $core.withContext(function($ctx1) {
  13339. $self._subclassResponsibility();
  13340. return self;
  13341. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.ProtoStream)});
  13342. },
  13343. args: [],
  13344. source: "contents\x0a\x09self subclassResponsibility",
  13345. referencedClasses: [],
  13346. messageSends: ["subclassResponsibility"]
  13347. }),
  13348. $globals.ProtoStream);
  13349. $core.addMethod(
  13350. $core.method({
  13351. selector: "do:",
  13352. protocol: "enumerating",
  13353. fn: function (aBlock){
  13354. var self=this,$self=this;
  13355. return $core.withContext(function($ctx1) {
  13356. $recv((function(){
  13357. return $core.withContext(function($ctx2) {
  13358. return $self._atEnd();
  13359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13360. }))._whileFalse_((function(){
  13361. return $core.withContext(function($ctx2) {
  13362. return $recv(aBlock)._value_($self._next());
  13363. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  13364. }));
  13365. return self;
  13366. }, function($ctx1) {$ctx1.fill(self,"do:",{aBlock:aBlock},$globals.ProtoStream)});
  13367. },
  13368. args: ["aBlock"],
  13369. source: "do: aBlock\x0a\x09[ self atEnd ] whileFalse: [ aBlock value: self next ]",
  13370. referencedClasses: [],
  13371. messageSends: ["whileFalse:", "atEnd", "value:", "next"]
  13372. }),
  13373. $globals.ProtoStream);
  13374. $core.addMethod(
  13375. $core.method({
  13376. selector: "isEmpty",
  13377. protocol: "testing",
  13378. fn: function (){
  13379. var self=this,$self=this;
  13380. return $core.withContext(function($ctx1) {
  13381. return $recv($self._atStart())._and_((function(){
  13382. return $core.withContext(function($ctx2) {
  13383. return $self._atEnd();
  13384. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13385. }));
  13386. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.ProtoStream)});
  13387. },
  13388. args: [],
  13389. source: "isEmpty\x0a\x09^ self atStart and: [ self atEnd ]",
  13390. referencedClasses: [],
  13391. messageSends: ["and:", "atStart", "atEnd"]
  13392. }),
  13393. $globals.ProtoStream);
  13394. $core.addMethod(
  13395. $core.method({
  13396. selector: "next",
  13397. protocol: "reading",
  13398. fn: function (){
  13399. var self=this,$self=this;
  13400. return $core.withContext(function($ctx1) {
  13401. var $1;
  13402. $1=$self._atEnd();
  13403. if($core.assert($1)){
  13404. return nil;
  13405. } else {
  13406. return $self._subclassResponsibility();
  13407. }
  13408. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.ProtoStream)});
  13409. },
  13410. args: [],
  13411. source: "next\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13412. referencedClasses: [],
  13413. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13414. }),
  13415. $globals.ProtoStream);
  13416. $core.addMethod(
  13417. $core.method({
  13418. selector: "nextPut:",
  13419. protocol: "writing",
  13420. fn: function (anObject){
  13421. var self=this,$self=this;
  13422. return $core.withContext(function($ctx1) {
  13423. $self._subclassResponsibility();
  13424. return self;
  13425. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.ProtoStream)});
  13426. },
  13427. args: ["anObject"],
  13428. source: "nextPut: anObject\x0a\x09self subclassResponsibility",
  13429. referencedClasses: [],
  13430. messageSends: ["subclassResponsibility"]
  13431. }),
  13432. $globals.ProtoStream);
  13433. $core.addMethod(
  13434. $core.method({
  13435. selector: "nextPutAll:",
  13436. protocol: "writing",
  13437. fn: function (aCollection){
  13438. var self=this,$self=this;
  13439. return $core.withContext(function($ctx1) {
  13440. $recv(aCollection)._do_((function(each){
  13441. return $core.withContext(function($ctx2) {
  13442. return $self._nextPut_(each);
  13443. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  13444. }));
  13445. return self;
  13446. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aCollection:aCollection},$globals.ProtoStream)});
  13447. },
  13448. args: ["aCollection"],
  13449. source: "nextPutAll: aCollection\x0a\x09aCollection do: [ :each |\x0a\x09\x09self nextPut: each ]",
  13450. referencedClasses: [],
  13451. messageSends: ["do:", "nextPut:"]
  13452. }),
  13453. $globals.ProtoStream);
  13454. $core.addMethod(
  13455. $core.method({
  13456. selector: "nextPutString:",
  13457. protocol: "writing",
  13458. fn: function (aString){
  13459. var self=this,$self=this;
  13460. return $core.withContext(function($ctx1) {
  13461. $self._nextPut_(aString);
  13462. return self;
  13463. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.ProtoStream)});
  13464. },
  13465. args: ["aString"],
  13466. source: "nextPutString: aString\x0a\x09self nextPut: aString",
  13467. referencedClasses: [],
  13468. messageSends: ["nextPut:"]
  13469. }),
  13470. $globals.ProtoStream);
  13471. $core.addMethod(
  13472. $core.method({
  13473. selector: "peek",
  13474. protocol: "reading",
  13475. fn: function (){
  13476. var self=this,$self=this;
  13477. return $core.withContext(function($ctx1) {
  13478. var $1;
  13479. $1=$self._atEnd();
  13480. if($core.assert($1)){
  13481. return nil;
  13482. } else {
  13483. return $self._subclassResponsibility();
  13484. }
  13485. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ProtoStream)});
  13486. },
  13487. args: [],
  13488. source: "peek\x0a\x09^ self atEnd\x0a\x09\x09ifTrue: [ nil ]\x0a\x09\x09ifFalse: [ self subclassResponsibility ]",
  13489. referencedClasses: [],
  13490. messageSends: ["ifTrue:ifFalse:", "atEnd", "subclassResponsibility"]
  13491. }),
  13492. $globals.ProtoStream);
  13493. $core.addMethod(
  13494. $core.method({
  13495. selector: "reset",
  13496. protocol: "actions",
  13497. fn: function (){
  13498. var self=this,$self=this;
  13499. return $core.withContext(function($ctx1) {
  13500. $self._subclassResponsibility();
  13501. return self;
  13502. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.ProtoStream)});
  13503. },
  13504. args: [],
  13505. source: "reset\x0a\x09self subclassResponsibility",
  13506. referencedClasses: [],
  13507. messageSends: ["subclassResponsibility"]
  13508. }),
  13509. $globals.ProtoStream);
  13510. $core.addMethod(
  13511. $core.method({
  13512. selector: "resetContents",
  13513. protocol: "actions",
  13514. fn: function (){
  13515. var self=this,$self=this;
  13516. return $core.withContext(function($ctx1) {
  13517. $self._subclassResponsibility();
  13518. return self;
  13519. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.ProtoStream)});
  13520. },
  13521. args: [],
  13522. source: "resetContents\x0a\x09self subclassResponsibility",
  13523. referencedClasses: [],
  13524. messageSends: ["subclassResponsibility"]
  13525. }),
  13526. $globals.ProtoStream);
  13527. $core.addMethod(
  13528. $core.method({
  13529. selector: "setToEnd",
  13530. protocol: "positioning",
  13531. fn: function (){
  13532. var self=this,$self=this;
  13533. return $core.withContext(function($ctx1) {
  13534. $self._subclassResponsibility();
  13535. return self;
  13536. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.ProtoStream)});
  13537. },
  13538. args: [],
  13539. source: "setToEnd\x0a\x09self subclassResponsibility",
  13540. referencedClasses: [],
  13541. messageSends: ["subclassResponsibility"]
  13542. }),
  13543. $globals.ProtoStream);
  13544. $core.addMethod(
  13545. $core.method({
  13546. selector: "setToStart",
  13547. protocol: "positioning",
  13548. fn: function (){
  13549. var self=this,$self=this;
  13550. return $core.withContext(function($ctx1) {
  13551. $self._reset();
  13552. return self;
  13553. }, function($ctx1) {$ctx1.fill(self,"setToStart",{},$globals.ProtoStream)});
  13554. },
  13555. args: [],
  13556. source: "setToStart\x0a\x09self reset",
  13557. referencedClasses: [],
  13558. messageSends: ["reset"]
  13559. }),
  13560. $globals.ProtoStream);
  13561. $core.addMethod(
  13562. $core.method({
  13563. selector: "write:",
  13564. protocol: "writing",
  13565. fn: function (anObject){
  13566. var self=this,$self=this;
  13567. return $core.withContext(function($ctx1) {
  13568. $recv(anObject)._putOn_(self);
  13569. return self;
  13570. }, function($ctx1) {$ctx1.fill(self,"write:",{anObject:anObject},$globals.ProtoStream)});
  13571. },
  13572. args: ["anObject"],
  13573. source: "write: anObject\x0a\x09anObject putOn: self",
  13574. referencedClasses: [],
  13575. messageSends: ["putOn:"]
  13576. }),
  13577. $globals.ProtoStream);
  13578. $core.addMethod(
  13579. $core.method({
  13580. selector: "on:",
  13581. protocol: "instance creation",
  13582. fn: function (aCollection){
  13583. var self=this,$self=this;
  13584. return $core.withContext(function($ctx1) {
  13585. var $1;
  13586. $1=$self._new();
  13587. $recv($1)._setCollection_(aCollection);
  13588. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13589. return $recv($1)._yourself();
  13590. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.ProtoStream.a$cls)});
  13591. },
  13592. args: ["aCollection"],
  13593. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13594. referencedClasses: [],
  13595. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13596. }),
  13597. $globals.ProtoStream.a$cls);
  13598. $core.addClass("Stream", $globals.ProtoStream, ["collection", "position", "streamSize"], "Kernel-Collections");
  13599. $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.";
  13600. $core.addMethod(
  13601. $core.method({
  13602. selector: "atEnd",
  13603. protocol: "testing",
  13604. fn: function (){
  13605. var self=this,$self=this;
  13606. return $core.withContext(function($ctx1) {
  13607. return $recv($self._position()).__eq($self._size());
  13608. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.Stream)});
  13609. },
  13610. args: [],
  13611. source: "atEnd\x0a\x09^ self position = self size",
  13612. referencedClasses: [],
  13613. messageSends: ["=", "position", "size"]
  13614. }),
  13615. $globals.Stream);
  13616. $core.addMethod(
  13617. $core.method({
  13618. selector: "atStart",
  13619. protocol: "testing",
  13620. fn: function (){
  13621. var self=this,$self=this;
  13622. return $core.withContext(function($ctx1) {
  13623. return $recv($self._position()).__eq((0));
  13624. }, function($ctx1) {$ctx1.fill(self,"atStart",{},$globals.Stream)});
  13625. },
  13626. args: [],
  13627. source: "atStart\x0a\x09^ self position = 0",
  13628. referencedClasses: [],
  13629. messageSends: ["=", "position"]
  13630. }),
  13631. $globals.Stream);
  13632. $core.addMethod(
  13633. $core.method({
  13634. selector: "close",
  13635. protocol: "actions",
  13636. fn: function (){
  13637. var self=this,$self=this;
  13638. return self;
  13639. },
  13640. args: [],
  13641. source: "close",
  13642. referencedClasses: [],
  13643. messageSends: []
  13644. }),
  13645. $globals.Stream);
  13646. $core.addMethod(
  13647. $core.method({
  13648. selector: "collection",
  13649. protocol: "accessing",
  13650. fn: function (){
  13651. var self=this,$self=this;
  13652. return $self["@collection"];
  13653. },
  13654. args: [],
  13655. source: "collection\x0a\x09^ collection",
  13656. referencedClasses: [],
  13657. messageSends: []
  13658. }),
  13659. $globals.Stream);
  13660. $core.addMethod(
  13661. $core.method({
  13662. selector: "contents",
  13663. protocol: "accessing",
  13664. fn: function (){
  13665. var self=this,$self=this;
  13666. return $core.withContext(function($ctx1) {
  13667. return $recv($self._collection())._copyFrom_to_((1),$self._streamSize());
  13668. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.Stream)});
  13669. },
  13670. args: [],
  13671. source: "contents\x0a\x09^ self collection\x0a\x09\x09copyFrom: 1\x0a\x09\x09to: self streamSize",
  13672. referencedClasses: [],
  13673. messageSends: ["copyFrom:to:", "collection", "streamSize"]
  13674. }),
  13675. $globals.Stream);
  13676. $core.addMethod(
  13677. $core.method({
  13678. selector: "flush",
  13679. protocol: "actions",
  13680. fn: function (){
  13681. var self=this,$self=this;
  13682. return self;
  13683. },
  13684. args: [],
  13685. source: "flush",
  13686. referencedClasses: [],
  13687. messageSends: []
  13688. }),
  13689. $globals.Stream);
  13690. $core.addMethod(
  13691. $core.method({
  13692. selector: "isEmpty",
  13693. protocol: "testing",
  13694. fn: function (){
  13695. var self=this,$self=this;
  13696. return $core.withContext(function($ctx1) {
  13697. return $recv($self._size()).__eq((0));
  13698. }, function($ctx1) {$ctx1.fill(self,"isEmpty",{},$globals.Stream)});
  13699. },
  13700. args: [],
  13701. source: "isEmpty\x0a\x09^ self size = 0",
  13702. referencedClasses: [],
  13703. messageSends: ["=", "size"]
  13704. }),
  13705. $globals.Stream);
  13706. $core.addMethod(
  13707. $core.method({
  13708. selector: "next",
  13709. protocol: "reading",
  13710. fn: function (){
  13711. var self=this,$self=this;
  13712. return $core.withContext(function($ctx1) {
  13713. var $1,$3,$2;
  13714. $1=$self._atEnd();
  13715. if($core.assert($1)){
  13716. return nil;
  13717. } else {
  13718. $3=$self._position();
  13719. $ctx1.sendIdx["position"]=1;
  13720. $2=$recv($3).__plus((1));
  13721. $self._position_($2);
  13722. return $recv($self["@collection"])._at_($self._position());
  13723. }
  13724. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Stream)});
  13725. },
  13726. args: [],
  13727. 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 ]",
  13728. referencedClasses: [],
  13729. messageSends: ["ifTrue:ifFalse:", "atEnd", "position:", "+", "position", "at:"]
  13730. }),
  13731. $globals.Stream);
  13732. $core.addMethod(
  13733. $core.method({
  13734. selector: "next:",
  13735. protocol: "reading",
  13736. fn: function (anInteger){
  13737. var self=this,$self=this;
  13738. var tempCollection;
  13739. return $core.withContext(function($ctx1) {
  13740. var $1;
  13741. tempCollection=$recv($recv($self._collection())._class())._new();
  13742. $recv(anInteger)._timesRepeat_((function(){
  13743. return $core.withContext(function($ctx2) {
  13744. $1=$self._atEnd();
  13745. if(!$core.assert($1)){
  13746. return $recv(tempCollection)._add_($self._next());
  13747. }
  13748. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  13749. }));
  13750. return tempCollection;
  13751. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.Stream)});
  13752. },
  13753. args: ["anInteger"],
  13754. 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",
  13755. referencedClasses: [],
  13756. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", "add:", "next"]
  13757. }),
  13758. $globals.Stream);
  13759. $core.addMethod(
  13760. $core.method({
  13761. selector: "nextPut:",
  13762. protocol: "writing",
  13763. fn: function (anObject){
  13764. var self=this,$self=this;
  13765. return $core.withContext(function($ctx1) {
  13766. var $2,$1,$3,$4;
  13767. $2=$self._position();
  13768. $ctx1.sendIdx["position"]=1;
  13769. $1=$recv($2).__plus((1));
  13770. $self._position_($1);
  13771. $3=$self._collection();
  13772. $4=$self._position();
  13773. $ctx1.sendIdx["position"]=2;
  13774. $recv($3)._at_put_($4,anObject);
  13775. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  13776. return self;
  13777. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Stream)});
  13778. },
  13779. args: ["anObject"],
  13780. 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)",
  13781. referencedClasses: [],
  13782. messageSends: ["position:", "+", "position", "at:put:", "collection", "setStreamSize:", "max:", "streamSize"]
  13783. }),
  13784. $globals.Stream);
  13785. $core.addMethod(
  13786. $core.method({
  13787. selector: "peek",
  13788. protocol: "reading",
  13789. fn: function (){
  13790. var self=this,$self=this;
  13791. return $core.withContext(function($ctx1) {
  13792. var $1;
  13793. $1=$self._atEnd();
  13794. if(!$core.assert($1)){
  13795. return $recv($self._collection())._at_($recv($self._position()).__plus((1)));
  13796. }
  13797. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.Stream)});
  13798. },
  13799. args: [],
  13800. source: "peek\x0a\x09^ self atEnd ifFalse: [\x0a\x09\x09self collection at: self position + 1 ]",
  13801. referencedClasses: [],
  13802. messageSends: ["ifFalse:", "atEnd", "at:", "collection", "+", "position"]
  13803. }),
  13804. $globals.Stream);
  13805. $core.addMethod(
  13806. $core.method({
  13807. selector: "position",
  13808. protocol: "accessing",
  13809. fn: function (){
  13810. var self=this,$self=this;
  13811. return $core.withContext(function($ctx1) {
  13812. var $1,$receiver;
  13813. $1=$self["@position"];
  13814. if(($receiver = $1) == null || $receiver.a$nil){
  13815. $self["@position"]=(0);
  13816. return $self["@position"];
  13817. } else {
  13818. return $1;
  13819. }
  13820. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.Stream)});
  13821. },
  13822. args: [],
  13823. source: "position\x0a\x09^ position ifNil: [ position := 0 ]",
  13824. referencedClasses: [],
  13825. messageSends: ["ifNil:"]
  13826. }),
  13827. $globals.Stream);
  13828. $core.addMethod(
  13829. $core.method({
  13830. selector: "position:",
  13831. protocol: "accessing",
  13832. fn: function (anInteger){
  13833. var self=this,$self=this;
  13834. $self["@position"]=anInteger;
  13835. return self;
  13836. },
  13837. args: ["anInteger"],
  13838. source: "position: anInteger\x0a\x09position := anInteger",
  13839. referencedClasses: [],
  13840. messageSends: []
  13841. }),
  13842. $globals.Stream);
  13843. $core.addMethod(
  13844. $core.method({
  13845. selector: "reset",
  13846. protocol: "actions",
  13847. fn: function (){
  13848. var self=this,$self=this;
  13849. return $core.withContext(function($ctx1) {
  13850. $self._position_((0));
  13851. return self;
  13852. }, function($ctx1) {$ctx1.fill(self,"reset",{},$globals.Stream)});
  13853. },
  13854. args: [],
  13855. source: "reset\x0a\x09self position: 0",
  13856. referencedClasses: [],
  13857. messageSends: ["position:"]
  13858. }),
  13859. $globals.Stream);
  13860. $core.addMethod(
  13861. $core.method({
  13862. selector: "resetContents",
  13863. protocol: "actions",
  13864. fn: function (){
  13865. var self=this,$self=this;
  13866. return $core.withContext(function($ctx1) {
  13867. $self._reset();
  13868. $self._setStreamSize_((0));
  13869. return self;
  13870. }, function($ctx1) {$ctx1.fill(self,"resetContents",{},$globals.Stream)});
  13871. },
  13872. args: [],
  13873. source: "resetContents\x0a\x09self reset.\x0a\x09self setStreamSize: 0",
  13874. referencedClasses: [],
  13875. messageSends: ["reset", "setStreamSize:"]
  13876. }),
  13877. $globals.Stream);
  13878. $core.addMethod(
  13879. $core.method({
  13880. selector: "setCollection:",
  13881. protocol: "accessing",
  13882. fn: function (aCollection){
  13883. var self=this,$self=this;
  13884. $self["@collection"]=aCollection;
  13885. return self;
  13886. },
  13887. args: ["aCollection"],
  13888. source: "setCollection: aCollection\x0a\x09collection := aCollection",
  13889. referencedClasses: [],
  13890. messageSends: []
  13891. }),
  13892. $globals.Stream);
  13893. $core.addMethod(
  13894. $core.method({
  13895. selector: "setStreamSize:",
  13896. protocol: "accessing",
  13897. fn: function (anInteger){
  13898. var self=this,$self=this;
  13899. $self["@streamSize"]=anInteger;
  13900. return self;
  13901. },
  13902. args: ["anInteger"],
  13903. source: "setStreamSize: anInteger\x0a\x09streamSize := anInteger",
  13904. referencedClasses: [],
  13905. messageSends: []
  13906. }),
  13907. $globals.Stream);
  13908. $core.addMethod(
  13909. $core.method({
  13910. selector: "setToEnd",
  13911. protocol: "positioning",
  13912. fn: function (){
  13913. var self=this,$self=this;
  13914. return $core.withContext(function($ctx1) {
  13915. $self._position_($self._size());
  13916. return self;
  13917. }, function($ctx1) {$ctx1.fill(self,"setToEnd",{},$globals.Stream)});
  13918. },
  13919. args: [],
  13920. source: "setToEnd\x0a\x09self position: self size",
  13921. referencedClasses: [],
  13922. messageSends: ["position:", "size"]
  13923. }),
  13924. $globals.Stream);
  13925. $core.addMethod(
  13926. $core.method({
  13927. selector: "size",
  13928. protocol: "accessing",
  13929. fn: function (){
  13930. var self=this,$self=this;
  13931. return $core.withContext(function($ctx1) {
  13932. return $self._streamSize();
  13933. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.Stream)});
  13934. },
  13935. args: [],
  13936. source: "size\x0a\x09^ self streamSize",
  13937. referencedClasses: [],
  13938. messageSends: ["streamSize"]
  13939. }),
  13940. $globals.Stream);
  13941. $core.addMethod(
  13942. $core.method({
  13943. selector: "skip:",
  13944. protocol: "positioning",
  13945. fn: function (anInteger){
  13946. var self=this,$self=this;
  13947. return $core.withContext(function($ctx1) {
  13948. $self._position_($recv($recv($self._position()).__plus(anInteger))._min_max_($self._size(),(0)));
  13949. return self;
  13950. }, function($ctx1) {$ctx1.fill(self,"skip:",{anInteger:anInteger},$globals.Stream)});
  13951. },
  13952. args: ["anInteger"],
  13953. source: "skip: anInteger\x0a\x09self position: ((self position + anInteger) min: self size max: 0)",
  13954. referencedClasses: [],
  13955. messageSends: ["position:", "min:max:", "+", "position", "size"]
  13956. }),
  13957. $globals.Stream);
  13958. $core.addMethod(
  13959. $core.method({
  13960. selector: "streamSize",
  13961. protocol: "accessing",
  13962. fn: function (){
  13963. var self=this,$self=this;
  13964. return $self["@streamSize"];
  13965. },
  13966. args: [],
  13967. source: "streamSize\x0a\x09^ streamSize",
  13968. referencedClasses: [],
  13969. messageSends: []
  13970. }),
  13971. $globals.Stream);
  13972. $core.addMethod(
  13973. $core.method({
  13974. selector: "on:",
  13975. protocol: "instance creation",
  13976. fn: function (aCollection){
  13977. var self=this,$self=this;
  13978. return $core.withContext(function($ctx1) {
  13979. var $1;
  13980. $1=$self._new();
  13981. $recv($1)._setCollection_(aCollection);
  13982. $recv($1)._setStreamSize_($recv(aCollection)._size());
  13983. return $recv($1)._yourself();
  13984. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.Stream.a$cls)});
  13985. },
  13986. args: ["aCollection"],
  13987. source: "on: aCollection\x0a\x09\x09^ self new\x0a\x09\x09setCollection: aCollection;\x0a\x09\x09setStreamSize: aCollection size;\x0a\x09\x09yourself",
  13988. referencedClasses: [],
  13989. messageSends: ["setCollection:", "new", "setStreamSize:", "size", "yourself"]
  13990. }),
  13991. $globals.Stream.a$cls);
  13992. $core.addClass("StringStream", $globals.Stream, [], "Kernel-Collections");
  13993. $globals.StringStream.comment="I am a Stream specific to `String` objects.";
  13994. $core.addMethod(
  13995. $core.method({
  13996. selector: "cr",
  13997. protocol: "writing",
  13998. fn: function (){
  13999. var self=this,$self=this;
  14000. return $core.withContext(function($ctx1) {
  14001. return $self._nextPutAll_($recv($globals.String)._cr());
  14002. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.StringStream)});
  14003. },
  14004. args: [],
  14005. source: "cr\x0a\x09^ self nextPutAll: String cr",
  14006. referencedClasses: ["String"],
  14007. messageSends: ["nextPutAll:", "cr"]
  14008. }),
  14009. $globals.StringStream);
  14010. $core.addMethod(
  14011. $core.method({
  14012. selector: "crlf",
  14013. protocol: "writing",
  14014. fn: function (){
  14015. var self=this,$self=this;
  14016. return $core.withContext(function($ctx1) {
  14017. return $self._nextPutAll_($recv($globals.String)._crlf());
  14018. }, function($ctx1) {$ctx1.fill(self,"crlf",{},$globals.StringStream)});
  14019. },
  14020. args: [],
  14021. source: "crlf\x0a\x09^ self nextPutAll: String crlf",
  14022. referencedClasses: ["String"],
  14023. messageSends: ["nextPutAll:", "crlf"]
  14024. }),
  14025. $globals.StringStream);
  14026. $core.addMethod(
  14027. $core.method({
  14028. selector: "lf",
  14029. protocol: "writing",
  14030. fn: function (){
  14031. var self=this,$self=this;
  14032. return $core.withContext(function($ctx1) {
  14033. return $self._nextPutAll_($recv($globals.String)._lf());
  14034. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.StringStream)});
  14035. },
  14036. args: [],
  14037. source: "lf\x0a\x09^ self nextPutAll: String lf",
  14038. referencedClasses: ["String"],
  14039. messageSends: ["nextPutAll:", "lf"]
  14040. }),
  14041. $globals.StringStream);
  14042. $core.addMethod(
  14043. $core.method({
  14044. selector: "next:",
  14045. protocol: "reading",
  14046. fn: function (anInteger){
  14047. var self=this,$self=this;
  14048. var tempCollection;
  14049. return $core.withContext(function($ctx1) {
  14050. var $1;
  14051. tempCollection=$recv($recv($self._collection())._class())._new();
  14052. $recv(anInteger)._timesRepeat_((function(){
  14053. return $core.withContext(function($ctx2) {
  14054. $1=$self._atEnd();
  14055. if(!$core.assert($1)){
  14056. tempCollection=$recv(tempCollection).__comma($self._next());
  14057. return tempCollection;
  14058. }
  14059. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14060. }));
  14061. return tempCollection;
  14062. }, function($ctx1) {$ctx1.fill(self,"next:",{anInteger:anInteger,tempCollection:tempCollection},$globals.StringStream)});
  14063. },
  14064. args: ["anInteger"],
  14065. 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",
  14066. referencedClasses: [],
  14067. messageSends: ["new", "class", "collection", "timesRepeat:", "ifFalse:", "atEnd", ",", "next"]
  14068. }),
  14069. $globals.StringStream);
  14070. $core.addMethod(
  14071. $core.method({
  14072. selector: "nextPut:",
  14073. protocol: "writing",
  14074. fn: function (aString){
  14075. var self=this,$self=this;
  14076. return $core.withContext(function($ctx1) {
  14077. $self._nextPutAll_(aString);
  14078. return self;
  14079. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.StringStream)});
  14080. },
  14081. args: ["aString"],
  14082. source: "nextPut: aString\x0a\x09self nextPutAll: aString",
  14083. referencedClasses: [],
  14084. messageSends: ["nextPutAll:"]
  14085. }),
  14086. $globals.StringStream);
  14087. $core.addMethod(
  14088. $core.method({
  14089. selector: "nextPutAll:",
  14090. protocol: "writing",
  14091. fn: function (aString){
  14092. var self=this,$self=this;
  14093. var pre,post;
  14094. return $core.withContext(function($ctx1) {
  14095. var $1,$3,$2,$4,$5,$6,$9,$8,$10,$7,$11,$12,$14,$13;
  14096. $1=$self._atEnd();
  14097. if($core.assert($1)){
  14098. $3=$self._collection();
  14099. $ctx1.sendIdx["collection"]=1;
  14100. $2=$recv($3).__comma(aString);
  14101. $ctx1.sendIdx[","]=1;
  14102. $self._setCollection_($2);
  14103. $ctx1.sendIdx["setCollection:"]=1;
  14104. } else {
  14105. $4=$self._collection();
  14106. $ctx1.sendIdx["collection"]=2;
  14107. $5=$self._position();
  14108. $ctx1.sendIdx["position"]=1;
  14109. pre=$recv($4)._copyFrom_to_((1),$5);
  14110. $ctx1.sendIdx["copyFrom:to:"]=1;
  14111. $6=$self._collection();
  14112. $ctx1.sendIdx["collection"]=3;
  14113. $9=$self._position();
  14114. $ctx1.sendIdx["position"]=2;
  14115. $8=$recv($9).__plus((1));
  14116. $ctx1.sendIdx["+"]=2;
  14117. $10=$recv(aString)._size();
  14118. $ctx1.sendIdx["size"]=1;
  14119. $7=$recv($8).__plus($10);
  14120. $ctx1.sendIdx["+"]=1;
  14121. $11=$recv($self._collection())._size();
  14122. $ctx1.sendIdx["size"]=2;
  14123. post=$recv($6)._copyFrom_to_($7,$11);
  14124. $12=$recv($recv(pre).__comma(aString)).__comma(post);
  14125. $ctx1.sendIdx[","]=2;
  14126. $self._setCollection_($12);
  14127. }
  14128. $14=$self._position();
  14129. $ctx1.sendIdx["position"]=3;
  14130. $13=$recv($14).__plus($recv(aString)._size());
  14131. $self._position_($13);
  14132. $self._setStreamSize_($recv($self._streamSize())._max_($self._position()));
  14133. return self;
  14134. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString,pre:pre,post:post},$globals.StringStream)});
  14135. },
  14136. args: ["aString"],
  14137. 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)",
  14138. referencedClasses: [],
  14139. messageSends: ["ifTrue:ifFalse:", "atEnd", "setCollection:", ",", "collection", "copyFrom:to:", "position", "+", "size", "position:", "setStreamSize:", "max:", "streamSize"]
  14140. }),
  14141. $globals.StringStream);
  14142. $core.addMethod(
  14143. $core.method({
  14144. selector: "nextPutString:",
  14145. protocol: "writing",
  14146. fn: function (aString){
  14147. var self=this,$self=this;
  14148. return $core.withContext(function($ctx1) {
  14149. $self._nextPutAll_(aString);
  14150. return self;
  14151. }, function($ctx1) {$ctx1.fill(self,"nextPutString:",{aString:aString},$globals.StringStream)});
  14152. },
  14153. args: ["aString"],
  14154. source: "nextPutString: aString\x0a\x09self nextPutAll: aString",
  14155. referencedClasses: [],
  14156. messageSends: ["nextPutAll:"]
  14157. }),
  14158. $globals.StringStream);
  14159. $core.addMethod(
  14160. $core.method({
  14161. selector: "print:",
  14162. protocol: "writing",
  14163. fn: function (anObject){
  14164. var self=this,$self=this;
  14165. return $core.withContext(function($ctx1) {
  14166. $recv(anObject)._printOn_(self);
  14167. return self;
  14168. }, function($ctx1) {$ctx1.fill(self,"print:",{anObject:anObject},$globals.StringStream)});
  14169. },
  14170. args: ["anObject"],
  14171. source: "print: anObject\x0a\x09anObject printOn: self",
  14172. referencedClasses: [],
  14173. messageSends: ["printOn:"]
  14174. }),
  14175. $globals.StringStream);
  14176. $core.addMethod(
  14177. $core.method({
  14178. selector: "printSymbol:",
  14179. protocol: "writing",
  14180. fn: function (anObject){
  14181. var self=this,$self=this;
  14182. return $core.withContext(function($ctx1) {
  14183. $recv(anObject)._asSymbolPrintOn_(self);
  14184. return self;
  14185. }, function($ctx1) {$ctx1.fill(self,"printSymbol:",{anObject:anObject},$globals.StringStream)});
  14186. },
  14187. args: ["anObject"],
  14188. source: "printSymbol: anObject\x0a\x09anObject asSymbolPrintOn: self",
  14189. referencedClasses: [],
  14190. messageSends: ["asSymbolPrintOn:"]
  14191. }),
  14192. $globals.StringStream);
  14193. $core.addMethod(
  14194. $core.method({
  14195. selector: "space",
  14196. protocol: "writing",
  14197. fn: function (){
  14198. var self=this,$self=this;
  14199. return $core.withContext(function($ctx1) {
  14200. $self._nextPut_(" ");
  14201. return self;
  14202. }, function($ctx1) {$ctx1.fill(self,"space",{},$globals.StringStream)});
  14203. },
  14204. args: [],
  14205. source: "space\x0a\x09self nextPut: ' '",
  14206. referencedClasses: [],
  14207. messageSends: ["nextPut:"]
  14208. }),
  14209. $globals.StringStream);
  14210. $core.addMethod(
  14211. $core.method({
  14212. selector: "tab",
  14213. protocol: "writing",
  14214. fn: function (){
  14215. var self=this,$self=this;
  14216. return $core.withContext(function($ctx1) {
  14217. return $self._nextPutAll_($recv($globals.String)._tab());
  14218. }, function($ctx1) {$ctx1.fill(self,"tab",{},$globals.StringStream)});
  14219. },
  14220. args: [],
  14221. source: "tab\x0a\x09^ self nextPutAll: String tab",
  14222. referencedClasses: ["String"],
  14223. messageSends: ["nextPutAll:", "tab"]
  14224. }),
  14225. $globals.StringStream);
  14226. $core.addClass("Queue", $globals.Object, ["read", "readIndex", "write"], "Kernel-Collections");
  14227. $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.";
  14228. $core.addMethod(
  14229. $core.method({
  14230. selector: "initialize",
  14231. protocol: "initialization",
  14232. fn: function (){
  14233. var self=this,$self=this;
  14234. return $core.withContext(function($ctx1) {
  14235. (
  14236. $ctx1.supercall = true,
  14237. ($globals.Queue.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  14238. $ctx1.supercall = false;
  14239. $self["@read"]=$recv($globals.OrderedCollection)._new();
  14240. $ctx1.sendIdx["new"]=1;
  14241. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14242. $self["@readIndex"]=(1);
  14243. return self;
  14244. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Queue)});
  14245. },
  14246. args: [],
  14247. source: "initialize\x0a\x09super initialize.\x0a\x09read := OrderedCollection new.\x0a\x09write := OrderedCollection new.\x0a\x09readIndex := 1",
  14248. referencedClasses: ["OrderedCollection"],
  14249. messageSends: ["initialize", "new"]
  14250. }),
  14251. $globals.Queue);
  14252. $core.addMethod(
  14253. $core.method({
  14254. selector: "next",
  14255. protocol: "accessing",
  14256. fn: function (){
  14257. var self=this,$self=this;
  14258. return $core.withContext(function($ctx1) {
  14259. return $self._nextIfAbsent_((function(){
  14260. return $core.withContext(function($ctx2) {
  14261. return $self._error_("Cannot read from empty Queue.");
  14262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14263. }));
  14264. }, function($ctx1) {$ctx1.fill(self,"next",{},$globals.Queue)});
  14265. },
  14266. args: [],
  14267. source: "next\x0a\x09^ self nextIfAbsent: [ self error: 'Cannot read from empty Queue.' ]",
  14268. referencedClasses: [],
  14269. messageSends: ["nextIfAbsent:", "error:"]
  14270. }),
  14271. $globals.Queue);
  14272. $core.addMethod(
  14273. $core.method({
  14274. selector: "nextIfAbsent:",
  14275. protocol: "accessing",
  14276. fn: function (aBlock){
  14277. var self=this,$self=this;
  14278. var result;
  14279. return $core.withContext(function($ctx1) {
  14280. var $1;
  14281. var $early={};
  14282. try {
  14283. result=$recv($self["@read"])._at_ifAbsent_($self["@readIndex"],(function(){
  14284. return $core.withContext(function($ctx2) {
  14285. $recv($self["@write"])._ifEmpty_((function(){
  14286. return $core.withContext(function($ctx3) {
  14287. $1=$recv($self["@readIndex"]).__gt((1));
  14288. if($core.assert($1)){
  14289. $self["@read"]=[];
  14290. $self["@readIndex"]=(1);
  14291. $self["@readIndex"];
  14292. }
  14293. throw $early=[$recv(aBlock)._value()];
  14294. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14295. }));
  14296. $self["@read"]=$self["@write"];
  14297. $self["@readIndex"]=(1);
  14298. $self["@write"]=$recv($globals.OrderedCollection)._new();
  14299. return $recv($self["@read"])._first();
  14300. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14301. }));
  14302. $recv($self["@read"])._at_put_($self["@readIndex"],nil);
  14303. $self["@readIndex"]=$recv($self["@readIndex"]).__plus((1));
  14304. return result;
  14305. }
  14306. catch(e) {if(e===$early)return e[0]; throw e}
  14307. }, function($ctx1) {$ctx1.fill(self,"nextIfAbsent:",{aBlock:aBlock,result:result},$globals.Queue)});
  14308. },
  14309. args: ["aBlock"],
  14310. 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",
  14311. referencedClasses: ["OrderedCollection"],
  14312. messageSends: ["at:ifAbsent:", "ifEmpty:", "ifTrue:", ">", "value", "new", "first", "at:put:", "+"]
  14313. }),
  14314. $globals.Queue);
  14315. $core.addMethod(
  14316. $core.method({
  14317. selector: "nextPut:",
  14318. protocol: "accessing",
  14319. fn: function (anObject){
  14320. var self=this,$self=this;
  14321. return $core.withContext(function($ctx1) {
  14322. $recv($self["@write"])._add_(anObject);
  14323. return self;
  14324. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{anObject:anObject},$globals.Queue)});
  14325. },
  14326. args: ["anObject"],
  14327. source: "nextPut: anObject\x0a\x09write add: anObject",
  14328. referencedClasses: [],
  14329. messageSends: ["add:"]
  14330. }),
  14331. $globals.Queue);
  14332. $core.addClass("RegularExpression", $globals.Object, [], "Kernel-Collections");
  14333. $globals.RegularExpression.comment="I represent a regular expression object. My instances are JavaScript `RegExp` object.";
  14334. $core.addMethod(
  14335. $core.method({
  14336. selector: "compile:",
  14337. protocol: "evaluating",
  14338. fn: function (aString){
  14339. var self=this,$self=this;
  14340. return $core.withContext(function($ctx1) {
  14341. return self.compile(aString);
  14342. return self;
  14343. }, function($ctx1) {$ctx1.fill(self,"compile:",{aString:aString},$globals.RegularExpression)});
  14344. },
  14345. args: ["aString"],
  14346. source: "compile: aString\x0a\x09<inlineJS: 'return self.compile(aString)'>",
  14347. referencedClasses: [],
  14348. messageSends: []
  14349. }),
  14350. $globals.RegularExpression);
  14351. $core.addMethod(
  14352. $core.method({
  14353. selector: "exec:",
  14354. protocol: "evaluating",
  14355. fn: function (aString){
  14356. var self=this,$self=this;
  14357. return $core.withContext(function($ctx1) {
  14358. return self.exec(aString) || nil;
  14359. return self;
  14360. }, function($ctx1) {$ctx1.fill(self,"exec:",{aString:aString},$globals.RegularExpression)});
  14361. },
  14362. args: ["aString"],
  14363. source: "exec: aString\x0a\x09<inlineJS: 'return self.exec(aString) || nil'>",
  14364. referencedClasses: [],
  14365. messageSends: []
  14366. }),
  14367. $globals.RegularExpression);
  14368. $core.addMethod(
  14369. $core.method({
  14370. selector: "test:",
  14371. protocol: "evaluating",
  14372. fn: function (aString){
  14373. var self=this,$self=this;
  14374. return $core.withContext(function($ctx1) {
  14375. return self.test(aString);
  14376. return self;
  14377. }, function($ctx1) {$ctx1.fill(self,"test:",{aString:aString},$globals.RegularExpression)});
  14378. },
  14379. args: ["aString"],
  14380. source: "test: aString\x0a\x09<inlineJS: 'return self.test(aString)'>",
  14381. referencedClasses: [],
  14382. messageSends: []
  14383. }),
  14384. $globals.RegularExpression);
  14385. $core.addMethod(
  14386. $core.method({
  14387. selector: "fromString:",
  14388. protocol: "instance creation",
  14389. fn: function (aString){
  14390. var self=this,$self=this;
  14391. return $core.withContext(function($ctx1) {
  14392. return $self._fromString_flag_(aString,"");
  14393. }, function($ctx1) {$ctx1.fill(self,"fromString:",{aString:aString},$globals.RegularExpression.a$cls)});
  14394. },
  14395. args: ["aString"],
  14396. source: "fromString: aString\x0a\x09\x09^ self fromString: aString flag: ''",
  14397. referencedClasses: [],
  14398. messageSends: ["fromString:flag:"]
  14399. }),
  14400. $globals.RegularExpression.a$cls);
  14401. $core.addMethod(
  14402. $core.method({
  14403. selector: "fromString:flag:",
  14404. protocol: "instance creation",
  14405. fn: function (aString,anotherString){
  14406. var self=this,$self=this;
  14407. return $core.withContext(function($ctx1) {
  14408. return new RegExp(aString, anotherString);
  14409. return self;
  14410. }, function($ctx1) {$ctx1.fill(self,"fromString:flag:",{aString:aString,anotherString:anotherString},$globals.RegularExpression.a$cls)});
  14411. },
  14412. args: ["aString", "anotherString"],
  14413. source: "fromString: aString flag: anotherString\x0a\x09<inlineJS: 'return new RegExp(aString, anotherString)'>",
  14414. referencedClasses: [],
  14415. messageSends: []
  14416. }),
  14417. $globals.RegularExpression.a$cls);
  14418. });
  14419. define('amber_core/Kernel-Classes',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Helpers", "amber_core/Kernel-Objects"], function($boot){"use strict";
  14420. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  14421. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  14422. $core.addPackage("Kernel-Classes");
  14423. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].innerEval = function (expr) { return eval(expr); };
  14424. ($core.packageDescriptors||$core.packages)["Kernel-Classes"].transport = {"type":"amd","amdNamespace":"amber_core"};
  14425. $core.addClass("Behavior", $globals.Object, ["organization"], "Kernel-Classes");
  14426. $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.";
  14427. $core.addMethod(
  14428. $core.method({
  14429. selector: "allInstanceVariableNames",
  14430. protocol: "accessing",
  14431. fn: function (){
  14432. var self=this,$self=this;
  14433. var result;
  14434. return $core.withContext(function($ctx1) {
  14435. var $1,$receiver;
  14436. result=$recv($self._instanceVariableNames())._copy();
  14437. $1=$self._superclass();
  14438. $ctx1.sendIdx["superclass"]=1;
  14439. if(($receiver = $1) == null || $receiver.a$nil){
  14440. $1;
  14441. } else {
  14442. $recv(result)._addAll_($recv($self._superclass())._allInstanceVariableNames());
  14443. }
  14444. return result;
  14445. }, function($ctx1) {$ctx1.fill(self,"allInstanceVariableNames",{result:result},$globals.Behavior)});
  14446. },
  14447. args: [],
  14448. source: "allInstanceVariableNames\x0a\x09| result |\x0a\x09result := self instanceVariableNames copy.\x0a\x09self superclass ifNotNil: [\x0a\x09\x09result addAll: self superclass allInstanceVariableNames ].\x0a\x09^ result",
  14449. referencedClasses: [],
  14450. messageSends: ["copy", "instanceVariableNames", "ifNotNil:", "superclass", "addAll:", "allInstanceVariableNames"]
  14451. }),
  14452. $globals.Behavior);
  14453. $core.addMethod(
  14454. $core.method({
  14455. selector: "allSelectors",
  14456. protocol: "accessing",
  14457. fn: function (){
  14458. var self=this,$self=this;
  14459. return $core.withContext(function($ctx1) {
  14460. var $1,$2;
  14461. $1=$self._allSuperclasses();
  14462. $2=$self._selectors();
  14463. $ctx1.sendIdx["selectors"]=1;
  14464. return $recv($1)._inject_into_($2,(function(acc,each){
  14465. return $core.withContext(function($ctx2) {
  14466. $recv(acc)._addAll_($recv(each)._selectors());
  14467. return $recv(acc)._yourself();
  14468. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  14469. }));
  14470. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Behavior)});
  14471. },
  14472. args: [],
  14473. source: "allSelectors\x0a\x09^ self allSuperclasses\x0a\x09\x09inject: self selectors\x0a\x09\x09into: [ :acc :each | acc addAll: each selectors; yourself ]",
  14474. referencedClasses: [],
  14475. messageSends: ["inject:into:", "allSuperclasses", "selectors", "addAll:", "yourself"]
  14476. }),
  14477. $globals.Behavior);
  14478. $core.addMethod(
  14479. $core.method({
  14480. selector: "allSubclasses",
  14481. protocol: "accessing",
  14482. fn: function (){
  14483. var self=this,$self=this;
  14484. return $core.withContext(function($ctx1) {
  14485. return $recv($globals.Array)._streamContents_((function(str){
  14486. return $core.withContext(function($ctx2) {
  14487. return $self._allSubclassesDo_((function(each){
  14488. return $core.withContext(function($ctx3) {
  14489. return $recv(str)._nextPut_(each);
  14490. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  14491. }));
  14492. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  14493. }));
  14494. }, function($ctx1) {$ctx1.fill(self,"allSubclasses",{},$globals.Behavior)});
  14495. },
  14496. args: [],
  14497. 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 ] ]",
  14498. referencedClasses: ["Array"],
  14499. messageSends: ["streamContents:", "allSubclassesDo:", "nextPut:"]
  14500. }),
  14501. $globals.Behavior);
  14502. $core.addMethod(
  14503. $core.method({
  14504. selector: "allSubclassesDo:",
  14505. protocol: "enumerating",
  14506. fn: function (aBlock){
  14507. var self=this,$self=this;
  14508. return $core.withContext(function($ctx1) {
  14509. $core.traverseClassTree(self, function(subclass) {
  14510. if (subclass !== self) aBlock._value_(subclass);
  14511. });
  14512. return self;
  14513. }, function($ctx1) {$ctx1.fill(self,"allSubclassesDo:",{aBlock:aBlock},$globals.Behavior)});
  14514. },
  14515. args: ["aBlock"],
  14516. 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})'>",
  14517. referencedClasses: [],
  14518. messageSends: []
  14519. }),
  14520. $globals.Behavior);
  14521. $core.addMethod(
  14522. $core.method({
  14523. selector: "allSuperclasses",
  14524. protocol: "accessing",
  14525. fn: function (){
  14526. var self=this,$self=this;
  14527. return $core.withContext(function($ctx1) {
  14528. var $1,$3,$2,$receiver;
  14529. $1=$self._superclass();
  14530. $ctx1.sendIdx["superclass"]=1;
  14531. if(($receiver = $1) == null || $receiver.a$nil){
  14532. return [];
  14533. } else {
  14534. $1;
  14535. }
  14536. $3=$self._superclass();
  14537. $ctx1.sendIdx["superclass"]=2;
  14538. $2=$recv($globals.OrderedCollection)._with_($3);
  14539. $recv($2)._addAll_($recv($self._superclass())._allSuperclasses());
  14540. return $recv($2)._yourself();
  14541. }, function($ctx1) {$ctx1.fill(self,"allSuperclasses",{},$globals.Behavior)});
  14542. },
  14543. args: [],
  14544. 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",
  14545. referencedClasses: ["OrderedCollection"],
  14546. messageSends: ["ifNil:", "superclass", "addAll:", "with:", "allSuperclasses", "yourself"]
  14547. }),
  14548. $globals.Behavior);
  14549. $core.addMethod(
  14550. $core.method({
  14551. selector: "basicNew",
  14552. protocol: "instance creation",
  14553. fn: function (){
  14554. var self=this,$self=this;
  14555. return $core.withContext(function($ctx1) {
  14556. return new self.fn();
  14557. return self;
  14558. }, function($ctx1) {$ctx1.fill(self,"basicNew",{},$globals.Behavior)});
  14559. },
  14560. args: [],
  14561. source: "basicNew\x0a\x09<inlineJS: 'return new self.fn()'>",
  14562. referencedClasses: [],
  14563. messageSends: []
  14564. }),
  14565. $globals.Behavior);
  14566. $core.addMethod(
  14567. $core.method({
  14568. selector: "basicOrganization",
  14569. protocol: "accessing",
  14570. fn: function (){
  14571. var self=this,$self=this;
  14572. return $self["@organization"];
  14573. },
  14574. args: [],
  14575. source: "basicOrganization\x0a\x09^ organization",
  14576. referencedClasses: [],
  14577. messageSends: []
  14578. }),
  14579. $globals.Behavior);
  14580. $core.addMethod(
  14581. $core.method({
  14582. selector: "basicOrganization:",
  14583. protocol: "accessing",
  14584. fn: function (aClassOrganizer){
  14585. var self=this,$self=this;
  14586. $self["@organization"]=aClassOrganizer;
  14587. return self;
  14588. },
  14589. args: ["aClassOrganizer"],
  14590. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  14591. referencedClasses: [],
  14592. messageSends: []
  14593. }),
  14594. $globals.Behavior);
  14595. $core.addMethod(
  14596. $core.method({
  14597. selector: "canUnderstand:",
  14598. protocol: "testing",
  14599. fn: function (aSelector){
  14600. var self=this,$self=this;
  14601. return $core.withContext(function($ctx1) {
  14602. var $2,$1;
  14603. return $recv($self._includesSelector_($recv(aSelector)._asString()))._or_((function(){
  14604. return $core.withContext(function($ctx2) {
  14605. $2=$self._superclass();
  14606. $ctx2.sendIdx["superclass"]=1;
  14607. $1=$recv($2)._notNil();
  14608. return $recv($1)._and_((function(){
  14609. return $core.withContext(function($ctx3) {
  14610. return $recv($self._superclass())._canUnderstand_(aSelector);
  14611. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  14612. }));
  14613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14614. }));
  14615. }, function($ctx1) {$ctx1.fill(self,"canUnderstand:",{aSelector:aSelector},$globals.Behavior)});
  14616. },
  14617. args: ["aSelector"],
  14618. source: "canUnderstand: aSelector\x0a\x09^ (self includesSelector: aSelector asString) or: [\x0a\x09\x09self superclass notNil and: [ self superclass canUnderstand: aSelector ]]",
  14619. referencedClasses: [],
  14620. messageSends: ["or:", "includesSelector:", "asString", "and:", "notNil", "superclass", "canUnderstand:"]
  14621. }),
  14622. $globals.Behavior);
  14623. $core.addMethod(
  14624. $core.method({
  14625. selector: "includesBehavior:",
  14626. protocol: "testing",
  14627. fn: function (aClass){
  14628. var self=this,$self=this;
  14629. return $core.withContext(function($ctx1) {
  14630. return $recv($self.__eq_eq(aClass))._or_((function(){
  14631. return $core.withContext(function($ctx2) {
  14632. return $self._inheritsFrom_(aClass);
  14633. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14634. }));
  14635. }, function($ctx1) {$ctx1.fill(self,"includesBehavior:",{aClass:aClass},$globals.Behavior)});
  14636. },
  14637. args: ["aClass"],
  14638. source: "includesBehavior: aClass\x0a\x09^ self == aClass or: [\x0a\x09\x09\x09self inheritsFrom: aClass ]",
  14639. referencedClasses: [],
  14640. messageSends: ["or:", "==", "inheritsFrom:"]
  14641. }),
  14642. $globals.Behavior);
  14643. $core.addMethod(
  14644. $core.method({
  14645. selector: "inheritsFrom:",
  14646. protocol: "testing",
  14647. fn: function (aClass){
  14648. var self=this,$self=this;
  14649. return $core.withContext(function($ctx1) {
  14650. var $1,$3,$2,$receiver;
  14651. $1=$self._superclass();
  14652. $ctx1.sendIdx["superclass"]=1;
  14653. if(($receiver = $1) == null || $receiver.a$nil){
  14654. return false;
  14655. } else {
  14656. $1;
  14657. }
  14658. $3=$self._superclass();
  14659. $ctx1.sendIdx["superclass"]=2;
  14660. $2=$recv(aClass).__eq_eq($3);
  14661. return $recv($2)._or_((function(){
  14662. return $core.withContext(function($ctx2) {
  14663. return $recv($self._superclass())._inheritsFrom_(aClass);
  14664. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14665. }));
  14666. }, function($ctx1) {$ctx1.fill(self,"inheritsFrom:",{aClass:aClass},$globals.Behavior)});
  14667. },
  14668. args: ["aClass"],
  14669. source: "inheritsFrom: aClass\x0a\x09self superclass ifNil: [ ^ false ].\x0a\x0a\x09^ aClass == self superclass or: [ \x0a\x09\x09self superclass inheritsFrom: aClass ]",
  14670. referencedClasses: [],
  14671. messageSends: ["ifNil:", "superclass", "or:", "==", "inheritsFrom:"]
  14672. }),
  14673. $globals.Behavior);
  14674. $core.addMethod(
  14675. $core.method({
  14676. selector: "instanceVariableNames",
  14677. protocol: "accessing",
  14678. fn: function (){
  14679. var self=this,$self=this;
  14680. return $core.withContext(function($ctx1) {
  14681. return self.iVarNames;
  14682. return self;
  14683. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames",{},$globals.Behavior)});
  14684. },
  14685. args: [],
  14686. source: "instanceVariableNames\x0a\x09<inlineJS: 'return self.iVarNames'>",
  14687. referencedClasses: [],
  14688. messageSends: []
  14689. }),
  14690. $globals.Behavior);
  14691. $core.addMethod(
  14692. $core.method({
  14693. selector: "isBehavior",
  14694. protocol: "testing",
  14695. fn: function (){
  14696. var self=this,$self=this;
  14697. return true;
  14698. },
  14699. args: [],
  14700. source: "isBehavior\x0a\x09^ true",
  14701. referencedClasses: [],
  14702. messageSends: []
  14703. }),
  14704. $globals.Behavior);
  14705. $core.addMethod(
  14706. $core.method({
  14707. selector: "javascriptConstructor",
  14708. protocol: "accessing",
  14709. fn: function (){
  14710. var self=this,$self=this;
  14711. return $core.withContext(function($ctx1) {
  14712. return self.fn;
  14713. return self;
  14714. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor",{},$globals.Behavior)});
  14715. },
  14716. args: [],
  14717. source: "javascriptConstructor\x0a\x09\x22Answer the JS constructor used to instantiate. See boot.js\x22\x0a\x09\x0a\x09<inlineJS: 'return self.fn'>",
  14718. referencedClasses: [],
  14719. messageSends: []
  14720. }),
  14721. $globals.Behavior);
  14722. $core.addMethod(
  14723. $core.method({
  14724. selector: "javascriptConstructor:",
  14725. protocol: "accessing",
  14726. fn: function (aJavaScriptFunction){
  14727. var self=this,$self=this;
  14728. return $core.withContext(function($ctx1) {
  14729. $core.setClassConstructor(self, aJavaScriptFunction);;
  14730. return self;
  14731. }, function($ctx1) {$ctx1.fill(self,"javascriptConstructor:",{aJavaScriptFunction:aJavaScriptFunction},$globals.Behavior)});
  14732. },
  14733. args: ["aJavaScriptFunction"],
  14734. 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);'>",
  14735. referencedClasses: [],
  14736. messageSends: []
  14737. }),
  14738. $globals.Behavior);
  14739. $core.addMethod(
  14740. $core.method({
  14741. selector: "lookupSelector:",
  14742. protocol: "accessing",
  14743. fn: function (selector){
  14744. var self=this,$self=this;
  14745. var lookupClass;
  14746. return $core.withContext(function($ctx1) {
  14747. var $1;
  14748. var $early={};
  14749. try {
  14750. lookupClass=self;
  14751. $recv((function(){
  14752. return $core.withContext(function($ctx2) {
  14753. return $recv(lookupClass).__eq(nil);
  14754. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  14755. }))._whileFalse_((function(){
  14756. return $core.withContext(function($ctx2) {
  14757. $1=$recv(lookupClass)._includesSelector_(selector);
  14758. if($core.assert($1)){
  14759. throw $early=[$recv(lookupClass)._methodAt_(selector)];
  14760. }
  14761. lookupClass=$recv(lookupClass)._superclass();
  14762. return lookupClass;
  14763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  14764. }));
  14765. return nil;
  14766. }
  14767. catch(e) {if(e===$early)return e[0]; throw e}
  14768. }, function($ctx1) {$ctx1.fill(self,"lookupSelector:",{selector:selector,lookupClass:lookupClass},$globals.Behavior)});
  14769. },
  14770. args: ["selector"],
  14771. 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",
  14772. referencedClasses: [],
  14773. messageSends: ["whileFalse:", "=", "ifTrue:", "includesSelector:", "methodAt:", "superclass"]
  14774. }),
  14775. $globals.Behavior);
  14776. $core.addMethod(
  14777. $core.method({
  14778. selector: "new",
  14779. protocol: "instance creation",
  14780. fn: function (){
  14781. var self=this,$self=this;
  14782. return $core.withContext(function($ctx1) {
  14783. return $recv($self._basicNew())._initialize();
  14784. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Behavior)});
  14785. },
  14786. args: [],
  14787. source: "new\x0a\x09^ self basicNew initialize",
  14788. referencedClasses: [],
  14789. messageSends: ["initialize", "basicNew"]
  14790. }),
  14791. $globals.Behavior);
  14792. $core.addMethod(
  14793. $core.method({
  14794. selector: "prototype",
  14795. protocol: "accessing",
  14796. fn: function (){
  14797. var self=this,$self=this;
  14798. return $core.withContext(function($ctx1) {
  14799. return self.fn.prototype;
  14800. return self;
  14801. }, function($ctx1) {$ctx1.fill(self,"prototype",{},$globals.Behavior)});
  14802. },
  14803. args: [],
  14804. source: "prototype\x0a\x09<inlineJS: 'return self.fn.prototype'>",
  14805. referencedClasses: [],
  14806. messageSends: []
  14807. }),
  14808. $globals.Behavior);
  14809. $core.addMethod(
  14810. $core.method({
  14811. selector: "subclasses",
  14812. protocol: "accessing",
  14813. fn: function (){
  14814. var self=this,$self=this;
  14815. return $core.withContext(function($ctx1) {
  14816. $self._subclassResponsibility();
  14817. return self;
  14818. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Behavior)});
  14819. },
  14820. args: [],
  14821. source: "subclasses\x0a\x09self subclassResponsibility",
  14822. referencedClasses: [],
  14823. messageSends: ["subclassResponsibility"]
  14824. }),
  14825. $globals.Behavior);
  14826. $core.addMethod(
  14827. $core.method({
  14828. selector: "superclass",
  14829. protocol: "accessing",
  14830. fn: function (){
  14831. var self=this,$self=this;
  14832. return $core.withContext(function($ctx1) {
  14833. return self.superclass;
  14834. return self;
  14835. }, function($ctx1) {$ctx1.fill(self,"superclass",{},$globals.Behavior)});
  14836. },
  14837. args: [],
  14838. source: "superclass\x0a\x09<inlineJS: 'return self.superclass'>",
  14839. referencedClasses: [],
  14840. messageSends: []
  14841. }),
  14842. $globals.Behavior);
  14843. $core.addMethod(
  14844. $core.method({
  14845. selector: "theMetaClass",
  14846. protocol: "accessing",
  14847. fn: function (){
  14848. var self=this,$self=this;
  14849. return $core.withContext(function($ctx1) {
  14850. $self._subclassResponsibility();
  14851. return self;
  14852. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Behavior)});
  14853. },
  14854. args: [],
  14855. source: "theMetaClass\x0a\x09self subclassResponsibility",
  14856. referencedClasses: [],
  14857. messageSends: ["subclassResponsibility"]
  14858. }),
  14859. $globals.Behavior);
  14860. $core.addMethod(
  14861. $core.method({
  14862. selector: "theNonMetaClass",
  14863. protocol: "accessing",
  14864. fn: function (){
  14865. var self=this,$self=this;
  14866. return $core.withContext(function($ctx1) {
  14867. $self._subclassResponsibility();
  14868. return self;
  14869. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Behavior)});
  14870. },
  14871. args: [],
  14872. source: "theNonMetaClass\x0a\x09self subclassResponsibility",
  14873. referencedClasses: [],
  14874. messageSends: ["subclassResponsibility"]
  14875. }),
  14876. $globals.Behavior);
  14877. $core.addMethod(
  14878. $core.method({
  14879. selector: "withAllSubclasses",
  14880. protocol: "accessing",
  14881. fn: function (){
  14882. var self=this,$self=this;
  14883. return $core.withContext(function($ctx1) {
  14884. var $1;
  14885. $1=$recv($globals.Array)._with_(self);
  14886. $recv($1)._addAll_($self._allSubclasses());
  14887. return $recv($1)._yourself();
  14888. }, function($ctx1) {$ctx1.fill(self,"withAllSubclasses",{},$globals.Behavior)});
  14889. },
  14890. args: [],
  14891. source: "withAllSubclasses\x0a\x09^ (Array with: self) addAll: self allSubclasses; yourself",
  14892. referencedClasses: ["Array"],
  14893. messageSends: ["addAll:", "with:", "allSubclasses", "yourself"]
  14894. }),
  14895. $globals.Behavior);
  14896. $core.addClass("Class", $globals.Behavior, ["package"], "Kernel-Classes");
  14897. $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.";
  14898. $core.addMethod(
  14899. $core.method({
  14900. selector: "basicPackage:",
  14901. protocol: "accessing",
  14902. fn: function (aPackage){
  14903. var self=this,$self=this;
  14904. $self["@package"]=aPackage;
  14905. return self;
  14906. },
  14907. args: ["aPackage"],
  14908. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  14909. referencedClasses: [],
  14910. messageSends: []
  14911. }),
  14912. $globals.Class);
  14913. $core.addMethod(
  14914. $core.method({
  14915. selector: "classTag",
  14916. protocol: "accessing",
  14917. fn: function (){
  14918. var self=this,$self=this;
  14919. return "class";
  14920. },
  14921. args: [],
  14922. 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'",
  14923. referencedClasses: [],
  14924. messageSends: []
  14925. }),
  14926. $globals.Class);
  14927. $core.addMethod(
  14928. $core.method({
  14929. selector: "definition",
  14930. protocol: "accessing",
  14931. fn: function (){
  14932. var self=this,$self=this;
  14933. return $core.withContext(function($ctx1) {
  14934. var $1,$2;
  14935. return $recv($globals.String)._streamContents_((function(stream){
  14936. return $core.withContext(function($ctx2) {
  14937. $recv(stream)._print_($self._superclass());
  14938. $ctx2.sendIdx["print:"]=1;
  14939. $recv(stream)._write_(" subclass: ");
  14940. $ctx2.sendIdx["write:"]=1;
  14941. $recv(stream)._printSymbol_($self._name());
  14942. $recv(stream)._lf();
  14943. $ctx2.sendIdx["lf"]=1;
  14944. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  14945. return $core.withContext(function($ctx3) {
  14946. $1=$recv($globals.String)._tab();
  14947. $ctx3.sendIdx["tab"]=1;
  14948. $2=$recv($globals.String)._lf();
  14949. $ctx3.sendIdx["lf"]=2;
  14950. return [$1,"uses: ",tcd,$2];
  14951. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  14952. })));
  14953. $ctx2.sendIdx["write:"]=2;
  14954. $recv(stream)._tab();
  14955. $ctx2.sendIdx["tab"]=2;
  14956. $recv(stream)._write_("instanceVariableNames: ");
  14957. $ctx2.sendIdx["write:"]=3;
  14958. $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  14959. $ctx2.sendIdx["print:"]=2;
  14960. $recv(stream)._lf();
  14961. $recv(stream)._tab();
  14962. $recv(stream)._write_("package: ");
  14963. return $recv(stream)._print_($self._category());
  14964. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  14965. }));
  14966. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Class)});
  14967. },
  14968. args: [],
  14969. 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 ]",
  14970. referencedClasses: ["String"],
  14971. messageSends: ["streamContents:", "print:", "superclass", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "join:", "instanceVariableNames", "category"]
  14972. }),
  14973. $globals.Class);
  14974. $core.addMethod(
  14975. $core.method({
  14976. selector: "isClass",
  14977. protocol: "testing",
  14978. fn: function (){
  14979. var self=this,$self=this;
  14980. return true;
  14981. },
  14982. args: [],
  14983. source: "isClass\x0a\x09^ true",
  14984. referencedClasses: [],
  14985. messageSends: []
  14986. }),
  14987. $globals.Class);
  14988. $core.addMethod(
  14989. $core.method({
  14990. selector: "package",
  14991. protocol: "accessing",
  14992. fn: function (){
  14993. var self=this,$self=this;
  14994. return $self["@package"];
  14995. },
  14996. args: [],
  14997. source: "package\x0a\x09^ package",
  14998. referencedClasses: [],
  14999. messageSends: []
  15000. }),
  15001. $globals.Class);
  15002. $core.addMethod(
  15003. $core.method({
  15004. selector: "rename:",
  15005. protocol: "accessing",
  15006. fn: function (aString){
  15007. var self=this,$self=this;
  15008. return $core.withContext(function($ctx1) {
  15009. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  15010. return self;
  15011. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  15012. },
  15013. args: ["aString"],
  15014. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  15015. referencedClasses: ["ClassBuilder"],
  15016. messageSends: ["renameClass:to:", "new"]
  15017. }),
  15018. $globals.Class);
  15019. $core.addMethod(
  15020. $core.method({
  15021. selector: "subclasses",
  15022. protocol: "accessing",
  15023. fn: function (){
  15024. var self=this,$self=this;
  15025. return $core.withContext(function($ctx1) {
  15026. return self.subclasses._copy();
  15027. return self;
  15028. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  15029. },
  15030. args: [],
  15031. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  15032. referencedClasses: [],
  15033. messageSends: []
  15034. }),
  15035. $globals.Class);
  15036. $core.addMethod(
  15037. $core.method({
  15038. selector: "theMetaClass",
  15039. protocol: "accessing",
  15040. fn: function (){
  15041. var self=this,$self=this;
  15042. return $core.withContext(function($ctx1) {
  15043. return $self._class();
  15044. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  15045. },
  15046. args: [],
  15047. source: "theMetaClass\x0a\x09^ self class",
  15048. referencedClasses: [],
  15049. messageSends: ["class"]
  15050. }),
  15051. $globals.Class);
  15052. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  15053. $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.";
  15054. $core.addMethod(
  15055. $core.method({
  15056. selector: "asJavaScriptSource",
  15057. protocol: "converting",
  15058. fn: function (){
  15059. var self=this,$self=this;
  15060. return $core.withContext(function($ctx1) {
  15061. var $1;
  15062. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  15063. $ctx1.sendIdx[","]=1;
  15064. return $1;
  15065. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  15066. },
  15067. args: [],
  15068. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15069. referencedClasses: [],
  15070. messageSends: [",", "name", "instanceClass"]
  15071. }),
  15072. $globals.Metaclass);
  15073. $core.addMethod(
  15074. $core.method({
  15075. selector: "definition",
  15076. protocol: "accessing",
  15077. fn: function (){
  15078. var self=this,$self=this;
  15079. return $core.withContext(function($ctx1) {
  15080. var $1,$2;
  15081. return $recv($globals.String)._streamContents_((function(stream){
  15082. return $core.withContext(function($ctx2) {
  15083. $recv(stream)._print_(self);
  15084. $ctx2.sendIdx["print:"]=1;
  15085. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15086. return " ";
  15087. }),(function(tcd){
  15088. return $core.withContext(function($ctx3) {
  15089. $1=$recv($globals.String)._lf();
  15090. $ctx3.sendIdx["lf"]=1;
  15091. $2=$recv($globals.String)._tab();
  15092. $ctx3.sendIdx["tab"]=1;
  15093. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15094. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15095. })));
  15096. $ctx2.sendIdx["write:"]=1;
  15097. $recv(stream)._write_("instanceVariableNames: ");
  15098. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15099. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15100. }));
  15101. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  15102. },
  15103. args: [],
  15104. 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) ]",
  15105. referencedClasses: ["String"],
  15106. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  15107. }),
  15108. $globals.Metaclass);
  15109. $core.addMethod(
  15110. $core.method({
  15111. selector: "instanceClass",
  15112. protocol: "accessing",
  15113. fn: function (){
  15114. var self=this,$self=this;
  15115. return $core.withContext(function($ctx1) {
  15116. return self.instanceClass;
  15117. return self;
  15118. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  15119. },
  15120. args: [],
  15121. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15122. referencedClasses: [],
  15123. messageSends: []
  15124. }),
  15125. $globals.Metaclass);
  15126. $core.addMethod(
  15127. $core.method({
  15128. selector: "instanceVariableNames:",
  15129. protocol: "accessing",
  15130. fn: function (aCollection){
  15131. var self=this,$self=this;
  15132. return $core.withContext(function($ctx1) {
  15133. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15134. return self;
  15135. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15136. },
  15137. args: ["aCollection"],
  15138. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15139. referencedClasses: ["ClassBuilder"],
  15140. messageSends: ["class:instanceVariableNames:", "new"]
  15141. }),
  15142. $globals.Metaclass);
  15143. $core.addMethod(
  15144. $core.method({
  15145. selector: "isMetaclass",
  15146. protocol: "testing",
  15147. fn: function (){
  15148. var self=this,$self=this;
  15149. return true;
  15150. },
  15151. args: [],
  15152. source: "isMetaclass\x0a\x09^ true",
  15153. referencedClasses: [],
  15154. messageSends: []
  15155. }),
  15156. $globals.Metaclass);
  15157. $core.addMethod(
  15158. $core.method({
  15159. selector: "name",
  15160. protocol: "accessing",
  15161. fn: function (){
  15162. var self=this,$self=this;
  15163. return $core.withContext(function($ctx1) {
  15164. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15165. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15166. },
  15167. args: [],
  15168. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15169. referencedClasses: [],
  15170. messageSends: [",", "name", "instanceClass"]
  15171. }),
  15172. $globals.Metaclass);
  15173. $core.addMethod(
  15174. $core.method({
  15175. selector: "package",
  15176. protocol: "accessing",
  15177. fn: function (){
  15178. var self=this,$self=this;
  15179. return $core.withContext(function($ctx1) {
  15180. return $recv($self._instanceClass())._package();
  15181. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15182. },
  15183. args: [],
  15184. source: "package\x0a\x09^ self instanceClass package",
  15185. referencedClasses: [],
  15186. messageSends: ["package", "instanceClass"]
  15187. }),
  15188. $globals.Metaclass);
  15189. $core.addMethod(
  15190. $core.method({
  15191. selector: "subclasses",
  15192. protocol: "accessing",
  15193. fn: function (){
  15194. var self=this,$self=this;
  15195. return $core.withContext(function($ctx1) {
  15196. return $core.metaSubclasses(self);
  15197. return self;
  15198. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15199. },
  15200. args: [],
  15201. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15202. referencedClasses: [],
  15203. messageSends: []
  15204. }),
  15205. $globals.Metaclass);
  15206. $core.addMethod(
  15207. $core.method({
  15208. selector: "theMetaClass",
  15209. protocol: "accessing",
  15210. fn: function (){
  15211. var self=this,$self=this;
  15212. return self;
  15213. },
  15214. args: [],
  15215. source: "theMetaClass\x0a\x09^ self",
  15216. referencedClasses: [],
  15217. messageSends: []
  15218. }),
  15219. $globals.Metaclass);
  15220. $core.addMethod(
  15221. $core.method({
  15222. selector: "theNonMetaClass",
  15223. protocol: "accessing",
  15224. fn: function (){
  15225. var self=this,$self=this;
  15226. return $core.withContext(function($ctx1) {
  15227. return $self._instanceClass();
  15228. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15229. },
  15230. args: [],
  15231. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15232. referencedClasses: [],
  15233. messageSends: ["instanceClass"]
  15234. }),
  15235. $globals.Metaclass);
  15236. $core.addMethod(
  15237. $core.method({
  15238. selector: "uses:instanceVariableNames:",
  15239. protocol: "accessing",
  15240. fn: function (aTraitCompositionDescription,aCollection){
  15241. var self=this,$self=this;
  15242. var metaclass;
  15243. return $core.withContext(function($ctx1) {
  15244. metaclass=$self._instanceVariableNames_(aCollection);
  15245. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15246. return metaclass;
  15247. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15248. },
  15249. args: ["aTraitCompositionDescription", "aCollection"],
  15250. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15251. referencedClasses: [],
  15252. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15253. }),
  15254. $globals.Metaclass);
  15255. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15256. $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:`.";
  15257. $core.addMethod(
  15258. $core.method({
  15259. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15260. protocol: "class definition",
  15261. fn: function (aClass,className,aCollection,packageName){
  15262. var self=this,$self=this;
  15263. var theClass,thePackage;
  15264. return $core.withContext(function($ctx1) {
  15265. var $1,$2,$3,$receiver;
  15266. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15267. thePackage=$recv($globals.Package)._named_(packageName);
  15268. $1=theClass;
  15269. if(($receiver = $1) == null || $receiver.a$nil){
  15270. $1;
  15271. } else {
  15272. $recv(theClass)._package_(thePackage);
  15273. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15274. if(!$core.assert($2)){
  15275. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15276. }
  15277. }
  15278. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15279. $recv($3)._recompile();
  15280. return $recv($3)._yourself();
  15281. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15282. },
  15283. args: ["aClass", "className", "aCollection", "packageName"],
  15284. 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",
  15285. referencedClasses: ["Smalltalk", "Package"],
  15286. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15287. }),
  15288. $globals.ClassBuilder);
  15289. $core.addMethod(
  15290. $core.method({
  15291. selector: "addTraitNamed:package:",
  15292. protocol: "class definition",
  15293. fn: function (traitName,packageName){
  15294. var self=this,$self=this;
  15295. var theTrait,thePackage;
  15296. return $core.withContext(function($ctx1) {
  15297. var $1,$2,$receiver;
  15298. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15299. thePackage=$recv($globals.Package)._named_(packageName);
  15300. $1=theTrait;
  15301. if(($receiver = $1) == null || $receiver.a$nil){
  15302. $1;
  15303. } else {
  15304. $2=theTrait;
  15305. $recv($2)._package_(thePackage);
  15306. $recv($2)._recompile();
  15307. return $recv($2)._yourself();
  15308. }
  15309. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15310. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15311. },
  15312. args: ["traitName", "packageName"],
  15313. 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",
  15314. referencedClasses: ["Smalltalk", "Package"],
  15315. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15316. }),
  15317. $globals.ClassBuilder);
  15318. $core.addMethod(
  15319. $core.method({
  15320. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15321. protocol: "private",
  15322. fn: function (aClass,aString,aCollection,packageName){
  15323. var self=this,$self=this;
  15324. return $core.withContext(function($ctx1) {
  15325. return $core.addClass(aString, aClass, aCollection, packageName);
  15326. ;
  15327. return self;
  15328. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15329. },
  15330. args: ["aClass", "aString", "aCollection", "packageName"],
  15331. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15332. referencedClasses: [],
  15333. messageSends: []
  15334. }),
  15335. $globals.ClassBuilder);
  15336. $core.addMethod(
  15337. $core.method({
  15338. selector: "basicAddTraitNamed:package:",
  15339. protocol: "private",
  15340. fn: function (aString,anotherString){
  15341. var self=this,$self=this;
  15342. return $core.withContext(function($ctx1) {
  15343. return $core.addTrait(aString, anotherString);
  15344. return self;
  15345. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15346. },
  15347. args: ["aString", "anotherString"],
  15348. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15349. referencedClasses: [],
  15350. messageSends: []
  15351. }),
  15352. $globals.ClassBuilder);
  15353. $core.addMethod(
  15354. $core.method({
  15355. selector: "basicClass:instanceVariables:",
  15356. protocol: "private",
  15357. fn: function (aClass,aCollection){
  15358. var self=this,$self=this;
  15359. return $core.withContext(function($ctx1) {
  15360. var $1;
  15361. $1=$recv(aClass)._isMetaclass();
  15362. if(!$core.assert($1)){
  15363. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15364. }
  15365. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15366. return self;
  15367. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15368. },
  15369. args: ["aClass", "aCollection"],
  15370. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15371. referencedClasses: [],
  15372. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15373. }),
  15374. $globals.ClassBuilder);
  15375. $core.addMethod(
  15376. $core.method({
  15377. selector: "basicRemoveClass:",
  15378. protocol: "private",
  15379. fn: function (aClass){
  15380. var self=this,$self=this;
  15381. return $core.withContext(function($ctx1) {
  15382. $core.removeClass(aClass);
  15383. return self;
  15384. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15385. },
  15386. args: ["aClass"],
  15387. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15388. referencedClasses: [],
  15389. messageSends: []
  15390. }),
  15391. $globals.ClassBuilder);
  15392. $core.addMethod(
  15393. $core.method({
  15394. selector: "basicRenameClass:to:",
  15395. protocol: "private",
  15396. fn: function (aClass,aString){
  15397. var self=this,$self=this;
  15398. return $core.withContext(function($ctx1) {
  15399. $globals[aString] = aClass;
  15400. delete $globals[aClass.name];
  15401. aClass.name = aString;
  15402. ;
  15403. return self;
  15404. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15405. },
  15406. args: ["aClass", "aString"],
  15407. source: "basicRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09\x09delete $globals[aClass.name];\x0a\x09\x09aClass.name = aString;\x0a\x09'>",
  15408. referencedClasses: [],
  15409. messageSends: []
  15410. }),
  15411. $globals.ClassBuilder);
  15412. $core.addMethod(
  15413. $core.method({
  15414. selector: "basicSwapClassNames:with:",
  15415. protocol: "private",
  15416. fn: function (aClass,anotherClass){
  15417. var self=this,$self=this;
  15418. return $core.withContext(function($ctx1) {
  15419. var tmp = aClass.name;
  15420. aClass.name = anotherClass.name;
  15421. anotherClass.name = tmp;
  15422. ;
  15423. return self;
  15424. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15425. },
  15426. args: ["aClass", "anotherClass"],
  15427. source: "basicSwapClassNames: aClass with: anotherClass\x0a\x09<inlineJS: '\x0a\x09\x09var tmp = aClass.name;\x0a\x09\x09aClass.name = anotherClass.name;\x0a\x09\x09anotherClass.name = tmp;\x0a\x09'>",
  15428. referencedClasses: [],
  15429. messageSends: []
  15430. }),
  15431. $globals.ClassBuilder);
  15432. $core.addMethod(
  15433. $core.method({
  15434. selector: "class:instanceVariableNames:",
  15435. protocol: "class definition",
  15436. fn: function (aClass,ivarNames){
  15437. var self=this,$self=this;
  15438. return $core.withContext(function($ctx1) {
  15439. $self._class_instanceVariables_(aClass,$self._instanceVariableNamesFor_(ivarNames));
  15440. return self;
  15441. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15442. },
  15443. args: ["aClass", "ivarNames"],
  15444. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self class: aClass instanceVariables: (self instanceVariableNamesFor: ivarNames)",
  15445. referencedClasses: [],
  15446. messageSends: ["class:instanceVariables:", "instanceVariableNamesFor:"]
  15447. }),
  15448. $globals.ClassBuilder);
  15449. $core.addMethod(
  15450. $core.method({
  15451. selector: "class:instanceVariables:",
  15452. protocol: "class definition",
  15453. fn: function (aClass,aCollection){
  15454. var self=this,$self=this;
  15455. return $core.withContext(function($ctx1) {
  15456. var $1,$3,$2;
  15457. $self._basicClass_instanceVariables_(aClass,aCollection);
  15458. $1=$recv($globals.SystemAnnouncer)._current();
  15459. $3=$recv($globals.ClassDefinitionChanged)._new();
  15460. $recv($3)._theClass_(aClass);
  15461. $2=$recv($3)._yourself();
  15462. $recv($1)._announce_($2);
  15463. return self;
  15464. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15465. },
  15466. args: ["aClass", "aCollection"],
  15467. source: "class: aClass instanceVariables: aCollection\x0a\x09self basicClass: aClass instanceVariables: aCollection.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassDefinitionChanged new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  15468. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15469. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15470. }),
  15471. $globals.ClassBuilder);
  15472. $core.addMethod(
  15473. $core.method({
  15474. selector: "copyClass:named:",
  15475. protocol: "copying",
  15476. fn: function (aClass,className){
  15477. var self=this,$self=this;
  15478. var newClass;
  15479. return $core.withContext(function($ctx1) {
  15480. var $1,$3,$2;
  15481. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15482. $self._copyClass_to_(aClass,newClass);
  15483. $1=$recv($globals.SystemAnnouncer)._current();
  15484. $3=$recv($globals.ClassAdded)._new();
  15485. $recv($3)._theClass_(newClass);
  15486. $2=$recv($3)._yourself();
  15487. $recv($1)._announce_($2);
  15488. return newClass;
  15489. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15490. },
  15491. args: ["aClass", "className"],
  15492. 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",
  15493. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15494. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15495. }),
  15496. $globals.ClassBuilder);
  15497. $core.addMethod(
  15498. $core.method({
  15499. selector: "copyClass:to:",
  15500. protocol: "copying",
  15501. fn: function (aClass,anotherClass){
  15502. var self=this,$self=this;
  15503. return $core.withContext(function($ctx1) {
  15504. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15505. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15506. $1=$recv(aClass)._methodDictionary();
  15507. $ctx1.sendIdx["methodDictionary"]=1;
  15508. $recv($1)._valuesDo_((function(each){
  15509. return $core.withContext(function($ctx2) {
  15510. $3=$recv(each)._methodClass();
  15511. $ctx2.sendIdx["methodClass"]=1;
  15512. $2=$recv($3).__eq(aClass);
  15513. $ctx2.sendIdx["="]=1;
  15514. if($core.assert($2)){
  15515. $4=$recv($globals.Compiler)._new();
  15516. $ctx2.sendIdx["new"]=1;
  15517. $5=$recv(each)._source();
  15518. $ctx2.sendIdx["source"]=1;
  15519. $6=$recv(each)._protocol();
  15520. $ctx2.sendIdx["protocol"]=1;
  15521. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15522. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15523. }
  15524. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15525. }));
  15526. $ctx1.sendIdx["valuesDo:"]=1;
  15527. $7=$recv(aClass)._traitComposition();
  15528. $ctx1.sendIdx["traitComposition"]=1;
  15529. $recv(anotherClass)._setTraitComposition_($7);
  15530. $ctx1.sendIdx["setTraitComposition:"]=1;
  15531. $8=$recv(anotherClass)._class();
  15532. $ctx1.sendIdx["class"]=1;
  15533. $10=$recv(aClass)._class();
  15534. $ctx1.sendIdx["class"]=2;
  15535. $9=$recv($10)._instanceVariableNames();
  15536. $self._basicClass_instanceVariables_($8,$9);
  15537. $12=$recv(aClass)._class();
  15538. $ctx1.sendIdx["class"]=3;
  15539. $11=$recv($12)._methodDictionary();
  15540. $recv($11)._valuesDo_((function(each){
  15541. return $core.withContext(function($ctx2) {
  15542. $14=$recv(each)._methodClass();
  15543. $15=$recv(aClass)._class();
  15544. $ctx2.sendIdx["class"]=4;
  15545. $13=$recv($14).__eq($15);
  15546. if($core.assert($13)){
  15547. $16=$recv($globals.Compiler)._new();
  15548. $17=$recv(each)._source();
  15549. $18=$recv(anotherClass)._class();
  15550. $ctx2.sendIdx["class"]=5;
  15551. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15552. }
  15553. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15554. }));
  15555. $19=$recv(anotherClass)._class();
  15556. $ctx1.sendIdx["class"]=6;
  15557. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15558. return self;
  15559. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15560. },
  15561. args: ["aClass", "anotherClass"],
  15562. 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",
  15563. referencedClasses: ["Compiler"],
  15564. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15565. }),
  15566. $globals.ClassBuilder);
  15567. $core.addMethod(
  15568. $core.method({
  15569. selector: "installMethod:forClass:protocol:",
  15570. protocol: "method definition",
  15571. fn: function (aCompiledMethod,aBehavior,aString){
  15572. var self=this,$self=this;
  15573. return $core.withContext(function($ctx1) {
  15574. $recv(aCompiledMethod)._protocol_(aString);
  15575. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15576. return aCompiledMethod;
  15577. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15578. },
  15579. args: ["aCompiledMethod", "aBehavior", "aString"],
  15580. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15581. referencedClasses: [],
  15582. messageSends: ["protocol:", "addCompiledMethod:"]
  15583. }),
  15584. $globals.ClassBuilder);
  15585. $core.addMethod(
  15586. $core.method({
  15587. selector: "instanceVariableNamesFor:",
  15588. protocol: "accessing",
  15589. fn: function (aString){
  15590. var self=this,$self=this;
  15591. return $core.withContext(function($ctx1) {
  15592. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15593. return $core.withContext(function($ctx2) {
  15594. return $recv(each)._isEmpty();
  15595. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15596. }));
  15597. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15598. },
  15599. args: ["aString"],
  15600. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15601. referencedClasses: [],
  15602. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15603. }),
  15604. $globals.ClassBuilder);
  15605. $core.addMethod(
  15606. $core.method({
  15607. selector: "migrateClass:superclass:",
  15608. protocol: "class migration",
  15609. fn: function (aClass,anotherClass){
  15610. var self=this,$self=this;
  15611. return $core.withContext(function($ctx1) {
  15612. var $1;
  15613. $1=$recv(aClass)._name();
  15614. $ctx1.sendIdx["name"]=1;
  15615. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15616. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15617. },
  15618. args: ["aClass", "anotherClass"],
  15619. 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",
  15620. referencedClasses: [],
  15621. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15622. }),
  15623. $globals.ClassBuilder);
  15624. $core.addMethod(
  15625. $core.method({
  15626. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15627. protocol: "class migration",
  15628. fn: function (className,aClass,aCollection,packageName){
  15629. var self=this,$self=this;
  15630. var oldClass,newClass,tmp;
  15631. return $core.withContext(function($ctx1) {
  15632. var $1,$2,$4,$3;
  15633. tmp="new*".__comma(className);
  15634. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15635. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15636. $self._basicSwapClassNames_with_(oldClass,newClass);
  15637. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15638. $recv((function(){
  15639. return $core.withContext(function($ctx2) {
  15640. return $self._copyClass_to_(oldClass,newClass);
  15641. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15642. }))._on_do_($globals.Error,(function(exception){
  15643. return $core.withContext(function($ctx2) {
  15644. $self._basicSwapClassNames_with_(oldClass,newClass);
  15645. $1=$self._basicRemoveClass_(newClass);
  15646. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15647. return $recv(exception)._pass();
  15648. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15649. }));
  15650. $self._rawRenameClass_to_(oldClass,tmp);
  15651. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15652. $self._rawRenameClass_to_(newClass,className);
  15653. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15654. return $core.withContext(function($ctx2) {
  15655. return $self._migrateClass_superclass_(each,newClass);
  15656. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15657. }));
  15658. $self._basicRemoveClass_(oldClass);
  15659. $2=$recv($globals.SystemAnnouncer)._current();
  15660. $4=$recv($globals.ClassMigrated)._new();
  15661. $recv($4)._theClass_(newClass);
  15662. $recv($4)._oldClass_(oldClass);
  15663. $3=$recv($4)._yourself();
  15664. $recv($2)._announce_($3);
  15665. return newClass;
  15666. }, 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)});
  15667. },
  15668. args: ["className", "aClass", "aCollection", "packageName"],
  15669. 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 pass ].\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",
  15670. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15671. messageSends: [",", "at:", "globals", "addSubclassOf:named:instanceVariableNames:package:", "basicSwapClassNames:with:", "on:do:", "copyClass:to:", "basicRemoveClass:", "pass", "rawRenameClass:to:", "do:", "subclasses", "migrateClass:superclass:", "announce:", "current", "theClass:", "new", "oldClass:", "yourself"]
  15672. }),
  15673. $globals.ClassBuilder);
  15674. $core.addMethod(
  15675. $core.method({
  15676. selector: "rawRenameClass:to:",
  15677. protocol: "private",
  15678. fn: function (aClass,aString){
  15679. var self=this,$self=this;
  15680. return $core.withContext(function($ctx1) {
  15681. $globals[aString] = aClass;
  15682. ;
  15683. return self;
  15684. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15685. },
  15686. args: ["aClass", "aString"],
  15687. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15688. referencedClasses: [],
  15689. messageSends: []
  15690. }),
  15691. $globals.ClassBuilder);
  15692. $core.addMethod(
  15693. $core.method({
  15694. selector: "renameClass:to:",
  15695. protocol: "class migration",
  15696. fn: function (aClass,className){
  15697. var self=this,$self=this;
  15698. return $core.withContext(function($ctx1) {
  15699. var $1,$3,$2;
  15700. $self._basicRenameClass_to_(aClass,className);
  15701. $recv(aClass)._recompile();
  15702. $1=$recv($globals.SystemAnnouncer)._current();
  15703. $3=$recv($globals.ClassRenamed)._new();
  15704. $recv($3)._theClass_(aClass);
  15705. $2=$recv($3)._yourself();
  15706. $recv($1)._announce_($2);
  15707. return self;
  15708. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15709. },
  15710. args: ["aClass", "className"],
  15711. 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)",
  15712. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15713. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15714. }),
  15715. $globals.ClassBuilder);
  15716. $core.addMethod(
  15717. $core.method({
  15718. selector: "superclass:subclass:",
  15719. protocol: "class definition",
  15720. fn: function (aClass,className){
  15721. var self=this,$self=this;
  15722. return $core.withContext(function($ctx1) {
  15723. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15724. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15725. },
  15726. args: ["aClass", "className"],
  15727. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15728. referencedClasses: [],
  15729. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15730. }),
  15731. $globals.ClassBuilder);
  15732. $core.addMethod(
  15733. $core.method({
  15734. selector: "superclass:subclass:instanceVariableNames:package:",
  15735. protocol: "class definition",
  15736. fn: function (aClass,className,ivarNames,packageName){
  15737. var self=this,$self=this;
  15738. var newClass;
  15739. return $core.withContext(function($ctx1) {
  15740. var $1,$2,$3,$5,$4,$receiver;
  15741. $1=$self._instanceVariableNamesFor_(ivarNames);
  15742. if(($receiver = packageName) == null || $receiver.a$nil){
  15743. $2="unclassified";
  15744. } else {
  15745. $2=packageName;
  15746. }
  15747. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15748. $3=$recv($globals.SystemAnnouncer)._current();
  15749. $5=$recv($globals.ClassAdded)._new();
  15750. $recv($5)._theClass_(newClass);
  15751. $4=$recv($5)._yourself();
  15752. $recv($3)._announce_($4);
  15753. return newClass;
  15754. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15755. },
  15756. args: ["aClass", "className", "ivarNames", "packageName"],
  15757. 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",
  15758. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15759. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15760. }),
  15761. $globals.ClassBuilder);
  15762. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15763. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15764. $core.addMethod(
  15765. $core.method({
  15766. selector: "getNodesFrom:",
  15767. protocol: "accessing",
  15768. fn: function (aCollection){
  15769. var self=this,$self=this;
  15770. var children,others;
  15771. return $core.withContext(function($ctx1) {
  15772. var $1;
  15773. children=[];
  15774. others=[];
  15775. $recv(aCollection)._do_((function(each){
  15776. return $core.withContext(function($ctx2) {
  15777. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15778. if($core.assert($1)){
  15779. return $recv(children)._add_(each);
  15780. $ctx2.sendIdx["add:"]=1;
  15781. } else {
  15782. return $recv(others)._add_(each);
  15783. }
  15784. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15785. }));
  15786. $self["@nodes"]=$recv(children)._collect_((function(each){
  15787. return $core.withContext(function($ctx2) {
  15788. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15789. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15790. }));
  15791. return self;
  15792. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15793. },
  15794. args: ["aCollection"],
  15795. 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 ]",
  15796. referencedClasses: ["ClassSorterNode"],
  15797. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15798. }),
  15799. $globals.ClassSorterNode);
  15800. $core.addMethod(
  15801. $core.method({
  15802. selector: "level",
  15803. protocol: "accessing",
  15804. fn: function (){
  15805. var self=this,$self=this;
  15806. return $self["@level"];
  15807. },
  15808. args: [],
  15809. source: "level\x0a\x09^ level",
  15810. referencedClasses: [],
  15811. messageSends: []
  15812. }),
  15813. $globals.ClassSorterNode);
  15814. $core.addMethod(
  15815. $core.method({
  15816. selector: "level:",
  15817. protocol: "accessing",
  15818. fn: function (anInteger){
  15819. var self=this,$self=this;
  15820. $self["@level"]=anInteger;
  15821. return self;
  15822. },
  15823. args: ["anInteger"],
  15824. source: "level: anInteger\x0a\x09level := anInteger",
  15825. referencedClasses: [],
  15826. messageSends: []
  15827. }),
  15828. $globals.ClassSorterNode);
  15829. $core.addMethod(
  15830. $core.method({
  15831. selector: "nodes",
  15832. protocol: "accessing",
  15833. fn: function (){
  15834. var self=this,$self=this;
  15835. return $self["@nodes"];
  15836. },
  15837. args: [],
  15838. source: "nodes\x0a\x09^ nodes",
  15839. referencedClasses: [],
  15840. messageSends: []
  15841. }),
  15842. $globals.ClassSorterNode);
  15843. $core.addMethod(
  15844. $core.method({
  15845. selector: "theClass",
  15846. protocol: "accessing",
  15847. fn: function (){
  15848. var self=this,$self=this;
  15849. return $self["@theClass"];
  15850. },
  15851. args: [],
  15852. source: "theClass\x0a\x09^ theClass",
  15853. referencedClasses: [],
  15854. messageSends: []
  15855. }),
  15856. $globals.ClassSorterNode);
  15857. $core.addMethod(
  15858. $core.method({
  15859. selector: "theClass:",
  15860. protocol: "accessing",
  15861. fn: function (aClass){
  15862. var self=this,$self=this;
  15863. $self["@theClass"]=aClass;
  15864. return self;
  15865. },
  15866. args: ["aClass"],
  15867. source: "theClass: aClass\x0a\x09theClass := aClass",
  15868. referencedClasses: [],
  15869. messageSends: []
  15870. }),
  15871. $globals.ClassSorterNode);
  15872. $core.addMethod(
  15873. $core.method({
  15874. selector: "traverseClassesWith:",
  15875. protocol: "visiting",
  15876. fn: function (aCollection){
  15877. var self=this,$self=this;
  15878. return $core.withContext(function($ctx1) {
  15879. var $1,$3,$2;
  15880. $1=$self._theClass();
  15881. $ctx1.sendIdx["theClass"]=1;
  15882. $recv(aCollection)._add_($1);
  15883. $recv($recv($self._nodes())._sorted_((function(a,b){
  15884. return $core.withContext(function($ctx2) {
  15885. $3=$recv(a)._theClass();
  15886. $ctx2.sendIdx["theClass"]=2;
  15887. $2=$recv($3)._name();
  15888. $ctx2.sendIdx["name"]=1;
  15889. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15890. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15891. })))._do_((function(aNode){
  15892. return $core.withContext(function($ctx2) {
  15893. return $recv(aNode)._traverseClassesWith_(aCollection);
  15894. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15895. }));
  15896. return self;
  15897. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15898. },
  15899. args: ["aCollection"],
  15900. 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 ].",
  15901. referencedClasses: [],
  15902. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15903. }),
  15904. $globals.ClassSorterNode);
  15905. $core.addMethod(
  15906. $core.method({
  15907. selector: "on:classes:level:",
  15908. protocol: "instance creation",
  15909. fn: function (aClass,aCollection,anInteger){
  15910. var self=this,$self=this;
  15911. return $core.withContext(function($ctx1) {
  15912. var $1;
  15913. $1=$self._new();
  15914. $recv($1)._theClass_(aClass);
  15915. $recv($1)._level_(anInteger);
  15916. $recv($1)._getNodesFrom_(aCollection);
  15917. return $recv($1)._yourself();
  15918. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15919. },
  15920. args: ["aClass", "aCollection", "anInteger"],
  15921. 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",
  15922. referencedClasses: [],
  15923. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15924. }),
  15925. $globals.ClassSorterNode.a$cls);
  15926. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15927. $core.addMethod(
  15928. $core.method({
  15929. selector: "allInstanceVariableNames",
  15930. protocol: "accessing",
  15931. fn: function (){
  15932. var self=this,$self=this;
  15933. return [];
  15934. },
  15935. args: [],
  15936. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15937. referencedClasses: [],
  15938. messageSends: []
  15939. }),
  15940. $globals.TBehaviorDefaults);
  15941. $core.addMethod(
  15942. $core.method({
  15943. selector: "allSubclassesDo:",
  15944. protocol: "enumerating",
  15945. fn: function (aBlock){
  15946. var self=this,$self=this;
  15947. return self;
  15948. },
  15949. args: ["aBlock"],
  15950. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15951. referencedClasses: [],
  15952. messageSends: []
  15953. }),
  15954. $globals.TBehaviorDefaults);
  15955. $core.addMethod(
  15956. $core.method({
  15957. selector: "name",
  15958. protocol: "accessing",
  15959. fn: function (){
  15960. var self=this,$self=this;
  15961. return nil;
  15962. },
  15963. args: [],
  15964. source: "name\x0a\x09^ nil",
  15965. referencedClasses: [],
  15966. messageSends: []
  15967. }),
  15968. $globals.TBehaviorDefaults);
  15969. $core.addMethod(
  15970. $core.method({
  15971. selector: "printOn:",
  15972. protocol: "printing",
  15973. fn: function (aStream){
  15974. var self=this,$self=this;
  15975. return $core.withContext(function($ctx1) {
  15976. var $1,$receiver;
  15977. $1=$self._name();
  15978. if(($receiver = $1) == null || $receiver.a$nil){
  15979. (
  15980. $ctx1.supercall = true,
  15981. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15982. $ctx1.supercall = false;
  15983. } else {
  15984. var name;
  15985. name=$receiver;
  15986. $recv(aStream)._nextPutAll_(name);
  15987. }
  15988. return self;
  15989. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  15990. },
  15991. args: ["aStream"],
  15992. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  15993. referencedClasses: [],
  15994. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  15995. }),
  15996. $globals.TBehaviorDefaults);
  15997. $core.addMethod(
  15998. $core.method({
  15999. selector: "superclass",
  16000. protocol: "accessing",
  16001. fn: function (){
  16002. var self=this,$self=this;
  16003. return nil;
  16004. },
  16005. args: [],
  16006. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  16007. referencedClasses: [],
  16008. messageSends: []
  16009. }),
  16010. $globals.TBehaviorDefaults);
  16011. $core.addMethod(
  16012. $core.method({
  16013. selector: "traitUsers",
  16014. protocol: "accessing",
  16015. fn: function (){
  16016. var self=this,$self=this;
  16017. return [];
  16018. },
  16019. args: [],
  16020. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  16021. referencedClasses: [],
  16022. messageSends: []
  16023. }),
  16024. $globals.TBehaviorDefaults);
  16025. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  16026. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  16027. $core.addMethod(
  16028. $core.method({
  16029. selector: ">>",
  16030. protocol: "accessing",
  16031. fn: function (aString){
  16032. var self=this,$self=this;
  16033. return $core.withContext(function($ctx1) {
  16034. return $self._methodAt_(aString);
  16035. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  16036. },
  16037. args: ["aString"],
  16038. source: ">> aString\x0a\x09^ self methodAt: aString",
  16039. referencedClasses: [],
  16040. messageSends: ["methodAt:"]
  16041. }),
  16042. $globals.TBehaviorProvider);
  16043. $core.addMethod(
  16044. $core.method({
  16045. selector: "addCompiledMethod:",
  16046. protocol: "compiling",
  16047. fn: function (aMethod){
  16048. var self=this,$self=this;
  16049. var oldMethod,announcement;
  16050. return $core.withContext(function($ctx1) {
  16051. var $1,$2,$3,$4,$receiver;
  16052. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  16053. return nil;
  16054. }));
  16055. $self._basicAddCompiledMethod_(aMethod);
  16056. $1=oldMethod;
  16057. if(($receiver = $1) == null || $receiver.a$nil){
  16058. $2=$recv($globals.MethodAdded)._new();
  16059. $ctx1.sendIdx["new"]=1;
  16060. $recv($2)._method_(aMethod);
  16061. $ctx1.sendIdx["method:"]=1;
  16062. $3=$recv($2)._yourself();
  16063. $ctx1.sendIdx["yourself"]=1;
  16064. announcement=$3;
  16065. } else {
  16066. $4=$recv($globals.MethodModified)._new();
  16067. $recv($4)._oldMethod_(oldMethod);
  16068. $recv($4)._method_(aMethod);
  16069. announcement=$recv($4)._yourself();
  16070. }
  16071. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16072. return self;
  16073. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  16074. },
  16075. args: ["aMethod"],
  16076. 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\x09self basicAddCompiledMethod: aMethod.\x0a\x09\x0a\x09announcement := oldMethod\x0a\x09\x09ifNil: [\x0a\x09\x09\x09MethodAdded new\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ]\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09MethodModified new\x0a\x09\x09\x09\x09\x09oldMethod: oldMethod;\x0a\x09\x09\x09\x09\x09method: aMethod;\x0a\x09\x09\x09\x09\x09yourself ].\x0a\x09\x09\x09\x09\x09\x0a\x09\x09\x09\x09\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09\x09\x09announce: announcement",
  16077. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16078. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16079. }),
  16080. $globals.TBehaviorProvider);
  16081. $core.addMethod(
  16082. $core.method({
  16083. selector: "basicAddCompiledMethod:",
  16084. protocol: "private",
  16085. fn: function (aMethod){
  16086. var self=this,$self=this;
  16087. return $core.withContext(function($ctx1) {
  16088. $core.addMethod(aMethod, self);
  16089. return self;
  16090. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16091. },
  16092. args: ["aMethod"],
  16093. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16094. referencedClasses: [],
  16095. messageSends: []
  16096. }),
  16097. $globals.TBehaviorProvider);
  16098. $core.addMethod(
  16099. $core.method({
  16100. selector: "basicRemoveCompiledMethod:",
  16101. protocol: "private",
  16102. fn: function (aMethod){
  16103. var self=this,$self=this;
  16104. return $core.withContext(function($ctx1) {
  16105. $core.removeMethod(aMethod,self);
  16106. return self;
  16107. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16108. },
  16109. args: ["aMethod"],
  16110. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16111. referencedClasses: [],
  16112. messageSends: []
  16113. }),
  16114. $globals.TBehaviorProvider);
  16115. $core.addMethod(
  16116. $core.method({
  16117. selector: "compile:protocol:",
  16118. protocol: "compiling",
  16119. fn: function (aString,anotherString){
  16120. var self=this,$self=this;
  16121. return $core.withContext(function($ctx1) {
  16122. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16123. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16124. },
  16125. args: ["aString", "anotherString"],
  16126. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16127. referencedClasses: ["Compiler"],
  16128. messageSends: ["install:forClass:protocol:", "new"]
  16129. }),
  16130. $globals.TBehaviorProvider);
  16131. $core.addMethod(
  16132. $core.method({
  16133. selector: "includesSelector:",
  16134. protocol: "testing",
  16135. fn: function (aString){
  16136. var self=this,$self=this;
  16137. return $core.withContext(function($ctx1) {
  16138. return $recv($self._methodDictionary())._includesKey_(aString);
  16139. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16140. },
  16141. args: ["aString"],
  16142. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16143. referencedClasses: [],
  16144. messageSends: ["includesKey:", "methodDictionary"]
  16145. }),
  16146. $globals.TBehaviorProvider);
  16147. $core.addMethod(
  16148. $core.method({
  16149. selector: "methodAt:",
  16150. protocol: "accessing",
  16151. fn: function (aString){
  16152. var self=this,$self=this;
  16153. return $core.withContext(function($ctx1) {
  16154. return $recv($self._methodDictionary())._at_(aString);
  16155. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16156. },
  16157. args: ["aString"],
  16158. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16159. referencedClasses: [],
  16160. messageSends: ["at:", "methodDictionary"]
  16161. }),
  16162. $globals.TBehaviorProvider);
  16163. $core.addMethod(
  16164. $core.method({
  16165. selector: "methodDictionary",
  16166. protocol: "accessing",
  16167. fn: function (){
  16168. var self=this,$self=this;
  16169. return $core.withContext(function($ctx1) {
  16170. var dict = $globals.HashedCollection._new();
  16171. var methods = self.methods;
  16172. Object.keys(methods).forEach(function(i) {
  16173. if(methods[i].selector) {
  16174. dict._at_put_(methods[i].selector, methods[i]);
  16175. }
  16176. });
  16177. return dict;
  16178. return self;
  16179. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16180. },
  16181. args: [],
  16182. 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'>",
  16183. referencedClasses: [],
  16184. messageSends: []
  16185. }),
  16186. $globals.TBehaviorProvider);
  16187. $core.addMethod(
  16188. $core.method({
  16189. selector: "methodOrganizationEnter:andLeave:",
  16190. protocol: "accessing",
  16191. fn: function (aMethod,oldMethod){
  16192. var self=this,$self=this;
  16193. return $core.withContext(function($ctx1) {
  16194. var $1,$2,$receiver;
  16195. if(($receiver = aMethod) == null || $receiver.a$nil){
  16196. aMethod;
  16197. } else {
  16198. $1=$self._organization();
  16199. $2=$recv(aMethod)._protocol();
  16200. $ctx1.sendIdx["protocol"]=1;
  16201. $recv($1)._addElement_($2);
  16202. }
  16203. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16204. oldMethod;
  16205. } else {
  16206. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16207. }
  16208. return self;
  16209. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16210. },
  16211. args: ["aMethod", "oldMethod"],
  16212. source: "methodOrganizationEnter: aMethod andLeave: oldMethod\x0a\x09aMethod ifNotNil: [\x0a\x09\x09self organization addElement: aMethod protocol ].\x0a\x09\x0a\x09oldMethod ifNotNil: [\x0a\x09\x09self removeProtocolIfEmpty: oldMethod protocol ]",
  16213. referencedClasses: [],
  16214. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16215. }),
  16216. $globals.TBehaviorProvider);
  16217. $core.addMethod(
  16218. $core.method({
  16219. selector: "methodTemplate",
  16220. protocol: "accessing",
  16221. fn: function (){
  16222. var self=this,$self=this;
  16223. return $core.withContext(function($ctx1) {
  16224. return $recv($globals.String)._streamContents_((function(stream){
  16225. return $core.withContext(function($ctx2) {
  16226. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16227. $ctx2.sendIdx["write:"]=1;
  16228. $recv(stream)._lf();
  16229. $ctx2.sendIdx["lf"]=1;
  16230. $recv(stream)._tab();
  16231. $ctx2.sendIdx["tab"]=1;
  16232. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16233. $ctx2.sendIdx["write:"]=2;
  16234. $recv(stream)._lf();
  16235. $ctx2.sendIdx["lf"]=2;
  16236. $recv(stream)._lf();
  16237. $ctx2.sendIdx["lf"]=3;
  16238. $recv(stream)._tab();
  16239. $ctx2.sendIdx["tab"]=2;
  16240. $recv(stream)._write_("| temporary variable names |");
  16241. $ctx2.sendIdx["write:"]=3;
  16242. $recv(stream)._lf();
  16243. $recv(stream)._tab();
  16244. return $recv(stream)._write_("statements");
  16245. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16246. }));
  16247. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16248. },
  16249. args: [],
  16250. 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' ]",
  16251. referencedClasses: ["String"],
  16252. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16253. }),
  16254. $globals.TBehaviorProvider);
  16255. $core.addMethod(
  16256. $core.method({
  16257. selector: "methods",
  16258. protocol: "accessing",
  16259. fn: function (){
  16260. var self=this,$self=this;
  16261. return $core.withContext(function($ctx1) {
  16262. return $recv($self._methodDictionary())._values();
  16263. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16264. },
  16265. args: [],
  16266. source: "methods\x0a\x09^ self methodDictionary values",
  16267. referencedClasses: [],
  16268. messageSends: ["values", "methodDictionary"]
  16269. }),
  16270. $globals.TBehaviorProvider);
  16271. $core.addMethod(
  16272. $core.method({
  16273. selector: "methodsInProtocol:",
  16274. protocol: "accessing",
  16275. fn: function (aString){
  16276. var self=this,$self=this;
  16277. return $core.withContext(function($ctx1) {
  16278. return $recv($self._methods())._select_((function(each){
  16279. return $core.withContext(function($ctx2) {
  16280. return $recv($recv(each)._protocol()).__eq(aString);
  16281. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16282. }));
  16283. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16284. },
  16285. args: ["aString"],
  16286. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16287. referencedClasses: [],
  16288. messageSends: ["select:", "methods", "=", "protocol"]
  16289. }),
  16290. $globals.TBehaviorProvider);
  16291. $core.addMethod(
  16292. $core.method({
  16293. selector: "organization",
  16294. protocol: "accessing",
  16295. fn: function (){
  16296. var self=this,$self=this;
  16297. return $core.withContext(function($ctx1) {
  16298. var $1,$receiver;
  16299. $1=$self._basicOrganization();
  16300. $ctx1.sendIdx["basicOrganization"]=1;
  16301. if(($receiver = $1) == null || $receiver.a$nil){
  16302. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16303. return $self._basicOrganization();
  16304. } else {
  16305. return $1;
  16306. }
  16307. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16308. },
  16309. args: [],
  16310. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16311. referencedClasses: ["ClassOrganizer"],
  16312. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16313. }),
  16314. $globals.TBehaviorProvider);
  16315. $core.addMethod(
  16316. $core.method({
  16317. selector: "ownMethods",
  16318. protocol: "accessing",
  16319. fn: function (){
  16320. var self=this,$self=this;
  16321. return $core.withContext(function($ctx1) {
  16322. var $1;
  16323. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16324. return $core.withContext(function($ctx2) {
  16325. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16326. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16327. })))._sorted_((function(a,b){
  16328. return $core.withContext(function($ctx2) {
  16329. $1=$recv(a)._selector();
  16330. $ctx2.sendIdx["selector"]=1;
  16331. return $recv($1).__lt_eq($recv(b)._selector());
  16332. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16333. }));
  16334. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16335. },
  16336. args: [],
  16337. 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 ]",
  16338. referencedClasses: ["OrderedCollection"],
  16339. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16340. }),
  16341. $globals.TBehaviorProvider);
  16342. $core.addMethod(
  16343. $core.method({
  16344. selector: "ownMethodsInProtocol:",
  16345. protocol: "accessing",
  16346. fn: function (aString){
  16347. var self=this,$self=this;
  16348. return $core.withContext(function($ctx1) {
  16349. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16350. return $core.withContext(function($ctx2) {
  16351. return $recv($recv(each)._methodClass()).__eq(self);
  16352. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16353. }));
  16354. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16355. },
  16356. args: ["aString"],
  16357. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16358. referencedClasses: [],
  16359. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16360. }),
  16361. $globals.TBehaviorProvider);
  16362. $core.addMethod(
  16363. $core.method({
  16364. selector: "ownProtocols",
  16365. protocol: "accessing",
  16366. fn: function (){
  16367. var self=this,$self=this;
  16368. return $core.withContext(function($ctx1) {
  16369. return $recv($self._protocols())._reject_((function(each){
  16370. return $core.withContext(function($ctx2) {
  16371. return $recv(each)._match_("^\x5c*");
  16372. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16373. }));
  16374. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16375. },
  16376. args: [],
  16377. 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*' ]",
  16378. referencedClasses: [],
  16379. messageSends: ["reject:", "protocols", "match:"]
  16380. }),
  16381. $globals.TBehaviorProvider);
  16382. $core.addMethod(
  16383. $core.method({
  16384. selector: "packageOfProtocol:",
  16385. protocol: "accessing",
  16386. fn: function (aString){
  16387. var self=this,$self=this;
  16388. return $core.withContext(function($ctx1) {
  16389. var $1;
  16390. $1=$recv(aString)._beginsWith_("*");
  16391. if(!$core.assert($1)){
  16392. return $self._package();
  16393. }
  16394. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16395. return nil;
  16396. }));
  16397. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16398. },
  16399. args: ["aString"],
  16400. 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 ]",
  16401. referencedClasses: ["Package"],
  16402. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16403. }),
  16404. $globals.TBehaviorProvider);
  16405. $core.addMethod(
  16406. $core.method({
  16407. selector: "protocols",
  16408. protocol: "accessing",
  16409. fn: function (){
  16410. var self=this,$self=this;
  16411. return $core.withContext(function($ctx1) {
  16412. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16413. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16414. },
  16415. args: [],
  16416. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16417. referencedClasses: [],
  16418. messageSends: ["sorted", "asArray", "elements", "organization"]
  16419. }),
  16420. $globals.TBehaviorProvider);
  16421. $core.addMethod(
  16422. $core.method({
  16423. selector: "protocolsDo:",
  16424. protocol: "enumerating",
  16425. fn: function (aBlock){
  16426. var self=this,$self=this;
  16427. var methodsByProtocol;
  16428. return $core.withContext(function($ctx1) {
  16429. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16430. $ctx1.sendIdx["new"]=1;
  16431. $recv($self._methodDictionary())._valuesDo_((function(m){
  16432. return $core.withContext(function($ctx2) {
  16433. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16434. return $core.withContext(function($ctx3) {
  16435. return $recv($globals.Array)._new();
  16436. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16437. })))._add_(m);
  16438. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16439. }));
  16440. $recv($self._protocols())._do_((function(protocol){
  16441. return $core.withContext(function($ctx2) {
  16442. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16443. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16444. }));
  16445. return self;
  16446. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16447. },
  16448. args: ["aBlock"],
  16449. 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) ]",
  16450. referencedClasses: ["HashedCollection", "Array"],
  16451. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16452. }),
  16453. $globals.TBehaviorProvider);
  16454. $core.addMethod(
  16455. $core.method({
  16456. selector: "recompile",
  16457. protocol: "compiling",
  16458. fn: function (){
  16459. var self=this,$self=this;
  16460. return $core.withContext(function($ctx1) {
  16461. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16462. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16463. },
  16464. args: [],
  16465. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16466. referencedClasses: ["Compiler"],
  16467. messageSends: ["recompile:", "new"]
  16468. }),
  16469. $globals.TBehaviorProvider);
  16470. $core.addMethod(
  16471. $core.method({
  16472. selector: "removeCompiledMethod:",
  16473. protocol: "compiling",
  16474. fn: function (aMethod){
  16475. var self=this,$self=this;
  16476. return $core.withContext(function($ctx1) {
  16477. var $1,$3,$2;
  16478. $self._basicRemoveCompiledMethod_(aMethod);
  16479. $1=$recv($globals.SystemAnnouncer)._current();
  16480. $3=$recv($globals.MethodRemoved)._new();
  16481. $recv($3)._method_(aMethod);
  16482. $2=$recv($3)._yourself();
  16483. $recv($1)._announce_($2);
  16484. return self;
  16485. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16486. },
  16487. args: ["aMethod"],
  16488. source: "removeCompiledMethod: aMethod\x0a\x09self basicRemoveCompiledMethod: aMethod.\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (MethodRemoved new\x0a\x09\x09\x09method: aMethod;\x0a\x09\x09\x09yourself)",
  16489. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16490. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16491. }),
  16492. $globals.TBehaviorProvider);
  16493. $core.addMethod(
  16494. $core.method({
  16495. selector: "removeProtocolIfEmpty:",
  16496. protocol: "accessing",
  16497. fn: function (aString){
  16498. var self=this,$self=this;
  16499. return $core.withContext(function($ctx1) {
  16500. $recv($self._methods())._detect_ifNone_((function(each){
  16501. return $core.withContext(function($ctx2) {
  16502. return $recv($recv(each)._protocol()).__eq(aString);
  16503. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16504. }),(function(){
  16505. return $core.withContext(function($ctx2) {
  16506. return $recv($self._organization())._removeElement_(aString);
  16507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16508. }));
  16509. return self;
  16510. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16511. },
  16512. args: ["aString"],
  16513. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16514. referencedClasses: [],
  16515. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16516. }),
  16517. $globals.TBehaviorProvider);
  16518. $core.addMethod(
  16519. $core.method({
  16520. selector: "selectors",
  16521. protocol: "accessing",
  16522. fn: function (){
  16523. var self=this,$self=this;
  16524. return $core.withContext(function($ctx1) {
  16525. return $recv($self._methodDictionary())._keys();
  16526. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16527. },
  16528. args: [],
  16529. source: "selectors\x0a\x09^ self methodDictionary keys",
  16530. referencedClasses: [],
  16531. messageSends: ["keys", "methodDictionary"]
  16532. }),
  16533. $globals.TBehaviorProvider);
  16534. $core.addMethod(
  16535. $core.method({
  16536. selector: "setTraitComposition:",
  16537. protocol: "compiling",
  16538. fn: function (aTraitComposition){
  16539. var self=this,$self=this;
  16540. return $core.withContext(function($ctx1) {
  16541. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16542. return self;
  16543. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16544. },
  16545. args: ["aTraitComposition"],
  16546. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16547. referencedClasses: [],
  16548. messageSends: []
  16549. }),
  16550. $globals.TBehaviorProvider);
  16551. $core.addMethod(
  16552. $core.method({
  16553. selector: "traitComposition",
  16554. protocol: "accessing",
  16555. fn: function (){
  16556. var self=this,$self=this;
  16557. return $core.withContext(function($ctx1) {
  16558. var $1,$receiver;
  16559. $1=$self._basicAt_("traitComposition");
  16560. if(($receiver = $1) == null || $receiver.a$nil){
  16561. return [];
  16562. } else {
  16563. var aCollection;
  16564. aCollection=$receiver;
  16565. return $recv(aCollection)._collect_((function(each){
  16566. return $core.withContext(function($ctx2) {
  16567. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16568. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16569. }));
  16570. }
  16571. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16572. },
  16573. args: [],
  16574. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16575. referencedClasses: ["TraitTransformation"],
  16576. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16577. }),
  16578. $globals.TBehaviorProvider);
  16579. $core.addMethod(
  16580. $core.method({
  16581. selector: "traitCompositionDefinition",
  16582. protocol: "accessing",
  16583. fn: function (){
  16584. var self=this,$self=this;
  16585. return $core.withContext(function($ctx1) {
  16586. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16587. return $core.withContext(function($ctx2) {
  16588. return $recv($globals.String)._streamContents_((function(str){
  16589. return $core.withContext(function($ctx3) {
  16590. $recv(str)._write_("{");
  16591. $ctx3.sendIdx["write:"]=1;
  16592. $recv(traitComposition)._do_separatedBy_((function(each){
  16593. return $core.withContext(function($ctx4) {
  16594. return $recv(str)._write_($recv(each)._definition());
  16595. $ctx4.sendIdx["write:"]=2;
  16596. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16597. }),(function(){
  16598. return $core.withContext(function($ctx4) {
  16599. return $recv(str)._write_(". ");
  16600. $ctx4.sendIdx["write:"]=3;
  16601. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16602. }));
  16603. return $recv(str)._write_("}");
  16604. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16605. }));
  16606. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16607. }));
  16608. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16609. },
  16610. args: [],
  16611. 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: '}' ] ]",
  16612. referencedClasses: ["String"],
  16613. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16614. }),
  16615. $globals.TBehaviorProvider);
  16616. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16617. $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.";
  16618. $core.addMethod(
  16619. $core.method({
  16620. selector: "asJavaScriptSource",
  16621. protocol: "converting",
  16622. fn: function (){
  16623. var self=this,$self=this;
  16624. return $core.withContext(function($ctx1) {
  16625. return "$globals.".__comma($self._name());
  16626. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16627. },
  16628. args: [],
  16629. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16630. referencedClasses: [],
  16631. messageSends: [",", "name"]
  16632. }),
  16633. $globals.TMasterBehavior);
  16634. $core.addMethod(
  16635. $core.method({
  16636. selector: "browse",
  16637. protocol: "browsing",
  16638. fn: function (){
  16639. var self=this,$self=this;
  16640. return $core.withContext(function($ctx1) {
  16641. $recv($globals.Finder)._findClass_(self);
  16642. return self;
  16643. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16644. },
  16645. args: [],
  16646. source: "browse\x0a\x09Finder findClass: self",
  16647. referencedClasses: ["Finder"],
  16648. messageSends: ["findClass:"]
  16649. }),
  16650. $globals.TMasterBehavior);
  16651. $core.addMethod(
  16652. $core.method({
  16653. selector: "category",
  16654. protocol: "accessing",
  16655. fn: function (){
  16656. var self=this,$self=this;
  16657. return $core.withContext(function($ctx1) {
  16658. var $1,$receiver;
  16659. $1=$self._package();
  16660. $ctx1.sendIdx["package"]=1;
  16661. if(($receiver = $1) == null || $receiver.a$nil){
  16662. return "Unclassified";
  16663. } else {
  16664. return $recv($self._package())._name();
  16665. }
  16666. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16667. },
  16668. args: [],
  16669. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16670. referencedClasses: [],
  16671. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16672. }),
  16673. $globals.TMasterBehavior);
  16674. $core.addMethod(
  16675. $core.method({
  16676. selector: "classTag",
  16677. protocol: "accessing",
  16678. fn: function (){
  16679. var self=this,$self=this;
  16680. return $core.withContext(function($ctx1) {
  16681. return $self._subclassResponsibility();
  16682. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16683. },
  16684. args: [],
  16685. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16686. referencedClasses: [],
  16687. messageSends: ["subclassResponsibility"]
  16688. }),
  16689. $globals.TMasterBehavior);
  16690. $core.addMethod(
  16691. $core.method({
  16692. selector: "comment",
  16693. protocol: "accessing",
  16694. fn: function (){
  16695. var self=this,$self=this;
  16696. return $core.withContext(function($ctx1) {
  16697. var $1,$receiver;
  16698. $1=$self._basicAt_("comment");
  16699. if(($receiver = $1) == null || $receiver.a$nil){
  16700. return "";
  16701. } else {
  16702. return $1;
  16703. }
  16704. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16705. },
  16706. args: [],
  16707. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16708. referencedClasses: [],
  16709. messageSends: ["ifNil:", "basicAt:"]
  16710. }),
  16711. $globals.TMasterBehavior);
  16712. $core.addMethod(
  16713. $core.method({
  16714. selector: "comment:",
  16715. protocol: "accessing",
  16716. fn: function (aString){
  16717. var self=this,$self=this;
  16718. return $core.withContext(function($ctx1) {
  16719. var $1,$3,$2;
  16720. $self._basicAt_put_("comment",aString);
  16721. $1=$recv($globals.SystemAnnouncer)._current();
  16722. $3=$recv($globals.ClassCommentChanged)._new();
  16723. $recv($3)._theClass_(self);
  16724. $2=$recv($3)._yourself();
  16725. $recv($1)._announce_($2);
  16726. return self;
  16727. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16728. },
  16729. args: ["aString"],
  16730. 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)",
  16731. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16732. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16733. }),
  16734. $globals.TMasterBehavior);
  16735. $core.addMethod(
  16736. $core.method({
  16737. selector: "definedMethods",
  16738. protocol: "accessing",
  16739. fn: function (){
  16740. var self=this,$self=this;
  16741. var methods;
  16742. return $core.withContext(function($ctx1) {
  16743. var $1,$receiver;
  16744. methods=$self._methods();
  16745. $ctx1.sendIdx["methods"]=1;
  16746. $1=$self._theMetaClass();
  16747. if(($receiver = $1) == null || $receiver.a$nil){
  16748. return methods;
  16749. } else {
  16750. var meta;
  16751. meta=$receiver;
  16752. return $recv(methods).__comma($recv(meta)._methods());
  16753. }
  16754. return self;
  16755. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16756. },
  16757. args: [],
  16758. source: "definedMethods\x0a\x09\x22Answers methods of me and derived 'meta' part if present\x22\x0a\x09| methods |\x0a\x09methods := self methods.\x0a\x09self theMetaClass\x0a\x09\x09ifNil: [ ^ methods ]\x0a\x09\x09ifNotNil: [ :meta | ^ methods, meta methods ]",
  16759. referencedClasses: [],
  16760. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16761. }),
  16762. $globals.TMasterBehavior);
  16763. $core.addMethod(
  16764. $core.method({
  16765. selector: "enterOrganization",
  16766. protocol: "accessing",
  16767. fn: function (){
  16768. var self=this,$self=this;
  16769. return $core.withContext(function($ctx1) {
  16770. var $1,$receiver;
  16771. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16772. $globals.Smalltalk;
  16773. } else {
  16774. $1=$self._basicAt_("category");
  16775. if(($receiver = $1) == null || $receiver.a$nil){
  16776. $self._basicPackage_(nil);
  16777. $ctx1.sendIdx["basicPackage:"]=1;
  16778. } else {
  16779. var category;
  16780. category=$receiver;
  16781. $self._basicPackage_($recv($globals.Package)._named_(category));
  16782. $recv($recv($self._package())._organization())._addElement_(self);
  16783. }
  16784. }
  16785. return self;
  16786. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16787. },
  16788. args: [],
  16789. source: "enterOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09(self basicAt: 'category')\x0a\x09\x09\x09ifNil: [ self basicPackage: nil ]\x0a\x09\x09\x09ifNotNil: [ :category |\x0a\x09\x09\x09\x09\x22Amber has 1-1 correspondence between cat and pkg, atm\x22\x0a\x09\x09\x09\x09self basicPackage: (Package named: category).\x0a\x09\x09\x09\x09self package organization addElement: self ] ]",
  16790. referencedClasses: ["Smalltalk", "Package"],
  16791. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16792. }),
  16793. $globals.TMasterBehavior);
  16794. $core.addMethod(
  16795. $core.method({
  16796. selector: "leaveOrganization",
  16797. protocol: "accessing",
  16798. fn: function (){
  16799. var self=this,$self=this;
  16800. return $core.withContext(function($ctx1) {
  16801. var $receiver;
  16802. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16803. $globals.Smalltalk;
  16804. } else {
  16805. $recv($recv($self._package())._organization())._removeElement_(self);
  16806. }
  16807. return self;
  16808. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16809. },
  16810. args: [],
  16811. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16812. referencedClasses: ["Smalltalk"],
  16813. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16814. }),
  16815. $globals.TMasterBehavior);
  16816. $core.addMethod(
  16817. $core.method({
  16818. selector: "name",
  16819. protocol: "accessing",
  16820. fn: function (){
  16821. var self=this,$self=this;
  16822. return $core.withContext(function($ctx1) {
  16823. return self.name;
  16824. return self;
  16825. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16826. },
  16827. args: [],
  16828. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16829. referencedClasses: [],
  16830. messageSends: []
  16831. }),
  16832. $globals.TMasterBehavior);
  16833. $core.addMethod(
  16834. $core.method({
  16835. selector: "package:",
  16836. protocol: "accessing",
  16837. fn: function (aPackage){
  16838. var self=this,$self=this;
  16839. var oldPackage;
  16840. return $core.withContext(function($ctx1) {
  16841. var $2,$1,$3,$5,$4;
  16842. $2=$self._package();
  16843. $ctx1.sendIdx["package"]=1;
  16844. $1=$recv($2).__eq(aPackage);
  16845. if($core.assert($1)){
  16846. return self;
  16847. }
  16848. oldPackage=$self._package();
  16849. $self._leaveOrganization();
  16850. $self._basicAt_put_("category",$recv(aPackage)._name());
  16851. $self._enterOrganization();
  16852. $3=$recv($globals.SystemAnnouncer)._current();
  16853. $5=$recv($globals.ClassMoved)._new();
  16854. $recv($5)._theClass_(self);
  16855. $recv($5)._oldPackage_(oldPackage);
  16856. $4=$recv($5)._yourself();
  16857. $recv($3)._announce_($4);
  16858. return self;
  16859. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16860. },
  16861. args: ["aPackage"],
  16862. source: "package: aPackage\x0a\x09| oldPackage |\x0a\x09\x0a\x09self package = aPackage ifTrue: [ ^ self ].\x0a\x09\x0a\x09oldPackage := self package.\x0a\x09\x0a\x09self\x0a\x09\x09leaveOrganization;\x0a\x09\x09basicAt: 'category' put: aPackage name;\x0a\x09\x09enterOrganization.\x0a\x0a\x09SystemAnnouncer current announce: (ClassMoved new\x0a\x09\x09theClass: self;\x0a\x09\x09oldPackage: oldPackage;\x0a\x09\x09yourself)",
  16863. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16864. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16865. }),
  16866. $globals.TMasterBehavior);
  16867. $core.addMethod(
  16868. $core.method({
  16869. selector: "theNonMetaClass",
  16870. protocol: "accessing",
  16871. fn: function (){
  16872. var self=this,$self=this;
  16873. return self;
  16874. },
  16875. args: [],
  16876. source: "theNonMetaClass\x0a\x09^ self",
  16877. referencedClasses: [],
  16878. messageSends: []
  16879. }),
  16880. $globals.TMasterBehavior);
  16881. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16882. $core.addMethod(
  16883. $core.method({
  16884. selector: "-",
  16885. protocol: "composition",
  16886. fn: function (anArray){
  16887. var self=this,$self=this;
  16888. return $core.withContext(function($ctx1) {
  16889. return $recv($self._asTraitTransformation()).__minus(anArray);
  16890. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16891. },
  16892. args: ["anArray"],
  16893. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16894. referencedClasses: [],
  16895. messageSends: ["-", "asTraitTransformation"]
  16896. }),
  16897. $globals.Trait);
  16898. $core.addMethod(
  16899. $core.method({
  16900. selector: "@",
  16901. protocol: "composition",
  16902. fn: function (anArrayOfAssociations){
  16903. var self=this,$self=this;
  16904. return $core.withContext(function($ctx1) {
  16905. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16906. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16907. },
  16908. args: ["anArrayOfAssociations"],
  16909. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16910. referencedClasses: [],
  16911. messageSends: ["@", "asTraitTransformation"]
  16912. }),
  16913. $globals.Trait);
  16914. $core.addMethod(
  16915. $core.method({
  16916. selector: "asTraitComposition",
  16917. protocol: "converting",
  16918. fn: function (){
  16919. var self=this,$self=this;
  16920. return $core.withContext(function($ctx1) {
  16921. return $recv($self._asTraitTransformation())._asTraitComposition();
  16922. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16923. },
  16924. args: [],
  16925. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16926. referencedClasses: [],
  16927. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16928. }),
  16929. $globals.Trait);
  16930. $core.addMethod(
  16931. $core.method({
  16932. selector: "asTraitTransformation",
  16933. protocol: "converting",
  16934. fn: function (){
  16935. var self=this,$self=this;
  16936. return $core.withContext(function($ctx1) {
  16937. return $recv($globals.TraitTransformation)._on_(self);
  16938. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16939. },
  16940. args: [],
  16941. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16942. referencedClasses: ["TraitTransformation"],
  16943. messageSends: ["on:"]
  16944. }),
  16945. $globals.Trait);
  16946. $core.addMethod(
  16947. $core.method({
  16948. selector: "basicOrganization",
  16949. protocol: "accessing",
  16950. fn: function (){
  16951. var self=this,$self=this;
  16952. return $self["@organization"];
  16953. },
  16954. args: [],
  16955. source: "basicOrganization\x0a\x09^ organization",
  16956. referencedClasses: [],
  16957. messageSends: []
  16958. }),
  16959. $globals.Trait);
  16960. $core.addMethod(
  16961. $core.method({
  16962. selector: "basicOrganization:",
  16963. protocol: "accessing",
  16964. fn: function (aClassOrganizer){
  16965. var self=this,$self=this;
  16966. $self["@organization"]=aClassOrganizer;
  16967. return self;
  16968. },
  16969. args: ["aClassOrganizer"],
  16970. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  16971. referencedClasses: [],
  16972. messageSends: []
  16973. }),
  16974. $globals.Trait);
  16975. $core.addMethod(
  16976. $core.method({
  16977. selector: "basicPackage:",
  16978. protocol: "accessing",
  16979. fn: function (aPackage){
  16980. var self=this,$self=this;
  16981. $self["@package"]=aPackage;
  16982. return self;
  16983. },
  16984. args: ["aPackage"],
  16985. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  16986. referencedClasses: [],
  16987. messageSends: []
  16988. }),
  16989. $globals.Trait);
  16990. $core.addMethod(
  16991. $core.method({
  16992. selector: "classTag",
  16993. protocol: "accessing",
  16994. fn: function (){
  16995. var self=this,$self=this;
  16996. return "trait";
  16997. },
  16998. args: [],
  16999. source: "classTag\x0a\x09^ 'trait'",
  17000. referencedClasses: [],
  17001. messageSends: []
  17002. }),
  17003. $globals.Trait);
  17004. $core.addMethod(
  17005. $core.method({
  17006. selector: "definition",
  17007. protocol: "accessing",
  17008. fn: function (){
  17009. var self=this,$self=this;
  17010. return $core.withContext(function($ctx1) {
  17011. var $1;
  17012. return $recv($globals.String)._streamContents_((function(stream){
  17013. return $core.withContext(function($ctx2) {
  17014. $recv(stream)._write_("Trait named: ");
  17015. $ctx2.sendIdx["write:"]=1;
  17016. $recv(stream)._printSymbol_($self._name());
  17017. $recv(stream)._lf();
  17018. $ctx2.sendIdx["lf"]=1;
  17019. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  17020. return $core.withContext(function($ctx3) {
  17021. $1=$recv($globals.String)._tab();
  17022. $ctx3.sendIdx["tab"]=1;
  17023. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  17024. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  17025. })));
  17026. $ctx2.sendIdx["write:"]=2;
  17027. $recv(stream)._tab();
  17028. $recv(stream)._write_("package: ");
  17029. return $recv(stream)._print_($self._category());
  17030. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  17031. }));
  17032. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  17033. },
  17034. args: [],
  17035. 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 ]",
  17036. referencedClasses: ["String"],
  17037. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  17038. }),
  17039. $globals.Trait);
  17040. $core.addMethod(
  17041. $core.method({
  17042. selector: "package",
  17043. protocol: "accessing",
  17044. fn: function (){
  17045. var self=this,$self=this;
  17046. return $self["@package"];
  17047. },
  17048. args: [],
  17049. source: "package\x0a\x09^ package",
  17050. referencedClasses: [],
  17051. messageSends: []
  17052. }),
  17053. $globals.Trait);
  17054. $core.addMethod(
  17055. $core.method({
  17056. selector: "theMetaClass",
  17057. protocol: "accessing",
  17058. fn: function (){
  17059. var self=this,$self=this;
  17060. return nil;
  17061. },
  17062. args: [],
  17063. source: "theMetaClass\x0a\x09^ nil",
  17064. referencedClasses: [],
  17065. messageSends: []
  17066. }),
  17067. $globals.Trait);
  17068. $core.addMethod(
  17069. $core.method({
  17070. selector: "traitUsers",
  17071. protocol: "accessing",
  17072. fn: function (){
  17073. var self=this,$self=this;
  17074. return $core.withContext(function($ctx1) {
  17075. return $recv($self._basicAt_("traitUsers"))._copy();
  17076. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  17077. },
  17078. args: [],
  17079. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  17080. referencedClasses: [],
  17081. messageSends: ["copy", "basicAt:"]
  17082. }),
  17083. $globals.Trait);
  17084. $core.addMethod(
  17085. $core.method({
  17086. selector: "named:package:",
  17087. protocol: "instance creation",
  17088. fn: function (aString,anotherString){
  17089. var self=this,$self=this;
  17090. return $core.withContext(function($ctx1) {
  17091. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17092. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  17093. },
  17094. args: ["aString", "anotherString"],
  17095. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17096. referencedClasses: ["ClassBuilder"],
  17097. messageSends: ["addTraitNamed:package:", "new"]
  17098. }),
  17099. $globals.Trait.a$cls);
  17100. $core.addMethod(
  17101. $core.method({
  17102. selector: "named:uses:package:",
  17103. protocol: "instance creation",
  17104. fn: function (aString,aTraitCompositionDescription,anotherString){
  17105. var self=this,$self=this;
  17106. var trait;
  17107. return $core.withContext(function($ctx1) {
  17108. trait=$self._named_package_(aString,anotherString);
  17109. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17110. return trait;
  17111. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  17112. },
  17113. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17114. 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",
  17115. referencedClasses: [],
  17116. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17117. }),
  17118. $globals.Trait.a$cls);
  17119. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17120. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17121. $core.addMethod(
  17122. $core.method({
  17123. selector: "-",
  17124. protocol: "composition",
  17125. fn: function (anArray){
  17126. var self=this,$self=this;
  17127. return $core.withContext(function($ctx1) {
  17128. var $1;
  17129. $1=$self._copy();
  17130. $recv($1)._addExclusions_(anArray);
  17131. return $recv($1)._yourself();
  17132. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17133. },
  17134. args: ["anArray"],
  17135. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17136. referencedClasses: [],
  17137. messageSends: ["addExclusions:", "copy", "yourself"]
  17138. }),
  17139. $globals.TraitTransformation);
  17140. $core.addMethod(
  17141. $core.method({
  17142. selector: "@",
  17143. protocol: "composition",
  17144. fn: function (anArrayOfAssociations){
  17145. var self=this,$self=this;
  17146. return $core.withContext(function($ctx1) {
  17147. var $1;
  17148. $1=$self._copy();
  17149. $recv($1)._addAliases_(anArrayOfAssociations);
  17150. return $recv($1)._yourself();
  17151. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17152. },
  17153. args: ["anArrayOfAssociations"],
  17154. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17155. referencedClasses: [],
  17156. messageSends: ["addAliases:", "copy", "yourself"]
  17157. }),
  17158. $globals.TraitTransformation);
  17159. $core.addMethod(
  17160. $core.method({
  17161. selector: "addAliases:",
  17162. protocol: "accessing",
  17163. fn: function (anArrayOfAssociations){
  17164. var self=this,$self=this;
  17165. return $core.withContext(function($ctx1) {
  17166. $recv(anArrayOfAssociations)._do_((function(each){
  17167. var key;
  17168. return $core.withContext(function($ctx2) {
  17169. key=$recv(each)._key();
  17170. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17171. return $core.withContext(function($ctx3) {
  17172. return $self._error_("Cannot use same alias name twice.");
  17173. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17174. }),(function(){
  17175. return $core.withContext(function($ctx3) {
  17176. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17177. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17178. }));
  17179. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17180. }));
  17181. return anArrayOfAssociations;
  17182. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17183. },
  17184. args: ["anArrayOfAssociations"],
  17185. 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",
  17186. referencedClasses: [],
  17187. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17188. }),
  17189. $globals.TraitTransformation);
  17190. $core.addMethod(
  17191. $core.method({
  17192. selector: "addExclusions:",
  17193. protocol: "accessing",
  17194. fn: function (anArray){
  17195. var self=this,$self=this;
  17196. return $core.withContext(function($ctx1) {
  17197. $recv($self["@exclusions"])._addAll_(anArray);
  17198. return anArray;
  17199. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17200. },
  17201. args: ["anArray"],
  17202. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17203. referencedClasses: [],
  17204. messageSends: ["addAll:"]
  17205. }),
  17206. $globals.TraitTransformation);
  17207. $core.addMethod(
  17208. $core.method({
  17209. selector: "aliases",
  17210. protocol: "accessing",
  17211. fn: function (){
  17212. var self=this,$self=this;
  17213. return $self["@aliases"];
  17214. },
  17215. args: [],
  17216. source: "aliases\x0a\x09^ aliases",
  17217. referencedClasses: [],
  17218. messageSends: []
  17219. }),
  17220. $globals.TraitTransformation);
  17221. $core.addMethod(
  17222. $core.method({
  17223. selector: "asJavaScriptObject",
  17224. protocol: "converting",
  17225. fn: function (){
  17226. var self=this,$self=this;
  17227. return $core.withContext(function($ctx1) {
  17228. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17229. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17230. },
  17231. args: [],
  17232. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17233. referencedClasses: [],
  17234. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17235. }),
  17236. $globals.TraitTransformation);
  17237. $core.addMethod(
  17238. $core.method({
  17239. selector: "asJavaScriptSource",
  17240. protocol: "converting",
  17241. fn: function (){
  17242. var self=this,$self=this;
  17243. return $core.withContext(function($ctx1) {
  17244. var $2,$3,$1;
  17245. return $recv($globals.String)._streamContents_((function(str){
  17246. return $core.withContext(function($ctx2) {
  17247. $2=$recv($self._trait())._asJavaScriptSource();
  17248. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17249. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17250. return $core.withContext(function($ctx3) {
  17251. return [", aliases: ",$recv(al)._asJSONString()];
  17252. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17253. }));
  17254. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17255. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17256. return $core.withContext(function($ctx3) {
  17257. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17258. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17259. })),"}"];
  17260. return $recv(str)._write_($1);
  17261. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17262. }));
  17263. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17264. },
  17265. args: [],
  17266. 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'}' } ]",
  17267. referencedClasses: ["String"],
  17268. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17269. }),
  17270. $globals.TraitTransformation);
  17271. $core.addMethod(
  17272. $core.method({
  17273. selector: "asTraitComposition",
  17274. protocol: "converting",
  17275. fn: function (){
  17276. var self=this,$self=this;
  17277. return [self];
  17278. },
  17279. args: [],
  17280. source: "asTraitComposition\x0a\x09^ { self }",
  17281. referencedClasses: [],
  17282. messageSends: []
  17283. }),
  17284. $globals.TraitTransformation);
  17285. $core.addMethod(
  17286. $core.method({
  17287. selector: "asTraitTransformation",
  17288. protocol: "converting",
  17289. fn: function (){
  17290. var self=this,$self=this;
  17291. return self;
  17292. },
  17293. args: [],
  17294. source: "asTraitTransformation\x0a\x09^ self",
  17295. referencedClasses: [],
  17296. messageSends: []
  17297. }),
  17298. $globals.TraitTransformation);
  17299. $core.addMethod(
  17300. $core.method({
  17301. selector: "definition",
  17302. protocol: "accessing",
  17303. fn: function (){
  17304. var self=this,$self=this;
  17305. return $core.withContext(function($ctx1) {
  17306. return $recv($globals.String)._streamContents_((function(str){
  17307. return $core.withContext(function($ctx2) {
  17308. $recv(str)._print_($self._trait());
  17309. $recv($self._aliases())._ifNotEmpty_((function(al){
  17310. return $core.withContext(function($ctx3) {
  17311. $recv(str)._write_(" @ {");
  17312. $ctx3.sendIdx["write:"]=1;
  17313. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17314. return $core.withContext(function($ctx4) {
  17315. $recv(str)._printSymbol_($recv(each)._key());
  17316. $ctx4.sendIdx["printSymbol:"]=1;
  17317. $recv(str)._write_(" -> ");
  17318. $ctx4.sendIdx["write:"]=2;
  17319. return $recv(str)._printSymbol_($recv(each)._value());
  17320. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17321. }),(function(){
  17322. return $core.withContext(function($ctx4) {
  17323. return $recv(str)._write_(". ");
  17324. $ctx4.sendIdx["write:"]=3;
  17325. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17326. }));
  17327. $ctx3.sendIdx["do:separatedBy:"]=1;
  17328. return $recv(str)._write_("}");
  17329. $ctx3.sendIdx["write:"]=4;
  17330. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17331. }));
  17332. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17333. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17334. return $core.withContext(function($ctx3) {
  17335. $recv(str)._write_(" - #(");
  17336. $ctx3.sendIdx["write:"]=5;
  17337. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17338. return $core.withContext(function($ctx4) {
  17339. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17340. $ctx4.sendIdx["write:"]=6;
  17341. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17342. }),(function(){
  17343. return $core.withContext(function($ctx4) {
  17344. return $recv(str)._space();
  17345. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17346. }));
  17347. return $recv(str)._write_(")");
  17348. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17349. }));
  17350. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17351. }));
  17352. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17353. },
  17354. args: [],
  17355. 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: ')' ] ]",
  17356. referencedClasses: ["String"],
  17357. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17358. }),
  17359. $globals.TraitTransformation);
  17360. $core.addMethod(
  17361. $core.method({
  17362. selector: "exclusions",
  17363. protocol: "accessing",
  17364. fn: function (){
  17365. var self=this,$self=this;
  17366. return $self["@exclusions"];
  17367. },
  17368. args: [],
  17369. source: "exclusions\x0a\x09^ exclusions",
  17370. referencedClasses: [],
  17371. messageSends: []
  17372. }),
  17373. $globals.TraitTransformation);
  17374. $core.addMethod(
  17375. $core.method({
  17376. selector: "initialize",
  17377. protocol: "initialization",
  17378. fn: function (){
  17379. var self=this,$self=this;
  17380. return $core.withContext(function($ctx1) {
  17381. (
  17382. $ctx1.supercall = true,
  17383. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17384. $ctx1.supercall = false;
  17385. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17386. $self["@exclusions"]=$recv($globals.Set)._new();
  17387. $self["@trait"]=nil;
  17388. return self;
  17389. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17390. },
  17391. args: [],
  17392. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17393. referencedClasses: ["Set"],
  17394. messageSends: ["initialize", "new"]
  17395. }),
  17396. $globals.TraitTransformation);
  17397. $core.addMethod(
  17398. $core.method({
  17399. selector: "postCopy",
  17400. protocol: "copying",
  17401. fn: function (){
  17402. var self=this,$self=this;
  17403. return $core.withContext(function($ctx1) {
  17404. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17405. $ctx1.sendIdx["copy"]=1;
  17406. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17407. return self;
  17408. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17409. },
  17410. args: [],
  17411. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17412. referencedClasses: [],
  17413. messageSends: ["copy"]
  17414. }),
  17415. $globals.TraitTransformation);
  17416. $core.addMethod(
  17417. $core.method({
  17418. selector: "trait",
  17419. protocol: "accessing",
  17420. fn: function (){
  17421. var self=this,$self=this;
  17422. return $self["@trait"];
  17423. },
  17424. args: [],
  17425. source: "trait\x0a\x09^ trait",
  17426. referencedClasses: [],
  17427. messageSends: []
  17428. }),
  17429. $globals.TraitTransformation);
  17430. $core.addMethod(
  17431. $core.method({
  17432. selector: "trait:",
  17433. protocol: "accessing",
  17434. fn: function (anObject){
  17435. var self=this,$self=this;
  17436. $self["@trait"]=anObject;
  17437. return self;
  17438. },
  17439. args: ["anObject"],
  17440. source: "trait: anObject\x0a\x09trait := anObject",
  17441. referencedClasses: [],
  17442. messageSends: []
  17443. }),
  17444. $globals.TraitTransformation);
  17445. $core.addMethod(
  17446. $core.method({
  17447. selector: "fromJSON:",
  17448. protocol: "instance creation",
  17449. fn: function (aJSObject){
  17450. var self=this,$self=this;
  17451. return $core.withContext(function($ctx1) {
  17452. var $1,$4,$3,$2;
  17453. $1=(
  17454. $ctx1.supercall = true,
  17455. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17456. $ctx1.supercall = false;
  17457. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17458. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17459. return $globals.HashedCollection._newFromPairs_([]);
  17460. }));
  17461. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17462. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17463. $2=$recv($3)._associations();
  17464. $recv($1)._addAliases_($2);
  17465. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17466. return [];
  17467. })));
  17468. return $recv($1)._yourself();
  17469. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17470. },
  17471. args: ["aJSObject"],
  17472. 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",
  17473. referencedClasses: ["Smalltalk"],
  17474. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17475. }),
  17476. $globals.TraitTransformation.a$cls);
  17477. $core.addMethod(
  17478. $core.method({
  17479. selector: "on:",
  17480. protocol: "instance creation",
  17481. fn: function (aTrait){
  17482. var self=this,$self=this;
  17483. return $core.withContext(function($ctx1) {
  17484. var $1;
  17485. $1=(
  17486. $ctx1.supercall = true,
  17487. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17488. $ctx1.supercall = false;
  17489. $recv($1)._trait_(aTrait);
  17490. return $recv($1)._yourself();
  17491. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17492. },
  17493. args: ["aTrait"],
  17494. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17495. referencedClasses: [],
  17496. messageSends: ["trait:", "new", "yourself"]
  17497. }),
  17498. $globals.TraitTransformation.a$cls);
  17499. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17500. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17501. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17502. $core.addMethod(
  17503. $core.method({
  17504. selector: "asTraitComposition",
  17505. protocol: "*Kernel-Classes",
  17506. fn: function (){
  17507. var self=this,$self=this;
  17508. return $core.withContext(function($ctx1) {
  17509. return $self._collect_((function(each){
  17510. return $core.withContext(function($ctx2) {
  17511. return $recv(each)._asTraitTransformation();
  17512. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17513. }));
  17514. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17515. },
  17516. args: [],
  17517. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17518. referencedClasses: [],
  17519. messageSends: ["collect:", "asTraitTransformation"]
  17520. }),
  17521. $globals.Array);
  17522. });
  17523. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17524. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17525. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17526. $core.addPackage("Kernel-Methods");
  17527. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  17528. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17529. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17530. $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 | ... ] `";
  17531. $core.addMethod(
  17532. $core.method({
  17533. selector: "applyTo:arguments:",
  17534. protocol: "evaluating",
  17535. fn: function (anObject,aCollection){
  17536. var self=this,$self=this;
  17537. return $core.withContext(function($ctx1) {
  17538. return self.apply(anObject, aCollection);
  17539. return self;
  17540. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17541. },
  17542. args: ["anObject", "aCollection"],
  17543. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17544. referencedClasses: [],
  17545. messageSends: []
  17546. }),
  17547. $globals.BlockClosure);
  17548. $core.addMethod(
  17549. $core.method({
  17550. selector: "asCompiledMethod:",
  17551. protocol: "converting",
  17552. fn: function (aString){
  17553. var self=this,$self=this;
  17554. return $core.withContext(function($ctx1) {
  17555. return $core.method({selector:aString, fn:self});;
  17556. return self;
  17557. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17558. },
  17559. args: ["aString"],
  17560. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17561. referencedClasses: [],
  17562. messageSends: []
  17563. }),
  17564. $globals.BlockClosure);
  17565. $core.addMethod(
  17566. $core.method({
  17567. selector: "compiledSource",
  17568. protocol: "accessing",
  17569. fn: function (){
  17570. var self=this,$self=this;
  17571. return $core.withContext(function($ctx1) {
  17572. return self.toString();
  17573. return self;
  17574. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17575. },
  17576. args: [],
  17577. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17578. referencedClasses: [],
  17579. messageSends: []
  17580. }),
  17581. $globals.BlockClosure);
  17582. $core.addMethod(
  17583. $core.method({
  17584. selector: "currySelf",
  17585. protocol: "converting",
  17586. fn: function (){
  17587. var self=this,$self=this;
  17588. return $core.withContext(function($ctx1) {
  17589. return function () {
  17590. var args = [ this ];
  17591. args.push.apply(args, arguments);
  17592. return self.apply(null, args);
  17593. }
  17594. ;
  17595. return self;
  17596. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17597. },
  17598. args: [],
  17599. 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'>",
  17600. referencedClasses: [],
  17601. messageSends: []
  17602. }),
  17603. $globals.BlockClosure);
  17604. $core.addMethod(
  17605. $core.method({
  17606. selector: "ensure:",
  17607. protocol: "evaluating",
  17608. fn: function (aBlock){
  17609. var self=this,$self=this;
  17610. return $core.withContext(function($ctx1) {
  17611. try{return $self._value()}finally{aBlock._value()};
  17612. return self;
  17613. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17614. },
  17615. args: ["aBlock"],
  17616. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17617. referencedClasses: [],
  17618. messageSends: []
  17619. }),
  17620. $globals.BlockClosure);
  17621. $core.addMethod(
  17622. $core.method({
  17623. selector: "fork",
  17624. protocol: "timeout/interval",
  17625. fn: function (){
  17626. var self=this,$self=this;
  17627. return $core.withContext(function($ctx1) {
  17628. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17629. return self;
  17630. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17631. },
  17632. args: [],
  17633. source: "fork\x0a\x09ForkPool default fork: self",
  17634. referencedClasses: ["ForkPool"],
  17635. messageSends: ["fork:", "default"]
  17636. }),
  17637. $globals.BlockClosure);
  17638. $core.addMethod(
  17639. $core.method({
  17640. selector: "new",
  17641. protocol: "evaluating",
  17642. fn: function (){
  17643. var self=this,$self=this;
  17644. return $core.withContext(function($ctx1) {
  17645. return new self();
  17646. return self;
  17647. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17648. },
  17649. args: [],
  17650. 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()'>",
  17651. referencedClasses: [],
  17652. messageSends: []
  17653. }),
  17654. $globals.BlockClosure);
  17655. $core.addMethod(
  17656. $core.method({
  17657. selector: "newValue:",
  17658. protocol: "evaluating",
  17659. fn: function (anObject){
  17660. var self=this,$self=this;
  17661. return $core.withContext(function($ctx1) {
  17662. return $self._newWithValues_([anObject]);
  17663. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17664. },
  17665. args: ["anObject"],
  17666. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17667. referencedClasses: [],
  17668. messageSends: ["newWithValues:"]
  17669. }),
  17670. $globals.BlockClosure);
  17671. $core.addMethod(
  17672. $core.method({
  17673. selector: "newValue:value:",
  17674. protocol: "evaluating",
  17675. fn: function (anObject,anObject2){
  17676. var self=this,$self=this;
  17677. return $core.withContext(function($ctx1) {
  17678. return $self._newWithValues_([anObject,anObject2]);
  17679. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17680. },
  17681. args: ["anObject", "anObject2"],
  17682. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17683. referencedClasses: [],
  17684. messageSends: ["newWithValues:"]
  17685. }),
  17686. $globals.BlockClosure);
  17687. $core.addMethod(
  17688. $core.method({
  17689. selector: "newValue:value:value:",
  17690. protocol: "evaluating",
  17691. fn: function (anObject,anObject2,anObject3){
  17692. var self=this,$self=this;
  17693. return $core.withContext(function($ctx1) {
  17694. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17695. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17696. },
  17697. args: ["anObject", "anObject2", "anObject3"],
  17698. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17699. referencedClasses: [],
  17700. messageSends: ["newWithValues:"]
  17701. }),
  17702. $globals.BlockClosure);
  17703. $core.addMethod(
  17704. $core.method({
  17705. selector: "newWithValues:",
  17706. protocol: "evaluating",
  17707. fn: function (aCollection){
  17708. var self=this,$self=this;
  17709. return $core.withContext(function($ctx1) {
  17710. var object = Object.create(self.prototype);
  17711. var result = self.apply(object, aCollection);
  17712. return typeof result === "object" ? result : object;
  17713. ;
  17714. return self;
  17715. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17716. },
  17717. args: ["aCollection"],
  17718. 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'>",
  17719. referencedClasses: [],
  17720. messageSends: []
  17721. }),
  17722. $globals.BlockClosure);
  17723. $core.addMethod(
  17724. $core.method({
  17725. selector: "numArgs",
  17726. protocol: "accessing",
  17727. fn: function (){
  17728. var self=this,$self=this;
  17729. return $core.withContext(function($ctx1) {
  17730. return self.length;
  17731. return self;
  17732. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17733. },
  17734. args: [],
  17735. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17736. referencedClasses: [],
  17737. messageSends: []
  17738. }),
  17739. $globals.BlockClosure);
  17740. $core.addMethod(
  17741. $core.method({
  17742. selector: "on:do:",
  17743. protocol: "error handling",
  17744. fn: function (anErrorClass,aBlock){
  17745. var self=this,$self=this;
  17746. return $core.withContext(function($ctx1) {
  17747. var $1;
  17748. return $self._tryCatch_((function(error){
  17749. var smalltalkError;
  17750. return $core.withContext(function($ctx2) {
  17751. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17752. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17753. if($core.assert($1)){
  17754. return $recv(aBlock)._value_(smalltalkError);
  17755. } else {
  17756. return $recv(smalltalkError)._pass();
  17757. }
  17758. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17759. }));
  17760. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17761. },
  17762. args: ["anErrorClass", "aBlock"],
  17763. 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 pass ] ]",
  17764. referencedClasses: ["Smalltalk"],
  17765. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "pass"]
  17766. }),
  17767. $globals.BlockClosure);
  17768. $core.addMethod(
  17769. $core.method({
  17770. selector: "receiver",
  17771. protocol: "accessing",
  17772. fn: function (){
  17773. var self=this,$self=this;
  17774. return nil;
  17775. },
  17776. args: [],
  17777. source: "receiver\x0a\x09^ nil",
  17778. referencedClasses: [],
  17779. messageSends: []
  17780. }),
  17781. $globals.BlockClosure);
  17782. $core.addMethod(
  17783. $core.method({
  17784. selector: "timeToRun",
  17785. protocol: "evaluating",
  17786. fn: function (){
  17787. var self=this,$self=this;
  17788. return $core.withContext(function($ctx1) {
  17789. return $recv($globals.Date)._millisecondsToRun_(self);
  17790. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17791. },
  17792. args: [],
  17793. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17794. referencedClasses: ["Date"],
  17795. messageSends: ["millisecondsToRun:"]
  17796. }),
  17797. $globals.BlockClosure);
  17798. $core.addMethod(
  17799. $core.method({
  17800. selector: "tryCatch:",
  17801. protocol: "error handling",
  17802. fn: function (aBlock){
  17803. var self=this,$self=this;
  17804. return $core.withContext(function($ctx1) {
  17805. try {
  17806. return $self._value();
  17807. } catch(error) {
  17808. // pass non-local returns undetected
  17809. if (Array.isArray(error) && error.length === 1) throw error;
  17810. return aBlock._value_(error);
  17811. }
  17812. ;
  17813. return self;
  17814. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17815. },
  17816. args: ["aBlock"],
  17817. 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'>",
  17818. referencedClasses: [],
  17819. messageSends: []
  17820. }),
  17821. $globals.BlockClosure);
  17822. $core.addMethod(
  17823. $core.method({
  17824. selector: "value",
  17825. protocol: "evaluating",
  17826. fn: function (){
  17827. var self=this,$self=this;
  17828. return $core.withContext(function($ctx1) {
  17829. return self();;
  17830. return self;
  17831. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17832. },
  17833. args: [],
  17834. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17835. referencedClasses: [],
  17836. messageSends: []
  17837. }),
  17838. $globals.BlockClosure);
  17839. $core.addMethod(
  17840. $core.method({
  17841. selector: "value:",
  17842. protocol: "evaluating",
  17843. fn: function (anArg){
  17844. var self=this,$self=this;
  17845. return $core.withContext(function($ctx1) {
  17846. return self(anArg);;
  17847. return self;
  17848. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17849. },
  17850. args: ["anArg"],
  17851. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17852. referencedClasses: [],
  17853. messageSends: []
  17854. }),
  17855. $globals.BlockClosure);
  17856. $core.addMethod(
  17857. $core.method({
  17858. selector: "value:value:",
  17859. protocol: "evaluating",
  17860. fn: function (firstArg,secondArg){
  17861. var self=this,$self=this;
  17862. return $core.withContext(function($ctx1) {
  17863. return self(firstArg, secondArg);;
  17864. return self;
  17865. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17866. },
  17867. args: ["firstArg", "secondArg"],
  17868. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17869. referencedClasses: [],
  17870. messageSends: []
  17871. }),
  17872. $globals.BlockClosure);
  17873. $core.addMethod(
  17874. $core.method({
  17875. selector: "value:value:value:",
  17876. protocol: "evaluating",
  17877. fn: function (firstArg,secondArg,thirdArg){
  17878. var self=this,$self=this;
  17879. return $core.withContext(function($ctx1) {
  17880. return self(firstArg, secondArg, thirdArg);;
  17881. return self;
  17882. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17883. },
  17884. args: ["firstArg", "secondArg", "thirdArg"],
  17885. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17886. referencedClasses: [],
  17887. messageSends: []
  17888. }),
  17889. $globals.BlockClosure);
  17890. $core.addMethod(
  17891. $core.method({
  17892. selector: "valueWithInterval:",
  17893. protocol: "timeout/interval",
  17894. fn: function (aNumber){
  17895. var self=this,$self=this;
  17896. return $core.withContext(function($ctx1) {
  17897. var interval = setInterval(self, aNumber);
  17898. return $globals.Timeout._on_(interval);
  17899. ;
  17900. return self;
  17901. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17902. },
  17903. args: ["aNumber"],
  17904. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17905. referencedClasses: [],
  17906. messageSends: []
  17907. }),
  17908. $globals.BlockClosure);
  17909. $core.addMethod(
  17910. $core.method({
  17911. selector: "valueWithPossibleArguments:",
  17912. protocol: "evaluating",
  17913. fn: function (aCollection){
  17914. var self=this,$self=this;
  17915. return $core.withContext(function($ctx1) {
  17916. return self.apply(null, aCollection);;
  17917. return self;
  17918. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17919. },
  17920. args: ["aCollection"],
  17921. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17922. referencedClasses: [],
  17923. messageSends: []
  17924. }),
  17925. $globals.BlockClosure);
  17926. $core.addMethod(
  17927. $core.method({
  17928. selector: "valueWithTimeout:",
  17929. protocol: "timeout/interval",
  17930. fn: function (aNumber){
  17931. var self=this,$self=this;
  17932. return $core.withContext(function($ctx1) {
  17933. var timeout = setTimeout(self, aNumber);
  17934. return $globals.Timeout._on_(timeout);
  17935. ;
  17936. return self;
  17937. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17938. },
  17939. args: ["aNumber"],
  17940. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17941. referencedClasses: [],
  17942. messageSends: []
  17943. }),
  17944. $globals.BlockClosure);
  17945. $core.addMethod(
  17946. $core.method({
  17947. selector: "whileFalse",
  17948. protocol: "controlling",
  17949. fn: function (){
  17950. var self=this,$self=this;
  17951. return $core.withContext(function($ctx1) {
  17952. $self._whileFalse_((function(){
  17953. }));
  17954. return self;
  17955. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17956. },
  17957. args: [],
  17958. source: "whileFalse\x0a\x09self whileFalse: []",
  17959. referencedClasses: [],
  17960. messageSends: ["whileFalse:"]
  17961. }),
  17962. $globals.BlockClosure);
  17963. $core.addMethod(
  17964. $core.method({
  17965. selector: "whileFalse:",
  17966. protocol: "controlling",
  17967. fn: function (aBlock){
  17968. var self=this,$self=this;
  17969. return $core.withContext(function($ctx1) {
  17970. while(!$core.assert($self._value())) {aBlock._value()};
  17971. return self;
  17972. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  17973. },
  17974. args: ["aBlock"],
  17975. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  17976. referencedClasses: [],
  17977. messageSends: []
  17978. }),
  17979. $globals.BlockClosure);
  17980. $core.addMethod(
  17981. $core.method({
  17982. selector: "whileTrue",
  17983. protocol: "controlling",
  17984. fn: function (){
  17985. var self=this,$self=this;
  17986. return $core.withContext(function($ctx1) {
  17987. $self._whileTrue_((function(){
  17988. }));
  17989. return self;
  17990. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  17991. },
  17992. args: [],
  17993. source: "whileTrue\x0a\x09self whileTrue: []",
  17994. referencedClasses: [],
  17995. messageSends: ["whileTrue:"]
  17996. }),
  17997. $globals.BlockClosure);
  17998. $core.addMethod(
  17999. $core.method({
  18000. selector: "whileTrue:",
  18001. protocol: "controlling",
  18002. fn: function (aBlock){
  18003. var self=this,$self=this;
  18004. return $core.withContext(function($ctx1) {
  18005. while($core.assert($self._value())) {aBlock._value()};
  18006. return self;
  18007. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  18008. },
  18009. args: ["aBlock"],
  18010. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  18011. referencedClasses: [],
  18012. messageSends: []
  18013. }),
  18014. $globals.BlockClosure);
  18015. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  18016. $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";
  18017. $core.addMethod(
  18018. $core.method({
  18019. selector: "arguments",
  18020. protocol: "accessing",
  18021. fn: function (){
  18022. var self=this,$self=this;
  18023. return $core.withContext(function($ctx1) {
  18024. return self.args || [];
  18025. return self;
  18026. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  18027. },
  18028. args: [],
  18029. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  18030. referencedClasses: [],
  18031. messageSends: []
  18032. }),
  18033. $globals.CompiledMethod);
  18034. $core.addMethod(
  18035. $core.method({
  18036. selector: "browse",
  18037. protocol: "browsing",
  18038. fn: function (){
  18039. var self=this,$self=this;
  18040. return $core.withContext(function($ctx1) {
  18041. $recv($globals.Finder)._findMethod_(self);
  18042. return self;
  18043. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  18044. },
  18045. args: [],
  18046. source: "browse\x0a\x09Finder findMethod: self",
  18047. referencedClasses: ["Finder"],
  18048. messageSends: ["findMethod:"]
  18049. }),
  18050. $globals.CompiledMethod);
  18051. $core.addMethod(
  18052. $core.method({
  18053. selector: "category",
  18054. protocol: "accessing",
  18055. fn: function (){
  18056. var self=this,$self=this;
  18057. return $core.withContext(function($ctx1) {
  18058. return $self._protocol();
  18059. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  18060. },
  18061. args: [],
  18062. source: "category\x0a\x09^ self protocol",
  18063. referencedClasses: [],
  18064. messageSends: ["protocol"]
  18065. }),
  18066. $globals.CompiledMethod);
  18067. $core.addMethod(
  18068. $core.method({
  18069. selector: "defaultProtocol",
  18070. protocol: "defaults",
  18071. fn: function (){
  18072. var self=this,$self=this;
  18073. return "as yet unclassified";
  18074. },
  18075. args: [],
  18076. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18077. referencedClasses: [],
  18078. messageSends: []
  18079. }),
  18080. $globals.CompiledMethod);
  18081. $core.addMethod(
  18082. $core.method({
  18083. selector: "fn",
  18084. protocol: "accessing",
  18085. fn: function (){
  18086. var self=this,$self=this;
  18087. return $core.withContext(function($ctx1) {
  18088. return $self._basicAt_("fn");
  18089. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  18090. },
  18091. args: [],
  18092. source: "fn\x0a\x09^ self basicAt: 'fn'",
  18093. referencedClasses: [],
  18094. messageSends: ["basicAt:"]
  18095. }),
  18096. $globals.CompiledMethod);
  18097. $core.addMethod(
  18098. $core.method({
  18099. selector: "fn:",
  18100. protocol: "accessing",
  18101. fn: function (aBlock){
  18102. var self=this,$self=this;
  18103. return $core.withContext(function($ctx1) {
  18104. $self._basicAt_put_("fn",aBlock);
  18105. return self;
  18106. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18107. },
  18108. args: ["aBlock"],
  18109. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18110. referencedClasses: [],
  18111. messageSends: ["basicAt:put:"]
  18112. }),
  18113. $globals.CompiledMethod);
  18114. $core.addMethod(
  18115. $core.method({
  18116. selector: "isCompiledMethod",
  18117. protocol: "testing",
  18118. fn: function (){
  18119. var self=this,$self=this;
  18120. return true;
  18121. },
  18122. args: [],
  18123. source: "isCompiledMethod\x0a\x09^ true",
  18124. referencedClasses: [],
  18125. messageSends: []
  18126. }),
  18127. $globals.CompiledMethod);
  18128. $core.addMethod(
  18129. $core.method({
  18130. selector: "isOverridden",
  18131. protocol: "testing",
  18132. fn: function (){
  18133. var self=this,$self=this;
  18134. var selector;
  18135. return $core.withContext(function($ctx1) {
  18136. var $1;
  18137. var $early={};
  18138. try {
  18139. selector=$self._selector();
  18140. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18141. return $core.withContext(function($ctx2) {
  18142. $1=$recv(each)._includesSelector_(selector);
  18143. if($core.assert($1)){
  18144. throw $early=[true];
  18145. }
  18146. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18147. }));
  18148. return false;
  18149. }
  18150. catch(e) {if(e===$early)return e[0]; throw e}
  18151. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18152. },
  18153. args: [],
  18154. 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",
  18155. referencedClasses: [],
  18156. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18157. }),
  18158. $globals.CompiledMethod);
  18159. $core.addMethod(
  18160. $core.method({
  18161. selector: "isOverride",
  18162. protocol: "testing",
  18163. fn: function (){
  18164. var self=this,$self=this;
  18165. var superclass;
  18166. return $core.withContext(function($ctx1) {
  18167. var $1,$2,$receiver;
  18168. $1=$self._methodClass();
  18169. $ctx1.sendIdx["methodClass"]=1;
  18170. superclass=$recv($1)._superclass();
  18171. $ctx1.sendIdx["superclass"]=1;
  18172. $2=superclass;
  18173. if(($receiver = $2) == null || $receiver.a$nil){
  18174. return false;
  18175. } else {
  18176. $2;
  18177. }
  18178. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18179. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18180. },
  18181. args: [],
  18182. 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",
  18183. referencedClasses: [],
  18184. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18185. }),
  18186. $globals.CompiledMethod);
  18187. $core.addMethod(
  18188. $core.method({
  18189. selector: "messageSends",
  18190. protocol: "accessing",
  18191. fn: function (){
  18192. var self=this,$self=this;
  18193. return $core.withContext(function($ctx1) {
  18194. return $self._basicAt_("messageSends");
  18195. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18196. },
  18197. args: [],
  18198. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18199. referencedClasses: [],
  18200. messageSends: ["basicAt:"]
  18201. }),
  18202. $globals.CompiledMethod);
  18203. $core.addMethod(
  18204. $core.method({
  18205. selector: "methodClass",
  18206. protocol: "accessing",
  18207. fn: function (){
  18208. var self=this,$self=this;
  18209. return $core.withContext(function($ctx1) {
  18210. return $self._basicAt_("owner");
  18211. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18212. },
  18213. args: [],
  18214. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18215. referencedClasses: [],
  18216. messageSends: ["basicAt:"]
  18217. }),
  18218. $globals.CompiledMethod);
  18219. $core.addMethod(
  18220. $core.method({
  18221. selector: "package",
  18222. protocol: "accessing",
  18223. fn: function (){
  18224. var self=this,$self=this;
  18225. return $core.withContext(function($ctx1) {
  18226. var $1,$receiver;
  18227. $1=$self._methodClass();
  18228. if(($receiver = $1) == null || $receiver.a$nil){
  18229. return $1;
  18230. } else {
  18231. var class_;
  18232. class_=$receiver;
  18233. return $recv(class_)._packageOfProtocol_($self._protocol());
  18234. }
  18235. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18236. },
  18237. args: [],
  18238. 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 ]",
  18239. referencedClasses: [],
  18240. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18241. }),
  18242. $globals.CompiledMethod);
  18243. $core.addMethod(
  18244. $core.method({
  18245. selector: "protocol",
  18246. protocol: "accessing",
  18247. fn: function (){
  18248. var self=this,$self=this;
  18249. return $core.withContext(function($ctx1) {
  18250. var $1,$receiver;
  18251. $1=$self._basicAt_("protocol");
  18252. if(($receiver = $1) == null || $receiver.a$nil){
  18253. return $self._defaultProtocol();
  18254. } else {
  18255. return $1;
  18256. }
  18257. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18258. },
  18259. args: [],
  18260. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18261. referencedClasses: [],
  18262. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18263. }),
  18264. $globals.CompiledMethod);
  18265. $core.addMethod(
  18266. $core.method({
  18267. selector: "protocol:",
  18268. protocol: "accessing",
  18269. fn: function (aString){
  18270. var self=this,$self=this;
  18271. var oldProtocol;
  18272. return $core.withContext(function($ctx1) {
  18273. var $1,$3,$2,$4,$receiver;
  18274. oldProtocol=$self._protocol();
  18275. $self._basicAt_put_("protocol",aString);
  18276. $1=$recv($globals.SystemAnnouncer)._current();
  18277. $3=$recv($globals.MethodMoved)._new();
  18278. $recv($3)._method_(self);
  18279. $recv($3)._oldProtocol_(oldProtocol);
  18280. $2=$recv($3)._yourself();
  18281. $recv($1)._announce_($2);
  18282. $4=$self._methodClass();
  18283. if(($receiver = $4) == null || $receiver.a$nil){
  18284. $4;
  18285. } else {
  18286. var methodClass;
  18287. methodClass=$receiver;
  18288. $recv($recv(methodClass)._organization())._addElement_(aString);
  18289. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18290. }
  18291. return self;
  18292. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18293. },
  18294. args: ["aString"],
  18295. 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 ]",
  18296. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18297. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18298. }),
  18299. $globals.CompiledMethod);
  18300. $core.addMethod(
  18301. $core.method({
  18302. selector: "referencedClasses",
  18303. protocol: "accessing",
  18304. fn: function (){
  18305. var self=this,$self=this;
  18306. return $core.withContext(function($ctx1) {
  18307. return $self._basicAt_("referencedClasses");
  18308. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18309. },
  18310. args: [],
  18311. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18312. referencedClasses: [],
  18313. messageSends: ["basicAt:"]
  18314. }),
  18315. $globals.CompiledMethod);
  18316. $core.addMethod(
  18317. $core.method({
  18318. selector: "selector",
  18319. protocol: "accessing",
  18320. fn: function (){
  18321. var self=this,$self=this;
  18322. return $core.withContext(function($ctx1) {
  18323. return $self._basicAt_("selector");
  18324. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18325. },
  18326. args: [],
  18327. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18328. referencedClasses: [],
  18329. messageSends: ["basicAt:"]
  18330. }),
  18331. $globals.CompiledMethod);
  18332. $core.addMethod(
  18333. $core.method({
  18334. selector: "selector:",
  18335. protocol: "accessing",
  18336. fn: function (aString){
  18337. var self=this,$self=this;
  18338. return $core.withContext(function($ctx1) {
  18339. $self._basicAt_put_("selector",aString);
  18340. return self;
  18341. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18342. },
  18343. args: ["aString"],
  18344. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18345. referencedClasses: [],
  18346. messageSends: ["basicAt:put:"]
  18347. }),
  18348. $globals.CompiledMethod);
  18349. $core.addMethod(
  18350. $core.method({
  18351. selector: "sendTo:arguments:",
  18352. protocol: "evaluating",
  18353. fn: function (anObject,aCollection){
  18354. var self=this,$self=this;
  18355. return $core.withContext(function($ctx1) {
  18356. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18357. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18358. },
  18359. args: ["anObject", "aCollection"],
  18360. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18361. referencedClasses: [],
  18362. messageSends: ["applyTo:arguments:", "fn"]
  18363. }),
  18364. $globals.CompiledMethod);
  18365. $core.addMethod(
  18366. $core.method({
  18367. selector: "source",
  18368. protocol: "accessing",
  18369. fn: function (){
  18370. var self=this,$self=this;
  18371. return $core.withContext(function($ctx1) {
  18372. var $1,$receiver;
  18373. $1=$self._basicAt_("source");
  18374. if(($receiver = $1) == null || $receiver.a$nil){
  18375. return "";
  18376. } else {
  18377. return $1;
  18378. }
  18379. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18380. },
  18381. args: [],
  18382. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18383. referencedClasses: [],
  18384. messageSends: ["ifNil:", "basicAt:"]
  18385. }),
  18386. $globals.CompiledMethod);
  18387. $core.addMethod(
  18388. $core.method({
  18389. selector: "source:",
  18390. protocol: "accessing",
  18391. fn: function (aString){
  18392. var self=this,$self=this;
  18393. return $core.withContext(function($ctx1) {
  18394. $self._basicAt_put_("source",aString);
  18395. return self;
  18396. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18397. },
  18398. args: ["aString"],
  18399. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18400. referencedClasses: [],
  18401. messageSends: ["basicAt:put:"]
  18402. }),
  18403. $globals.CompiledMethod);
  18404. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18405. $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`";
  18406. $core.addMethod(
  18407. $core.method({
  18408. selector: "addWorker",
  18409. protocol: "private",
  18410. fn: function (){
  18411. var self=this,$self=this;
  18412. return $core.withContext(function($ctx1) {
  18413. $recv($self["@worker"])._valueWithTimeout_((0));
  18414. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18415. return self;
  18416. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18417. },
  18418. args: [],
  18419. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18420. referencedClasses: [],
  18421. messageSends: ["valueWithTimeout:", "+"]
  18422. }),
  18423. $globals.ForkPool);
  18424. $core.addMethod(
  18425. $core.method({
  18426. selector: "defaultMaxPoolSize",
  18427. protocol: "defaults",
  18428. fn: function (){
  18429. var self=this,$self=this;
  18430. return $core.withContext(function($ctx1) {
  18431. return $recv($self._class())._defaultMaxPoolSize();
  18432. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18433. },
  18434. args: [],
  18435. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18436. referencedClasses: [],
  18437. messageSends: ["defaultMaxPoolSize", "class"]
  18438. }),
  18439. $globals.ForkPool);
  18440. $core.addMethod(
  18441. $core.method({
  18442. selector: "fork:",
  18443. protocol: "actions",
  18444. fn: function (aBlock){
  18445. var self=this,$self=this;
  18446. return $core.withContext(function($ctx1) {
  18447. var $1;
  18448. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18449. if($core.assert($1)){
  18450. $self._addWorker();
  18451. }
  18452. $recv($self["@queue"])._nextPut_(aBlock);
  18453. return self;
  18454. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18455. },
  18456. args: ["aBlock"],
  18457. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18458. referencedClasses: [],
  18459. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18460. }),
  18461. $globals.ForkPool);
  18462. $core.addMethod(
  18463. $core.method({
  18464. selector: "initialize",
  18465. protocol: "initialization",
  18466. fn: function (){
  18467. var self=this,$self=this;
  18468. return $core.withContext(function($ctx1) {
  18469. (
  18470. $ctx1.supercall = true,
  18471. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18472. $ctx1.supercall = false;
  18473. $self["@poolSize"]=(0);
  18474. $self["@queue"]=$recv($globals.Queue)._new();
  18475. $self["@worker"]=$self._makeWorker();
  18476. return self;
  18477. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18478. },
  18479. args: [],
  18480. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18481. referencedClasses: ["Queue"],
  18482. messageSends: ["initialize", "new", "makeWorker"]
  18483. }),
  18484. $globals.ForkPool);
  18485. $core.addMethod(
  18486. $core.method({
  18487. selector: "makeWorker",
  18488. protocol: "initialization",
  18489. fn: function (){
  18490. var self=this,$self=this;
  18491. var sentinel;
  18492. return $core.withContext(function($ctx1) {
  18493. var $1;
  18494. sentinel=$recv($globals.Object)._new();
  18495. return (function(){
  18496. var block;
  18497. return $core.withContext(function($ctx2) {
  18498. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18499. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18500. return sentinel;
  18501. }));
  18502. $1=$recv(block).__eq_eq(sentinel);
  18503. if(!$core.assert($1)){
  18504. return $recv((function(){
  18505. return $core.withContext(function($ctx3) {
  18506. return $recv(block)._value();
  18507. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18508. }))._ensure_((function(){
  18509. return $core.withContext(function($ctx3) {
  18510. return $self._addWorker();
  18511. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18512. }));
  18513. }
  18514. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18515. });
  18516. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18517. },
  18518. args: [],
  18519. 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 ] ]]",
  18520. referencedClasses: ["Object"],
  18521. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18522. }),
  18523. $globals.ForkPool);
  18524. $core.addMethod(
  18525. $core.method({
  18526. selector: "maxPoolSize",
  18527. protocol: "accessing",
  18528. fn: function (){
  18529. var self=this,$self=this;
  18530. return $core.withContext(function($ctx1) {
  18531. var $1,$receiver;
  18532. $1=$self["@maxPoolSize"];
  18533. if(($receiver = $1) == null || $receiver.a$nil){
  18534. return $self._defaultMaxPoolSize();
  18535. } else {
  18536. return $1;
  18537. }
  18538. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18539. },
  18540. args: [],
  18541. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18542. referencedClasses: [],
  18543. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18544. }),
  18545. $globals.ForkPool);
  18546. $core.addMethod(
  18547. $core.method({
  18548. selector: "maxPoolSize:",
  18549. protocol: "accessing",
  18550. fn: function (anInteger){
  18551. var self=this,$self=this;
  18552. $self["@maxPoolSize"]=anInteger;
  18553. return self;
  18554. },
  18555. args: ["anInteger"],
  18556. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18557. referencedClasses: [],
  18558. messageSends: []
  18559. }),
  18560. $globals.ForkPool);
  18561. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18562. $core.addMethod(
  18563. $core.method({
  18564. selector: "default",
  18565. protocol: "accessing",
  18566. fn: function (){
  18567. var self=this,$self=this;
  18568. return $core.withContext(function($ctx1) {
  18569. var $1,$receiver;
  18570. $1=$self["@default"];
  18571. if(($receiver = $1) == null || $receiver.a$nil){
  18572. $self["@default"]=$self._new();
  18573. return $self["@default"];
  18574. } else {
  18575. return $1;
  18576. }
  18577. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18578. },
  18579. args: [],
  18580. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18581. referencedClasses: [],
  18582. messageSends: ["ifNil:", "new"]
  18583. }),
  18584. $globals.ForkPool.a$cls);
  18585. $core.addMethod(
  18586. $core.method({
  18587. selector: "defaultMaxPoolSize",
  18588. protocol: "accessing",
  18589. fn: function (){
  18590. var self=this,$self=this;
  18591. return (100);
  18592. },
  18593. args: [],
  18594. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18595. referencedClasses: [],
  18596. messageSends: []
  18597. }),
  18598. $globals.ForkPool.a$cls);
  18599. $core.addMethod(
  18600. $core.method({
  18601. selector: "resetDefault",
  18602. protocol: "accessing",
  18603. fn: function (){
  18604. var self=this,$self=this;
  18605. $self["@default"]=nil;
  18606. return self;
  18607. },
  18608. args: [],
  18609. source: "resetDefault\x0a\x09default := nil",
  18610. referencedClasses: [],
  18611. messageSends: []
  18612. }),
  18613. $globals.ForkPool.a$cls);
  18614. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18615. $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.";
  18616. $core.addMethod(
  18617. $core.method({
  18618. selector: "arguments",
  18619. protocol: "accessing",
  18620. fn: function (){
  18621. var self=this,$self=this;
  18622. return $self["@arguments"];
  18623. },
  18624. args: [],
  18625. source: "arguments\x0a\x09^ arguments",
  18626. referencedClasses: [],
  18627. messageSends: []
  18628. }),
  18629. $globals.Message);
  18630. $core.addMethod(
  18631. $core.method({
  18632. selector: "arguments:",
  18633. protocol: "accessing",
  18634. fn: function (anArray){
  18635. var self=this,$self=this;
  18636. $self["@arguments"]=anArray;
  18637. return self;
  18638. },
  18639. args: ["anArray"],
  18640. source: "arguments: anArray\x0a\x09arguments := anArray",
  18641. referencedClasses: [],
  18642. messageSends: []
  18643. }),
  18644. $globals.Message);
  18645. $core.addMethod(
  18646. $core.method({
  18647. selector: "printOn:",
  18648. protocol: "printing",
  18649. fn: function (aStream){
  18650. var self=this,$self=this;
  18651. return $core.withContext(function($ctx1) {
  18652. (
  18653. $ctx1.supercall = true,
  18654. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18655. $ctx1.supercall = false;
  18656. $recv(aStream)._nextPutAll_("(");
  18657. $ctx1.sendIdx["nextPutAll:"]=1;
  18658. $recv(aStream)._nextPutAll_($self._selector());
  18659. $ctx1.sendIdx["nextPutAll:"]=2;
  18660. $recv(aStream)._nextPutAll_(")");
  18661. return self;
  18662. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18663. },
  18664. args: ["aStream"],
  18665. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18666. referencedClasses: [],
  18667. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18668. }),
  18669. $globals.Message);
  18670. $core.addMethod(
  18671. $core.method({
  18672. selector: "selector",
  18673. protocol: "accessing",
  18674. fn: function (){
  18675. var self=this,$self=this;
  18676. return $self["@selector"];
  18677. },
  18678. args: [],
  18679. source: "selector\x0a\x09^ selector",
  18680. referencedClasses: [],
  18681. messageSends: []
  18682. }),
  18683. $globals.Message);
  18684. $core.addMethod(
  18685. $core.method({
  18686. selector: "selector:",
  18687. protocol: "accessing",
  18688. fn: function (aString){
  18689. var self=this,$self=this;
  18690. $self["@selector"]=aString;
  18691. return self;
  18692. },
  18693. args: ["aString"],
  18694. source: "selector: aString\x0a\x09selector := aString",
  18695. referencedClasses: [],
  18696. messageSends: []
  18697. }),
  18698. $globals.Message);
  18699. $core.addMethod(
  18700. $core.method({
  18701. selector: "sendTo:",
  18702. protocol: "actions",
  18703. fn: function (anObject){
  18704. var self=this,$self=this;
  18705. return $core.withContext(function($ctx1) {
  18706. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18707. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18708. },
  18709. args: ["anObject"],
  18710. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18711. referencedClasses: [],
  18712. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18713. }),
  18714. $globals.Message);
  18715. $core.addMethod(
  18716. $core.method({
  18717. selector: "selector:arguments:",
  18718. protocol: "instance creation",
  18719. fn: function (aString,anArray){
  18720. var self=this,$self=this;
  18721. return $core.withContext(function($ctx1) {
  18722. var $1;
  18723. $1=$self._new();
  18724. $recv($1)._selector_(aString);
  18725. $recv($1)._arguments_(anArray);
  18726. return $recv($1)._yourself();
  18727. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18728. },
  18729. args: ["aString", "anArray"],
  18730. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18731. referencedClasses: [],
  18732. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18733. }),
  18734. $globals.Message.a$cls);
  18735. $core.addMethod(
  18736. $core.method({
  18737. selector: "selector:arguments:notUnderstoodBy:",
  18738. protocol: "dnu handling",
  18739. fn: function (aString,anArray,anObject){
  18740. var self=this,$self=this;
  18741. return $core.withContext(function($ctx1) {
  18742. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18743. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18744. },
  18745. args: ["aString", "anArray", "anObject"],
  18746. source: "selector: aString arguments: anArray notUnderstoodBy: anObject\x0a\x09\x22Creates the message and passes it to #doesNotUnderstand:.\x0a\x09Used by kernel to handle MNU.\x22\x0a\x09^ anObject doesNotUnderstand:\x0a\x09\x09(self selector: aString arguments: anArray)",
  18747. referencedClasses: [],
  18748. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18749. }),
  18750. $globals.Message.a$cls);
  18751. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18752. $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.";
  18753. $core.addMethod(
  18754. $core.method({
  18755. selector: "arguments",
  18756. protocol: "accessing",
  18757. fn: function (){
  18758. var self=this,$self=this;
  18759. return $core.withContext(function($ctx1) {
  18760. return $recv($self["@message"])._arguments();
  18761. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18762. },
  18763. args: [],
  18764. source: "arguments\x0a\x09^ message arguments",
  18765. referencedClasses: [],
  18766. messageSends: ["arguments"]
  18767. }),
  18768. $globals.MessageSend);
  18769. $core.addMethod(
  18770. $core.method({
  18771. selector: "arguments:",
  18772. protocol: "accessing",
  18773. fn: function (aCollection){
  18774. var self=this,$self=this;
  18775. return $core.withContext(function($ctx1) {
  18776. $recv($self["@message"])._arguments_(aCollection);
  18777. return self;
  18778. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18779. },
  18780. args: ["aCollection"],
  18781. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18782. referencedClasses: [],
  18783. messageSends: ["arguments:"]
  18784. }),
  18785. $globals.MessageSend);
  18786. $core.addMethod(
  18787. $core.method({
  18788. selector: "initialize",
  18789. protocol: "initialization",
  18790. fn: function (){
  18791. var self=this,$self=this;
  18792. return $core.withContext(function($ctx1) {
  18793. (
  18794. $ctx1.supercall = true,
  18795. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18796. $ctx1.supercall = false;
  18797. $self["@message"]=$recv($globals.Message)._new();
  18798. return self;
  18799. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18800. },
  18801. args: [],
  18802. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18803. referencedClasses: ["Message"],
  18804. messageSends: ["initialize", "new"]
  18805. }),
  18806. $globals.MessageSend);
  18807. $core.addMethod(
  18808. $core.method({
  18809. selector: "printOn:",
  18810. protocol: "printing",
  18811. fn: function (aStream){
  18812. var self=this,$self=this;
  18813. return $core.withContext(function($ctx1) {
  18814. (
  18815. $ctx1.supercall = true,
  18816. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18817. $ctx1.supercall = false;
  18818. $recv(aStream)._nextPutAll_("(");
  18819. $ctx1.sendIdx["nextPutAll:"]=1;
  18820. $recv(aStream)._nextPutAll_($self._receiver());
  18821. $ctx1.sendIdx["nextPutAll:"]=2;
  18822. $recv(aStream)._nextPutAll_(" >> ");
  18823. $ctx1.sendIdx["nextPutAll:"]=3;
  18824. $recv(aStream)._nextPutAll_($self._selector());
  18825. $ctx1.sendIdx["nextPutAll:"]=4;
  18826. $recv(aStream)._nextPutAll_(")");
  18827. return self;
  18828. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18829. },
  18830. args: ["aStream"],
  18831. 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: ')'",
  18832. referencedClasses: [],
  18833. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18834. }),
  18835. $globals.MessageSend);
  18836. $core.addMethod(
  18837. $core.method({
  18838. selector: "receiver",
  18839. protocol: "accessing",
  18840. fn: function (){
  18841. var self=this,$self=this;
  18842. return $self["@receiver"];
  18843. },
  18844. args: [],
  18845. source: "receiver\x0a\x09^ receiver",
  18846. referencedClasses: [],
  18847. messageSends: []
  18848. }),
  18849. $globals.MessageSend);
  18850. $core.addMethod(
  18851. $core.method({
  18852. selector: "receiver:",
  18853. protocol: "accessing",
  18854. fn: function (anObject){
  18855. var self=this,$self=this;
  18856. $self["@receiver"]=anObject;
  18857. return self;
  18858. },
  18859. args: ["anObject"],
  18860. source: "receiver: anObject\x0a\x09receiver := anObject",
  18861. referencedClasses: [],
  18862. messageSends: []
  18863. }),
  18864. $globals.MessageSend);
  18865. $core.addMethod(
  18866. $core.method({
  18867. selector: "selector",
  18868. protocol: "accessing",
  18869. fn: function (){
  18870. var self=this,$self=this;
  18871. return $core.withContext(function($ctx1) {
  18872. return $recv($self["@message"])._selector();
  18873. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18874. },
  18875. args: [],
  18876. source: "selector\x0a\x09^ message selector",
  18877. referencedClasses: [],
  18878. messageSends: ["selector"]
  18879. }),
  18880. $globals.MessageSend);
  18881. $core.addMethod(
  18882. $core.method({
  18883. selector: "selector:",
  18884. protocol: "accessing",
  18885. fn: function (aString){
  18886. var self=this,$self=this;
  18887. return $core.withContext(function($ctx1) {
  18888. $recv($self["@message"])._selector_(aString);
  18889. return self;
  18890. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18891. },
  18892. args: ["aString"],
  18893. source: "selector: aString\x0a\x09message selector: aString",
  18894. referencedClasses: [],
  18895. messageSends: ["selector:"]
  18896. }),
  18897. $globals.MessageSend);
  18898. $core.addMethod(
  18899. $core.method({
  18900. selector: "value",
  18901. protocol: "evaluating",
  18902. fn: function (){
  18903. var self=this,$self=this;
  18904. return $core.withContext(function($ctx1) {
  18905. return $recv($self["@message"])._sendTo_($self._receiver());
  18906. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18907. },
  18908. args: [],
  18909. source: "value\x0a\x09^ message sendTo: self receiver",
  18910. referencedClasses: [],
  18911. messageSends: ["sendTo:", "receiver"]
  18912. }),
  18913. $globals.MessageSend);
  18914. $core.addMethod(
  18915. $core.method({
  18916. selector: "value:",
  18917. protocol: "evaluating",
  18918. fn: function (anObject){
  18919. var self=this,$self=this;
  18920. return $core.withContext(function($ctx1) {
  18921. var $1;
  18922. $1=$self["@message"];
  18923. $recv($1)._arguments_([anObject]);
  18924. return $recv($1)._sendTo_($self._receiver());
  18925. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18926. },
  18927. args: ["anObject"],
  18928. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18929. referencedClasses: [],
  18930. messageSends: ["arguments:", "sendTo:", "receiver"]
  18931. }),
  18932. $globals.MessageSend);
  18933. $core.addMethod(
  18934. $core.method({
  18935. selector: "value:value:",
  18936. protocol: "evaluating",
  18937. fn: function (firstArgument,secondArgument){
  18938. var self=this,$self=this;
  18939. return $core.withContext(function($ctx1) {
  18940. var $1;
  18941. $1=$self["@message"];
  18942. $recv($1)._arguments_([firstArgument,secondArgument]);
  18943. return $recv($1)._sendTo_($self._receiver());
  18944. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18945. },
  18946. args: ["firstArgument", "secondArgument"],
  18947. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18948. referencedClasses: [],
  18949. messageSends: ["arguments:", "sendTo:", "receiver"]
  18950. }),
  18951. $globals.MessageSend);
  18952. $core.addMethod(
  18953. $core.method({
  18954. selector: "value:value:value:",
  18955. protocol: "evaluating",
  18956. fn: function (firstArgument,secondArgument,thirdArgument){
  18957. var self=this,$self=this;
  18958. return $core.withContext(function($ctx1) {
  18959. var $1;
  18960. $1=$self["@message"];
  18961. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18962. return $recv($1)._sendTo_($self._receiver());
  18963. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18964. },
  18965. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18966. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18967. referencedClasses: [],
  18968. messageSends: ["arguments:", "sendTo:", "receiver"]
  18969. }),
  18970. $globals.MessageSend);
  18971. $core.addMethod(
  18972. $core.method({
  18973. selector: "valueWithPossibleArguments:",
  18974. protocol: "evaluating",
  18975. fn: function (aCollection){
  18976. var self=this,$self=this;
  18977. return $core.withContext(function($ctx1) {
  18978. $self._arguments_(aCollection);
  18979. return $self._value();
  18980. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  18981. },
  18982. args: ["aCollection"],
  18983. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  18984. referencedClasses: [],
  18985. messageSends: ["arguments:", "value"]
  18986. }),
  18987. $globals.MessageSend);
  18988. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  18989. $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`.";
  18990. $core.addMethod(
  18991. $core.method({
  18992. selector: "asString",
  18993. protocol: "converting",
  18994. fn: function (){
  18995. var self=this,$self=this;
  18996. return $core.withContext(function($ctx1) {
  18997. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  18998. $2=$self._isBlockContext();
  18999. if($core.assert($2)){
  19000. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  19001. $ctx1.sendIdx[","]=2;
  19002. $1=$recv($3).__comma(")");
  19003. $ctx1.sendIdx[","]=1;
  19004. } else {
  19005. var methodClass;
  19006. methodClass=$recv($self._method())._methodClass();
  19007. $5=methodClass;
  19008. $7=$self._receiver();
  19009. $ctx1.sendIdx["receiver"]=1;
  19010. $6=$recv($7)._class();
  19011. $ctx1.sendIdx["class"]=1;
  19012. $4=$recv($5).__eq($6);
  19013. if($core.assert($4)){
  19014. $11=$self._receiver();
  19015. $ctx1.sendIdx["receiver"]=2;
  19016. $10=$recv($11)._class();
  19017. $ctx1.sendIdx["class"]=2;
  19018. $9=$recv($10)._name();
  19019. $ctx1.sendIdx["name"]=1;
  19020. $8=$recv($9).__comma(" >> ");
  19021. $ctx1.sendIdx[","]=4;
  19022. $12=$self._selector();
  19023. $ctx1.sendIdx["selector"]=1;
  19024. $1=$recv($8).__comma($12);
  19025. $ctx1.sendIdx[","]=3;
  19026. } else {
  19027. $16=$recv($recv($self._receiver())._class())._name();
  19028. $ctx1.sendIdx["name"]=2;
  19029. $15=$recv($16).__comma("(");
  19030. $14=$recv($15).__comma($recv(methodClass)._name());
  19031. $ctx1.sendIdx[","]=7;
  19032. $13=$recv($14).__comma(") >> ");
  19033. $ctx1.sendIdx[","]=6;
  19034. $1=$recv($13).__comma($self._selector());
  19035. $ctx1.sendIdx[","]=5;
  19036. }
  19037. }
  19038. return $1;
  19039. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  19040. },
  19041. args: [],
  19042. 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 ] ]",
  19043. referencedClasses: [],
  19044. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  19045. }),
  19046. $globals.MethodContext);
  19047. $core.addMethod(
  19048. $core.method({
  19049. selector: "basicReceiver",
  19050. protocol: "accessing",
  19051. fn: function (){
  19052. var self=this,$self=this;
  19053. return $core.withContext(function($ctx1) {
  19054. return self.receiver;
  19055. return self;
  19056. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  19057. },
  19058. args: [],
  19059. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  19060. referencedClasses: [],
  19061. messageSends: []
  19062. }),
  19063. $globals.MethodContext);
  19064. $core.addMethod(
  19065. $core.method({
  19066. selector: "evaluatedSelector",
  19067. protocol: "accessing",
  19068. fn: function (){
  19069. var self=this,$self=this;
  19070. return $core.withContext(function($ctx1) {
  19071. return self.evaluatedSelector;
  19072. return self;
  19073. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  19074. },
  19075. args: [],
  19076. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  19077. referencedClasses: [],
  19078. messageSends: []
  19079. }),
  19080. $globals.MethodContext);
  19081. $core.addMethod(
  19082. $core.method({
  19083. selector: "findContextSuchThat:",
  19084. protocol: "accessing",
  19085. fn: function (testBlock){
  19086. var self=this,$self=this;
  19087. var context;
  19088. return $core.withContext(function($ctx1) {
  19089. var $1;
  19090. var $early={};
  19091. try {
  19092. context=self;
  19093. $recv((function(){
  19094. return $core.withContext(function($ctx2) {
  19095. return $recv(context)._isNil();
  19096. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19097. }))._whileFalse_((function(){
  19098. return $core.withContext(function($ctx2) {
  19099. $1=$recv(testBlock)._value_(context);
  19100. if($core.assert($1)){
  19101. throw $early=[context];
  19102. }
  19103. context=$recv(context)._outerContext();
  19104. return context;
  19105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19106. }));
  19107. return nil;
  19108. }
  19109. catch(e) {if(e===$early)return e[0]; throw e}
  19110. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19111. },
  19112. args: ["testBlock"],
  19113. 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",
  19114. referencedClasses: [],
  19115. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19116. }),
  19117. $globals.MethodContext);
  19118. $core.addMethod(
  19119. $core.method({
  19120. selector: "home",
  19121. protocol: "accessing",
  19122. fn: function (){
  19123. var self=this,$self=this;
  19124. return $core.withContext(function($ctx1) {
  19125. return self.homeContext;
  19126. return self;
  19127. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19128. },
  19129. args: [],
  19130. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19131. referencedClasses: [],
  19132. messageSends: []
  19133. }),
  19134. $globals.MethodContext);
  19135. $core.addMethod(
  19136. $core.method({
  19137. selector: "index",
  19138. protocol: "accessing",
  19139. fn: function (){
  19140. var self=this,$self=this;
  19141. return $core.withContext(function($ctx1) {
  19142. return self.index || 0;
  19143. return self;
  19144. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19145. },
  19146. args: [],
  19147. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19148. referencedClasses: [],
  19149. messageSends: []
  19150. }),
  19151. $globals.MethodContext);
  19152. $core.addMethod(
  19153. $core.method({
  19154. selector: "isBlockContext",
  19155. protocol: "testing",
  19156. fn: function (){
  19157. var self=this,$self=this;
  19158. return $core.withContext(function($ctx1) {
  19159. return $recv($self._selector())._isNil();
  19160. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19161. },
  19162. args: [],
  19163. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19164. referencedClasses: [],
  19165. messageSends: ["isNil", "selector"]
  19166. }),
  19167. $globals.MethodContext);
  19168. $core.addMethod(
  19169. $core.method({
  19170. selector: "locals",
  19171. protocol: "accessing",
  19172. fn: function (){
  19173. var self=this,$self=this;
  19174. return $core.withContext(function($ctx1) {
  19175. return self.locals || {};
  19176. return self;
  19177. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19178. },
  19179. args: [],
  19180. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19181. referencedClasses: [],
  19182. messageSends: []
  19183. }),
  19184. $globals.MethodContext);
  19185. $core.addMethod(
  19186. $core.method({
  19187. selector: "method",
  19188. protocol: "accessing",
  19189. fn: function (){
  19190. var self=this,$self=this;
  19191. var method,lookupClass,receiverClass,supercall;
  19192. return $core.withContext(function($ctx1) {
  19193. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19194. $1=$self._methodContext();
  19195. $ctx1.sendIdx["methodContext"]=1;
  19196. if(($receiver = $1) == null || $receiver.a$nil){
  19197. return nil;
  19198. } else {
  19199. $1;
  19200. }
  19201. $3=$self._methodContext();
  19202. $ctx1.sendIdx["methodContext"]=2;
  19203. $2=$recv($3)._receiver();
  19204. receiverClass=$recv($2)._class();
  19205. $4=receiverClass;
  19206. $6=$self._methodContext();
  19207. $ctx1.sendIdx["methodContext"]=3;
  19208. $5=$recv($6)._selector();
  19209. $ctx1.sendIdx["selector"]=1;
  19210. method=$recv($4)._lookupSelector_($5);
  19211. $ctx1.sendIdx["lookupSelector:"]=1;
  19212. $7=$self._outerContext();
  19213. if(($receiver = $7) == null || $receiver.a$nil){
  19214. supercall=false;
  19215. } else {
  19216. var outer;
  19217. outer=$receiver;
  19218. supercall=$recv(outer)._supercall();
  19219. }
  19220. $8=supercall;
  19221. if($core.assert($8)){
  19222. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19223. } else {
  19224. return method;
  19225. }
  19226. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19227. },
  19228. args: [],
  19229. 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 ]",
  19230. referencedClasses: [],
  19231. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19232. }),
  19233. $globals.MethodContext);
  19234. $core.addMethod(
  19235. $core.method({
  19236. selector: "methodContext",
  19237. protocol: "accessing",
  19238. fn: function (){
  19239. var self=this,$self=this;
  19240. return $core.withContext(function($ctx1) {
  19241. var $1,$2,$receiver;
  19242. $1=$self._isBlockContext();
  19243. if(!$core.assert($1)){
  19244. return self;
  19245. }
  19246. $2=$self._outerContext();
  19247. if(($receiver = $2) == null || $receiver.a$nil){
  19248. return $2;
  19249. } else {
  19250. var outer;
  19251. outer=$receiver;
  19252. return $recv(outer)._methodContext();
  19253. }
  19254. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19255. },
  19256. args: [],
  19257. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19258. referencedClasses: [],
  19259. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19260. }),
  19261. $globals.MethodContext);
  19262. $core.addMethod(
  19263. $core.method({
  19264. selector: "outerContext",
  19265. protocol: "accessing",
  19266. fn: function (){
  19267. var self=this,$self=this;
  19268. return $core.withContext(function($ctx1) {
  19269. return self.outerContext || self.homeContext;
  19270. return self;
  19271. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19272. },
  19273. args: [],
  19274. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19275. referencedClasses: [],
  19276. messageSends: []
  19277. }),
  19278. $globals.MethodContext);
  19279. $core.addMethod(
  19280. $core.method({
  19281. selector: "printOn:",
  19282. protocol: "printing",
  19283. fn: function (aStream){
  19284. var self=this,$self=this;
  19285. return $core.withContext(function($ctx1) {
  19286. (
  19287. $ctx1.supercall = true,
  19288. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19289. $ctx1.supercall = false;
  19290. $recv(aStream)._nextPutAll_("(");
  19291. $ctx1.sendIdx["nextPutAll:"]=1;
  19292. $recv(aStream)._nextPutAll_($self._asString());
  19293. $ctx1.sendIdx["nextPutAll:"]=2;
  19294. $recv(aStream)._nextPutAll_(")");
  19295. return self;
  19296. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19297. },
  19298. args: ["aStream"],
  19299. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19300. referencedClasses: [],
  19301. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19302. }),
  19303. $globals.MethodContext);
  19304. $core.addMethod(
  19305. $core.method({
  19306. selector: "receiver",
  19307. protocol: "accessing",
  19308. fn: function (){
  19309. var self=this,$self=this;
  19310. return $core.withContext(function($ctx1) {
  19311. var $2,$1;
  19312. $1=$recv($self._isBlockContext())._and_((function(){
  19313. return $core.withContext(function($ctx2) {
  19314. $2=$self._outerContext();
  19315. $ctx2.sendIdx["outerContext"]=1;
  19316. return $recv($2)._notNil();
  19317. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19318. }));
  19319. if($core.assert($1)){
  19320. return $recv($self._outerContext())._receiver();
  19321. } else {
  19322. return $self._basicReceiver();
  19323. }
  19324. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19325. },
  19326. args: [],
  19327. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19328. referencedClasses: [],
  19329. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19330. }),
  19331. $globals.MethodContext);
  19332. $core.addMethod(
  19333. $core.method({
  19334. selector: "selector",
  19335. protocol: "accessing",
  19336. fn: function (){
  19337. var self=this,$self=this;
  19338. return $core.withContext(function($ctx1) {
  19339. if(self.selector) {
  19340. return $core.js2st(self.selector);
  19341. } else {
  19342. return nil;
  19343. }
  19344. ;
  19345. return self;
  19346. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19347. },
  19348. args: [],
  19349. 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'>",
  19350. referencedClasses: [],
  19351. messageSends: []
  19352. }),
  19353. $globals.MethodContext);
  19354. $core.addMethod(
  19355. $core.method({
  19356. selector: "sendIndexAt:",
  19357. protocol: "accessing",
  19358. fn: function (aSelector){
  19359. var self=this,$self=this;
  19360. return $core.withContext(function($ctx1) {
  19361. return self.sendIdx[aSelector] || 0;
  19362. return self;
  19363. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19364. },
  19365. args: ["aSelector"],
  19366. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19367. referencedClasses: [],
  19368. messageSends: []
  19369. }),
  19370. $globals.MethodContext);
  19371. $core.addMethod(
  19372. $core.method({
  19373. selector: "sendIndexes",
  19374. protocol: "accessing",
  19375. fn: function (){
  19376. var self=this,$self=this;
  19377. return $core.withContext(function($ctx1) {
  19378. return self.sendIdx;
  19379. return self;
  19380. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19381. },
  19382. args: [],
  19383. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19384. referencedClasses: [],
  19385. messageSends: []
  19386. }),
  19387. $globals.MethodContext);
  19388. $core.addMethod(
  19389. $core.method({
  19390. selector: "stubHere",
  19391. protocol: "accessing",
  19392. fn: function (){
  19393. var self=this,$self=this;
  19394. return $core.withContext(function($ctx1) {
  19395. self.homeContext = undefined;
  19396. return self;
  19397. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19398. },
  19399. args: [],
  19400. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19401. referencedClasses: [],
  19402. messageSends: []
  19403. }),
  19404. $globals.MethodContext);
  19405. $core.addMethod(
  19406. $core.method({
  19407. selector: "stubToAtMost:",
  19408. protocol: "error handling",
  19409. fn: function (anInteger){
  19410. var self=this,$self=this;
  19411. var context;
  19412. return $core.withContext(function($ctx1) {
  19413. var $1,$2,$receiver;
  19414. context=self;
  19415. $recv(anInteger)._timesRepeat_((function(){
  19416. return $core.withContext(function($ctx2) {
  19417. $1=context;
  19418. if(($receiver = $1) == null || $receiver.a$nil){
  19419. context=$1;
  19420. } else {
  19421. context=$recv(context)._home();
  19422. }
  19423. return context;
  19424. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19425. }));
  19426. $2=context;
  19427. if(($receiver = $2) == null || $receiver.a$nil){
  19428. $2;
  19429. } else {
  19430. $recv(context)._stubHere();
  19431. }
  19432. return self;
  19433. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19434. },
  19435. args: ["anInteger"],
  19436. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19437. referencedClasses: [],
  19438. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19439. }),
  19440. $globals.MethodContext);
  19441. $core.addMethod(
  19442. $core.method({
  19443. selector: "supercall",
  19444. protocol: "accessing",
  19445. fn: function (){
  19446. var self=this,$self=this;
  19447. return $core.withContext(function($ctx1) {
  19448. return self.supercall == true;
  19449. return self;
  19450. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19451. },
  19452. args: [],
  19453. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19454. referencedClasses: [],
  19455. messageSends: []
  19456. }),
  19457. $globals.MethodContext);
  19458. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19459. $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' ]";
  19460. $core.addMethod(
  19461. $core.method({
  19462. selector: "constructorNamed:",
  19463. protocol: "instance creation",
  19464. fn: function (aString){
  19465. var self=this,$self=this;
  19466. return $core.withContext(function($ctx1) {
  19467. var nativeFunc=$globals.Platform._globals()[aString];
  19468. return new nativeFunc();
  19469. ;
  19470. return self;
  19471. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19472. },
  19473. args: ["aString"],
  19474. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19475. referencedClasses: [],
  19476. messageSends: []
  19477. }),
  19478. $globals.NativeFunction.a$cls);
  19479. $core.addMethod(
  19480. $core.method({
  19481. selector: "constructorNamed:value:",
  19482. protocol: "instance creation",
  19483. fn: function (aString,anObject){
  19484. var self=this,$self=this;
  19485. return $core.withContext(function($ctx1) {
  19486. var nativeFunc=$globals.Platform._globals()[aString];
  19487. return new nativeFunc(anObject);
  19488. ;
  19489. return self;
  19490. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19491. },
  19492. args: ["aString", "anObject"],
  19493. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19494. referencedClasses: [],
  19495. messageSends: []
  19496. }),
  19497. $globals.NativeFunction.a$cls);
  19498. $core.addMethod(
  19499. $core.method({
  19500. selector: "constructorNamed:value:value:",
  19501. protocol: "instance creation",
  19502. fn: function (aString,anObject,anObject2){
  19503. var self=this,$self=this;
  19504. return $core.withContext(function($ctx1) {
  19505. var nativeFunc=$globals.Platform._globals[aString];
  19506. return new nativeFunc(anObject,anObject2);
  19507. ;
  19508. return self;
  19509. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19510. },
  19511. args: ["aString", "anObject", "anObject2"],
  19512. source: "constructorNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19513. referencedClasses: [],
  19514. messageSends: []
  19515. }),
  19516. $globals.NativeFunction.a$cls);
  19517. $core.addMethod(
  19518. $core.method({
  19519. selector: "constructorNamed:value:value:value:",
  19520. protocol: "instance creation",
  19521. fn: function (aString,anObject,anObject2,anObject3){
  19522. var self=this,$self=this;
  19523. return $core.withContext(function($ctx1) {
  19524. var nativeFunc=$globals.Platform._globals[aString];
  19525. return new nativeFunc(anObject,anObject2, anObject3);
  19526. ;
  19527. return self;
  19528. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19529. },
  19530. args: ["aString", "anObject", "anObject2", "anObject3"],
  19531. source: "constructorNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19532. referencedClasses: [],
  19533. messageSends: []
  19534. }),
  19535. $globals.NativeFunction.a$cls);
  19536. $core.addMethod(
  19537. $core.method({
  19538. selector: "constructorOf:",
  19539. protocol: "instance creation",
  19540. fn: function (nativeFunc){
  19541. var self=this,$self=this;
  19542. return $core.withContext(function($ctx1) {
  19543. return new nativeFunc();
  19544. ;
  19545. return self;
  19546. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19547. },
  19548. args: ["nativeFunc"],
  19549. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19550. referencedClasses: [],
  19551. messageSends: []
  19552. }),
  19553. $globals.NativeFunction.a$cls);
  19554. $core.addMethod(
  19555. $core.method({
  19556. selector: "constructorOf:value:",
  19557. protocol: "instance creation",
  19558. fn: function (nativeFunc,anObject){
  19559. var self=this,$self=this;
  19560. return $core.withContext(function($ctx1) {
  19561. return new nativeFunc(anObject);
  19562. ;
  19563. return self;
  19564. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19565. },
  19566. args: ["nativeFunc", "anObject"],
  19567. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19568. referencedClasses: [],
  19569. messageSends: []
  19570. }),
  19571. $globals.NativeFunction.a$cls);
  19572. $core.addMethod(
  19573. $core.method({
  19574. selector: "constructorOf:value:value:",
  19575. protocol: "instance creation",
  19576. fn: function (nativeFunc,anObject,anObject2){
  19577. var self=this,$self=this;
  19578. return $core.withContext(function($ctx1) {
  19579. return new nativeFunc(anObject,anObject2);
  19580. ;
  19581. return self;
  19582. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19583. },
  19584. args: ["nativeFunc", "anObject", "anObject2"],
  19585. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19586. referencedClasses: [],
  19587. messageSends: []
  19588. }),
  19589. $globals.NativeFunction.a$cls);
  19590. $core.addMethod(
  19591. $core.method({
  19592. selector: "constructorOf:value:value:value:",
  19593. protocol: "instance creation",
  19594. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19595. var self=this,$self=this;
  19596. return $core.withContext(function($ctx1) {
  19597. return new nativeFunc(anObject,anObject2, anObject3);
  19598. ;
  19599. return self;
  19600. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19601. },
  19602. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19603. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19604. referencedClasses: [],
  19605. messageSends: []
  19606. }),
  19607. $globals.NativeFunction.a$cls);
  19608. $core.addMethod(
  19609. $core.method({
  19610. selector: "exists:",
  19611. protocol: "testing",
  19612. fn: function (aString){
  19613. var self=this,$self=this;
  19614. return $core.withContext(function($ctx1) {
  19615. return $recv($globals.Platform)._includesGlobal_(aString);
  19616. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19617. },
  19618. args: ["aString"],
  19619. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19620. referencedClasses: ["Platform"],
  19621. messageSends: ["includesGlobal:"]
  19622. }),
  19623. $globals.NativeFunction.a$cls);
  19624. $core.addMethod(
  19625. $core.method({
  19626. selector: "functionNamed:",
  19627. protocol: "function calling",
  19628. fn: function (aString){
  19629. var self=this,$self=this;
  19630. return $core.withContext(function($ctx1) {
  19631. var nativeFunc=$globals.Platform._globals[aString];
  19632. return nativeFunc();
  19633. ;
  19634. return self;
  19635. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19636. },
  19637. args: ["aString"],
  19638. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19639. referencedClasses: [],
  19640. messageSends: []
  19641. }),
  19642. $globals.NativeFunction.a$cls);
  19643. $core.addMethod(
  19644. $core.method({
  19645. selector: "functionNamed:value:",
  19646. protocol: "function calling",
  19647. fn: function (aString,anObject){
  19648. var self=this,$self=this;
  19649. return $core.withContext(function($ctx1) {
  19650. var nativeFunc=$globals.Platform._globals()[aString];
  19651. return nativeFunc(anObject);
  19652. ;
  19653. return self;
  19654. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19655. },
  19656. args: ["aString", "anObject"],
  19657. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19658. referencedClasses: [],
  19659. messageSends: []
  19660. }),
  19661. $globals.NativeFunction.a$cls);
  19662. $core.addMethod(
  19663. $core.method({
  19664. selector: "functionNamed:value:value:",
  19665. protocol: "function calling",
  19666. fn: function (aString,anObject,anObject2){
  19667. var self=this,$self=this;
  19668. return $core.withContext(function($ctx1) {
  19669. var nativeFunc=$globals.Platform._globals()[aString];
  19670. return nativeFunc(anObject,anObject2);
  19671. ;
  19672. return self;
  19673. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19674. },
  19675. args: ["aString", "anObject", "anObject2"],
  19676. source: "functionNamed: aString value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19677. referencedClasses: [],
  19678. messageSends: []
  19679. }),
  19680. $globals.NativeFunction.a$cls);
  19681. $core.addMethod(
  19682. $core.method({
  19683. selector: "functionNamed:value:value:value:",
  19684. protocol: "function calling",
  19685. fn: function (aString,anObject,anObject2,anObject3){
  19686. var self=this,$self=this;
  19687. return $core.withContext(function($ctx1) {
  19688. var nativeFunc=$globals.Platform._globals()[aString];
  19689. return nativeFunc(anObject,anObject2, anObject3);
  19690. ;
  19691. return self;
  19692. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19693. },
  19694. args: ["aString", "anObject", "anObject2", "anObject3"],
  19695. source: "functionNamed: aString value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19696. referencedClasses: [],
  19697. messageSends: []
  19698. }),
  19699. $globals.NativeFunction.a$cls);
  19700. $core.addMethod(
  19701. $core.method({
  19702. selector: "functionNamed:valueWithArgs:",
  19703. protocol: "function calling",
  19704. fn: function (aString,args){
  19705. var self=this,$self=this;
  19706. return $core.withContext(function($ctx1) {
  19707. var nativeFunc=$globals.Platform._globals()[aString];
  19708. return Function.prototype.apply.call(nativeFunc, null, args);
  19709. ;
  19710. return self;
  19711. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19712. },
  19713. args: ["aString", "args"],
  19714. source: "functionNamed: aString valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19715. referencedClasses: [],
  19716. messageSends: []
  19717. }),
  19718. $globals.NativeFunction.a$cls);
  19719. $core.addMethod(
  19720. $core.method({
  19721. selector: "functionOf:",
  19722. protocol: "function calling",
  19723. fn: function (nativeFunc){
  19724. var self=this,$self=this;
  19725. return $core.withContext(function($ctx1) {
  19726. return nativeFunc();
  19727. ;
  19728. return self;
  19729. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19730. },
  19731. args: ["nativeFunc"],
  19732. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19733. referencedClasses: [],
  19734. messageSends: []
  19735. }),
  19736. $globals.NativeFunction.a$cls);
  19737. $core.addMethod(
  19738. $core.method({
  19739. selector: "functionOf:value:",
  19740. protocol: "function calling",
  19741. fn: function (nativeFunc,anObject){
  19742. var self=this,$self=this;
  19743. return $core.withContext(function($ctx1) {
  19744. return nativeFunc(anObject);
  19745. ;
  19746. return self;
  19747. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19748. },
  19749. args: ["nativeFunc", "anObject"],
  19750. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19751. referencedClasses: [],
  19752. messageSends: []
  19753. }),
  19754. $globals.NativeFunction.a$cls);
  19755. $core.addMethod(
  19756. $core.method({
  19757. selector: "functionOf:value:value:",
  19758. protocol: "function calling",
  19759. fn: function (nativeFunc,anObject,anObject2){
  19760. var self=this,$self=this;
  19761. return $core.withContext(function($ctx1) {
  19762. return nativeFunc(anObject,anObject2);
  19763. ;
  19764. return self;
  19765. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19766. },
  19767. args: ["nativeFunc", "anObject", "anObject2"],
  19768. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19769. referencedClasses: [],
  19770. messageSends: []
  19771. }),
  19772. $globals.NativeFunction.a$cls);
  19773. $core.addMethod(
  19774. $core.method({
  19775. selector: "functionOf:value:value:value:",
  19776. protocol: "function calling",
  19777. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19778. var self=this,$self=this;
  19779. return $core.withContext(function($ctx1) {
  19780. return nativeFunc(anObject,anObject2, anObject3);
  19781. ;
  19782. return self;
  19783. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19784. },
  19785. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19786. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19787. referencedClasses: [],
  19788. messageSends: []
  19789. }),
  19790. $globals.NativeFunction.a$cls);
  19791. $core.addMethod(
  19792. $core.method({
  19793. selector: "functionOf:valueWithArgs:",
  19794. protocol: "function calling",
  19795. fn: function (nativeFunc,args){
  19796. var self=this,$self=this;
  19797. return $core.withContext(function($ctx1) {
  19798. return Function.prototype.apply.call(nativeFunc, null, args);
  19799. ;
  19800. return self;
  19801. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19802. },
  19803. args: ["nativeFunc", "args"],
  19804. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19805. referencedClasses: [],
  19806. messageSends: []
  19807. }),
  19808. $globals.NativeFunction.a$cls);
  19809. $core.addMethod(
  19810. $core.method({
  19811. selector: "isNativeFunction:",
  19812. protocol: "testing",
  19813. fn: function (anObject){
  19814. var self=this,$self=this;
  19815. return $core.withContext(function($ctx1) {
  19816. return typeof anObject === "function";
  19817. return self;
  19818. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19819. },
  19820. args: ["anObject"],
  19821. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19822. referencedClasses: [],
  19823. messageSends: []
  19824. }),
  19825. $globals.NativeFunction.a$cls);
  19826. $core.addMethod(
  19827. $core.method({
  19828. selector: "methodOf:this:",
  19829. protocol: "method calling",
  19830. fn: function (nativeFunc,thisObject){
  19831. var self=this,$self=this;
  19832. return $core.withContext(function($ctx1) {
  19833. return Function.prototype.call.call(nativeFunc, thisObject);
  19834. ;
  19835. return self;
  19836. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19837. },
  19838. args: ["nativeFunc", "thisObject"],
  19839. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19840. referencedClasses: [],
  19841. messageSends: []
  19842. }),
  19843. $globals.NativeFunction.a$cls);
  19844. $core.addMethod(
  19845. $core.method({
  19846. selector: "methodOf:this:value:",
  19847. protocol: "method calling",
  19848. fn: function (nativeFunc,thisObject,anObject){
  19849. var self=this,$self=this;
  19850. return $core.withContext(function($ctx1) {
  19851. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19852. ;
  19853. return self;
  19854. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19855. },
  19856. args: ["nativeFunc", "thisObject", "anObject"],
  19857. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19858. referencedClasses: [],
  19859. messageSends: []
  19860. }),
  19861. $globals.NativeFunction.a$cls);
  19862. $core.addMethod(
  19863. $core.method({
  19864. selector: "methodOf:this:value:value:",
  19865. protocol: "method calling",
  19866. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19867. var self=this,$self=this;
  19868. return $core.withContext(function($ctx1) {
  19869. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19870. ;
  19871. return self;
  19872. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19873. },
  19874. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19875. 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'>",
  19876. referencedClasses: [],
  19877. messageSends: []
  19878. }),
  19879. $globals.NativeFunction.a$cls);
  19880. $core.addMethod(
  19881. $core.method({
  19882. selector: "methodOf:this:value:value:value:",
  19883. protocol: "method calling",
  19884. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19885. var self=this,$self=this;
  19886. return $core.withContext(function($ctx1) {
  19887. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19888. ;
  19889. return self;
  19890. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19891. },
  19892. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19893. 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'>",
  19894. referencedClasses: [],
  19895. messageSends: []
  19896. }),
  19897. $globals.NativeFunction.a$cls);
  19898. $core.addMethod(
  19899. $core.method({
  19900. selector: "methodOf:this:valueWithArgs:",
  19901. protocol: "method calling",
  19902. fn: function (nativeFunc,thisObject,args){
  19903. var self=this,$self=this;
  19904. return $core.withContext(function($ctx1) {
  19905. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19906. ;
  19907. return self;
  19908. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19909. },
  19910. args: ["nativeFunc", "thisObject", "args"],
  19911. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19912. referencedClasses: [],
  19913. messageSends: []
  19914. }),
  19915. $globals.NativeFunction.a$cls);
  19916. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19917. $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.";
  19918. $core.addMethod(
  19919. $core.method({
  19920. selector: "clearInterval",
  19921. protocol: "timeout/interval",
  19922. fn: function (){
  19923. var self=this,$self=this;
  19924. return $core.withContext(function($ctx1) {
  19925. var interval = $self["@rawTimeout"];
  19926. clearInterval(interval);
  19927. ;
  19928. return self;
  19929. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19930. },
  19931. args: [],
  19932. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  19933. referencedClasses: [],
  19934. messageSends: []
  19935. }),
  19936. $globals.Timeout);
  19937. $core.addMethod(
  19938. $core.method({
  19939. selector: "clearTimeout",
  19940. protocol: "timeout/interval",
  19941. fn: function (){
  19942. var self=this,$self=this;
  19943. return $core.withContext(function($ctx1) {
  19944. var timeout = $self["@rawTimeout"];
  19945. clearTimeout(timeout);
  19946. ;
  19947. return self;
  19948. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  19949. },
  19950. args: [],
  19951. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  19952. referencedClasses: [],
  19953. messageSends: []
  19954. }),
  19955. $globals.Timeout);
  19956. $core.addMethod(
  19957. $core.method({
  19958. selector: "rawTimeout:",
  19959. protocol: "accessing",
  19960. fn: function (anObject){
  19961. var self=this,$self=this;
  19962. $self["@rawTimeout"]=anObject;
  19963. return self;
  19964. },
  19965. args: ["anObject"],
  19966. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19967. referencedClasses: [],
  19968. messageSends: []
  19969. }),
  19970. $globals.Timeout);
  19971. $core.addMethod(
  19972. $core.method({
  19973. selector: "on:",
  19974. protocol: "instance creation",
  19975. fn: function (anObject){
  19976. var self=this,$self=this;
  19977. return $core.withContext(function($ctx1) {
  19978. var $1;
  19979. $1=$self._new();
  19980. $recv($1)._rawTimeout_(anObject);
  19981. return $recv($1)._yourself();
  19982. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  19983. },
  19984. args: ["anObject"],
  19985. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  19986. referencedClasses: [],
  19987. messageSends: ["rawTimeout:", "new", "yourself"]
  19988. }),
  19989. $globals.Timeout.a$cls);
  19990. });
  19991. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  19992. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  19993. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  19994. $core.addPackage("Kernel-Dag");
  19995. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  19996. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  19997. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  19998. $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:`.";
  19999. $core.addMethod(
  20000. $core.method({
  20001. selector: "value:",
  20002. protocol: "evaluating",
  20003. fn: function (anObject){
  20004. var self=this,$self=this;
  20005. return $core.withContext(function($ctx1) {
  20006. return $self._visit_(anObject);
  20007. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  20008. },
  20009. args: ["anObject"],
  20010. source: "value: anObject\x0a\x09^ self visit: anObject",
  20011. referencedClasses: [],
  20012. messageSends: ["visit:"]
  20013. }),
  20014. $globals.AbstractDagVisitor);
  20015. $core.addMethod(
  20016. $core.method({
  20017. selector: "visit:",
  20018. protocol: "visiting",
  20019. fn: function (aNode){
  20020. var self=this,$self=this;
  20021. return $core.withContext(function($ctx1) {
  20022. return $recv(aNode)._acceptDagVisitor_(self);
  20023. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20024. },
  20025. args: ["aNode"],
  20026. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  20027. referencedClasses: [],
  20028. messageSends: ["acceptDagVisitor:"]
  20029. }),
  20030. $globals.AbstractDagVisitor);
  20031. $core.addMethod(
  20032. $core.method({
  20033. selector: "visitAll:",
  20034. protocol: "visiting",
  20035. fn: function (aCollection){
  20036. var self=this,$self=this;
  20037. return $core.withContext(function($ctx1) {
  20038. return $recv(aCollection)._collect_((function(each){
  20039. return $core.withContext(function($ctx2) {
  20040. return $self._visit_(each);
  20041. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20042. }));
  20043. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  20044. },
  20045. args: ["aCollection"],
  20046. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  20047. referencedClasses: [],
  20048. messageSends: ["collect:", "visit:"]
  20049. }),
  20050. $globals.AbstractDagVisitor);
  20051. $core.addMethod(
  20052. $core.method({
  20053. selector: "visitAllChildren:",
  20054. protocol: "visiting",
  20055. fn: function (aDagNode){
  20056. var self=this,$self=this;
  20057. return $core.withContext(function($ctx1) {
  20058. return $self._visitAll_($recv(aDagNode)._dagChildren());
  20059. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  20060. },
  20061. args: ["aDagNode"],
  20062. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  20063. referencedClasses: [],
  20064. messageSends: ["visitAll:", "dagChildren"]
  20065. }),
  20066. $globals.AbstractDagVisitor);
  20067. $core.addMethod(
  20068. $core.method({
  20069. selector: "visitDagNode:",
  20070. protocol: "visiting",
  20071. fn: function (aNode){
  20072. var self=this,$self=this;
  20073. return $core.withContext(function($ctx1) {
  20074. $self._subclassResponsibility();
  20075. return self;
  20076. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20077. },
  20078. args: ["aNode"],
  20079. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  20080. referencedClasses: [],
  20081. messageSends: ["subclassResponsibility"]
  20082. }),
  20083. $globals.AbstractDagVisitor);
  20084. $core.addMethod(
  20085. $core.method({
  20086. selector: "visitDagNodeVariantRedux:",
  20087. protocol: "visiting",
  20088. fn: function (aNode){
  20089. var self=this,$self=this;
  20090. var newChildren,oldChildren;
  20091. return $core.withContext(function($ctx1) {
  20092. var $2,$3,$1,$4,$5;
  20093. var $early={};
  20094. try {
  20095. oldChildren=$recv(aNode)._dagChildren();
  20096. newChildren=$self._visitAllChildren_(aNode);
  20097. $2=$recv(oldChildren)._size();
  20098. $ctx1.sendIdx["size"]=1;
  20099. $3=$recv(newChildren)._size();
  20100. $ctx1.sendIdx["size"]=2;
  20101. $1=$recv($2).__eq($3);
  20102. if($core.assert($1)){
  20103. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  20104. return $core.withContext(function($ctx2) {
  20105. $4=$recv(oldChildren)._at_(i);
  20106. $ctx2.sendIdx["at:"]=1;
  20107. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20108. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20109. }),(function(){
  20110. throw $early=[aNode];
  20111. }));
  20112. }
  20113. $5=$recv(aNode)._copy();
  20114. $recv($5)._dagChildren_(newChildren);
  20115. return $recv($5)._yourself();
  20116. }
  20117. catch(e) {if(e===$early)return e[0]; throw e}
  20118. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20119. },
  20120. args: ["aNode"],
  20121. 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",
  20122. referencedClasses: [],
  20123. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20124. }),
  20125. $globals.AbstractDagVisitor);
  20126. $core.addMethod(
  20127. $core.method({
  20128. selector: "visitDagNodeVariantSimple:",
  20129. protocol: "visiting",
  20130. fn: function (aNode){
  20131. var self=this,$self=this;
  20132. return $core.withContext(function($ctx1) {
  20133. $self._visitAllChildren_(aNode);
  20134. return aNode;
  20135. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20136. },
  20137. args: ["aNode"],
  20138. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20139. referencedClasses: [],
  20140. messageSends: ["visitAllChildren:"]
  20141. }),
  20142. $globals.AbstractDagVisitor);
  20143. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20144. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20145. $core.addMethod(
  20146. $core.method({
  20147. selector: "initialize",
  20148. protocol: "initialization",
  20149. fn: function (){
  20150. var self=this,$self=this;
  20151. return $core.withContext(function($ctx1) {
  20152. (
  20153. $ctx1.supercall = true,
  20154. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20155. $ctx1.supercall = false;
  20156. $self["@path"]=[];
  20157. return self;
  20158. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20159. },
  20160. args: [],
  20161. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20162. referencedClasses: [],
  20163. messageSends: ["initialize"]
  20164. }),
  20165. $globals.PathDagVisitor);
  20166. $core.addMethod(
  20167. $core.method({
  20168. selector: "path",
  20169. protocol: "accessing",
  20170. fn: function (){
  20171. var self=this,$self=this;
  20172. return $self["@path"];
  20173. },
  20174. args: [],
  20175. source: "path\x0a\x09^ path",
  20176. referencedClasses: [],
  20177. messageSends: []
  20178. }),
  20179. $globals.PathDagVisitor);
  20180. $core.addMethod(
  20181. $core.method({
  20182. selector: "visit:",
  20183. protocol: "visiting",
  20184. fn: function (aNode){
  20185. var self=this,$self=this;
  20186. var oldPath,result;
  20187. return $core.withContext(function($ctx1) {
  20188. result=aNode;
  20189. oldPath=$self["@path"];
  20190. $recv((function(){
  20191. return $core.withContext(function($ctx2) {
  20192. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20193. result=(
  20194. $ctx2.supercall = true,
  20195. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20196. $ctx2.supercall = false;
  20197. return result;
  20198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20199. }))._ensure_((function(){
  20200. $self["@path"]=oldPath;
  20201. return $self["@path"];
  20202. }));
  20203. return result;
  20204. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20205. },
  20206. args: ["aNode"],
  20207. 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",
  20208. referencedClasses: [],
  20209. messageSends: ["ensure:", ",", "visit:"]
  20210. }),
  20211. $globals.PathDagVisitor);
  20212. $core.addMethod(
  20213. $core.method({
  20214. selector: "visitDagNodeVariantRedux:",
  20215. protocol: "visiting",
  20216. fn: function (aNode){
  20217. var self=this,$self=this;
  20218. var newNode;
  20219. return $core.withContext(function($ctx1) {
  20220. var $1;
  20221. newNode=(
  20222. $ctx1.supercall = true,
  20223. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20224. $ctx1.supercall = false;
  20225. $1=$recv(aNode).__eq_eq(newNode);
  20226. if(!$core.assert($1)){
  20227. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20228. }
  20229. return newNode;
  20230. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20231. },
  20232. args: ["aNode"],
  20233. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20234. referencedClasses: [],
  20235. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20236. }),
  20237. $globals.PathDagVisitor);
  20238. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20239. $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).";
  20240. $core.addMethod(
  20241. $core.method({
  20242. selector: "acceptDagVisitor:",
  20243. protocol: "visiting",
  20244. fn: function (aVisitor){
  20245. var self=this,$self=this;
  20246. return $core.withContext(function($ctx1) {
  20247. return $recv(aVisitor)._visitDagNode_(self);
  20248. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20249. },
  20250. args: ["aVisitor"],
  20251. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20252. referencedClasses: [],
  20253. messageSends: ["visitDagNode:"]
  20254. }),
  20255. $globals.DagNode);
  20256. $core.addMethod(
  20257. $core.method({
  20258. selector: "allDagChildren",
  20259. protocol: "accessing",
  20260. fn: function (){
  20261. var self=this,$self=this;
  20262. var allNodes;
  20263. return $core.withContext(function($ctx1) {
  20264. var $1;
  20265. $1=$self._dagChildren();
  20266. $ctx1.sendIdx["dagChildren"]=1;
  20267. allNodes=$recv($1)._asSet();
  20268. $recv($self._dagChildren())._do_((function(each){
  20269. return $core.withContext(function($ctx2) {
  20270. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20271. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20272. }));
  20273. return allNodes;
  20274. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20275. },
  20276. args: [],
  20277. 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",
  20278. referencedClasses: [],
  20279. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20280. }),
  20281. $globals.DagNode);
  20282. $core.addMethod(
  20283. $core.method({
  20284. selector: "dagChildren",
  20285. protocol: "accessing",
  20286. fn: function (){
  20287. var self=this,$self=this;
  20288. return $core.withContext(function($ctx1) {
  20289. $self._subclassResponsibility();
  20290. return self;
  20291. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20292. },
  20293. args: [],
  20294. source: "dagChildren\x0a\x09self subclassResponsibility",
  20295. referencedClasses: [],
  20296. messageSends: ["subclassResponsibility"]
  20297. }),
  20298. $globals.DagNode);
  20299. $core.addMethod(
  20300. $core.method({
  20301. selector: "dagChildren:",
  20302. protocol: "accessing",
  20303. fn: function (aCollection){
  20304. var self=this,$self=this;
  20305. return $core.withContext(function($ctx1) {
  20306. $self._subclassResponsibility();
  20307. return self;
  20308. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20309. },
  20310. args: ["aCollection"],
  20311. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20312. referencedClasses: [],
  20313. messageSends: ["subclassResponsibility"]
  20314. }),
  20315. $globals.DagNode);
  20316. $core.addMethod(
  20317. $core.method({
  20318. selector: "isDagNode",
  20319. protocol: "testing",
  20320. fn: function (){
  20321. var self=this,$self=this;
  20322. return true;
  20323. },
  20324. args: [],
  20325. source: "isDagNode\x0a\x09^ true",
  20326. referencedClasses: [],
  20327. messageSends: []
  20328. }),
  20329. $globals.DagNode);
  20330. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20331. $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.";
  20332. $core.addMethod(
  20333. $core.method({
  20334. selector: "addDagChild:",
  20335. protocol: "accessing",
  20336. fn: function (aDagNode){
  20337. var self=this,$self=this;
  20338. return $core.withContext(function($ctx1) {
  20339. $recv($self._dagChildren())._add_(aDagNode);
  20340. return self;
  20341. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20342. },
  20343. args: ["aDagNode"],
  20344. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20345. referencedClasses: [],
  20346. messageSends: ["add:", "dagChildren"]
  20347. }),
  20348. $globals.DagParentNode);
  20349. $core.addMethod(
  20350. $core.method({
  20351. selector: "dagChildren",
  20352. protocol: "accessing",
  20353. fn: function (){
  20354. var self=this,$self=this;
  20355. return $core.withContext(function($ctx1) {
  20356. var $1,$receiver;
  20357. $1=$self["@nodes"];
  20358. if(($receiver = $1) == null || $receiver.a$nil){
  20359. $self["@nodes"]=$recv($globals.Array)._new();
  20360. return $self["@nodes"];
  20361. } else {
  20362. return $1;
  20363. }
  20364. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20365. },
  20366. args: [],
  20367. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20368. referencedClasses: ["Array"],
  20369. messageSends: ["ifNil:", "new"]
  20370. }),
  20371. $globals.DagParentNode);
  20372. $core.addMethod(
  20373. $core.method({
  20374. selector: "dagChildren:",
  20375. protocol: "accessing",
  20376. fn: function (aCollection){
  20377. var self=this,$self=this;
  20378. $self["@nodes"]=aCollection;
  20379. return self;
  20380. },
  20381. args: ["aCollection"],
  20382. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20383. referencedClasses: [],
  20384. messageSends: []
  20385. }),
  20386. $globals.DagParentNode);
  20387. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20388. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20389. $core.addMethod(
  20390. $core.method({
  20391. selector: "dagChildren",
  20392. protocol: "accessing",
  20393. fn: function (){
  20394. var self=this,$self=this;
  20395. return [];
  20396. },
  20397. args: [],
  20398. source: "dagChildren\x0a\x09^ #()",
  20399. referencedClasses: [],
  20400. messageSends: []
  20401. }),
  20402. $globals.DagSink);
  20403. $core.addMethod(
  20404. $core.method({
  20405. selector: "dagChildren:",
  20406. protocol: "accessing",
  20407. fn: function (aCollection){
  20408. var self=this,$self=this;
  20409. return $core.withContext(function($ctx1) {
  20410. $recv(aCollection)._ifNotEmpty_((function(){
  20411. return $core.withContext(function($ctx2) {
  20412. return $self._error_("A DagSink cannot have children.");
  20413. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20414. }));
  20415. return self;
  20416. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20417. },
  20418. args: ["aCollection"],
  20419. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20420. referencedClasses: [],
  20421. messageSends: ["ifNotEmpty:", "error:"]
  20422. }),
  20423. $globals.DagSink);
  20424. $core.addMethod(
  20425. $core.method({
  20426. selector: "isDagNode",
  20427. protocol: "*Kernel-Dag",
  20428. fn: function (){
  20429. var self=this,$self=this;
  20430. return false;
  20431. },
  20432. args: [],
  20433. source: "isDagNode\x0a\x09^ false",
  20434. referencedClasses: [],
  20435. messageSends: []
  20436. }),
  20437. $globals.Object);
  20438. });
  20439. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20440. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20441. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20442. $core.addPackage("Kernel-Exceptions");
  20443. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20444. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20445. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20446. $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.";
  20447. $core.addMethod(
  20448. $core.method({
  20449. selector: "beHandled",
  20450. protocol: "accessing",
  20451. fn: function (){
  20452. var self=this,$self=this;
  20453. return $core.withContext(function($ctx1) {
  20454. self.amberHandled = true;
  20455. return self;
  20456. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20457. },
  20458. args: [],
  20459. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20460. referencedClasses: [],
  20461. messageSends: []
  20462. }),
  20463. $globals.Error);
  20464. $core.addMethod(
  20465. $core.method({
  20466. selector: "beUnhandled",
  20467. protocol: "accessing",
  20468. fn: function (){
  20469. var self=this,$self=this;
  20470. return $core.withContext(function($ctx1) {
  20471. self.amberHandled = false;
  20472. return self;
  20473. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20474. },
  20475. args: [],
  20476. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20477. referencedClasses: [],
  20478. messageSends: []
  20479. }),
  20480. $globals.Error);
  20481. $core.addMethod(
  20482. $core.method({
  20483. selector: "context",
  20484. protocol: "accessing",
  20485. fn: function (){
  20486. var self=this,$self=this;
  20487. return $core.withContext(function($ctx1) {
  20488. return self.context;
  20489. return self;
  20490. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20491. },
  20492. args: [],
  20493. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20494. referencedClasses: [],
  20495. messageSends: []
  20496. }),
  20497. $globals.Error);
  20498. $core.addMethod(
  20499. $core.method({
  20500. selector: "initialize",
  20501. protocol: "initialization",
  20502. fn: function (){
  20503. var self=this,$self=this;
  20504. return $core.withContext(function($ctx1) {
  20505. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20506. return self;
  20507. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20508. },
  20509. args: [],
  20510. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20511. referencedClasses: [],
  20512. messageSends: ["messageText:", ",", "name", "class"]
  20513. }),
  20514. $globals.Error);
  20515. $core.addMethod(
  20516. $core.method({
  20517. selector: "isSmalltalkError",
  20518. protocol: "testing",
  20519. fn: function (){
  20520. var self=this,$self=this;
  20521. return $core.withContext(function($ctx1) {
  20522. return self.smalltalkError === true;
  20523. return self;
  20524. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20525. },
  20526. args: [],
  20527. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20528. referencedClasses: [],
  20529. messageSends: []
  20530. }),
  20531. $globals.Error);
  20532. $core.addMethod(
  20533. $core.method({
  20534. selector: "jsStack",
  20535. protocol: "accessing",
  20536. fn: function (){
  20537. var self=this,$self=this;
  20538. return $core.withContext(function($ctx1) {
  20539. return self.stack;
  20540. return self;
  20541. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20542. },
  20543. args: [],
  20544. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20545. referencedClasses: [],
  20546. messageSends: []
  20547. }),
  20548. $globals.Error);
  20549. $core.addMethod(
  20550. $core.method({
  20551. selector: "messageText",
  20552. protocol: "accessing",
  20553. fn: function (){
  20554. var self=this,$self=this;
  20555. return $self["@messageText"];
  20556. },
  20557. args: [],
  20558. source: "messageText\x0a\x09^ messageText",
  20559. referencedClasses: [],
  20560. messageSends: []
  20561. }),
  20562. $globals.Error);
  20563. $core.addMethod(
  20564. $core.method({
  20565. selector: "messageText:",
  20566. protocol: "accessing",
  20567. fn: function (aString){
  20568. var self=this,$self=this;
  20569. $self["@messageText"]=aString;
  20570. return self;
  20571. },
  20572. args: ["aString"],
  20573. source: "messageText: aString\x0a\x09messageText := aString",
  20574. referencedClasses: [],
  20575. messageSends: []
  20576. }),
  20577. $globals.Error);
  20578. $core.addMethod(
  20579. $core.method({
  20580. selector: "outer",
  20581. protocol: "signaling",
  20582. fn: function (){
  20583. var self=this,$self=this;
  20584. return $core.withContext(function($ctx1) {
  20585. return $self._pass();
  20586. }, function($ctx1) {$ctx1.fill(self,"outer",{},$globals.Error)});
  20587. },
  20588. args: [],
  20589. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  20590. referencedClasses: [],
  20591. messageSends: ["pass"]
  20592. }),
  20593. $globals.Error);
  20594. $core.addMethod(
  20595. $core.method({
  20596. selector: "pass",
  20597. protocol: "signaling",
  20598. fn: function (){
  20599. var self=this,$self=this;
  20600. return $core.withContext(function($ctx1) {
  20601. self.amberHandled = false;
  20602. throw self;
  20603. ;
  20604. return self;
  20605. }, function($ctx1) {$ctx1.fill(self,"pass",{},$globals.Error)});
  20606. },
  20607. args: [],
  20608. source: "pass\x0a\x09\x22Let outer handler take care of this.\x22\x0a\x09\x0a\x09<inlineJS: '\x0a\x09\x09self.amberHandled = false;\x0a\x09\x09throw self;\x0a\x09'>",
  20609. referencedClasses: [],
  20610. messageSends: []
  20611. }),
  20612. $globals.Error);
  20613. $core.addMethod(
  20614. $core.method({
  20615. selector: "resignal",
  20616. protocol: "signaling",
  20617. fn: function (){
  20618. var self=this,$self=this;
  20619. return $core.withContext(function($ctx1) {
  20620. $self._deprecatedAPI_("Use #pass.");
  20621. return $self._pass();
  20622. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20623. },
  20624. args: [],
  20625. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  20626. referencedClasses: [],
  20627. messageSends: ["deprecatedAPI:", "pass"]
  20628. }),
  20629. $globals.Error);
  20630. $core.addMethod(
  20631. $core.method({
  20632. selector: "signal",
  20633. protocol: "signaling",
  20634. fn: function (){
  20635. var self=this,$self=this;
  20636. return $core.withContext(function($ctx1) {
  20637. self.amberHandled = false;
  20638. self.context = $core.getThisContext();
  20639. self.smalltalkError = true;
  20640. throw self;
  20641. ;
  20642. return self;
  20643. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20644. },
  20645. args: [],
  20646. 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'>",
  20647. referencedClasses: [],
  20648. messageSends: []
  20649. }),
  20650. $globals.Error);
  20651. $core.addMethod(
  20652. $core.method({
  20653. selector: "signal:",
  20654. protocol: "signaling",
  20655. fn: function (aString){
  20656. var self=this,$self=this;
  20657. return $core.withContext(function($ctx1) {
  20658. $self._messageText_(aString);
  20659. $self._signal();
  20660. return self;
  20661. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20662. },
  20663. args: ["aString"],
  20664. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20665. referencedClasses: [],
  20666. messageSends: ["messageText:", "signal"]
  20667. }),
  20668. $globals.Error);
  20669. $core.addMethod(
  20670. $core.method({
  20671. selector: "signalerContext",
  20672. protocol: "accessing",
  20673. fn: function (){
  20674. var self=this,$self=this;
  20675. return $core.withContext(function($ctx1) {
  20676. return $self._signalerContextFrom_($self._context());
  20677. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20678. },
  20679. args: [],
  20680. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20681. referencedClasses: [],
  20682. messageSends: ["signalerContextFrom:", "context"]
  20683. }),
  20684. $globals.Error);
  20685. $core.addMethod(
  20686. $core.method({
  20687. selector: "signalerContextFrom:",
  20688. protocol: "accessing",
  20689. fn: function (aContext){
  20690. var self=this,$self=this;
  20691. return $core.withContext(function($ctx1) {
  20692. var $3,$2,$1;
  20693. return $recv(aContext)._findContextSuchThat_((function(context){
  20694. return $core.withContext(function($ctx2) {
  20695. $3=$recv(context)._receiver();
  20696. $ctx2.sendIdx["receiver"]=1;
  20697. $2=$recv($3).__eq_eq(self);
  20698. $ctx2.sendIdx["=="]=1;
  20699. $1=$recv($2)._or_((function(){
  20700. return $core.withContext(function($ctx3) {
  20701. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20702. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20703. }));
  20704. return $recv($1)._not();
  20705. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20706. }));
  20707. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20708. },
  20709. args: ["aContext"],
  20710. 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 ]",
  20711. referencedClasses: [],
  20712. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20713. }),
  20714. $globals.Error);
  20715. $core.addMethod(
  20716. $core.method({
  20717. selector: "wasHandled",
  20718. protocol: "testing",
  20719. fn: function (){
  20720. var self=this,$self=this;
  20721. return $core.withContext(function($ctx1) {
  20722. return self.amberHandled || false;
  20723. return self;
  20724. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20725. },
  20726. args: [],
  20727. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20728. referencedClasses: [],
  20729. messageSends: []
  20730. }),
  20731. $globals.Error);
  20732. $core.addMethod(
  20733. $core.method({
  20734. selector: "classTag",
  20735. protocol: "accessing",
  20736. fn: function (){
  20737. var self=this,$self=this;
  20738. return "exception";
  20739. },
  20740. args: [],
  20741. 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'",
  20742. referencedClasses: [],
  20743. messageSends: []
  20744. }),
  20745. $globals.Error.a$cls);
  20746. $core.addMethod(
  20747. $core.method({
  20748. selector: "signal",
  20749. protocol: "instance creation",
  20750. fn: function (){
  20751. var self=this,$self=this;
  20752. return $core.withContext(function($ctx1) {
  20753. return $recv($self._new())._signal();
  20754. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20755. },
  20756. args: [],
  20757. source: "signal\x0a\x09^ self new signal",
  20758. referencedClasses: [],
  20759. messageSends: ["signal", "new"]
  20760. }),
  20761. $globals.Error.a$cls);
  20762. $core.addMethod(
  20763. $core.method({
  20764. selector: "signal:",
  20765. protocol: "instance creation",
  20766. fn: function (aString){
  20767. var self=this,$self=this;
  20768. return $core.withContext(function($ctx1) {
  20769. return $recv($self._new())._signal_(aString);
  20770. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20771. },
  20772. args: ["aString"],
  20773. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20774. referencedClasses: [],
  20775. messageSends: ["signal:", "new"]
  20776. }),
  20777. $globals.Error.a$cls);
  20778. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20779. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20780. $core.addMethod(
  20781. $core.method({
  20782. selector: "messageText",
  20783. protocol: "accessing",
  20784. fn: function (){
  20785. var self=this,$self=this;
  20786. return "Halt encountered";
  20787. },
  20788. args: [],
  20789. source: "messageText\x0a\x09^ 'Halt encountered'",
  20790. referencedClasses: [],
  20791. messageSends: []
  20792. }),
  20793. $globals.Halt);
  20794. $core.addMethod(
  20795. $core.method({
  20796. selector: "signalerContextFrom:",
  20797. protocol: "accessing",
  20798. fn: function (aContext){
  20799. var self=this,$self=this;
  20800. return $core.withContext(function($ctx1) {
  20801. var $3,$2,$1;
  20802. return $recv(aContext)._findContextSuchThat_((function(context){
  20803. return $core.withContext(function($ctx2) {
  20804. $3=$recv(context)._receiver();
  20805. $ctx2.sendIdx["receiver"]=1;
  20806. $2=$recv($3).__eq_eq(self);
  20807. $ctx2.sendIdx["=="]=1;
  20808. $1=$recv($2)._or_((function(){
  20809. return $core.withContext(function($ctx3) {
  20810. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20811. return $core.withContext(function($ctx4) {
  20812. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20813. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20814. }));
  20815. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20816. }));
  20817. $ctx2.sendIdx["or:"]=1;
  20818. return $recv($1)._not();
  20819. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20820. }));
  20821. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20822. },
  20823. args: ["aContext"],
  20824. 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 ]",
  20825. referencedClasses: [],
  20826. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20827. }),
  20828. $globals.Halt);
  20829. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20830. $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:`";
  20831. $core.addMethod(
  20832. $core.method({
  20833. selector: "context:",
  20834. protocol: "accessing",
  20835. fn: function (aMethodContext){
  20836. var self=this,$self=this;
  20837. return $core.withContext(function($ctx1) {
  20838. self.context = aMethodContext;
  20839. return self;
  20840. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20841. },
  20842. args: ["aMethodContext"],
  20843. 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'>",
  20844. referencedClasses: [],
  20845. messageSends: []
  20846. }),
  20847. $globals.JavaScriptException);
  20848. $core.addMethod(
  20849. $core.method({
  20850. selector: "exception",
  20851. protocol: "accessing",
  20852. fn: function (){
  20853. var self=this,$self=this;
  20854. return $self["@exception"];
  20855. },
  20856. args: [],
  20857. source: "exception\x0a\x09^ exception",
  20858. referencedClasses: [],
  20859. messageSends: []
  20860. }),
  20861. $globals.JavaScriptException);
  20862. $core.addMethod(
  20863. $core.method({
  20864. selector: "exception:",
  20865. protocol: "accessing",
  20866. fn: function (anException){
  20867. var self=this,$self=this;
  20868. $self["@exception"]=anException;
  20869. return self;
  20870. },
  20871. args: ["anException"],
  20872. source: "exception: anException\x0a\x09exception := anException",
  20873. referencedClasses: [],
  20874. messageSends: []
  20875. }),
  20876. $globals.JavaScriptException);
  20877. $core.addMethod(
  20878. $core.method({
  20879. selector: "messageText",
  20880. protocol: "accessing",
  20881. fn: function (){
  20882. var self=this,$self=this;
  20883. return $core.withContext(function($ctx1) {
  20884. return "JavaScript exception: " + $self["@exception"].toString();
  20885. return self;
  20886. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20887. },
  20888. args: [],
  20889. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20890. referencedClasses: [],
  20891. messageSends: []
  20892. }),
  20893. $globals.JavaScriptException);
  20894. $core.addMethod(
  20895. $core.method({
  20896. selector: "shouldBeStubbed",
  20897. protocol: "testing",
  20898. fn: function (){
  20899. var self=this,$self=this;
  20900. return $core.withContext(function($ctx1) {
  20901. return $self["@exception"] instanceof RangeError;
  20902. return self;
  20903. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20904. },
  20905. args: [],
  20906. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20907. referencedClasses: [],
  20908. messageSends: []
  20909. }),
  20910. $globals.JavaScriptException);
  20911. $core.addMethod(
  20912. $core.method({
  20913. selector: "wrap",
  20914. protocol: "error handling",
  20915. fn: function (){
  20916. var self=this,$self=this;
  20917. return $core.withContext(function($ctx1) {
  20918. var $1;
  20919. $recv((function(){
  20920. return $core.withContext(function($ctx2) {
  20921. return $self._signal();
  20922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20923. }))._tryCatch_((function(){
  20924. return $core.withContext(function($ctx2) {
  20925. $1=$self._shouldBeStubbed();
  20926. if($core.assert($1)){
  20927. return $recv($self._context())._stubToAtMost_((100));
  20928. }
  20929. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20930. }));
  20931. return self;
  20932. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20933. },
  20934. args: [],
  20935. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20936. referencedClasses: [],
  20937. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20938. }),
  20939. $globals.JavaScriptException);
  20940. $core.addMethod(
  20941. $core.method({
  20942. selector: "on:",
  20943. protocol: "instance creation",
  20944. fn: function (anException){
  20945. var self=this,$self=this;
  20946. return $core.withContext(function($ctx1) {
  20947. var $1;
  20948. $1=$self._new();
  20949. $recv($1)._exception_(anException);
  20950. return $recv($1)._yourself();
  20951. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20952. },
  20953. args: ["anException"],
  20954. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20955. referencedClasses: [],
  20956. messageSends: ["exception:", "new", "yourself"]
  20957. }),
  20958. $globals.JavaScriptException.a$cls);
  20959. $core.addMethod(
  20960. $core.method({
  20961. selector: "on:context:",
  20962. protocol: "instance creation",
  20963. fn: function (anException,aMethodContext){
  20964. var self=this,$self=this;
  20965. return $core.withContext(function($ctx1) {
  20966. var $1;
  20967. $1=$self._new();
  20968. $recv($1)._exception_(anException);
  20969. $recv($1)._context_(aMethodContext);
  20970. return $recv($1)._yourself();
  20971. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  20972. },
  20973. args: ["anException", "aMethodContext"],
  20974. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  20975. referencedClasses: [],
  20976. messageSends: ["exception:", "new", "context:", "yourself"]
  20977. }),
  20978. $globals.JavaScriptException.a$cls);
  20979. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  20980. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  20981. $core.addMethod(
  20982. $core.method({
  20983. selector: "message",
  20984. protocol: "accessing",
  20985. fn: function (){
  20986. var self=this,$self=this;
  20987. return $self["@message"];
  20988. },
  20989. args: [],
  20990. source: "message\x0a\x09^ message",
  20991. referencedClasses: [],
  20992. messageSends: []
  20993. }),
  20994. $globals.MessageNotUnderstood);
  20995. $core.addMethod(
  20996. $core.method({
  20997. selector: "message:",
  20998. protocol: "accessing",
  20999. fn: function (aMessage){
  21000. var self=this,$self=this;
  21001. $self["@message"]=aMessage;
  21002. return self;
  21003. },
  21004. args: ["aMessage"],
  21005. source: "message: aMessage\x0a\x09message := aMessage",
  21006. referencedClasses: [],
  21007. messageSends: []
  21008. }),
  21009. $globals.MessageNotUnderstood);
  21010. $core.addMethod(
  21011. $core.method({
  21012. selector: "messageText",
  21013. protocol: "accessing",
  21014. fn: function (){
  21015. var self=this,$self=this;
  21016. return $core.withContext(function($ctx1) {
  21017. var $1;
  21018. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  21019. $ctx1.sendIdx[","]=1;
  21020. return $1;
  21021. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  21022. },
  21023. args: [],
  21024. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  21025. referencedClasses: [],
  21026. messageSends: [",", "asString", "receiver", "selector", "message"]
  21027. }),
  21028. $globals.MessageNotUnderstood);
  21029. $core.addMethod(
  21030. $core.method({
  21031. selector: "receiver",
  21032. protocol: "accessing",
  21033. fn: function (){
  21034. var self=this,$self=this;
  21035. return $self["@receiver"];
  21036. },
  21037. args: [],
  21038. source: "receiver\x0a\x09^ receiver",
  21039. referencedClasses: [],
  21040. messageSends: []
  21041. }),
  21042. $globals.MessageNotUnderstood);
  21043. $core.addMethod(
  21044. $core.method({
  21045. selector: "receiver:",
  21046. protocol: "accessing",
  21047. fn: function (anObject){
  21048. var self=this,$self=this;
  21049. $self["@receiver"]=anObject;
  21050. return self;
  21051. },
  21052. args: ["anObject"],
  21053. source: "receiver: anObject\x0a\x09receiver := anObject",
  21054. referencedClasses: [],
  21055. messageSends: []
  21056. }),
  21057. $globals.MessageNotUnderstood);
  21058. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  21059. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  21060. $core.addMethod(
  21061. $core.method({
  21062. selector: "object",
  21063. protocol: "accessing",
  21064. fn: function (){
  21065. var self=this,$self=this;
  21066. return $self["@object"];
  21067. },
  21068. args: [],
  21069. source: "object\x0a\x09^ object",
  21070. referencedClasses: [],
  21071. messageSends: []
  21072. }),
  21073. $globals.NonBooleanReceiver);
  21074. $core.addMethod(
  21075. $core.method({
  21076. selector: "object:",
  21077. protocol: "accessing",
  21078. fn: function (anObject){
  21079. var self=this,$self=this;
  21080. $self["@object"]=anObject;
  21081. return self;
  21082. },
  21083. args: ["anObject"],
  21084. source: "object: anObject\x0a\x09object := anObject",
  21085. referencedClasses: [],
  21086. messageSends: []
  21087. }),
  21088. $globals.NonBooleanReceiver);
  21089. $core.addMethod(
  21090. $core.method({
  21091. selector: "signalOn:",
  21092. protocol: "instance creation",
  21093. fn: function (anObject){
  21094. var self=this,$self=this;
  21095. return $core.withContext(function($ctx1) {
  21096. var $1;
  21097. $1=$self._new();
  21098. $recv($1)._object_(anObject);
  21099. return $recv($1)._signal();
  21100. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  21101. },
  21102. args: ["anObject"],
  21103. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  21104. referencedClasses: [],
  21105. messageSends: ["object:", "new", "signal"]
  21106. }),
  21107. $globals.NonBooleanReceiver.a$cls);
  21108. });
  21109. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21110. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21111. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21112. $core.addPackage("Kernel-Promises");
  21113. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  21114. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21115. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21116. $core.addMethod(
  21117. $core.method({
  21118. selector: "all:",
  21119. protocol: "composites",
  21120. fn: function (aCollection){
  21121. var self=this,$self=this;
  21122. return $core.withContext(function($ctx1) {
  21123. return Promise.all($recv(aCollection)._asArray());
  21124. return self;
  21125. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21126. },
  21127. args: ["aCollection"],
  21128. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21129. referencedClasses: [],
  21130. messageSends: []
  21131. }),
  21132. $globals.Promise.a$cls);
  21133. $core.addMethod(
  21134. $core.method({
  21135. selector: "any:",
  21136. protocol: "composites",
  21137. fn: function (aCollection){
  21138. var self=this,$self=this;
  21139. return $core.withContext(function($ctx1) {
  21140. return Promise.race($recv(aCollection)._asArray());
  21141. return self;
  21142. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21143. },
  21144. args: ["aCollection"],
  21145. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21146. referencedClasses: [],
  21147. messageSends: []
  21148. }),
  21149. $globals.Promise.a$cls);
  21150. $core.addMethod(
  21151. $core.method({
  21152. selector: "forBlock:",
  21153. protocol: "instance creation",
  21154. fn: function (aBlock){
  21155. var self=this,$self=this;
  21156. return $core.withContext(function($ctx1) {
  21157. return $recv($self._new())._then_(aBlock);
  21158. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21159. },
  21160. args: ["aBlock"],
  21161. 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",
  21162. referencedClasses: [],
  21163. messageSends: ["then:", "new"]
  21164. }),
  21165. $globals.Promise.a$cls);
  21166. $core.addMethod(
  21167. $core.method({
  21168. selector: "new",
  21169. protocol: "instance creation",
  21170. fn: function (){
  21171. var self=this,$self=this;
  21172. return $core.withContext(function($ctx1) {
  21173. return Promise.resolve();
  21174. return self;
  21175. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21176. },
  21177. args: [],
  21178. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21179. referencedClasses: [],
  21180. messageSends: []
  21181. }),
  21182. $globals.Promise.a$cls);
  21183. $core.addMethod(
  21184. $core.method({
  21185. selector: "new:",
  21186. protocol: "instance creation",
  21187. fn: function (aBlock){
  21188. var self=this,$self=this;
  21189. return $core.withContext(function($ctx1) {
  21190. return new Promise(function (resolve, reject) {
  21191. var model = {value: resolve, signal: reject};
  21192. aBlock._value_(model);
  21193. });
  21194. return self;
  21195. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21196. },
  21197. args: ["aBlock"],
  21198. 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};\x0a aBlock._value_(model);\x0a})'>",
  21199. referencedClasses: [],
  21200. messageSends: []
  21201. }),
  21202. $globals.Promise.a$cls);
  21203. $core.addMethod(
  21204. $core.method({
  21205. selector: "signal:",
  21206. protocol: "instance creation",
  21207. fn: function (anObject){
  21208. var self=this,$self=this;
  21209. return $core.withContext(function($ctx1) {
  21210. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21211. return self;
  21212. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21213. },
  21214. args: ["anObject"],
  21215. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21216. referencedClasses: [],
  21217. messageSends: []
  21218. }),
  21219. $globals.Promise.a$cls);
  21220. $core.addMethod(
  21221. $core.method({
  21222. selector: "value:",
  21223. protocol: "instance creation",
  21224. fn: function (anObject){
  21225. var self=this,$self=this;
  21226. return $core.withContext(function($ctx1) {
  21227. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21228. return self;
  21229. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21230. },
  21231. args: ["anObject"],
  21232. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21233. referencedClasses: [],
  21234. messageSends: []
  21235. }),
  21236. $globals.Promise.a$cls);
  21237. $core.addTrait("TThenable", "Kernel-Promises");
  21238. $core.addMethod(
  21239. $core.method({
  21240. selector: "catch:",
  21241. protocol: "promises",
  21242. fn: function (aBlock){
  21243. var self=this,$self=this;
  21244. return $core.withContext(function($ctx1) {
  21245. return self.then(null, function (err) {return $core.seamless(function () {
  21246. return aBlock._value_(err);
  21247. })});
  21248. return self;
  21249. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21250. },
  21251. args: ["aBlock"],
  21252. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21253. referencedClasses: [],
  21254. messageSends: []
  21255. }),
  21256. $globals.TThenable);
  21257. $core.addMethod(
  21258. $core.method({
  21259. selector: "on:do:",
  21260. protocol: "promises",
  21261. fn: function (aClass,aBlock){
  21262. var self=this,$self=this;
  21263. return $core.withContext(function($ctx1) {
  21264. return self.then(null, function (err) {return $core.seamless(function () {
  21265. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21266. else throw err;
  21267. })});
  21268. return self;
  21269. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21270. },
  21271. args: ["aClass", "aBlock"],
  21272. 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})})'>",
  21273. referencedClasses: [],
  21274. messageSends: []
  21275. }),
  21276. $globals.TThenable);
  21277. $core.addMethod(
  21278. $core.method({
  21279. selector: "on:do:catch:",
  21280. protocol: "promises",
  21281. fn: function (aClass,aBlock,anotherBlock){
  21282. var self=this,$self=this;
  21283. return $core.withContext(function($ctx1) {
  21284. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21285. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21286. },
  21287. args: ["aClass", "aBlock", "anotherBlock"],
  21288. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21289. referencedClasses: [],
  21290. messageSends: ["catch:", "on:do:"]
  21291. }),
  21292. $globals.TThenable);
  21293. $core.addMethod(
  21294. $core.method({
  21295. selector: "then:",
  21296. protocol: "promises",
  21297. fn: function (aBlockOrArray){
  21298. var self=this,$self=this;
  21299. return $core.withContext(function($ctx1) {
  21300. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21301. return array.reduce(function (soFar, aBlock) {
  21302. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21303. function (result) {return $core.seamless(function () {
  21304. if (Array.isArray(result)) {
  21305. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21306. } else {
  21307. return aBlock._value_(result);
  21308. }
  21309. })} :
  21310. function (result) {return $core.seamless(function () {
  21311. return aBlock._value_(result);
  21312. })}
  21313. );
  21314. }, self);
  21315. return self;
  21316. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21317. },
  21318. args: ["aBlockOrArray"],
  21319. 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)'>",
  21320. referencedClasses: [],
  21321. messageSends: []
  21322. }),
  21323. $globals.TThenable);
  21324. $core.addMethod(
  21325. $core.method({
  21326. selector: "then:catch:",
  21327. protocol: "promises",
  21328. fn: function (aBlockOrArray,anotherBlock){
  21329. var self=this,$self=this;
  21330. return $core.withContext(function($ctx1) {
  21331. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21332. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21333. },
  21334. args: ["aBlockOrArray", "anotherBlock"],
  21335. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21336. referencedClasses: [],
  21337. messageSends: ["catch:", "then:"]
  21338. }),
  21339. $globals.TThenable);
  21340. $core.addMethod(
  21341. $core.method({
  21342. selector: "then:on:do:",
  21343. protocol: "promises",
  21344. fn: function (aBlockOrArray,aClass,aBlock){
  21345. var self=this,$self=this;
  21346. return $core.withContext(function($ctx1) {
  21347. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21348. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21349. },
  21350. args: ["aBlockOrArray", "aClass", "aBlock"],
  21351. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21352. referencedClasses: [],
  21353. messageSends: ["on:do:", "then:"]
  21354. }),
  21355. $globals.TThenable);
  21356. $core.addMethod(
  21357. $core.method({
  21358. selector: "then:on:do:catch:",
  21359. protocol: "promises",
  21360. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21361. var self=this,$self=this;
  21362. return $core.withContext(function($ctx1) {
  21363. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21364. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21365. },
  21366. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21367. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21368. referencedClasses: [],
  21369. messageSends: ["catch:", "on:do:", "then:"]
  21370. }),
  21371. $globals.TThenable);
  21372. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21373. });
  21374. 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";
  21375. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21376. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21377. $core.addPackage("Kernel-Infrastructure");
  21378. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  21379. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21380. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21381. $core.addMethod(
  21382. $core.method({
  21383. selector: "organizeClasses",
  21384. protocol: "organization",
  21385. fn: function (){
  21386. var self=this,$self=this;
  21387. return $core.withContext(function($ctx1) {
  21388. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21389. return $core.withContext(function($ctx2) {
  21390. return $recv(each)._enterOrganization();
  21391. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21392. }));
  21393. return self;
  21394. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21395. },
  21396. args: [],
  21397. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21398. referencedClasses: ["Smalltalk"],
  21399. messageSends: ["do:", "classes", "enterOrganization"]
  21400. }),
  21401. $globals.AmberBootstrapInitialization.a$cls);
  21402. $core.addMethod(
  21403. $core.method({
  21404. selector: "organizeMethods",
  21405. protocol: "organization",
  21406. fn: function (){
  21407. var self=this,$self=this;
  21408. return $core.withContext(function($ctx1) {
  21409. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21410. return $core.withContext(function($ctx2) {
  21411. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21412. return $core.withContext(function($ctx3) {
  21413. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21414. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21415. }));
  21416. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21417. }));
  21418. $ctx1.sendIdx["do:"]=1;
  21419. return self;
  21420. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21421. },
  21422. args: [],
  21423. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21424. referencedClasses: ["Smalltalk"],
  21425. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21426. }),
  21427. $globals.AmberBootstrapInitialization.a$cls);
  21428. $core.addMethod(
  21429. $core.method({
  21430. selector: "run",
  21431. protocol: "public api",
  21432. fn: function (){
  21433. var self=this,$self=this;
  21434. return $core.withContext(function($ctx1) {
  21435. $recv($globals.SmalltalkImage)._initialize();
  21436. $self._organizeClasses();
  21437. $self._organizeMethods();
  21438. $recv($globals.Smalltalk)._postLoad();
  21439. return self;
  21440. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21441. },
  21442. args: [],
  21443. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09Smalltalk postLoad",
  21444. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21445. messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"]
  21446. }),
  21447. $globals.AmberBootstrapInitialization.a$cls);
  21448. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21449. $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`.";
  21450. $core.addMethod(
  21451. $core.method({
  21452. selector: "=",
  21453. protocol: "comparing",
  21454. fn: function (anObject){
  21455. var self=this,$self=this;
  21456. return $core.withContext(function($ctx1) {
  21457. var $2,$1;
  21458. $2=$recv(anObject)._class();
  21459. $ctx1.sendIdx["class"]=1;
  21460. $1=$recv($2).__eq_eq($self._class());
  21461. if(!$core.assert($1)){
  21462. return false;
  21463. }
  21464. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21465. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21466. },
  21467. args: ["anObject"],
  21468. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21469. referencedClasses: ["JSObjectProxy"],
  21470. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21471. }),
  21472. $globals.JSObjectProxy);
  21473. $core.addMethod(
  21474. $core.method({
  21475. selector: "asJavaScriptObject",
  21476. protocol: "converting",
  21477. fn: function (){
  21478. var self=this,$self=this;
  21479. return $self["@jsObject"];
  21480. },
  21481. args: [],
  21482. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21483. referencedClasses: [],
  21484. messageSends: []
  21485. }),
  21486. $globals.JSObjectProxy);
  21487. $core.addMethod(
  21488. $core.method({
  21489. selector: "at:",
  21490. protocol: "accessing",
  21491. fn: function (aString){
  21492. var self=this,$self=this;
  21493. return $core.withContext(function($ctx1) {
  21494. return $self['@jsObject'][aString];
  21495. return self;
  21496. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21497. },
  21498. args: ["aString"],
  21499. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21500. referencedClasses: [],
  21501. messageSends: []
  21502. }),
  21503. $globals.JSObjectProxy);
  21504. $core.addMethod(
  21505. $core.method({
  21506. selector: "at:ifAbsent:",
  21507. protocol: "accessing",
  21508. fn: function (aString,aBlock){
  21509. var self=this,$self=this;
  21510. return $core.withContext(function($ctx1) {
  21511. var obj = $self['@jsObject'];
  21512. return aString in obj ? obj[aString] : aBlock._value();
  21513. ;
  21514. return self;
  21515. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21516. },
  21517. args: ["aString", "aBlock"],
  21518. 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'>",
  21519. referencedClasses: [],
  21520. messageSends: []
  21521. }),
  21522. $globals.JSObjectProxy);
  21523. $core.addMethod(
  21524. $core.method({
  21525. selector: "at:ifPresent:",
  21526. protocol: "accessing",
  21527. fn: function (aString,aBlock){
  21528. var self=this,$self=this;
  21529. return $core.withContext(function($ctx1) {
  21530. var obj = $self['@jsObject'];
  21531. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21532. ;
  21533. return self;
  21534. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21535. },
  21536. args: ["aString", "aBlock"],
  21537. 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'>",
  21538. referencedClasses: [],
  21539. messageSends: []
  21540. }),
  21541. $globals.JSObjectProxy);
  21542. $core.addMethod(
  21543. $core.method({
  21544. selector: "at:ifPresent:ifAbsent:",
  21545. protocol: "accessing",
  21546. fn: function (aString,aBlock,anotherBlock){
  21547. var self=this,$self=this;
  21548. return $core.withContext(function($ctx1) {
  21549. var obj = $self['@jsObject'];
  21550. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21551. ;
  21552. return self;
  21553. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21554. },
  21555. args: ["aString", "aBlock", "anotherBlock"],
  21556. 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'>",
  21557. referencedClasses: [],
  21558. messageSends: []
  21559. }),
  21560. $globals.JSObjectProxy);
  21561. $core.addMethod(
  21562. $core.method({
  21563. selector: "at:put:",
  21564. protocol: "accessing",
  21565. fn: function (aString,anObject){
  21566. var self=this,$self=this;
  21567. return $core.withContext(function($ctx1) {
  21568. return $self['@jsObject'][aString] = anObject;
  21569. return self;
  21570. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21571. },
  21572. args: ["aString", "anObject"],
  21573. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21574. referencedClasses: [],
  21575. messageSends: []
  21576. }),
  21577. $globals.JSObjectProxy);
  21578. $core.addMethod(
  21579. $core.method({
  21580. selector: "catch:",
  21581. protocol: "promises",
  21582. fn: function (aBlock){
  21583. var self=this,$self=this;
  21584. return $core.withContext(function($ctx1) {
  21585. var $1,$2;
  21586. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21587. if($core.assert($1)){
  21588. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21589. } else {
  21590. $2=(
  21591. $ctx1.supercall = true,
  21592. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21593. $ctx1.supercall = false;
  21594. return $2;
  21595. }
  21596. return self;
  21597. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21598. },
  21599. args: ["aBlock"],
  21600. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21601. referencedClasses: ["NativeFunction", "TThenable"],
  21602. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21603. }),
  21604. $globals.JSObjectProxy);
  21605. $core.addMethod(
  21606. $core.method({
  21607. selector: "doesNotUnderstand:",
  21608. protocol: "proxy",
  21609. fn: function (aMessage){
  21610. var self=this,$self=this;
  21611. return $core.withContext(function($ctx1) {
  21612. var $1,$receiver;
  21613. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21614. if(($receiver = $1) == null || $receiver.a$nil){
  21615. return (
  21616. $ctx1.supercall = true,
  21617. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21618. $ctx1.supercall = false;
  21619. } else {
  21620. var jsSelector;
  21621. jsSelector=$receiver;
  21622. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21623. }
  21624. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21625. },
  21626. args: ["aMessage"],
  21627. 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 ]",
  21628. referencedClasses: ["JSObjectProxy"],
  21629. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21630. }),
  21631. $globals.JSObjectProxy);
  21632. $core.addMethod(
  21633. $core.method({
  21634. selector: "in:",
  21635. protocol: "accessing",
  21636. fn: function (aValuable){
  21637. var self=this,$self=this;
  21638. return $core.withContext(function($ctx1) {
  21639. return $recv(aValuable)._value_($self["@jsObject"]);
  21640. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21641. },
  21642. args: ["aValuable"],
  21643. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21644. referencedClasses: [],
  21645. messageSends: ["value:"]
  21646. }),
  21647. $globals.JSObjectProxy);
  21648. $core.addMethod(
  21649. $core.method({
  21650. selector: "jsObject",
  21651. protocol: "accessing",
  21652. fn: function (){
  21653. var self=this,$self=this;
  21654. return $self["@jsObject"];
  21655. },
  21656. args: [],
  21657. source: "jsObject\x0a\x09^ jsObject",
  21658. referencedClasses: [],
  21659. messageSends: []
  21660. }),
  21661. $globals.JSObjectProxy);
  21662. $core.addMethod(
  21663. $core.method({
  21664. selector: "keysAndValuesDo:",
  21665. protocol: "enumerating",
  21666. fn: function (aBlock){
  21667. var self=this,$self=this;
  21668. return $core.withContext(function($ctx1) {
  21669. var o = $self['@jsObject'];
  21670. for(var i in o) {
  21671. aBlock._value_value_(i, o[i]);
  21672. }
  21673. ;
  21674. return self;
  21675. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21676. },
  21677. args: ["aBlock"],
  21678. 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'>",
  21679. referencedClasses: [],
  21680. messageSends: []
  21681. }),
  21682. $globals.JSObjectProxy);
  21683. $core.addMethod(
  21684. $core.method({
  21685. selector: "on:do:",
  21686. protocol: "promises",
  21687. fn: function (aClass,aBlock){
  21688. var self=this,$self=this;
  21689. return $core.withContext(function($ctx1) {
  21690. var $1,$2;
  21691. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21692. if($core.assert($1)){
  21693. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21694. } else {
  21695. $2=(
  21696. $ctx1.supercall = true,
  21697. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21698. $ctx1.supercall = false;
  21699. return $2;
  21700. }
  21701. return self;
  21702. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21703. },
  21704. args: ["aClass", "aBlock"],
  21705. 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 ]",
  21706. referencedClasses: ["NativeFunction", "TThenable"],
  21707. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21708. }),
  21709. $globals.JSObjectProxy);
  21710. $core.addMethod(
  21711. $core.method({
  21712. selector: "printOn:",
  21713. protocol: "printing",
  21714. fn: function (aStream){
  21715. var self=this,$self=this;
  21716. return $core.withContext(function($ctx1) {
  21717. $recv(aStream)._nextPutAll_($self._printString());
  21718. return self;
  21719. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21720. },
  21721. args: ["aStream"],
  21722. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21723. referencedClasses: [],
  21724. messageSends: ["nextPutAll:", "printString"]
  21725. }),
  21726. $globals.JSObjectProxy);
  21727. $core.addMethod(
  21728. $core.method({
  21729. selector: "printString",
  21730. protocol: "printing",
  21731. fn: function (){
  21732. var self=this,$self=this;
  21733. return $core.withContext(function($ctx1) {
  21734. var js = $self['@jsObject'];
  21735. return js.toString
  21736. ? js.toString()
  21737. : Object.prototype.toString.call(js)
  21738. ;
  21739. return self;
  21740. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21741. },
  21742. args: [],
  21743. 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'>",
  21744. referencedClasses: [],
  21745. messageSends: []
  21746. }),
  21747. $globals.JSObjectProxy);
  21748. $core.addMethod(
  21749. $core.method({
  21750. selector: "putOn:",
  21751. protocol: "streaming",
  21752. fn: function (aStream){
  21753. var self=this,$self=this;
  21754. return $core.withContext(function($ctx1) {
  21755. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21756. return self;
  21757. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21758. },
  21759. args: ["aStream"],
  21760. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21761. referencedClasses: [],
  21762. messageSends: ["nextPutJSObject:"]
  21763. }),
  21764. $globals.JSObjectProxy);
  21765. $core.addMethod(
  21766. $core.method({
  21767. selector: "removeKey:",
  21768. protocol: "accessing",
  21769. fn: function (aString){
  21770. var self=this,$self=this;
  21771. return $core.withContext(function($ctx1) {
  21772. delete $self['@jsObject'][aString]; return aString;
  21773. return self;
  21774. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)});
  21775. },
  21776. args: ["aString"],
  21777. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self[''@jsObject''][aString]; return aString'>",
  21778. referencedClasses: [],
  21779. messageSends: []
  21780. }),
  21781. $globals.JSObjectProxy);
  21782. $core.addMethod(
  21783. $core.method({
  21784. selector: "then:",
  21785. protocol: "promises",
  21786. fn: function (aBlockOrArray){
  21787. var self=this,$self=this;
  21788. return $core.withContext(function($ctx1) {
  21789. var $1,$2;
  21790. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21791. if($core.assert($1)){
  21792. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21793. } else {
  21794. $2=(
  21795. $ctx1.supercall = true,
  21796. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21797. $ctx1.supercall = false;
  21798. return $2;
  21799. }
  21800. return self;
  21801. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21802. },
  21803. args: ["aBlockOrArray"],
  21804. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21805. referencedClasses: ["NativeFunction", "TThenable"],
  21806. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21807. }),
  21808. $globals.JSObjectProxy);
  21809. $core.addMethod(
  21810. $core.method({
  21811. selector: "addObjectVariablesTo:ofProxy:",
  21812. protocol: "proxy",
  21813. fn: function (aDictionary,aProxy){
  21814. var self=this,$self=this;
  21815. return $core.withContext(function($ctx1) {
  21816. var jsObject = aProxy['@jsObject'];
  21817. for(var i in jsObject) {
  21818. aDictionary._at_put_(i, jsObject[i]);
  21819. }
  21820. ;
  21821. return self;
  21822. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21823. },
  21824. args: ["aDictionary", "aProxy"],
  21825. 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'>",
  21826. referencedClasses: [],
  21827. messageSends: []
  21828. }),
  21829. $globals.JSObjectProxy.a$cls);
  21830. $core.addMethod(
  21831. $core.method({
  21832. selector: "compareJSObjectOfProxy:withProxy:",
  21833. protocol: "proxy",
  21834. fn: function (aProxy,anotherProxy){
  21835. var self=this,$self=this;
  21836. return $core.withContext(function($ctx1) {
  21837. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21838. return aProxy["@jsObject"] === anotherJSObject;
  21839. return self;
  21840. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21841. },
  21842. args: ["aProxy", "anotherProxy"],
  21843. 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'>",
  21844. referencedClasses: [],
  21845. messageSends: []
  21846. }),
  21847. $globals.JSObjectProxy.a$cls);
  21848. $core.addMethod(
  21849. $core.method({
  21850. selector: "forwardMessage:withArguments:ofProxy:",
  21851. protocol: "proxy",
  21852. fn: function (aString,anArray,aProxy){
  21853. var self=this,$self=this;
  21854. return $core.withContext(function($ctx1) {
  21855. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21856. ;
  21857. return self;
  21858. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21859. },
  21860. args: ["aString", "anArray", "aProxy"],
  21861. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21862. referencedClasses: [],
  21863. messageSends: []
  21864. }),
  21865. $globals.JSObjectProxy.a$cls);
  21866. $core.addMethod(
  21867. $core.method({
  21868. selector: "jsObject:ofProxy:",
  21869. protocol: "proxy",
  21870. fn: function (aJSObject,aProxy){
  21871. var self=this,$self=this;
  21872. return $core.withContext(function($ctx1) {
  21873. aProxy['@jsObject'] = aJSObject;
  21874. return self;
  21875. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21876. },
  21877. args: ["aJSObject", "aProxy"],
  21878. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21879. referencedClasses: [],
  21880. messageSends: []
  21881. }),
  21882. $globals.JSObjectProxy.a$cls);
  21883. $core.addMethod(
  21884. $core.method({
  21885. selector: "lookupProperty:ofProxy:",
  21886. protocol: "proxy",
  21887. fn: function (aString,aProxy){
  21888. var self=this,$self=this;
  21889. return $core.withContext(function($ctx1) {
  21890. return aString in aProxy._jsObject() ? aString : nil;
  21891. return self;
  21892. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21893. },
  21894. args: ["aString", "aProxy"],
  21895. 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'>",
  21896. referencedClasses: [],
  21897. messageSends: []
  21898. }),
  21899. $globals.JSObjectProxy.a$cls);
  21900. $core.addMethod(
  21901. $core.method({
  21902. selector: "null",
  21903. protocol: "accessing",
  21904. fn: function (){
  21905. var self=this,$self=this;
  21906. return $core.withContext(function($ctx1) {
  21907. return null;
  21908. return self;
  21909. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  21910. },
  21911. args: [],
  21912. source: "null\x0a\x09<inlineJS: 'return null'>",
  21913. referencedClasses: [],
  21914. messageSends: []
  21915. }),
  21916. $globals.JSObjectProxy.a$cls);
  21917. $core.addMethod(
  21918. $core.method({
  21919. selector: "on:",
  21920. protocol: "instance creation",
  21921. fn: function (aJSObject){
  21922. var self=this,$self=this;
  21923. var instance;
  21924. return $core.withContext(function($ctx1) {
  21925. instance=$self._new();
  21926. $self._jsObject_ofProxy_(aJSObject,instance);
  21927. return instance;
  21928. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21929. },
  21930. args: ["aJSObject"],
  21931. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21932. referencedClasses: [],
  21933. messageSends: ["new", "jsObject:ofProxy:"]
  21934. }),
  21935. $globals.JSObjectProxy.a$cls);
  21936. $core.addMethod(
  21937. $core.method({
  21938. selector: "undefined",
  21939. protocol: "accessing",
  21940. fn: function (){
  21941. var self=this,$self=this;
  21942. return $core.withContext(function($ctx1) {
  21943. return undefined;
  21944. return self;
  21945. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  21946. },
  21947. args: [],
  21948. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  21949. referencedClasses: [],
  21950. messageSends: []
  21951. }),
  21952. $globals.JSObjectProxy.a$cls);
  21953. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21954. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21955. $core.addMethod(
  21956. $core.method({
  21957. selector: "addElement:",
  21958. protocol: "accessing",
  21959. fn: function (anObject){
  21960. var self=this,$self=this;
  21961. return $core.withContext(function($ctx1) {
  21962. $recv($self._elements())._add_(anObject);
  21963. return self;
  21964. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  21965. },
  21966. args: ["anObject"],
  21967. source: "addElement: anObject\x0a\x09self elements add: anObject",
  21968. referencedClasses: [],
  21969. messageSends: ["add:", "elements"]
  21970. }),
  21971. $globals.Organizer);
  21972. $core.addMethod(
  21973. $core.method({
  21974. selector: "elements",
  21975. protocol: "accessing",
  21976. fn: function (){
  21977. var self=this,$self=this;
  21978. return $self["@elements"];
  21979. },
  21980. args: [],
  21981. source: "elements\x0a\x09^ elements",
  21982. referencedClasses: [],
  21983. messageSends: []
  21984. }),
  21985. $globals.Organizer);
  21986. $core.addMethod(
  21987. $core.method({
  21988. selector: "initialize",
  21989. protocol: "initialization",
  21990. fn: function (){
  21991. var self=this,$self=this;
  21992. return $core.withContext(function($ctx1) {
  21993. (
  21994. $ctx1.supercall = true,
  21995. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  21996. $ctx1.supercall = false;
  21997. $self["@elements"]=$recv($globals.Set)._new();
  21998. return self;
  21999. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  22000. },
  22001. args: [],
  22002. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  22003. referencedClasses: ["Set"],
  22004. messageSends: ["initialize", "new"]
  22005. }),
  22006. $globals.Organizer);
  22007. $core.addMethod(
  22008. $core.method({
  22009. selector: "removeElement:",
  22010. protocol: "accessing",
  22011. fn: function (anObject){
  22012. var self=this,$self=this;
  22013. return $core.withContext(function($ctx1) {
  22014. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  22015. }));
  22016. return self;
  22017. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  22018. },
  22019. args: ["anObject"],
  22020. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  22021. referencedClasses: [],
  22022. messageSends: ["remove:ifAbsent:", "elements"]
  22023. }),
  22024. $globals.Organizer);
  22025. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  22026. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  22027. $core.addMethod(
  22028. $core.method({
  22029. selector: "addElement:",
  22030. protocol: "accessing",
  22031. fn: function (aString){
  22032. var self=this,$self=this;
  22033. return $core.withContext(function($ctx1) {
  22034. var $1,$3,$2;
  22035. (
  22036. $ctx1.supercall = true,
  22037. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  22038. $ctx1.supercall = false;
  22039. $1=$recv($globals.SystemAnnouncer)._current();
  22040. $3=$recv($globals.ProtocolAdded)._new();
  22041. $recv($3)._protocol_(aString);
  22042. $recv($3)._theClass_($self._theClass());
  22043. $2=$recv($3)._yourself();
  22044. $recv($1)._announce_($2);
  22045. return self;
  22046. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  22047. },
  22048. args: ["aString"],
  22049. 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)",
  22050. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  22051. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22052. }),
  22053. $globals.ClassOrganizer);
  22054. $core.addMethod(
  22055. $core.method({
  22056. selector: "removeElement:",
  22057. protocol: "accessing",
  22058. fn: function (aString){
  22059. var self=this,$self=this;
  22060. return $core.withContext(function($ctx1) {
  22061. var $1,$3,$2;
  22062. (
  22063. $ctx1.supercall = true,
  22064. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  22065. $ctx1.supercall = false;
  22066. $1=$recv($globals.SystemAnnouncer)._current();
  22067. $3=$recv($globals.ProtocolRemoved)._new();
  22068. $recv($3)._protocol_(aString);
  22069. $recv($3)._theClass_($self._theClass());
  22070. $2=$recv($3)._yourself();
  22071. $recv($1)._announce_($2);
  22072. return self;
  22073. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  22074. },
  22075. args: ["aString"],
  22076. 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)",
  22077. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  22078. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22079. }),
  22080. $globals.ClassOrganizer);
  22081. $core.addMethod(
  22082. $core.method({
  22083. selector: "theClass",
  22084. protocol: "accessing",
  22085. fn: function (){
  22086. var self=this,$self=this;
  22087. return $self["@traitOrBehavior"];
  22088. },
  22089. args: [],
  22090. source: "theClass\x0a\x09^ traitOrBehavior",
  22091. referencedClasses: [],
  22092. messageSends: []
  22093. }),
  22094. $globals.ClassOrganizer);
  22095. $core.addMethod(
  22096. $core.method({
  22097. selector: "theClass:",
  22098. protocol: "accessing",
  22099. fn: function (aClass){
  22100. var self=this,$self=this;
  22101. $self["@traitOrBehavior"]=aClass;
  22102. return self;
  22103. },
  22104. args: ["aClass"],
  22105. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22106. referencedClasses: [],
  22107. messageSends: []
  22108. }),
  22109. $globals.ClassOrganizer);
  22110. $core.addMethod(
  22111. $core.method({
  22112. selector: "on:",
  22113. protocol: "instance creation",
  22114. fn: function (aClass){
  22115. var self=this,$self=this;
  22116. return $core.withContext(function($ctx1) {
  22117. var $1;
  22118. $1=$self._new();
  22119. $recv($1)._theClass_(aClass);
  22120. return $recv($1)._yourself();
  22121. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22122. },
  22123. args: ["aClass"],
  22124. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22125. referencedClasses: [],
  22126. messageSends: ["theClass:", "new", "yourself"]
  22127. }),
  22128. $globals.ClassOrganizer.a$cls);
  22129. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22130. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22131. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure");
  22132. $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'";
  22133. $core.addMethod(
  22134. $core.method({
  22135. selector: "basicTransport",
  22136. protocol: "private",
  22137. fn: function (){
  22138. var self=this,$self=this;
  22139. return $self["@basicTransport"];
  22140. },
  22141. args: [],
  22142. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22143. referencedClasses: [],
  22144. messageSends: []
  22145. }),
  22146. $globals.Package);
  22147. $core.addMethod(
  22148. $core.method({
  22149. selector: "beClean",
  22150. protocol: "accessing",
  22151. fn: function (){
  22152. var self=this,$self=this;
  22153. return $core.withContext(function($ctx1) {
  22154. var $1,$3,$2;
  22155. $self["@dirty"]=false;
  22156. $1=$recv($globals.SystemAnnouncer)._current();
  22157. $3=$recv($globals.PackageClean)._new();
  22158. $recv($3)._package_(self);
  22159. $2=$recv($3)._yourself();
  22160. $recv($1)._announce_($2);
  22161. return self;
  22162. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22163. },
  22164. args: [],
  22165. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22166. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22167. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22168. }),
  22169. $globals.Package);
  22170. $core.addMethod(
  22171. $core.method({
  22172. selector: "beDirty",
  22173. protocol: "accessing",
  22174. fn: function (){
  22175. var self=this,$self=this;
  22176. return $core.withContext(function($ctx1) {
  22177. var $1,$3,$2;
  22178. $self["@dirty"]=true;
  22179. $1=$recv($globals.SystemAnnouncer)._current();
  22180. $3=$recv($globals.PackageDirty)._new();
  22181. $recv($3)._package_(self);
  22182. $2=$recv($3)._yourself();
  22183. $recv($1)._announce_($2);
  22184. return self;
  22185. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22186. },
  22187. args: [],
  22188. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22189. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22190. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22191. }),
  22192. $globals.Package);
  22193. $core.addMethod(
  22194. $core.method({
  22195. selector: "classTemplate",
  22196. protocol: "accessing",
  22197. fn: function (){
  22198. var self=this,$self=this;
  22199. return $core.withContext(function($ctx1) {
  22200. return $recv($globals.String)._streamContents_((function(stream){
  22201. return $core.withContext(function($ctx2) {
  22202. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22203. $ctx2.sendIdx["write:"]=1;
  22204. $recv(stream)._lf();
  22205. $ctx2.sendIdx["lf"]=1;
  22206. $recv(stream)._tab();
  22207. $ctx2.sendIdx["tab"]=1;
  22208. $recv(stream)._write_("instanceVariableNames: ''");
  22209. $ctx2.sendIdx["write:"]=2;
  22210. $recv(stream)._lf();
  22211. $recv(stream)._tab();
  22212. $recv(stream)._write_("package: ");
  22213. return $recv(stream)._print_($self._name());
  22214. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22215. }));
  22216. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22217. },
  22218. args: [],
  22219. 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 ]",
  22220. referencedClasses: ["String"],
  22221. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22222. }),
  22223. $globals.Package);
  22224. $core.addMethod(
  22225. $core.method({
  22226. selector: "classes",
  22227. protocol: "classes",
  22228. fn: function (){
  22229. var self=this,$self=this;
  22230. return $core.withContext(function($ctx1) {
  22231. return $recv($recv($self._organization())._elements())._copy();
  22232. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22233. },
  22234. args: [],
  22235. source: "classes\x0a\x09^ self organization elements copy",
  22236. referencedClasses: [],
  22237. messageSends: ["copy", "elements", "organization"]
  22238. }),
  22239. $globals.Package);
  22240. $core.addMethod(
  22241. $core.method({
  22242. selector: "definition",
  22243. protocol: "accessing",
  22244. fn: function (){
  22245. var self=this,$self=this;
  22246. return $core.withContext(function($ctx1) {
  22247. var $1;
  22248. return $recv($globals.String)._streamContents_((function(stream){
  22249. return $core.withContext(function($ctx2) {
  22250. $1=$recv($self._class())._name();
  22251. $ctx2.sendIdx["name"]=1;
  22252. $recv(stream)._write_($1);
  22253. $ctx2.sendIdx["write:"]=1;
  22254. $recv(stream)._lf();
  22255. $ctx2.sendIdx["lf"]=1;
  22256. $recv(stream)._tab();
  22257. $ctx2.sendIdx["tab"]=1;
  22258. $recv(stream)._write_("named: ");
  22259. $ctx2.sendIdx["write:"]=2;
  22260. $recv(stream)._print_($self._name());
  22261. $recv(stream)._lf();
  22262. $ctx2.sendIdx["lf"]=2;
  22263. $recv(stream)._tab();
  22264. $ctx2.sendIdx["tab"]=2;
  22265. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22266. $ctx2.sendIdx["write:"]=3;
  22267. $recv(stream)._lf();
  22268. $recv(stream)._tab();
  22269. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22270. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22271. }));
  22272. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22273. },
  22274. args: [],
  22275. 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. ')' } ]",
  22276. referencedClasses: ["String"],
  22277. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22278. }),
  22279. $globals.Package);
  22280. $core.addMethod(
  22281. $core.method({
  22282. selector: "eval:",
  22283. protocol: "evaluating",
  22284. fn: function (aString){
  22285. var self=this,$self=this;
  22286. return $core.withContext(function($ctx1) {
  22287. var $1,$receiver;
  22288. $1=$self["@evalBlock"];
  22289. if(($receiver = $1) == null || $receiver.a$nil){
  22290. return $recv($globals.Compiler)._eval_(aString);
  22291. } else {
  22292. return $recv($self["@evalBlock"])._value_(aString);
  22293. }
  22294. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22295. },
  22296. args: ["aString"],
  22297. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22298. referencedClasses: ["Compiler"],
  22299. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22300. }),
  22301. $globals.Package);
  22302. $core.addMethod(
  22303. $core.method({
  22304. selector: "evalBlock",
  22305. protocol: "accessing",
  22306. fn: function (){
  22307. var self=this,$self=this;
  22308. return $self["@evalBlock"];
  22309. },
  22310. args: [],
  22311. source: "evalBlock\x0a\x09^ evalBlock",
  22312. referencedClasses: [],
  22313. messageSends: []
  22314. }),
  22315. $globals.Package);
  22316. $core.addMethod(
  22317. $core.method({
  22318. selector: "evalBlock:",
  22319. protocol: "accessing",
  22320. fn: function (aBlock){
  22321. var self=this,$self=this;
  22322. $self["@evalBlock"]=aBlock;
  22323. return self;
  22324. },
  22325. args: ["aBlock"],
  22326. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22327. referencedClasses: [],
  22328. messageSends: []
  22329. }),
  22330. $globals.Package);
  22331. $core.addMethod(
  22332. $core.method({
  22333. selector: "imports",
  22334. protocol: "accessing",
  22335. fn: function (){
  22336. var self=this,$self=this;
  22337. return $core.withContext(function($ctx1) {
  22338. var $1,$receiver;
  22339. $1=$self["@imports"];
  22340. if(($receiver = $1) == null || $receiver.a$nil){
  22341. $self._imports_([]);
  22342. return $self["@imports"];
  22343. } else {
  22344. return $1;
  22345. }
  22346. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22347. },
  22348. args: [],
  22349. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22350. referencedClasses: [],
  22351. messageSends: ["ifNil:", "imports:"]
  22352. }),
  22353. $globals.Package);
  22354. $core.addMethod(
  22355. $core.method({
  22356. selector: "imports:",
  22357. protocol: "accessing",
  22358. fn: function (anArray){
  22359. var self=this,$self=this;
  22360. return $core.withContext(function($ctx1) {
  22361. $self._validateImports_(anArray);
  22362. $self["@imports"]=$recv(anArray)._asSet();
  22363. return self;
  22364. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22365. },
  22366. args: ["anArray"],
  22367. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22368. referencedClasses: [],
  22369. messageSends: ["validateImports:", "asSet"]
  22370. }),
  22371. $globals.Package);
  22372. $core.addMethod(
  22373. $core.method({
  22374. selector: "importsAsJson",
  22375. protocol: "converting",
  22376. fn: function (){
  22377. var self=this,$self=this;
  22378. return $core.withContext(function($ctx1) {
  22379. var $1;
  22380. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22381. return $core.withContext(function($ctx2) {
  22382. $1=$recv(each)._isString();
  22383. if($core.assert($1)){
  22384. return each;
  22385. } else {
  22386. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22387. $ctx2.sendIdx[","]=1;
  22388. }
  22389. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22390. }));
  22391. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22392. },
  22393. args: [],
  22394. 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 ]]",
  22395. referencedClasses: [],
  22396. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22397. }),
  22398. $globals.Package);
  22399. $core.addMethod(
  22400. $core.method({
  22401. selector: "importsDefinition",
  22402. protocol: "accessing",
  22403. fn: function (){
  22404. var self=this,$self=this;
  22405. return $core.withContext(function($ctx1) {
  22406. return $recv($globals.String)._streamContents_((function(stream){
  22407. return $core.withContext(function($ctx2) {
  22408. $recv(stream)._write_("{");
  22409. $ctx2.sendIdx["write:"]=1;
  22410. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22411. return $core.withContext(function($ctx3) {
  22412. return $recv(stream)._print_(each);
  22413. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22414. }),(function(){
  22415. return $core.withContext(function($ctx3) {
  22416. return $recv(stream)._write_(". ");
  22417. $ctx3.sendIdx["write:"]=2;
  22418. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22419. }));
  22420. return $recv(stream)._write_("}");
  22421. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22422. }));
  22423. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22424. },
  22425. args: [],
  22426. 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: '}' ]",
  22427. referencedClasses: ["String"],
  22428. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22429. }),
  22430. $globals.Package);
  22431. $core.addMethod(
  22432. $core.method({
  22433. selector: "importsFromJson:",
  22434. protocol: "converting",
  22435. fn: function (anArray){
  22436. var self=this,$self=this;
  22437. return $core.withContext(function($ctx1) {
  22438. var $1;
  22439. return $recv(anArray)._collect_((function(each){
  22440. var split;
  22441. return $core.withContext(function($ctx2) {
  22442. split=$recv(each)._tokenize_("=");
  22443. $1=$recv($recv(split)._size()).__eq((1));
  22444. if($core.assert($1)){
  22445. return $recv(split)._first();
  22446. $ctx2.sendIdx["first"]=1;
  22447. } else {
  22448. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22449. }
  22450. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22451. }));
  22452. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22453. },
  22454. args: ["anArray"],
  22455. 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 ]]",
  22456. referencedClasses: [],
  22457. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22458. }),
  22459. $globals.Package);
  22460. $core.addMethod(
  22461. $core.method({
  22462. selector: "initialize",
  22463. protocol: "initialization",
  22464. fn: function (){
  22465. var self=this,$self=this;
  22466. return $core.withContext(function($ctx1) {
  22467. (
  22468. $ctx1.supercall = true,
  22469. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22470. $ctx1.supercall = false;
  22471. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22472. $self["@evalBlock"]=nil;
  22473. $self["@dirty"]=nil;
  22474. $self["@imports"]=nil;
  22475. $self["@transport"]=nil;
  22476. return self;
  22477. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22478. },
  22479. args: [],
  22480. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  22481. referencedClasses: ["PackageOrganizer"],
  22482. messageSends: ["initialize", "new"]
  22483. }),
  22484. $globals.Package);
  22485. $core.addMethod(
  22486. $core.method({
  22487. selector: "isDirty",
  22488. protocol: "testing",
  22489. fn: function (){
  22490. var self=this,$self=this;
  22491. return $core.withContext(function($ctx1) {
  22492. var $1,$receiver;
  22493. $1=$self["@dirty"];
  22494. if(($receiver = $1) == null || $receiver.a$nil){
  22495. return false;
  22496. } else {
  22497. return $1;
  22498. }
  22499. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22500. },
  22501. args: [],
  22502. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22503. referencedClasses: [],
  22504. messageSends: ["ifNil:"]
  22505. }),
  22506. $globals.Package);
  22507. $core.addMethod(
  22508. $core.method({
  22509. selector: "isPackage",
  22510. protocol: "testing",
  22511. fn: function (){
  22512. var self=this,$self=this;
  22513. return true;
  22514. },
  22515. args: [],
  22516. source: "isPackage\x0a\x09^ true",
  22517. referencedClasses: [],
  22518. messageSends: []
  22519. }),
  22520. $globals.Package);
  22521. $core.addMethod(
  22522. $core.method({
  22523. selector: "javaScriptDescriptor:",
  22524. protocol: "accessing",
  22525. fn: function (anObject){
  22526. var self=this,$self=this;
  22527. var basicEval,basicImports;
  22528. return $core.withContext(function($ctx1) {
  22529. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22530. return $core.withContext(function($ctx2) {
  22531. return nil._asJavaScriptObject();
  22532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22533. }));
  22534. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22535. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22536. return [];
  22537. }));
  22538. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22539. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22540. }));
  22541. $self._evalBlock_(basicEval);
  22542. $self._imports_($self._importsFromJson_(basicImports));
  22543. return self;
  22544. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22545. },
  22546. args: ["anObject"],
  22547. source: "javaScriptDescriptor: anObject\x0a\x09| basicEval basicImports |\x0a\x0a\x09basicEval := (anObject at: 'innerEval' ifAbsent: [ nil asJavaScriptObject ]).\x0a\x09basicImports := (anObject at: 'imports' ifAbsent: [ #() ]).\x0a\x09basicTransport := (anObject at: 'transport' ifAbsent: []).\x0a\x09\x09\x09\x0a\x09self\x0a\x09\x09evalBlock: basicEval;\x0a\x09\x09imports: (self importsFromJson: basicImports)",
  22548. referencedClasses: [],
  22549. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  22550. }),
  22551. $globals.Package);
  22552. $core.addMethod(
  22553. $core.method({
  22554. selector: "loadDependencies",
  22555. protocol: "dependencies",
  22556. fn: function (){
  22557. var self=this,$self=this;
  22558. var classes,packages;
  22559. return $core.withContext(function($ctx1) {
  22560. var $1;
  22561. classes=$self._loadDependencyClasses();
  22562. $1=$recv($recv(classes)._collect_((function(each){
  22563. return $core.withContext(function($ctx2) {
  22564. return $recv(each)._package();
  22565. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22566. })))._asSet();
  22567. $recv($1)._remove_ifAbsent_(self,(function(){
  22568. }));
  22569. return $recv($1)._yourself();
  22570. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22571. },
  22572. args: [],
  22573. 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",
  22574. referencedClasses: [],
  22575. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22576. }),
  22577. $globals.Package);
  22578. $core.addMethod(
  22579. $core.method({
  22580. selector: "loadDependencyClasses",
  22581. protocol: "dependencies",
  22582. fn: function (){
  22583. var self=this,$self=this;
  22584. var starCategoryName;
  22585. return $core.withContext(function($ctx1) {
  22586. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22587. starCategoryName="*".__comma($self._name());
  22588. $ctx1.sendIdx[","]=1;
  22589. $3=$self._classes();
  22590. $ctx1.sendIdx["classes"]=1;
  22591. $2=$recv($3)._collect_((function(each){
  22592. return $core.withContext(function($ctx2) {
  22593. return $recv(each)._superclass();
  22594. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22595. }));
  22596. $ctx1.sendIdx["collect:"]=1;
  22597. $1=$recv($2)._asSet();
  22598. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22599. return $core.withContext(function($ctx2) {
  22600. $5=$recv(each)._protocols();
  22601. $ctx2.sendIdx["protocols"]=1;
  22602. $7=$recv(each)._theMetaClass();
  22603. if(($receiver = $7) == null || $receiver.a$nil){
  22604. $6=[];
  22605. } else {
  22606. var meta;
  22607. meta=$receiver;
  22608. $6=$recv(meta)._protocols();
  22609. }
  22610. $4=$recv($5).__comma($6);
  22611. return $recv($4)._includes_(starCategoryName);
  22612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22613. })));
  22614. $ctx1.sendIdx["addAll:"]=1;
  22615. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22616. return $core.withContext(function($ctx2) {
  22617. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22618. return $core.withContext(function($ctx3) {
  22619. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22620. return $core.withContext(function($ctx4) {
  22621. return $recv(eachTT)._trait();
  22622. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22623. })));
  22624. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22625. }));
  22626. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22627. })));
  22628. $recv($1)._remove_ifAbsent_(nil,(function(){
  22629. }));
  22630. return $recv($1)._yourself();
  22631. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22632. },
  22633. args: [],
  22634. 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",
  22635. referencedClasses: ["Smalltalk", "Array"],
  22636. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22637. }),
  22638. $globals.Package);
  22639. $core.addMethod(
  22640. $core.method({
  22641. selector: "name",
  22642. protocol: "accessing",
  22643. fn: function (){
  22644. var self=this,$self=this;
  22645. return $self["@name"];
  22646. },
  22647. args: [],
  22648. source: "name\x0a\x09^ name",
  22649. referencedClasses: [],
  22650. messageSends: []
  22651. }),
  22652. $globals.Package);
  22653. $core.addMethod(
  22654. $core.method({
  22655. selector: "name:",
  22656. protocol: "accessing",
  22657. fn: function (aString){
  22658. var self=this,$self=this;
  22659. $self["@name"]=aString;
  22660. return self;
  22661. },
  22662. args: ["aString"],
  22663. source: "name: aString\x0a\x09name := aString",
  22664. referencedClasses: [],
  22665. messageSends: []
  22666. }),
  22667. $globals.Package);
  22668. $core.addMethod(
  22669. $core.method({
  22670. selector: "organization",
  22671. protocol: "accessing",
  22672. fn: function (){
  22673. var self=this,$self=this;
  22674. return $self["@organization"];
  22675. },
  22676. args: [],
  22677. source: "organization\x0a\x09^ organization",
  22678. referencedClasses: [],
  22679. messageSends: []
  22680. }),
  22681. $globals.Package);
  22682. $core.addMethod(
  22683. $core.method({
  22684. selector: "printOn:",
  22685. protocol: "printing",
  22686. fn: function (aStream){
  22687. var self=this,$self=this;
  22688. return $core.withContext(function($ctx1) {
  22689. (
  22690. $ctx1.supercall = true,
  22691. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22692. $ctx1.supercall = false;
  22693. $recv(aStream)._nextPutAll_(" (");
  22694. $ctx1.sendIdx["nextPutAll:"]=1;
  22695. $recv(aStream)._nextPutAll_($self._name());
  22696. $ctx1.sendIdx["nextPutAll:"]=2;
  22697. $recv(aStream)._nextPutAll_(")");
  22698. return self;
  22699. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22700. },
  22701. args: ["aStream"],
  22702. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22703. referencedClasses: [],
  22704. messageSends: ["printOn:", "nextPutAll:", "name"]
  22705. }),
  22706. $globals.Package);
  22707. $core.addMethod(
  22708. $core.method({
  22709. selector: "setupClasses",
  22710. protocol: "classes",
  22711. fn: function (){
  22712. var self=this,$self=this;
  22713. return $core.withContext(function($ctx1) {
  22714. $recv($self._classes())._do_((function(each){
  22715. return $core.withContext(function($ctx2) {
  22716. return $recv(each)._initialize();
  22717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22718. }));
  22719. return self;
  22720. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22721. },
  22722. args: [],
  22723. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22724. referencedClasses: [],
  22725. messageSends: ["do:", "classes", "initialize"]
  22726. }),
  22727. $globals.Package);
  22728. $core.addMethod(
  22729. $core.method({
  22730. selector: "sortedClasses",
  22731. protocol: "classes",
  22732. fn: function (){
  22733. var self=this,$self=this;
  22734. return $core.withContext(function($ctx1) {
  22735. return $recv($self._class())._sortedClasses_($self._classes());
  22736. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22737. },
  22738. args: [],
  22739. 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",
  22740. referencedClasses: [],
  22741. messageSends: ["sortedClasses:", "class", "classes"]
  22742. }),
  22743. $globals.Package);
  22744. $core.addMethod(
  22745. $core.method({
  22746. selector: "sortedImportsAsArray",
  22747. protocol: "private",
  22748. fn: function (){
  22749. var self=this,$self=this;
  22750. return $core.withContext(function($ctx1) {
  22751. var $3,$2,$4,$1,$6,$5,$7;
  22752. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22753. return $core.withContext(function($ctx2) {
  22754. $3=$recv(a)._isString();
  22755. $ctx2.sendIdx["isString"]=1;
  22756. $2=$recv($3)._not();
  22757. $4=$recv(b)._isString();
  22758. $ctx2.sendIdx["isString"]=2;
  22759. $1=$recv($2).__and($4);
  22760. return $recv($1)._or_((function(){
  22761. return $core.withContext(function($ctx3) {
  22762. $6=$recv(a)._isString();
  22763. $ctx3.sendIdx["isString"]=3;
  22764. $5=$recv($6).__eq($recv(b)._isString());
  22765. return $recv($5)._and_((function(){
  22766. return $core.withContext(function($ctx4) {
  22767. $7=$recv(a)._value();
  22768. $ctx4.sendIdx["value"]=1;
  22769. return $recv($7).__lt_eq($recv(b)._value());
  22770. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22771. }));
  22772. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22773. }));
  22774. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22775. }));
  22776. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22777. },
  22778. args: [],
  22779. 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 ]]]",
  22780. referencedClasses: [],
  22781. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22782. }),
  22783. $globals.Package);
  22784. $core.addMethod(
  22785. $core.method({
  22786. selector: "traitCompositions",
  22787. protocol: "dependencies",
  22788. fn: function (){
  22789. var self=this,$self=this;
  22790. var traitCompositions;
  22791. return $core.withContext(function($ctx1) {
  22792. var $1,$2,$3,$receiver;
  22793. traitCompositions=$recv($globals.Dictionary)._new();
  22794. $recv($self._classes())._do_((function(each){
  22795. return $core.withContext(function($ctx2) {
  22796. $1=traitCompositions;
  22797. $2=$recv(each)._traitComposition();
  22798. $ctx2.sendIdx["traitComposition"]=1;
  22799. $recv($1)._at_put_(each,$2);
  22800. $ctx2.sendIdx["at:put:"]=1;
  22801. $3=$recv(each)._theMetaClass();
  22802. if(($receiver = $3) == null || $receiver.a$nil){
  22803. return $3;
  22804. } else {
  22805. var meta;
  22806. meta=$receiver;
  22807. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22808. }
  22809. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22810. }));
  22811. return $recv(traitCompositions)._reject_((function(each){
  22812. return $core.withContext(function($ctx2) {
  22813. return $recv(each)._isEmpty();
  22814. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22815. }));
  22816. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22817. },
  22818. args: [],
  22819. 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 ]",
  22820. referencedClasses: ["Dictionary"],
  22821. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22822. }),
  22823. $globals.Package);
  22824. $core.addMethod(
  22825. $core.method({
  22826. selector: "transport",
  22827. protocol: "accessing",
  22828. fn: function (){
  22829. var self=this,$self=this;
  22830. return $core.withContext(function($ctx1) {
  22831. var $1,$receiver;
  22832. $1=$self["@transport"];
  22833. if(($receiver = $1) == null || $receiver.a$nil){
  22834. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22835. return $self["@transport"];
  22836. } else {
  22837. return $1;
  22838. }
  22839. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22840. },
  22841. args: [],
  22842. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22843. referencedClasses: ["PackageTransport"],
  22844. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22845. }),
  22846. $globals.Package);
  22847. $core.addMethod(
  22848. $core.method({
  22849. selector: "transport:",
  22850. protocol: "accessing",
  22851. fn: function (aPackageTransport){
  22852. var self=this,$self=this;
  22853. return $core.withContext(function($ctx1) {
  22854. $self["@transport"]=aPackageTransport;
  22855. $recv(aPackageTransport)._package_(self);
  22856. return self;
  22857. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22858. },
  22859. args: ["aPackageTransport"],
  22860. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22861. referencedClasses: [],
  22862. messageSends: ["package:"]
  22863. }),
  22864. $globals.Package);
  22865. $core.addMethod(
  22866. $core.method({
  22867. selector: "validateImports:",
  22868. protocol: "validation",
  22869. fn: function (aCollection){
  22870. var self=this,$self=this;
  22871. return $core.withContext(function($ctx1) {
  22872. var $1,$2,$5,$4,$3,$6;
  22873. $recv(aCollection)._do_((function(import_){
  22874. return $core.withContext(function($ctx2) {
  22875. $1=$recv(import_)._isString();
  22876. $ctx2.sendIdx["isString"]=1;
  22877. if(!$core.assert($1)){
  22878. $2=$recv(import_)._respondsTo_("key");
  22879. if(!$core.assert($2)){
  22880. $self._error_("Imports must be Strings or Associations");
  22881. $ctx2.sendIdx["error:"]=1;
  22882. }
  22883. $5=$recv(import_)._key();
  22884. $ctx2.sendIdx["key"]=1;
  22885. $4=$recv($5)._isString();
  22886. $ctx2.sendIdx["isString"]=2;
  22887. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22888. if(!$core.assert($3)){
  22889. $self._error_("Key and value must be Strings");
  22890. $ctx2.sendIdx["error:"]=2;
  22891. }
  22892. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22893. if(!$core.assert($6)){
  22894. return $self._error_("Keys must be identifiers");
  22895. }
  22896. }
  22897. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22898. }));
  22899. return self;
  22900. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22901. },
  22902. args: ["aCollection"],
  22903. 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' ]]]",
  22904. referencedClasses: [],
  22905. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22906. }),
  22907. $globals.Package);
  22908. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22909. $core.addMethod(
  22910. $core.method({
  22911. selector: "named:",
  22912. protocol: "accessing",
  22913. fn: function (aPackageName){
  22914. var self=this,$self=this;
  22915. return $core.withContext(function($ctx1) {
  22916. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22917. return $core.withContext(function($ctx2) {
  22918. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22919. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22920. }));
  22921. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22922. },
  22923. args: ["aPackageName"],
  22924. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22925. referencedClasses: ["Smalltalk"],
  22926. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22927. }),
  22928. $globals.Package.a$cls);
  22929. $core.addMethod(
  22930. $core.method({
  22931. selector: "named:ifAbsent:",
  22932. protocol: "accessing",
  22933. fn: function (aPackageName,aBlock){
  22934. var self=this,$self=this;
  22935. return $core.withContext(function($ctx1) {
  22936. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22937. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22938. },
  22939. args: ["aPackageName", "aBlock"],
  22940. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22941. referencedClasses: ["Smalltalk"],
  22942. messageSends: ["packageAt:ifAbsent:"]
  22943. }),
  22944. $globals.Package.a$cls);
  22945. $core.addMethod(
  22946. $core.method({
  22947. selector: "named:imports:transport:",
  22948. protocol: "accessing",
  22949. fn: function (aPackageName,anArray,aTransport){
  22950. var self=this,$self=this;
  22951. var pkg;
  22952. return $core.withContext(function($ctx1) {
  22953. pkg=$self._named_(aPackageName);
  22954. $recv(pkg)._imports_(anArray);
  22955. $recv(pkg)._transport_(aTransport);
  22956. return pkg;
  22957. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22958. },
  22959. args: ["aPackageName", "anArray", "aTransport"],
  22960. source: "named: aPackageName imports: anArray transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg imports: anArray.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22961. referencedClasses: [],
  22962. messageSends: ["named:", "imports:", "transport:"]
  22963. }),
  22964. $globals.Package.a$cls);
  22965. $core.addMethod(
  22966. $core.method({
  22967. selector: "named:javaScriptDescriptor:",
  22968. protocol: "instance creation",
  22969. fn: function (aString,anObject){
  22970. var self=this,$self=this;
  22971. var pkg;
  22972. return $core.withContext(function($ctx1) {
  22973. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  22974. $recv(pkg)._javaScriptDescriptor_(anObject);
  22975. return pkg;
  22976. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  22977. },
  22978. args: ["aString", "anObject"],
  22979. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  22980. referencedClasses: ["Smalltalk"],
  22981. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  22982. }),
  22983. $globals.Package.a$cls);
  22984. $core.addMethod(
  22985. $core.method({
  22986. selector: "named:transport:",
  22987. protocol: "accessing",
  22988. fn: function (aPackageName,aTransport){
  22989. var self=this,$self=this;
  22990. var pkg;
  22991. return $core.withContext(function($ctx1) {
  22992. pkg=$self._named_(aPackageName);
  22993. $recv(pkg)._transport_(aTransport);
  22994. return pkg;
  22995. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22996. },
  22997. args: ["aPackageName", "aTransport"],
  22998. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  22999. referencedClasses: [],
  23000. messageSends: ["named:", "transport:"]
  23001. }),
  23002. $globals.Package.a$cls);
  23003. $core.addMethod(
  23004. $core.method({
  23005. selector: "new:",
  23006. protocol: "instance creation",
  23007. fn: function (aString){
  23008. var self=this,$self=this;
  23009. return $core.withContext(function($ctx1) {
  23010. var $1;
  23011. $1=$recv($globals.Package)._new();
  23012. $recv($1)._name_(aString);
  23013. return $recv($1)._yourself();
  23014. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  23015. },
  23016. args: ["aString"],
  23017. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  23018. referencedClasses: ["Package"],
  23019. messageSends: ["name:", "new", "yourself"]
  23020. }),
  23021. $globals.Package.a$cls);
  23022. $core.addMethod(
  23023. $core.method({
  23024. selector: "sortedClasses:",
  23025. protocol: "sorting",
  23026. fn: function (classes){
  23027. var self=this,$self=this;
  23028. var children,others,nodes,expandedClasses;
  23029. return $core.withContext(function($ctx1) {
  23030. var $1,$3,$2;
  23031. children=[];
  23032. others=[];
  23033. $recv(classes)._do_((function(each){
  23034. return $core.withContext(function($ctx2) {
  23035. $1=$recv(classes)._includes_($recv(each)._superclass());
  23036. if($core.assert($1)){
  23037. return $recv(others)._add_(each);
  23038. } else {
  23039. return $recv(children)._add_(each);
  23040. $ctx2.sendIdx["add:"]=1;
  23041. }
  23042. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23043. }));
  23044. $ctx1.sendIdx["do:"]=1;
  23045. nodes=$recv(children)._collect_((function(each){
  23046. return $core.withContext(function($ctx2) {
  23047. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  23048. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  23049. }));
  23050. nodes=$recv(nodes)._sorted_((function(a,b){
  23051. return $core.withContext(function($ctx2) {
  23052. $3=$recv(a)._theClass();
  23053. $ctx2.sendIdx["theClass"]=1;
  23054. $2=$recv($3)._name();
  23055. $ctx2.sendIdx["name"]=1;
  23056. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  23057. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  23058. }));
  23059. expandedClasses=$recv($globals.Array)._new();
  23060. $recv(nodes)._do_((function(aNode){
  23061. return $core.withContext(function($ctx2) {
  23062. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  23063. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  23064. }));
  23065. return expandedClasses;
  23066. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  23067. },
  23068. args: ["classes"],
  23069. 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",
  23070. referencedClasses: ["ClassSorterNode", "Array"],
  23071. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  23072. }),
  23073. $globals.Package.a$cls);
  23074. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  23075. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23076. $core.addMethod(
  23077. $core.method({
  23078. selector: "announcer",
  23079. protocol: "accessing",
  23080. fn: function (){
  23081. var self=this,$self=this;
  23082. return $core.withContext(function($ctx1) {
  23083. return $recv($globals.SystemAnnouncer)._current();
  23084. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23085. },
  23086. args: [],
  23087. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23088. referencedClasses: ["SystemAnnouncer"],
  23089. messageSends: ["current"]
  23090. }),
  23091. $globals.PackageStateObserver);
  23092. $core.addMethod(
  23093. $core.method({
  23094. selector: "observeSystem",
  23095. protocol: "actions",
  23096. fn: function (){
  23097. var self=this,$self=this;
  23098. return $core.withContext(function($ctx1) {
  23099. var $1;
  23100. $1=$self._announcer();
  23101. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23102. $ctx1.sendIdx["on:send:to:"]=1;
  23103. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23104. $ctx1.sendIdx["on:send:to:"]=2;
  23105. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23106. $ctx1.sendIdx["on:send:to:"]=3;
  23107. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23108. return self;
  23109. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23110. },
  23111. args: [],
  23112. 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",
  23113. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23114. messageSends: ["on:send:to:", "announcer"]
  23115. }),
  23116. $globals.PackageStateObserver);
  23117. $core.addMethod(
  23118. $core.method({
  23119. selector: "onClassModification:",
  23120. protocol: "reactions",
  23121. fn: function (anAnnouncement){
  23122. var self=this,$self=this;
  23123. return $core.withContext(function($ctx1) {
  23124. var $1,$receiver;
  23125. $1=$recv(anAnnouncement)._theClass();
  23126. if(($receiver = $1) == null || $receiver.a$nil){
  23127. $1;
  23128. } else {
  23129. var theClass;
  23130. theClass=$receiver;
  23131. $recv($recv(theClass)._package())._beDirty();
  23132. }
  23133. return self;
  23134. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23135. },
  23136. args: ["anAnnouncement"],
  23137. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23138. referencedClasses: [],
  23139. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23140. }),
  23141. $globals.PackageStateObserver);
  23142. $core.addMethod(
  23143. $core.method({
  23144. selector: "onMethodModification:",
  23145. protocol: "reactions",
  23146. fn: function (anAnnouncement){
  23147. var self=this,$self=this;
  23148. return $core.withContext(function($ctx1) {
  23149. var $1,$receiver;
  23150. $1=$recv($recv(anAnnouncement)._method())._package();
  23151. if(($receiver = $1) == null || $receiver.a$nil){
  23152. $1;
  23153. } else {
  23154. var package_;
  23155. package_=$receiver;
  23156. $recv(package_)._beDirty();
  23157. }
  23158. return self;
  23159. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23160. },
  23161. args: ["anAnnouncement"],
  23162. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23163. referencedClasses: [],
  23164. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23165. }),
  23166. $globals.PackageStateObserver);
  23167. $core.addMethod(
  23168. $core.method({
  23169. selector: "onPackageAdded:",
  23170. protocol: "reactions",
  23171. fn: function (anAnnouncement){
  23172. var self=this,$self=this;
  23173. return $core.withContext(function($ctx1) {
  23174. $recv($recv(anAnnouncement)._package())._beDirty();
  23175. return self;
  23176. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23177. },
  23178. args: ["anAnnouncement"],
  23179. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23180. referencedClasses: [],
  23181. messageSends: ["beDirty", "package"]
  23182. }),
  23183. $globals.PackageStateObserver);
  23184. $core.addMethod(
  23185. $core.method({
  23186. selector: "onProtocolModification:",
  23187. protocol: "reactions",
  23188. fn: function (anAnnouncement){
  23189. var self=this,$self=this;
  23190. return $core.withContext(function($ctx1) {
  23191. var $1,$receiver;
  23192. $1=$recv(anAnnouncement)._package();
  23193. if(($receiver = $1) == null || $receiver.a$nil){
  23194. $1;
  23195. } else {
  23196. var package_;
  23197. package_=$receiver;
  23198. $recv(package_)._beDirty();
  23199. }
  23200. return self;
  23201. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23202. },
  23203. args: ["anAnnouncement"],
  23204. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23205. referencedClasses: [],
  23206. messageSends: ["ifNotNil:", "package", "beDirty"]
  23207. }),
  23208. $globals.PackageStateObserver);
  23209. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23210. $core.addMethod(
  23211. $core.method({
  23212. selector: "current",
  23213. protocol: "accessing",
  23214. fn: function (){
  23215. var self=this,$self=this;
  23216. return $core.withContext(function($ctx1) {
  23217. var $1,$receiver;
  23218. $1=$self["@current"];
  23219. if(($receiver = $1) == null || $receiver.a$nil){
  23220. $self["@current"]=$self._new();
  23221. return $self["@current"];
  23222. } else {
  23223. return $1;
  23224. }
  23225. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23226. },
  23227. args: [],
  23228. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23229. referencedClasses: [],
  23230. messageSends: ["ifNil:", "new"]
  23231. }),
  23232. $globals.PackageStateObserver.a$cls);
  23233. $core.addMethod(
  23234. $core.method({
  23235. selector: "initialize",
  23236. protocol: "initialization",
  23237. fn: function (){
  23238. var self=this,$self=this;
  23239. return $core.withContext(function($ctx1) {
  23240. $recv($self._current())._observeSystem();
  23241. return self;
  23242. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23243. },
  23244. args: [],
  23245. source: "initialize\x0a\x09self current observeSystem",
  23246. referencedClasses: [],
  23247. messageSends: ["observeSystem", "current"]
  23248. }),
  23249. $globals.PackageStateObserver.a$cls);
  23250. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23251. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23252. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23253. $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`";
  23254. $core.addMethod(
  23255. $core.method({
  23256. selector: "defaultValue",
  23257. protocol: "accessing",
  23258. fn: function (){
  23259. var self=this,$self=this;
  23260. return $self["@defaultValue"];
  23261. },
  23262. args: [],
  23263. source: "defaultValue\x0a\x09^ defaultValue",
  23264. referencedClasses: [],
  23265. messageSends: []
  23266. }),
  23267. $globals.Setting);
  23268. $core.addMethod(
  23269. $core.method({
  23270. selector: "defaultValue:",
  23271. protocol: "accessing",
  23272. fn: function (aStringifiableObject){
  23273. var self=this,$self=this;
  23274. $self["@defaultValue"]=aStringifiableObject;
  23275. return self;
  23276. },
  23277. args: ["aStringifiableObject"],
  23278. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23279. referencedClasses: [],
  23280. messageSends: []
  23281. }),
  23282. $globals.Setting);
  23283. $core.addMethod(
  23284. $core.method({
  23285. selector: "key",
  23286. protocol: "accessing",
  23287. fn: function (){
  23288. var self=this,$self=this;
  23289. return $self["@key"];
  23290. },
  23291. args: [],
  23292. source: "key\x0a\x09^ key",
  23293. referencedClasses: [],
  23294. messageSends: []
  23295. }),
  23296. $globals.Setting);
  23297. $core.addMethod(
  23298. $core.method({
  23299. selector: "key:",
  23300. protocol: "accessing",
  23301. fn: function (aString){
  23302. var self=this,$self=this;
  23303. $self["@key"]=aString;
  23304. return self;
  23305. },
  23306. args: ["aString"],
  23307. source: "key: aString\x0a\x09key := aString",
  23308. referencedClasses: [],
  23309. messageSends: []
  23310. }),
  23311. $globals.Setting);
  23312. $core.addMethod(
  23313. $core.method({
  23314. selector: "value",
  23315. protocol: "accessing",
  23316. fn: function (){
  23317. var self=this,$self=this;
  23318. return $core.withContext(function($ctx1) {
  23319. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23320. return $core.withContext(function($ctx2) {
  23321. return $self._defaultValue();
  23322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23323. }));
  23324. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23325. },
  23326. args: [],
  23327. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23328. referencedClasses: ["Smalltalk"],
  23329. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23330. }),
  23331. $globals.Setting);
  23332. $core.addMethod(
  23333. $core.method({
  23334. selector: "value:",
  23335. protocol: "accessing",
  23336. fn: function (aStringifiableObject){
  23337. var self=this,$self=this;
  23338. return $core.withContext(function($ctx1) {
  23339. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23340. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23341. },
  23342. args: ["aStringifiableObject"],
  23343. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23344. referencedClasses: ["Smalltalk"],
  23345. messageSends: ["at:put:", "settings", "key"]
  23346. }),
  23347. $globals.Setting);
  23348. $core.addMethod(
  23349. $core.method({
  23350. selector: "at:ifAbsent:",
  23351. protocol: "instance creation",
  23352. fn: function (aString,aDefaultValue){
  23353. var self=this,$self=this;
  23354. return $core.withContext(function($ctx1) {
  23355. var $1;
  23356. $1=(
  23357. $ctx1.supercall = true,
  23358. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23359. $ctx1.supercall = false;
  23360. $recv($1)._key_(aString);
  23361. $recv($1)._defaultValue_(aDefaultValue);
  23362. return $recv($1)._yourself();
  23363. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23364. },
  23365. args: ["aString", "aDefaultValue"],
  23366. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23367. referencedClasses: [],
  23368. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23369. }),
  23370. $globals.Setting.a$cls);
  23371. $core.addMethod(
  23372. $core.method({
  23373. selector: "new",
  23374. protocol: "instance creation",
  23375. fn: function (){
  23376. var self=this,$self=this;
  23377. return $core.withContext(function($ctx1) {
  23378. $self._shouldNotImplement();
  23379. return self;
  23380. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23381. },
  23382. args: [],
  23383. source: "new\x0a\x09self shouldNotImplement",
  23384. referencedClasses: [],
  23385. messageSends: ["shouldNotImplement"]
  23386. }),
  23387. $globals.Setting.a$cls);
  23388. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23389. $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.";
  23390. $core.addMethod(
  23391. $core.method({
  23392. selector: "addGlobalJsVariable:",
  23393. protocol: "globals",
  23394. fn: function (aString){
  23395. var self=this,$self=this;
  23396. return $core.withContext(function($ctx1) {
  23397. $recv($self._globalJsVariables())._add_(aString);
  23398. return self;
  23399. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23400. },
  23401. args: ["aString"],
  23402. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23403. referencedClasses: [],
  23404. messageSends: ["add:", "globalJsVariables"]
  23405. }),
  23406. $globals.SmalltalkImage);
  23407. $core.addMethod(
  23408. $core.method({
  23409. selector: "adoptPackageDescriptors",
  23410. protocol: "private",
  23411. fn: function (){
  23412. var self=this,$self=this;
  23413. var pkgs;
  23414. return $core.withContext(function($ctx1) {
  23415. pkgs=$recv($globals.Set)._new();
  23416. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  23417. return $core.withContext(function($ctx2) {
  23418. return $recv(pkgs)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  23419. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23420. }));
  23421. return pkgs;
  23422. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{pkgs:pkgs},$globals.SmalltalkImage)});
  23423. },
  23424. args: [],
  23425. source: "adoptPackageDescriptors\x0a\x09| pkgs |\x0a\x09pkgs := Set new.\x0a\x09self core packageDescriptors keysAndValuesDo: [ :key :value |\x0a\x09\x09pkgs add: (Package named: key javaScriptDescriptor: value) ].\x0a\x09^ pkgs",
  23426. referencedClasses: ["Set", "Package"],
  23427. messageSends: ["new", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:"]
  23428. }),
  23429. $globals.SmalltalkImage);
  23430. $core.addMethod(
  23431. $core.method({
  23432. selector: "amdRequire",
  23433. protocol: "accessing amd",
  23434. fn: function (){
  23435. var self=this,$self=this;
  23436. return $core.withContext(function($ctx1) {
  23437. return $recv($self._core())._at_("amdRequire");
  23438. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23439. },
  23440. args: [],
  23441. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23442. referencedClasses: [],
  23443. messageSends: ["at:", "core"]
  23444. }),
  23445. $globals.SmalltalkImage);
  23446. $core.addMethod(
  23447. $core.method({
  23448. selector: "asSmalltalkException:",
  23449. protocol: "error handling",
  23450. fn: function (anObject){
  23451. var self=this,$self=this;
  23452. return $core.withContext(function($ctx1) {
  23453. var $1;
  23454. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23455. return $core.withContext(function($ctx2) {
  23456. return $recv(anObject)._isKindOf_($globals.Error);
  23457. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23458. }));
  23459. if($core.assert($1)){
  23460. return anObject;
  23461. } else {
  23462. return $recv($globals.JavaScriptException)._on_(anObject);
  23463. }
  23464. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23465. },
  23466. args: ["anObject"],
  23467. 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 ]",
  23468. referencedClasses: ["Error", "JavaScriptException"],
  23469. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23470. }),
  23471. $globals.SmalltalkImage);
  23472. $core.addMethod(
  23473. $core.method({
  23474. selector: "basicCreatePackage:",
  23475. protocol: "private",
  23476. fn: function (packageName){
  23477. var self=this,$self=this;
  23478. return $core.withContext(function($ctx1) {
  23479. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23480. return $core.withContext(function($ctx2) {
  23481. return $recv($globals.Package)._new_(packageName);
  23482. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23483. }));
  23484. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23485. },
  23486. args: ["packageName"],
  23487. source: "basicCreatePackage: packageName\x0a\x09\x22Create and bind a new bare package with given name and return it.\x22\x0a\x09^ self packageDictionary at: packageName ifAbsentPut: [ Package new: packageName ]",
  23488. referencedClasses: ["Package"],
  23489. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23490. }),
  23491. $globals.SmalltalkImage);
  23492. $core.addMethod(
  23493. $core.method({
  23494. selector: "basicParse:",
  23495. protocol: "private",
  23496. fn: function (aString){
  23497. var self=this,$self=this;
  23498. return $core.withContext(function($ctx1) {
  23499. return $recv($globals.SmalltalkParser)._parse_(aString);
  23500. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23501. },
  23502. args: ["aString"],
  23503. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23504. referencedClasses: ["SmalltalkParser"],
  23505. messageSends: ["parse:"]
  23506. }),
  23507. $globals.SmalltalkImage);
  23508. $core.addMethod(
  23509. $core.method({
  23510. selector: "cancelOptOut:",
  23511. protocol: "accessing",
  23512. fn: function (anObject){
  23513. var self=this,$self=this;
  23514. return $core.withContext(function($ctx1) {
  23515. delete anObject.klass; delete anObject.a$cls;;
  23516. return self;
  23517. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23518. },
  23519. args: ["anObject"],
  23520. 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;'>",
  23521. referencedClasses: [],
  23522. messageSends: []
  23523. }),
  23524. $globals.SmalltalkImage);
  23525. $core.addMethod(
  23526. $core.method({
  23527. selector: "classes",
  23528. protocol: "classes",
  23529. fn: function (){
  23530. var self=this,$self=this;
  23531. return $core.withContext(function($ctx1) {
  23532. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23533. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23534. },
  23535. args: [],
  23536. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23537. referencedClasses: [],
  23538. messageSends: ["copy", "traitsOrClasses", "core"]
  23539. }),
  23540. $globals.SmalltalkImage);
  23541. $core.addMethod(
  23542. $core.method({
  23543. selector: "core",
  23544. protocol: "accessing",
  23545. fn: function (){
  23546. var self=this,$self=this;
  23547. return $core.withContext(function($ctx1) {
  23548. return $core;
  23549. return self;
  23550. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23551. },
  23552. args: [],
  23553. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23554. referencedClasses: [],
  23555. messageSends: []
  23556. }),
  23557. $globals.SmalltalkImage);
  23558. $core.addMethod(
  23559. $core.method({
  23560. selector: "createPackage:",
  23561. protocol: "packages",
  23562. fn: function (packageName){
  23563. var self=this,$self=this;
  23564. var package_,announcement;
  23565. return $core.withContext(function($ctx1) {
  23566. var $1;
  23567. package_=$self._basicCreatePackage_(packageName);
  23568. $1=$recv($globals.PackageAdded)._new();
  23569. $recv($1)._package_(package_);
  23570. announcement=$recv($1)._yourself();
  23571. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23572. return package_;
  23573. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23574. },
  23575. args: ["packageName"],
  23576. 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",
  23577. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23578. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23579. }),
  23580. $globals.SmalltalkImage);
  23581. $core.addMethod(
  23582. $core.method({
  23583. selector: "defaultAmdNamespace",
  23584. protocol: "accessing amd",
  23585. fn: function (){
  23586. var self=this,$self=this;
  23587. return $core.withContext(function($ctx1) {
  23588. return "transport.defaultAmdNamespace"._settingValue();
  23589. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23590. },
  23591. args: [],
  23592. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23593. referencedClasses: [],
  23594. messageSends: ["settingValue"]
  23595. }),
  23596. $globals.SmalltalkImage);
  23597. $core.addMethod(
  23598. $core.method({
  23599. selector: "defaultAmdNamespace:",
  23600. protocol: "accessing amd",
  23601. fn: function (aString){
  23602. var self=this,$self=this;
  23603. return $core.withContext(function($ctx1) {
  23604. "transport.defaultAmdNamespace"._settingValue_(aString);
  23605. return self;
  23606. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23607. },
  23608. args: ["aString"],
  23609. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23610. referencedClasses: [],
  23611. messageSends: ["settingValue:"]
  23612. }),
  23613. $globals.SmalltalkImage);
  23614. $core.addMethod(
  23615. $core.method({
  23616. selector: "deleteClass:",
  23617. protocol: "private",
  23618. fn: function (aClass){
  23619. var self=this,$self=this;
  23620. return $core.withContext(function($ctx1) {
  23621. $core.removeClass(aClass);
  23622. return self;
  23623. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23624. },
  23625. args: ["aClass"],
  23626. 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)'>",
  23627. referencedClasses: [],
  23628. messageSends: []
  23629. }),
  23630. $globals.SmalltalkImage);
  23631. $core.addMethod(
  23632. $core.method({
  23633. selector: "deleteGlobalJsVariable:",
  23634. protocol: "globals",
  23635. fn: function (aString){
  23636. var self=this,$self=this;
  23637. return $core.withContext(function($ctx1) {
  23638. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23639. }));
  23640. return self;
  23641. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23642. },
  23643. args: ["aString"],
  23644. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23645. referencedClasses: [],
  23646. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23647. }),
  23648. $globals.SmalltalkImage);
  23649. $core.addMethod(
  23650. $core.method({
  23651. selector: "existsJsGlobal:",
  23652. protocol: "testing",
  23653. fn: function (aString){
  23654. var self=this,$self=this;
  23655. return $core.withContext(function($ctx1) {
  23656. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23657. return $recv($globals.Platform)._includesGlobal_(aString);
  23658. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23659. },
  23660. args: ["aString"],
  23661. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23662. referencedClasses: ["Platform"],
  23663. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23664. }),
  23665. $globals.SmalltalkImage);
  23666. $core.addMethod(
  23667. $core.method({
  23668. selector: "globalJsVariables",
  23669. protocol: "globals",
  23670. fn: function (){
  23671. var self=this,$self=this;
  23672. return $core.withContext(function($ctx1) {
  23673. var $1,$receiver;
  23674. $1=$self["@globalJsVariables"];
  23675. if(($receiver = $1) == null || $receiver.a$nil){
  23676. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23677. return $self["@globalJsVariables"];
  23678. } else {
  23679. return $1;
  23680. }
  23681. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23682. },
  23683. args: [],
  23684. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23685. referencedClasses: [],
  23686. messageSends: ["ifNil:"]
  23687. }),
  23688. $globals.SmalltalkImage);
  23689. $core.addMethod(
  23690. $core.method({
  23691. selector: "globals",
  23692. protocol: "accessing",
  23693. fn: function (){
  23694. var self=this,$self=this;
  23695. return $core.withContext(function($ctx1) {
  23696. return $globals;
  23697. return self;
  23698. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23699. },
  23700. args: [],
  23701. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23702. referencedClasses: [],
  23703. messageSends: []
  23704. }),
  23705. $globals.SmalltalkImage);
  23706. $core.addMethod(
  23707. $core.method({
  23708. selector: "includesKey:",
  23709. protocol: "accessing",
  23710. fn: function (aKey){
  23711. var self=this,$self=this;
  23712. return $core.withContext(function($ctx1) {
  23713. return $core.hasOwnProperty(aKey);
  23714. return self;
  23715. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23716. },
  23717. args: ["aKey"],
  23718. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23719. referencedClasses: [],
  23720. messageSends: []
  23721. }),
  23722. $globals.SmalltalkImage);
  23723. $core.addMethod(
  23724. $core.method({
  23725. selector: "isSmalltalkObject:",
  23726. protocol: "testing",
  23727. fn: function (anObject){
  23728. var self=this,$self=this;
  23729. return $core.withContext(function($ctx1) {
  23730. return anObject.a$cls != null;
  23731. return self;
  23732. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23733. },
  23734. args: ["anObject"],
  23735. 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'>",
  23736. referencedClasses: [],
  23737. messageSends: []
  23738. }),
  23739. $globals.SmalltalkImage);
  23740. $core.addMethod(
  23741. $core.method({
  23742. selector: "optOut:",
  23743. protocol: "accessing",
  23744. fn: function (anObject){
  23745. var self=this,$self=this;
  23746. return $core.withContext(function($ctx1) {
  23747. anObject.klass = null; anObject.a$cls = null;
  23748. return self;
  23749. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23750. },
  23751. args: ["anObject"],
  23752. 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'>",
  23753. referencedClasses: [],
  23754. messageSends: []
  23755. }),
  23756. $globals.SmalltalkImage);
  23757. $core.addMethod(
  23758. $core.method({
  23759. selector: "packageAt:ifAbsent:",
  23760. protocol: "packages",
  23761. fn: function (packageName,aBlock){
  23762. var self=this,$self=this;
  23763. return $core.withContext(function($ctx1) {
  23764. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23765. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23766. },
  23767. args: ["packageName", "aBlock"],
  23768. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23769. referencedClasses: [],
  23770. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23771. }),
  23772. $globals.SmalltalkImage);
  23773. $core.addMethod(
  23774. $core.method({
  23775. selector: "packageAt:ifPresent:",
  23776. protocol: "packages",
  23777. fn: function (packageName,aBlock){
  23778. var self=this,$self=this;
  23779. return $core.withContext(function($ctx1) {
  23780. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23781. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23782. },
  23783. args: ["packageName", "aBlock"],
  23784. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23785. referencedClasses: [],
  23786. messageSends: ["at:ifPresent:", "packageDictionary"]
  23787. }),
  23788. $globals.SmalltalkImage);
  23789. $core.addMethod(
  23790. $core.method({
  23791. selector: "packageDictionary",
  23792. protocol: "packages",
  23793. fn: function (){
  23794. var self=this,$self=this;
  23795. return $core.withContext(function($ctx1) {
  23796. var $1,$receiver;
  23797. $1=$self["@packageDictionary"];
  23798. if(($receiver = $1) == null || $receiver.a$nil){
  23799. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23800. return $self["@packageDictionary"];
  23801. } else {
  23802. return $1;
  23803. }
  23804. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23805. },
  23806. args: [],
  23807. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23808. referencedClasses: ["Dictionary"],
  23809. messageSends: ["ifNil:", "new"]
  23810. }),
  23811. $globals.SmalltalkImage);
  23812. $core.addMethod(
  23813. $core.method({
  23814. selector: "packages",
  23815. protocol: "packages",
  23816. fn: function (){
  23817. var self=this,$self=this;
  23818. return $core.withContext(function($ctx1) {
  23819. return $recv($recv($self._packageDictionary())._values())._copy();
  23820. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23821. },
  23822. args: [],
  23823. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23824. referencedClasses: [],
  23825. messageSends: ["copy", "values", "packageDictionary"]
  23826. }),
  23827. $globals.SmalltalkImage);
  23828. $core.addMethod(
  23829. $core.method({
  23830. selector: "parse:",
  23831. protocol: "accessing",
  23832. fn: function (aString){
  23833. var self=this,$self=this;
  23834. var result;
  23835. return $core.withContext(function($ctx1) {
  23836. var $1;
  23837. $recv((function(){
  23838. return $core.withContext(function($ctx2) {
  23839. result=$self._basicParse_(aString);
  23840. return result;
  23841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23842. }))._tryCatch_((function(ex){
  23843. return $core.withContext(function($ctx2) {
  23844. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23845. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23846. }));
  23847. $1=result;
  23848. $recv($1)._source_(aString);
  23849. return $recv($1)._yourself();
  23850. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23851. },
  23852. args: ["aString"],
  23853. 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",
  23854. referencedClasses: [],
  23855. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23856. }),
  23857. $globals.SmalltalkImage);
  23858. $core.addMethod(
  23859. $core.method({
  23860. selector: "parseError:parsing:",
  23861. protocol: "error handling",
  23862. fn: function (anException,aString){
  23863. var self=this,$self=this;
  23864. return $core.withContext(function($ctx1) {
  23865. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  23866. $1=$recv(anException)._basicAt_("location");
  23867. $ctx1.sendIdx["basicAt:"]=1;
  23868. if(($receiver = $1) == null || $receiver.a$nil){
  23869. return $recv(anException)._pass();
  23870. } else {
  23871. var loc;
  23872. loc=$receiver;
  23873. $2=$recv($globals.ParseError)._new();
  23874. $9=$recv(loc)._start();
  23875. $ctx1.sendIdx["start"]=1;
  23876. $8=$recv($9)._line();
  23877. $7="Parse error on line ".__comma($8);
  23878. $6=$recv($7).__comma(" column ");
  23879. $ctx1.sendIdx[","]=4;
  23880. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  23881. $ctx1.sendIdx[","]=3;
  23882. $4=$recv($5).__comma(" : Unexpected character ");
  23883. $ctx1.sendIdx[","]=2;
  23884. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23885. $ctx1.sendIdx[","]=1;
  23886. $recv($2)._messageText_($3);
  23887. return $recv($2)._yourself();
  23888. }
  23889. return self;
  23890. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  23891. },
  23892. args: ["anException", "aString"],
  23893. source: "parseError: anException parsing: aString\x0a\x09(anException basicAt: 'location')\x0a\x09\x09ifNil: [ ^ anException pass ]\x0a\x09\x09ifNotNil: [ :loc |\x0a\x09\x09\x09^ ParseError new \x0a\x09\x09\x09\x09messageText: \x0a\x09\x09\x09\x09\x09'Parse error on line ', loc start line ,\x0a\x09\x09\x09\x09\x09' column ' , loc start column ,\x0a\x09\x09\x09\x09\x09' : Unexpected character ', (anException basicAt: 'found');\x0a\x09\x09\x09\x09yourself ]",
  23894. referencedClasses: ["ParseError"],
  23895. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  23896. }),
  23897. $globals.SmalltalkImage);
  23898. $core.addMethod(
  23899. $core.method({
  23900. selector: "postLoad",
  23901. protocol: "image",
  23902. fn: function (){
  23903. var self=this,$self=this;
  23904. var pkgs,classes;
  23905. return $core.withContext(function($ctx1) {
  23906. var $1;
  23907. pkgs=$self._adoptPackageDescriptors();
  23908. $recv(pkgs)._do_("beClean");
  23909. $ctx1.sendIdx["do:"]=1;
  23910. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  23911. return $core.withContext(function($ctx2) {
  23912. return $recv(pkgs)._includes_($recv(each)._package());
  23913. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23914. }));
  23915. $recv(classes)._do_((function(each){
  23916. return $core.withContext(function($ctx2) {
  23917. $1=$recv(each).__eq($self._class());
  23918. if(!$core.assert($1)){
  23919. return $recv(each)._initialize();
  23920. }
  23921. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23922. }));
  23923. $self._sweepPackageDescriptors_(pkgs);
  23924. return self;
  23925. }, function($ctx1) {$ctx1.fill(self,"postLoad",{pkgs:pkgs,classes:classes},$globals.SmalltalkImage)});
  23926. },
  23927. args: [],
  23928. source: "postLoad\x0a\x09| pkgs classes |\x0a\x09pkgs := self adoptPackageDescriptors.\x0a\x09pkgs do: #beClean.\x0a\x09classes := Smalltalk classes select:\x0a\x09\x09[ :each | pkgs includes: each package ].\x0a\x09classes do: [ :each |\x0a\x09\x09each = self class ifFalse: [ each initialize ] ].\x0a\x09self sweepPackageDescriptors: pkgs",
  23929. referencedClasses: ["Smalltalk"],
  23930. messageSends: ["adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  23931. }),
  23932. $globals.SmalltalkImage);
  23933. $core.addMethod(
  23934. $core.method({
  23935. selector: "pseudoVariableNames",
  23936. protocol: "accessing",
  23937. fn: function (){
  23938. var self=this,$self=this;
  23939. return ["self", "super", "nil", "true", "false", "thisContext"];
  23940. },
  23941. args: [],
  23942. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23943. referencedClasses: [],
  23944. messageSends: []
  23945. }),
  23946. $globals.SmalltalkImage);
  23947. $core.addMethod(
  23948. $core.method({
  23949. selector: "readJSObject:",
  23950. protocol: "accessing",
  23951. fn: function (anObject){
  23952. var self=this,$self=this;
  23953. return $core.withContext(function($ctx1) {
  23954. return $core.readJSObject(anObject);
  23955. return self;
  23956. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23957. },
  23958. args: ["anObject"],
  23959. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23960. referencedClasses: [],
  23961. messageSends: []
  23962. }),
  23963. $globals.SmalltalkImage);
  23964. $core.addMethod(
  23965. $core.method({
  23966. selector: "removeClass:",
  23967. protocol: "classes",
  23968. fn: function (aClass){
  23969. var self=this,$self=this;
  23970. return $core.withContext(function($ctx1) {
  23971. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  23972. $1=$recv(aClass)._isMetaclass();
  23973. if($core.assert($1)){
  23974. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  23975. $ctx1.sendIdx[","]=1;
  23976. $self._error_($2);
  23977. $ctx1.sendIdx["error:"]=1;
  23978. }
  23979. $recv(aClass)._allSubclassesDo_((function(subclass){
  23980. return $core.withContext(function($ctx2) {
  23981. $5=$recv(aClass)._name();
  23982. $ctx2.sendIdx["name"]=1;
  23983. $4=$recv($5).__comma(" has a subclass: ");
  23984. $ctx2.sendIdx[","]=3;
  23985. $6=$recv(subclass)._name();
  23986. $ctx2.sendIdx["name"]=2;
  23987. $3=$recv($4).__comma($6);
  23988. $ctx2.sendIdx[","]=2;
  23989. return $self._error_($3);
  23990. $ctx2.sendIdx["error:"]=2;
  23991. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  23992. }));
  23993. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  23994. return $core.withContext(function($ctx2) {
  23995. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  23996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  23997. }));
  23998. $self._deleteClass_(aClass);
  23999. $recv(aClass)._setTraitComposition_([]);
  24000. $ctx1.sendIdx["setTraitComposition:"]=1;
  24001. $7=$recv(aClass)._theMetaClass();
  24002. if(($receiver = $7) == null || $receiver.a$nil){
  24003. $7;
  24004. } else {
  24005. var meta;
  24006. meta=$receiver;
  24007. $recv(meta)._setTraitComposition_([]);
  24008. }
  24009. $8=$recv($globals.SystemAnnouncer)._current();
  24010. $10=$recv($globals.ClassRemoved)._new();
  24011. $recv($10)._theClass_(aClass);
  24012. $9=$recv($10)._yourself();
  24013. $recv($8)._announce_($9);
  24014. return self;
  24015. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  24016. },
  24017. args: ["aClass"],
  24018. 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 theMetaClass ifNotNil: [ :meta | meta setTraitComposition: #() ].\x0a\x09\x0a\x09SystemAnnouncer current\x0a\x09\x09announce: (ClassRemoved new\x0a\x09\x09\x09theClass: aClass;\x0a\x09\x09\x09yourself)",
  24019. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  24020. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  24021. }),
  24022. $globals.SmalltalkImage);
  24023. $core.addMethod(
  24024. $core.method({
  24025. selector: "removePackage:",
  24026. protocol: "packages",
  24027. fn: function (packageName){
  24028. var self=this,$self=this;
  24029. var pkg;
  24030. return $core.withContext(function($ctx1) {
  24031. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24032. return $core.withContext(function($ctx2) {
  24033. return $self._error_("Missing package: ".__comma(packageName));
  24034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24035. }));
  24036. $recv($recv(pkg)._classes())._do_((function(each){
  24037. return $core.withContext(function($ctx2) {
  24038. return $self._removeClass_(each);
  24039. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  24040. }));
  24041. $recv($self._packageDictionary())._removeKey_(packageName);
  24042. return self;
  24043. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  24044. },
  24045. args: ["packageName"],
  24046. 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 packageDictionary removeKey: packageName",
  24047. referencedClasses: [],
  24048. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  24049. }),
  24050. $globals.SmalltalkImage);
  24051. $core.addMethod(
  24052. $core.method({
  24053. selector: "renamePackage:to:",
  24054. protocol: "packages",
  24055. fn: function (packageName,newName){
  24056. var self=this,$self=this;
  24057. var pkg;
  24058. return $core.withContext(function($ctx1) {
  24059. var $1,$2,$3;
  24060. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24061. return $core.withContext(function($ctx2) {
  24062. $1="Missing package: ".__comma(packageName);
  24063. $ctx2.sendIdx[","]=1;
  24064. return $self._error_($1);
  24065. $ctx2.sendIdx["error:"]=1;
  24066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24067. }));
  24068. $self._packageAt_ifPresent_(newName,(function(){
  24069. return $core.withContext(function($ctx2) {
  24070. return $self._error_("Already exists a package called: ".__comma(newName));
  24071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  24072. }));
  24073. $2=pkg;
  24074. $recv($2)._name_(newName);
  24075. $recv($2)._beDirty();
  24076. $3=$self._packageDictionary();
  24077. $recv($3)._at_put_(newName,pkg);
  24078. $recv($3)._removeKey_(packageName);
  24079. return self;
  24080. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  24081. },
  24082. args: ["packageName", "newName"],
  24083. 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\x09self packageAt: newName ifPresent: [ self error: 'Already exists a package called: ', newName ].\x0a\x09pkg name: newName; beDirty.\x0a\x09self packageDictionary\x0a\x09\x09at: newName put: pkg;\x0a\x09\x09removeKey: packageName",
  24084. referencedClasses: [],
  24085. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  24086. }),
  24087. $globals.SmalltalkImage);
  24088. $core.addMethod(
  24089. $core.method({
  24090. selector: "reservedWords",
  24091. protocol: "accessing",
  24092. fn: function (){
  24093. var self=this,$self=this;
  24094. return ["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "export", "extends", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "return", "super", "switch", "this", "throw", "try", "typeof", "var", "void", "while", "with", "yield", "let", "static", "arguments", "await", "enum", "implements", "interface", "package", "private", "protected", "public"];
  24095. },
  24096. args: [],
  24097. source: "reservedWords\x0a\x09^ #(\x0a\x09\x09\x22http://www.ecma-international.org/ecma-262/6.0/#sec-keywords\x22\x0a\x09\x09break case catch class const continue debugger\x0a\x09\x09default delete do else export extends finally\x0a\x09\x09for function if import in instanceof new\x0a\x09\x09return super switch this throw try typeof\x0a\x09\x09var void while with yield\x0a\x09\x09\x22in strict mode\x22\x0a\x09\x09let static\x0a\x09\x09\x22Amber protected words: these should not be compiled as-is when in code\x22\x0a\x09\x09arguments\x0a\x09\x09\x22http://www.ecma-international.org/ecma-262/6.0/#sec-future-reserved-words\x22\x0a\x09\x09await enum\x0a\x09\x09\x22in strict mode\x22\x0a\x09\x09implements interface package private protected public\x0a\x09)",
  24098. referencedClasses: [],
  24099. messageSends: []
  24100. }),
  24101. $globals.SmalltalkImage);
  24102. $core.addMethod(
  24103. $core.method({
  24104. selector: "settings",
  24105. protocol: "accessing",
  24106. fn: function (){
  24107. var self=this,$self=this;
  24108. return $globals.SmalltalkSettings;
  24109. },
  24110. args: [],
  24111. source: "settings\x0a\x09^ SmalltalkSettings",
  24112. referencedClasses: ["SmalltalkSettings"],
  24113. messageSends: []
  24114. }),
  24115. $globals.SmalltalkImage);
  24116. $core.addMethod(
  24117. $core.method({
  24118. selector: "sweepPackageDescriptors:",
  24119. protocol: "private",
  24120. fn: function (pkgs){
  24121. var self=this,$self=this;
  24122. var pd;
  24123. return $core.withContext(function($ctx1) {
  24124. pd=$recv($self._core())._packageDescriptors();
  24125. $recv(pkgs)._do_((function(each){
  24126. return $core.withContext(function($ctx2) {
  24127. return $recv(pd)._removeKey_($recv(each)._name());
  24128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24129. }));
  24130. return self;
  24131. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  24132. },
  24133. args: ["pkgs"],
  24134. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  24135. referencedClasses: [],
  24136. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  24137. }),
  24138. $globals.SmalltalkImage);
  24139. $core.addMethod(
  24140. $core.method({
  24141. selector: "version",
  24142. protocol: "accessing",
  24143. fn: function (){
  24144. var self=this,$self=this;
  24145. return "0.22.0";
  24146. },
  24147. args: [],
  24148. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.22.0'",
  24149. referencedClasses: [],
  24150. messageSends: []
  24151. }),
  24152. $globals.SmalltalkImage);
  24153. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24154. $core.addMethod(
  24155. $core.method({
  24156. selector: "current",
  24157. protocol: "instance creation",
  24158. fn: function (){
  24159. var self=this,$self=this;
  24160. return $core.withContext(function($ctx1) {
  24161. var $1,$receiver;
  24162. $1=$self["@current"];
  24163. if(($receiver = $1) == null || $receiver.a$nil){
  24164. $self["@current"]=(
  24165. $ctx1.supercall = true,
  24166. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24167. $ctx1.supercall = false;
  24168. return $self["@current"];
  24169. } else {
  24170. $self._deprecatedAPI();
  24171. return $self["@current"];
  24172. }
  24173. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24174. },
  24175. args: [],
  24176. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24177. referencedClasses: [],
  24178. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24179. }),
  24180. $globals.SmalltalkImage.a$cls);
  24181. $core.addMethod(
  24182. $core.method({
  24183. selector: "initialize",
  24184. protocol: "initialization",
  24185. fn: function (){
  24186. var self=this,$self=this;
  24187. var st;
  24188. return $core.withContext(function($ctx1) {
  24189. st=$self._current();
  24190. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24191. return self;
  24192. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24193. },
  24194. args: [],
  24195. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24196. referencedClasses: [],
  24197. messageSends: ["current", "at:put:", "globals"]
  24198. }),
  24199. $globals.SmalltalkImage.a$cls);
  24200. $core.addMethod(
  24201. $core.method({
  24202. selector: "new",
  24203. protocol: "instance creation",
  24204. fn: function (){
  24205. var self=this,$self=this;
  24206. return $core.withContext(function($ctx1) {
  24207. $self._shouldNotImplement();
  24208. return self;
  24209. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24210. },
  24211. args: [],
  24212. source: "new\x0a\x09self shouldNotImplement",
  24213. referencedClasses: [],
  24214. messageSends: ["shouldNotImplement"]
  24215. }),
  24216. $globals.SmalltalkImage.a$cls);
  24217. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24218. $core.addMethod(
  24219. $core.method({
  24220. selector: "nextPutJSObject:",
  24221. protocol: "*Kernel-Infrastructure",
  24222. fn: function (aJSObject){
  24223. var self=this,$self=this;
  24224. return $core.withContext(function($ctx1) {
  24225. $self._nextPut_(aJSObject);
  24226. return self;
  24227. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24228. },
  24229. args: ["aJSObject"],
  24230. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24231. referencedClasses: [],
  24232. messageSends: ["nextPut:"]
  24233. }),
  24234. $globals.ProtoStream);
  24235. $core.addMethod(
  24236. $core.method({
  24237. selector: "asJavaScriptPropertyName",
  24238. protocol: "*Kernel-Infrastructure",
  24239. fn: function (){
  24240. var self=this,$self=this;
  24241. return $core.withContext(function($ctx1) {
  24242. return $core.st2prop(self);
  24243. return self;
  24244. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24245. },
  24246. args: [],
  24247. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24248. referencedClasses: [],
  24249. messageSends: []
  24250. }),
  24251. $globals.String);
  24252. $core.addMethod(
  24253. $core.method({
  24254. selector: "asSetting",
  24255. protocol: "*Kernel-Infrastructure",
  24256. fn: function (){
  24257. var self=this,$self=this;
  24258. return $core.withContext(function($ctx1) {
  24259. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24260. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24261. },
  24262. args: [],
  24263. 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",
  24264. referencedClasses: ["Setting"],
  24265. messageSends: ["at:ifAbsent:"]
  24266. }),
  24267. $globals.String);
  24268. $core.addMethod(
  24269. $core.method({
  24270. selector: "asSettingIfAbsent:",
  24271. protocol: "*Kernel-Infrastructure",
  24272. fn: function (aDefaultValue){
  24273. var self=this,$self=this;
  24274. return $core.withContext(function($ctx1) {
  24275. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24276. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24277. },
  24278. args: ["aDefaultValue"],
  24279. 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",
  24280. referencedClasses: ["Setting"],
  24281. messageSends: ["at:ifAbsent:"]
  24282. }),
  24283. $globals.String);
  24284. $core.addMethod(
  24285. $core.method({
  24286. selector: "settingValue",
  24287. protocol: "*Kernel-Infrastructure",
  24288. fn: function (){
  24289. var self=this,$self=this;
  24290. return $core.withContext(function($ctx1) {
  24291. return $recv($self._asSetting())._value();
  24292. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24293. },
  24294. args: [],
  24295. source: "settingValue\x0a\x09^ self asSetting value",
  24296. referencedClasses: [],
  24297. messageSends: ["value", "asSetting"]
  24298. }),
  24299. $globals.String);
  24300. $core.addMethod(
  24301. $core.method({
  24302. selector: "settingValue:",
  24303. protocol: "*Kernel-Infrastructure",
  24304. fn: function (aValue){
  24305. var self=this,$self=this;
  24306. return $core.withContext(function($ctx1) {
  24307. return $recv($self._asSetting())._value_(aValue);
  24308. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24309. },
  24310. args: ["aValue"],
  24311. 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",
  24312. referencedClasses: [],
  24313. messageSends: ["value:", "asSetting"]
  24314. }),
  24315. $globals.String);
  24316. $core.addMethod(
  24317. $core.method({
  24318. selector: "settingValueIfAbsent:",
  24319. protocol: "*Kernel-Infrastructure",
  24320. fn: function (aDefaultValue){
  24321. var self=this,$self=this;
  24322. return $core.withContext(function($ctx1) {
  24323. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24324. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24325. },
  24326. args: ["aDefaultValue"],
  24327. 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",
  24328. referencedClasses: [],
  24329. messageSends: ["value", "asSettingIfAbsent:"]
  24330. }),
  24331. $globals.String);
  24332. });
  24333. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24334. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24335. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24336. $core.addPackage("Kernel-Announcements");
  24337. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  24338. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24339. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24340. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24341. $core.addMethod(
  24342. $core.method({
  24343. selector: "announcementClass",
  24344. protocol: "accessing",
  24345. fn: function (){
  24346. var self=this,$self=this;
  24347. return $self["@announcementClass"];
  24348. },
  24349. args: [],
  24350. source: "announcementClass\x0a\x09^ announcementClass",
  24351. referencedClasses: [],
  24352. messageSends: []
  24353. }),
  24354. $globals.AnnouncementSubscription);
  24355. $core.addMethod(
  24356. $core.method({
  24357. selector: "announcementClass:",
  24358. protocol: "accessing",
  24359. fn: function (aClass){
  24360. var self=this,$self=this;
  24361. $self["@announcementClass"]=aClass;
  24362. return self;
  24363. },
  24364. args: ["aClass"],
  24365. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  24366. referencedClasses: [],
  24367. messageSends: []
  24368. }),
  24369. $globals.AnnouncementSubscription);
  24370. $core.addMethod(
  24371. $core.method({
  24372. selector: "deliver:",
  24373. protocol: "announcing",
  24374. fn: function (anAnnouncement){
  24375. var self=this,$self=this;
  24376. return $core.withContext(function($ctx1) {
  24377. var $1;
  24378. $1=$self._handlesAnnouncement_(anAnnouncement);
  24379. if($core.assert($1)){
  24380. $recv($self._valuable())._value_(anAnnouncement);
  24381. }
  24382. return self;
  24383. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24384. },
  24385. args: ["anAnnouncement"],
  24386. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24387. referencedClasses: [],
  24388. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24389. }),
  24390. $globals.AnnouncementSubscription);
  24391. $core.addMethod(
  24392. $core.method({
  24393. selector: "handlesAnnouncement:",
  24394. protocol: "announcing",
  24395. fn: function (anAnnouncement){
  24396. var self=this,$self=this;
  24397. return $core.withContext(function($ctx1) {
  24398. var $2,$3,$1,$receiver;
  24399. $2=$recv($globals.Smalltalk)._globals();
  24400. $ctx1.sendIdx["globals"]=1;
  24401. $3=$recv($self._announcementClass())._name();
  24402. $ctx1.sendIdx["name"]=1;
  24403. $1=$recv($2)._at_($3);
  24404. $ctx1.sendIdx["at:"]=1;
  24405. if(($receiver = $1) == null || $receiver.a$nil){
  24406. return false;
  24407. } else {
  24408. var class_;
  24409. class_=$receiver;
  24410. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  24411. }
  24412. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24413. },
  24414. args: ["anAnnouncement"],
  24415. 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 ]",
  24416. referencedClasses: ["Smalltalk"],
  24417. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  24418. }),
  24419. $globals.AnnouncementSubscription);
  24420. $core.addMethod(
  24421. $core.method({
  24422. selector: "receiver",
  24423. protocol: "accessing",
  24424. fn: function (){
  24425. var self=this,$self=this;
  24426. return $core.withContext(function($ctx1) {
  24427. return $recv($self._valuable())._receiver();
  24428. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24429. },
  24430. args: [],
  24431. source: "receiver\x0a\x09^ self valuable receiver",
  24432. referencedClasses: [],
  24433. messageSends: ["receiver", "valuable"]
  24434. }),
  24435. $globals.AnnouncementSubscription);
  24436. $core.addMethod(
  24437. $core.method({
  24438. selector: "valuable",
  24439. protocol: "accessing",
  24440. fn: function (){
  24441. var self=this,$self=this;
  24442. return $self["@valuable"];
  24443. },
  24444. args: [],
  24445. source: "valuable\x0a\x09^ valuable",
  24446. referencedClasses: [],
  24447. messageSends: []
  24448. }),
  24449. $globals.AnnouncementSubscription);
  24450. $core.addMethod(
  24451. $core.method({
  24452. selector: "valuable:",
  24453. protocol: "accessing",
  24454. fn: function (aValuable){
  24455. var self=this,$self=this;
  24456. $self["@valuable"]=aValuable;
  24457. return self;
  24458. },
  24459. args: ["aValuable"],
  24460. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24461. referencedClasses: [],
  24462. messageSends: []
  24463. }),
  24464. $globals.AnnouncementSubscription);
  24465. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24466. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24467. $core.addMethod(
  24468. $core.method({
  24469. selector: "receiver",
  24470. protocol: "accessing",
  24471. fn: function (){
  24472. var self=this,$self=this;
  24473. return $self["@receiver"];
  24474. },
  24475. args: [],
  24476. source: "receiver\x0a\x09^ receiver",
  24477. referencedClasses: [],
  24478. messageSends: []
  24479. }),
  24480. $globals.AnnouncementValuable);
  24481. $core.addMethod(
  24482. $core.method({
  24483. selector: "receiver:",
  24484. protocol: "accessing",
  24485. fn: function (anObject){
  24486. var self=this,$self=this;
  24487. $self["@receiver"]=anObject;
  24488. return self;
  24489. },
  24490. args: ["anObject"],
  24491. source: "receiver: anObject\x0a\x09receiver := anObject",
  24492. referencedClasses: [],
  24493. messageSends: []
  24494. }),
  24495. $globals.AnnouncementValuable);
  24496. $core.addMethod(
  24497. $core.method({
  24498. selector: "valuable",
  24499. protocol: "accessing",
  24500. fn: function (){
  24501. var self=this,$self=this;
  24502. return $self["@valuable"];
  24503. },
  24504. args: [],
  24505. source: "valuable\x0a\x09^ valuable",
  24506. referencedClasses: [],
  24507. messageSends: []
  24508. }),
  24509. $globals.AnnouncementValuable);
  24510. $core.addMethod(
  24511. $core.method({
  24512. selector: "valuable:",
  24513. protocol: "accessing",
  24514. fn: function (anObject){
  24515. var self=this,$self=this;
  24516. $self["@valuable"]=anObject;
  24517. return self;
  24518. },
  24519. args: ["anObject"],
  24520. source: "valuable: anObject\x0a\x09valuable := anObject",
  24521. referencedClasses: [],
  24522. messageSends: []
  24523. }),
  24524. $globals.AnnouncementValuable);
  24525. $core.addMethod(
  24526. $core.method({
  24527. selector: "value",
  24528. protocol: "evaluating",
  24529. fn: function (){
  24530. var self=this,$self=this;
  24531. return $core.withContext(function($ctx1) {
  24532. return $recv($self._valuable())._value();
  24533. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24534. },
  24535. args: [],
  24536. source: "value\x0a\x09^ self valuable value",
  24537. referencedClasses: [],
  24538. messageSends: ["value", "valuable"]
  24539. }),
  24540. $globals.AnnouncementValuable);
  24541. $core.addMethod(
  24542. $core.method({
  24543. selector: "value:",
  24544. protocol: "evaluating",
  24545. fn: function (anObject){
  24546. var self=this,$self=this;
  24547. return $core.withContext(function($ctx1) {
  24548. return $recv($self._valuable())._value_(anObject);
  24549. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24550. },
  24551. args: ["anObject"],
  24552. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24553. referencedClasses: [],
  24554. messageSends: ["value:", "valuable"]
  24555. }),
  24556. $globals.AnnouncementValuable);
  24557. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24558. $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' ].";
  24559. $core.addMethod(
  24560. $core.method({
  24561. selector: "announce:",
  24562. protocol: "announcing",
  24563. fn: function (anAnnouncement){
  24564. var self=this,$self=this;
  24565. return $core.withContext(function($ctx1) {
  24566. $recv($self["@subscriptions"])._do_((function(each){
  24567. return $core.withContext(function($ctx2) {
  24568. return $recv(each)._deliver_(anAnnouncement);
  24569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24570. }));
  24571. return self;
  24572. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24573. },
  24574. args: ["anAnnouncement"],
  24575. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24576. referencedClasses: [],
  24577. messageSends: ["do:", "deliver:"]
  24578. }),
  24579. $globals.Announcer);
  24580. $core.addMethod(
  24581. $core.method({
  24582. selector: "initialize",
  24583. protocol: "initialization",
  24584. fn: function (){
  24585. var self=this,$self=this;
  24586. return $core.withContext(function($ctx1) {
  24587. (
  24588. $ctx1.supercall = true,
  24589. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24590. $ctx1.supercall = false;
  24591. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24592. return self;
  24593. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24594. },
  24595. args: [],
  24596. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24597. referencedClasses: ["OrderedCollection"],
  24598. messageSends: ["initialize", "new"]
  24599. }),
  24600. $globals.Announcer);
  24601. $core.addMethod(
  24602. $core.method({
  24603. selector: "on:do:",
  24604. protocol: "subscribing",
  24605. fn: function (aClass,aBlock){
  24606. var self=this,$self=this;
  24607. return $core.withContext(function($ctx1) {
  24608. $self._on_do_for_(aClass,aBlock,nil);
  24609. return self;
  24610. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24611. },
  24612. args: ["aClass", "aBlock"],
  24613. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24614. referencedClasses: [],
  24615. messageSends: ["on:do:for:"]
  24616. }),
  24617. $globals.Announcer);
  24618. $core.addMethod(
  24619. $core.method({
  24620. selector: "on:do:for:",
  24621. protocol: "subscribing",
  24622. fn: function (aClass,aBlock,aReceiver){
  24623. var self=this,$self=this;
  24624. return $core.withContext(function($ctx1) {
  24625. var $1,$3,$5,$6,$4,$2;
  24626. $1=$self["@subscriptions"];
  24627. $3=$recv($globals.AnnouncementSubscription)._new();
  24628. $ctx1.sendIdx["new"]=1;
  24629. $5=$recv($globals.AnnouncementValuable)._new();
  24630. $recv($5)._valuable_(aBlock);
  24631. $recv($5)._receiver_(aReceiver);
  24632. $6=$recv($5)._yourself();
  24633. $ctx1.sendIdx["yourself"]=1;
  24634. $4=$6;
  24635. $recv($3)._valuable_($4);
  24636. $ctx1.sendIdx["valuable:"]=1;
  24637. $recv($3)._announcementClass_(aClass);
  24638. $2=$recv($3)._yourself();
  24639. $recv($1)._add_($2);
  24640. return self;
  24641. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24642. },
  24643. args: ["aClass", "aBlock", "aReceiver"],
  24644. 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)",
  24645. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24646. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24647. }),
  24648. $globals.Announcer);
  24649. $core.addMethod(
  24650. $core.method({
  24651. selector: "on:doOnce:",
  24652. protocol: "subscribing",
  24653. fn: function (aClass,aBlock){
  24654. var self=this,$self=this;
  24655. var subscription;
  24656. return $core.withContext(function($ctx1) {
  24657. var $1;
  24658. $1=$recv($globals.AnnouncementSubscription)._new();
  24659. $recv($1)._announcementClass_(aClass);
  24660. subscription=$recv($1)._yourself();
  24661. $recv(subscription)._valuable_((function(ann){
  24662. return $core.withContext(function($ctx2) {
  24663. $recv($self["@subscriptions"])._remove_(subscription);
  24664. return $recv(aBlock)._value_(ann);
  24665. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24666. }));
  24667. $recv($self["@subscriptions"])._add_(subscription);
  24668. return self;
  24669. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24670. },
  24671. args: ["aClass", "aBlock"],
  24672. 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",
  24673. referencedClasses: ["AnnouncementSubscription"],
  24674. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24675. }),
  24676. $globals.Announcer);
  24677. $core.addMethod(
  24678. $core.method({
  24679. selector: "on:send:to:",
  24680. protocol: "subscribing",
  24681. fn: function (aClass,aSelector,anObject){
  24682. var self=this,$self=this;
  24683. return $core.withContext(function($ctx1) {
  24684. var $1,$3,$5,$6,$4,$2;
  24685. $1=$self["@subscriptions"];
  24686. $3=$recv($globals.AnnouncementSubscription)._new();
  24687. $ctx1.sendIdx["new"]=1;
  24688. $5=$recv($globals.MessageSend)._new();
  24689. $recv($5)._receiver_(anObject);
  24690. $recv($5)._selector_(aSelector);
  24691. $6=$recv($5)._yourself();
  24692. $ctx1.sendIdx["yourself"]=1;
  24693. $4=$6;
  24694. $recv($3)._valuable_($4);
  24695. $recv($3)._announcementClass_(aClass);
  24696. $2=$recv($3)._yourself();
  24697. $recv($1)._add_($2);
  24698. return self;
  24699. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24700. },
  24701. args: ["aClass", "aSelector", "anObject"],
  24702. 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)",
  24703. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24704. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24705. }),
  24706. $globals.Announcer);
  24707. $core.addMethod(
  24708. $core.method({
  24709. selector: "unsubscribe:",
  24710. protocol: "subscribing",
  24711. fn: function (anObject){
  24712. var self=this,$self=this;
  24713. return $core.withContext(function($ctx1) {
  24714. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24715. return $core.withContext(function($ctx2) {
  24716. return $recv($recv(each)._receiver()).__eq(anObject);
  24717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24718. }));
  24719. return self;
  24720. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24721. },
  24722. args: ["anObject"],
  24723. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24724. referencedClasses: [],
  24725. messageSends: ["reject:", "=", "receiver"]
  24726. }),
  24727. $globals.Announcer);
  24728. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24729. $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`";
  24730. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24731. $core.addMethod(
  24732. $core.method({
  24733. selector: "current",
  24734. protocol: "accessing",
  24735. fn: function (){
  24736. var self=this,$self=this;
  24737. return $core.withContext(function($ctx1) {
  24738. var $1,$receiver;
  24739. $1=$self["@current"];
  24740. if(($receiver = $1) == null || $receiver.a$nil){
  24741. $self["@current"]=(
  24742. $ctx1.supercall = true,
  24743. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24744. $ctx1.supercall = false;
  24745. return $self["@current"];
  24746. } else {
  24747. return $1;
  24748. }
  24749. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24750. },
  24751. args: [],
  24752. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24753. referencedClasses: [],
  24754. messageSends: ["ifNil:", "new"]
  24755. }),
  24756. $globals.SystemAnnouncer.a$cls);
  24757. $core.addMethod(
  24758. $core.method({
  24759. selector: "new",
  24760. protocol: "instance creation",
  24761. fn: function (){
  24762. var self=this,$self=this;
  24763. return $core.withContext(function($ctx1) {
  24764. $self._shouldNotImplement();
  24765. return self;
  24766. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24767. },
  24768. args: [],
  24769. source: "new\x0a\x09self shouldNotImplement",
  24770. referencedClasses: [],
  24771. messageSends: ["shouldNotImplement"]
  24772. }),
  24773. $globals.SystemAnnouncer.a$cls);
  24774. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24775. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24776. $core.addMethod(
  24777. $core.method({
  24778. selector: "classTag",
  24779. protocol: "accessing",
  24780. fn: function (){
  24781. var self=this,$self=this;
  24782. return "announcement";
  24783. },
  24784. args: [],
  24785. 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'",
  24786. referencedClasses: [],
  24787. messageSends: []
  24788. }),
  24789. $globals.SystemAnnouncement.a$cls);
  24790. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24791. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24792. $core.addMethod(
  24793. $core.method({
  24794. selector: "theClass",
  24795. protocol: "accessing",
  24796. fn: function (){
  24797. var self=this,$self=this;
  24798. return $self["@theClass"];
  24799. },
  24800. args: [],
  24801. source: "theClass\x0a\x09^ theClass",
  24802. referencedClasses: [],
  24803. messageSends: []
  24804. }),
  24805. $globals.ClassAnnouncement);
  24806. $core.addMethod(
  24807. $core.method({
  24808. selector: "theClass:",
  24809. protocol: "accessing",
  24810. fn: function (aClass){
  24811. var self=this,$self=this;
  24812. $self["@theClass"]=aClass;
  24813. return self;
  24814. },
  24815. args: ["aClass"],
  24816. source: "theClass: aClass\x0a\x09theClass := aClass",
  24817. referencedClasses: [],
  24818. messageSends: []
  24819. }),
  24820. $globals.ClassAnnouncement);
  24821. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24822. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24823. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24824. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24825. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24826. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24827. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24828. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24829. $core.addMethod(
  24830. $core.method({
  24831. selector: "oldClass",
  24832. protocol: "accessing",
  24833. fn: function (){
  24834. var self=this,$self=this;
  24835. return $self["@oldClass"];
  24836. },
  24837. args: [],
  24838. source: "oldClass\x0a\x09^ oldClass",
  24839. referencedClasses: [],
  24840. messageSends: []
  24841. }),
  24842. $globals.ClassMigrated);
  24843. $core.addMethod(
  24844. $core.method({
  24845. selector: "oldClass:",
  24846. protocol: "accessing",
  24847. fn: function (aClass){
  24848. var self=this,$self=this;
  24849. $self["@oldClass"]=aClass;
  24850. return self;
  24851. },
  24852. args: ["aClass"],
  24853. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24854. referencedClasses: [],
  24855. messageSends: []
  24856. }),
  24857. $globals.ClassMigrated);
  24858. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24859. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24860. $core.addMethod(
  24861. $core.method({
  24862. selector: "oldPackage",
  24863. protocol: "accessing",
  24864. fn: function (){
  24865. var self=this,$self=this;
  24866. return $self["@oldPackage"];
  24867. },
  24868. args: [],
  24869. source: "oldPackage\x0a\x09^ oldPackage",
  24870. referencedClasses: [],
  24871. messageSends: []
  24872. }),
  24873. $globals.ClassMoved);
  24874. $core.addMethod(
  24875. $core.method({
  24876. selector: "oldPackage:",
  24877. protocol: "accessing",
  24878. fn: function (aPackage){
  24879. var self=this,$self=this;
  24880. $self["@oldPackage"]=aPackage;
  24881. return self;
  24882. },
  24883. args: ["aPackage"],
  24884. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24885. referencedClasses: [],
  24886. messageSends: []
  24887. }),
  24888. $globals.ClassMoved);
  24889. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24890. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24891. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24892. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24893. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24894. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24895. $core.addMethod(
  24896. $core.method({
  24897. selector: "method",
  24898. protocol: "accessing",
  24899. fn: function (){
  24900. var self=this,$self=this;
  24901. return $self["@method"];
  24902. },
  24903. args: [],
  24904. source: "method\x0a\x09^ method",
  24905. referencedClasses: [],
  24906. messageSends: []
  24907. }),
  24908. $globals.MethodAnnouncement);
  24909. $core.addMethod(
  24910. $core.method({
  24911. selector: "method:",
  24912. protocol: "accessing",
  24913. fn: function (aCompiledMethod){
  24914. var self=this,$self=this;
  24915. $self["@method"]=aCompiledMethod;
  24916. return self;
  24917. },
  24918. args: ["aCompiledMethod"],
  24919. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24920. referencedClasses: [],
  24921. messageSends: []
  24922. }),
  24923. $globals.MethodAnnouncement);
  24924. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24925. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24926. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24927. $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.";
  24928. $core.addMethod(
  24929. $core.method({
  24930. selector: "oldMethod",
  24931. protocol: "accessing",
  24932. fn: function (){
  24933. var self=this,$self=this;
  24934. return $self["@oldMethod"];
  24935. },
  24936. args: [],
  24937. source: "oldMethod\x0a\x09^ oldMethod",
  24938. referencedClasses: [],
  24939. messageSends: []
  24940. }),
  24941. $globals.MethodModified);
  24942. $core.addMethod(
  24943. $core.method({
  24944. selector: "oldMethod:",
  24945. protocol: "accessing",
  24946. fn: function (aMethod){
  24947. var self=this,$self=this;
  24948. $self["@oldMethod"]=aMethod;
  24949. return self;
  24950. },
  24951. args: ["aMethod"],
  24952. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24953. referencedClasses: [],
  24954. messageSends: []
  24955. }),
  24956. $globals.MethodModified);
  24957. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24958. $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.";
  24959. $core.addMethod(
  24960. $core.method({
  24961. selector: "oldProtocol",
  24962. protocol: "accessing",
  24963. fn: function (){
  24964. var self=this,$self=this;
  24965. return $self["@oldProtocol"];
  24966. },
  24967. args: [],
  24968. source: "oldProtocol\x0a\x09^ oldProtocol",
  24969. referencedClasses: [],
  24970. messageSends: []
  24971. }),
  24972. $globals.MethodMoved);
  24973. $core.addMethod(
  24974. $core.method({
  24975. selector: "oldProtocol:",
  24976. protocol: "accessing",
  24977. fn: function (aString){
  24978. var self=this,$self=this;
  24979. $self["@oldProtocol"]=aString;
  24980. return self;
  24981. },
  24982. args: ["aString"],
  24983. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  24984. referencedClasses: [],
  24985. messageSends: []
  24986. }),
  24987. $globals.MethodMoved);
  24988. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24989. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  24990. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  24991. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  24992. $core.addMethod(
  24993. $core.method({
  24994. selector: "package",
  24995. protocol: "accessing",
  24996. fn: function (){
  24997. var self=this,$self=this;
  24998. return $self["@package"];
  24999. },
  25000. args: [],
  25001. source: "package\x0a\x09^ package",
  25002. referencedClasses: [],
  25003. messageSends: []
  25004. }),
  25005. $globals.PackageAnnouncement);
  25006. $core.addMethod(
  25007. $core.method({
  25008. selector: "package:",
  25009. protocol: "accessing",
  25010. fn: function (aPackage){
  25011. var self=this,$self=this;
  25012. $self["@package"]=aPackage;
  25013. return self;
  25014. },
  25015. args: ["aPackage"],
  25016. source: "package: aPackage\x0a\x09package := aPackage",
  25017. referencedClasses: [],
  25018. messageSends: []
  25019. }),
  25020. $globals.PackageAnnouncement);
  25021. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25022. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  25023. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25024. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  25025. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25026. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  25027. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25028. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  25029. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  25030. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  25031. $core.addMethod(
  25032. $core.method({
  25033. selector: "package",
  25034. protocol: "accessing",
  25035. fn: function (){
  25036. var self=this,$self=this;
  25037. return $core.withContext(function($ctx1) {
  25038. var $1,$receiver;
  25039. $1=$self._theClass();
  25040. if(($receiver = $1) == null || $receiver.a$nil){
  25041. return $1;
  25042. } else {
  25043. var class_;
  25044. class_=$receiver;
  25045. return $recv(class_)._packageOfProtocol_($self._protocol());
  25046. }
  25047. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  25048. },
  25049. args: [],
  25050. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  25051. referencedClasses: [],
  25052. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  25053. }),
  25054. $globals.ProtocolAnnouncement);
  25055. $core.addMethod(
  25056. $core.method({
  25057. selector: "protocol",
  25058. protocol: "accessing",
  25059. fn: function (){
  25060. var self=this,$self=this;
  25061. return $self["@protocol"];
  25062. },
  25063. args: [],
  25064. source: "protocol\x0a\x09^ protocol",
  25065. referencedClasses: [],
  25066. messageSends: []
  25067. }),
  25068. $globals.ProtocolAnnouncement);
  25069. $core.addMethod(
  25070. $core.method({
  25071. selector: "protocol:",
  25072. protocol: "accessing",
  25073. fn: function (aString){
  25074. var self=this,$self=this;
  25075. $self["@protocol"]=aString;
  25076. return self;
  25077. },
  25078. args: ["aString"],
  25079. source: "protocol: aString\x0a\x09protocol := aString",
  25080. referencedClasses: [],
  25081. messageSends: []
  25082. }),
  25083. $globals.ProtocolAnnouncement);
  25084. $core.addMethod(
  25085. $core.method({
  25086. selector: "theClass",
  25087. protocol: "accessing",
  25088. fn: function (){
  25089. var self=this,$self=this;
  25090. return $self["@theClass"];
  25091. },
  25092. args: [],
  25093. source: "theClass\x0a\x09^ theClass",
  25094. referencedClasses: [],
  25095. messageSends: []
  25096. }),
  25097. $globals.ProtocolAnnouncement);
  25098. $core.addMethod(
  25099. $core.method({
  25100. selector: "theClass:",
  25101. protocol: "accessing",
  25102. fn: function (aClass){
  25103. var self=this,$self=this;
  25104. $self["@theClass"]=aClass;
  25105. return self;
  25106. },
  25107. args: ["aClass"],
  25108. source: "theClass: aClass\x0a\x09theClass := aClass",
  25109. referencedClasses: [],
  25110. messageSends: []
  25111. }),
  25112. $globals.ProtocolAnnouncement);
  25113. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25114. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25115. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25116. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25117. });
  25118. 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";
  25119. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25120. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25121. $core.addPackage("Platform-Services");
  25122. ($core.packageDescriptors||$core.packages)["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  25123. ($core.packageDescriptors||$core.packages)["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25124. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25125. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25126. $core.addMethod(
  25127. $core.method({
  25128. selector: "handleError:",
  25129. protocol: "error handling",
  25130. fn: function (anError){
  25131. var self=this,$self=this;
  25132. return $core.withContext(function($ctx1) {
  25133. var $1,$receiver;
  25134. $1=$recv(anError)._context();
  25135. $ctx1.sendIdx["context"]=1;
  25136. if(($receiver = $1) == null || $receiver.a$nil){
  25137. $1;
  25138. } else {
  25139. $self._logErrorContext_($recv(anError)._context());
  25140. }
  25141. $self._logError_(anError);
  25142. return self;
  25143. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25144. },
  25145. args: ["anError"],
  25146. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25147. referencedClasses: [],
  25148. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25149. }),
  25150. $globals.ConsoleErrorHandler);
  25151. $core.addMethod(
  25152. $core.method({
  25153. selector: "log:",
  25154. protocol: "private",
  25155. fn: function (aString){
  25156. var self=this,$self=this;
  25157. return $core.withContext(function($ctx1) {
  25158. $recv(console)._log_(aString);
  25159. return self;
  25160. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25161. },
  25162. args: ["aString"],
  25163. source: "log: aString\x0a\x09console log: aString",
  25164. referencedClasses: [],
  25165. messageSends: ["log:"]
  25166. }),
  25167. $globals.ConsoleErrorHandler);
  25168. $core.addMethod(
  25169. $core.method({
  25170. selector: "logContext:",
  25171. protocol: "private",
  25172. fn: function (aContext){
  25173. var self=this,$self=this;
  25174. return $core.withContext(function($ctx1) {
  25175. var $1,$receiver;
  25176. $1=$recv(aContext)._home();
  25177. $ctx1.sendIdx["home"]=1;
  25178. if(($receiver = $1) == null || $receiver.a$nil){
  25179. $1;
  25180. } else {
  25181. $self._logContext_($recv(aContext)._home());
  25182. }
  25183. $self._log_($recv(aContext)._asString());
  25184. return self;
  25185. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25186. },
  25187. args: ["aContext"],
  25188. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25189. referencedClasses: [],
  25190. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25191. }),
  25192. $globals.ConsoleErrorHandler);
  25193. $core.addMethod(
  25194. $core.method({
  25195. selector: "logError:",
  25196. protocol: "private",
  25197. fn: function (anError){
  25198. var self=this,$self=this;
  25199. return $core.withContext(function($ctx1) {
  25200. $self._log_($recv(anError)._messageText());
  25201. return self;
  25202. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25203. },
  25204. args: ["anError"],
  25205. source: "logError: anError\x0a\x09self log: anError messageText",
  25206. referencedClasses: [],
  25207. messageSends: ["log:", "messageText"]
  25208. }),
  25209. $globals.ConsoleErrorHandler);
  25210. $core.addMethod(
  25211. $core.method({
  25212. selector: "logErrorContext:",
  25213. protocol: "private",
  25214. fn: function (aContext){
  25215. var self=this,$self=this;
  25216. return $core.withContext(function($ctx1) {
  25217. var $1,$receiver;
  25218. if(($receiver = aContext) == null || $receiver.a$nil){
  25219. aContext;
  25220. } else {
  25221. $1=$recv(aContext)._home();
  25222. $ctx1.sendIdx["home"]=1;
  25223. if(($receiver = $1) == null || $receiver.a$nil){
  25224. $1;
  25225. } else {
  25226. $self._logContext_($recv(aContext)._home());
  25227. }
  25228. }
  25229. return self;
  25230. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25231. },
  25232. args: ["aContext"],
  25233. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25234. referencedClasses: [],
  25235. messageSends: ["ifNotNil:", "home", "logContext:"]
  25236. }),
  25237. $globals.ConsoleErrorHandler);
  25238. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25239. $core.addMethod(
  25240. $core.method({
  25241. selector: "initialize",
  25242. protocol: "initialization",
  25243. fn: function (){
  25244. var self=this,$self=this;
  25245. return $core.withContext(function($ctx1) {
  25246. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25247. return self;
  25248. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25249. },
  25250. args: [],
  25251. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25252. referencedClasses: ["ErrorHandler"],
  25253. messageSends: ["registerIfNone:", "new"]
  25254. }),
  25255. $globals.ConsoleErrorHandler.a$cls);
  25256. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25257. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25258. $core.addMethod(
  25259. $core.method({
  25260. selector: "clear",
  25261. protocol: "printing",
  25262. fn: function (){
  25263. var self=this,$self=this;
  25264. return self;
  25265. },
  25266. args: [],
  25267. source: "clear\x0a\x09\x22no op\x22",
  25268. referencedClasses: [],
  25269. messageSends: []
  25270. }),
  25271. $globals.ConsoleTranscript);
  25272. $core.addMethod(
  25273. $core.method({
  25274. selector: "cr",
  25275. protocol: "printing",
  25276. fn: function (){
  25277. var self=this,$self=this;
  25278. return self;
  25279. },
  25280. args: [],
  25281. source: "cr\x0a\x09\x22no op\x22",
  25282. referencedClasses: [],
  25283. messageSends: []
  25284. }),
  25285. $globals.ConsoleTranscript);
  25286. $core.addMethod(
  25287. $core.method({
  25288. selector: "open",
  25289. protocol: "actions",
  25290. fn: function (){
  25291. var self=this,$self=this;
  25292. return self;
  25293. },
  25294. args: [],
  25295. source: "open",
  25296. referencedClasses: [],
  25297. messageSends: []
  25298. }),
  25299. $globals.ConsoleTranscript);
  25300. $core.addMethod(
  25301. $core.method({
  25302. selector: "show:",
  25303. protocol: "printing",
  25304. fn: function (anObject){
  25305. var self=this,$self=this;
  25306. return $core.withContext(function($ctx1) {
  25307. console.log(String($recv(anObject)._asString()));
  25308. return self;
  25309. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25310. },
  25311. args: ["anObject"],
  25312. 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()))'>",
  25313. referencedClasses: [],
  25314. messageSends: []
  25315. }),
  25316. $globals.ConsoleTranscript);
  25317. $core.addMethod(
  25318. $core.method({
  25319. selector: "initialize",
  25320. protocol: "initialization",
  25321. fn: function (){
  25322. var self=this,$self=this;
  25323. return $core.withContext(function($ctx1) {
  25324. $recv($globals.Transcript)._registerIfNone_($self._new());
  25325. return self;
  25326. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25327. },
  25328. args: [],
  25329. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25330. referencedClasses: ["Transcript"],
  25331. messageSends: ["registerIfNone:", "new"]
  25332. }),
  25333. $globals.ConsoleTranscript.a$cls);
  25334. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25335. $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.";
  25336. $core.addMethod(
  25337. $core.method({
  25338. selector: "addInstVarNamed:to:",
  25339. protocol: "compiling",
  25340. fn: function (aString,aClass){
  25341. var self=this,$self=this;
  25342. var newInstVars;
  25343. return $core.withContext(function($ctx1) {
  25344. var $1,$2,$3,$4,$5;
  25345. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25346. $1=$recv(aClass)._isMetaclass();
  25347. if($core.assert($1)){
  25348. $2=$self._classBuilder();
  25349. $ctx1.sendIdx["classBuilder"]=1;
  25350. $recv($2)._class_instanceVariables_(aClass,newInstVars);
  25351. } else {
  25352. $3=$self._classBuilder();
  25353. $4=$recv(aClass)._superclass();
  25354. $5=$recv(aClass)._name();
  25355. $ctx1.sendIdx["name"]=1;
  25356. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  25357. }
  25358. return self;
  25359. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars},$globals.Environment)});
  25360. },
  25361. args: ["aString", "aClass"],
  25362. source: "addInstVarNamed: aString to: aClass\x0a\x09| newInstVars |\x0a\x09newInstVars := aClass instanceVariableNames copyWith: aString.\x0a\x0a\x09aClass isMetaclass\x0a\x09\x09ifTrue: [ self classBuilder\x0a\x09\x09\x09class: aClass instanceVariables: newInstVars ]\x0a\x09\x09ifFalse: [ self classBuilder\x0a\x09\x09\x09addSubclassOf: aClass superclass \x0a\x09\x09\x09named: aClass name \x0a\x09\x09\x09instanceVariableNames: newInstVars\x0a\x09\x09\x09package: aClass package name ]",
  25363. referencedClasses: [],
  25364. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:instanceVariables:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25365. }),
  25366. $globals.Environment);
  25367. $core.addMethod(
  25368. $core.method({
  25369. selector: "allSelectors",
  25370. protocol: "accessing",
  25371. fn: function (){
  25372. var self=this,$self=this;
  25373. return $core.withContext(function($ctx1) {
  25374. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25375. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25376. },
  25377. args: [],
  25378. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25379. referencedClasses: ["Smalltalk"],
  25380. messageSends: ["allSelectors", "core"]
  25381. }),
  25382. $globals.Environment);
  25383. $core.addMethod(
  25384. $core.method({
  25385. selector: "availableClassNames",
  25386. protocol: "accessing",
  25387. fn: function (){
  25388. var self=this,$self=this;
  25389. return $core.withContext(function($ctx1) {
  25390. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25391. return $core.withContext(function($ctx2) {
  25392. return $recv(each)._name();
  25393. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25394. }));
  25395. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25396. },
  25397. args: [],
  25398. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25399. referencedClasses: ["Smalltalk"],
  25400. messageSends: ["collect:", "classes", "name"]
  25401. }),
  25402. $globals.Environment);
  25403. $core.addMethod(
  25404. $core.method({
  25405. selector: "availablePackageNames",
  25406. protocol: "accessing",
  25407. fn: function (){
  25408. var self=this,$self=this;
  25409. return $core.withContext(function($ctx1) {
  25410. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25411. return $core.withContext(function($ctx2) {
  25412. return $recv(each)._name();
  25413. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25414. }));
  25415. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25416. },
  25417. args: [],
  25418. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25419. referencedClasses: ["Smalltalk"],
  25420. messageSends: ["collect:", "packages", "name"]
  25421. }),
  25422. $globals.Environment);
  25423. $core.addMethod(
  25424. $core.method({
  25425. selector: "availableProtocolsFor:",
  25426. protocol: "accessing",
  25427. fn: function (aClass){
  25428. var self=this,$self=this;
  25429. var protocols;
  25430. return $core.withContext(function($ctx1) {
  25431. var $1,$receiver;
  25432. protocols=$recv(aClass)._protocols();
  25433. $1=$recv(aClass)._superclass();
  25434. $ctx1.sendIdx["superclass"]=1;
  25435. if(($receiver = $1) == null || $receiver.a$nil){
  25436. $1;
  25437. } else {
  25438. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25439. }
  25440. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25441. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25442. },
  25443. args: ["aClass"],
  25444. 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",
  25445. referencedClasses: [],
  25446. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25447. }),
  25448. $globals.Environment);
  25449. $core.addMethod(
  25450. $core.method({
  25451. selector: "classBuilder",
  25452. protocol: "accessing",
  25453. fn: function (){
  25454. var self=this,$self=this;
  25455. return $core.withContext(function($ctx1) {
  25456. return $recv($globals.ClassBuilder)._new();
  25457. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25458. },
  25459. args: [],
  25460. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25461. referencedClasses: ["ClassBuilder"],
  25462. messageSends: ["new"]
  25463. }),
  25464. $globals.Environment);
  25465. $core.addMethod(
  25466. $core.method({
  25467. selector: "classNamed:",
  25468. protocol: "accessing",
  25469. fn: function (aString){
  25470. var self=this,$self=this;
  25471. return $core.withContext(function($ctx1) {
  25472. var $1,$receiver;
  25473. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25474. if(($receiver = $1) == null || $receiver.a$nil){
  25475. return $self._error_("Invalid class name");
  25476. } else {
  25477. return $1;
  25478. }
  25479. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25480. },
  25481. args: ["aString"],
  25482. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25483. referencedClasses: ["Smalltalk"],
  25484. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25485. }),
  25486. $globals.Environment);
  25487. $core.addMethod(
  25488. $core.method({
  25489. selector: "classes",
  25490. protocol: "accessing",
  25491. fn: function (){
  25492. var self=this,$self=this;
  25493. return $core.withContext(function($ctx1) {
  25494. return $recv($globals.Smalltalk)._classes();
  25495. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25496. },
  25497. args: [],
  25498. source: "classes\x0a\x09^ Smalltalk classes",
  25499. referencedClasses: ["Smalltalk"],
  25500. messageSends: ["classes"]
  25501. }),
  25502. $globals.Environment);
  25503. $core.addMethod(
  25504. $core.method({
  25505. selector: "commitPackage:onSuccess:onError:",
  25506. protocol: "actions",
  25507. fn: function (aPackage,aBlock,anotherBlock){
  25508. var self=this,$self=this;
  25509. return $core.withContext(function($ctx1) {
  25510. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25511. return self;
  25512. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25513. },
  25514. args: ["aPackage", "aBlock", "anotherBlock"],
  25515. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25516. referencedClasses: [],
  25517. messageSends: ["commitOnSuccess:onError:", "transport"]
  25518. }),
  25519. $globals.Environment);
  25520. $core.addMethod(
  25521. $core.method({
  25522. selector: "compileClassComment:for:",
  25523. protocol: "compiling",
  25524. fn: function (aString,aClass){
  25525. var self=this,$self=this;
  25526. return $core.withContext(function($ctx1) {
  25527. $recv(aClass)._comment_(aString);
  25528. return self;
  25529. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25530. },
  25531. args: ["aString", "aClass"],
  25532. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25533. referencedClasses: [],
  25534. messageSends: ["comment:"]
  25535. }),
  25536. $globals.Environment);
  25537. $core.addMethod(
  25538. $core.method({
  25539. selector: "compileClassDefinition:",
  25540. protocol: "compiling",
  25541. fn: function (aString){
  25542. var self=this,$self=this;
  25543. return $core.withContext(function($ctx1) {
  25544. $recv((function(){
  25545. return $core.withContext(function($ctx2) {
  25546. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25547. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25548. }))._on_do_($globals.Error,(function(error){
  25549. return $core.withContext(function($ctx2) {
  25550. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25551. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25552. }));
  25553. return self;
  25554. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25555. },
  25556. args: ["aString"],
  25557. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25558. referencedClasses: ["DoIt", "Error", "Terminal"],
  25559. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25560. }),
  25561. $globals.Environment);
  25562. $core.addMethod(
  25563. $core.method({
  25564. selector: "compileMethod:for:protocol:",
  25565. protocol: "compiling",
  25566. fn: function (sourceCode,class_,protocol){
  25567. var self=this,$self=this;
  25568. return $core.withContext(function($ctx1) {
  25569. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25570. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25571. },
  25572. args: ["sourceCode", "class", "protocol"],
  25573. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25574. referencedClasses: [],
  25575. messageSends: ["compile:protocol:"]
  25576. }),
  25577. $globals.Environment);
  25578. $core.addMethod(
  25579. $core.method({
  25580. selector: "copyClass:to:",
  25581. protocol: "actions",
  25582. fn: function (aClass,aClassName){
  25583. var self=this,$self=this;
  25584. return $core.withContext(function($ctx1) {
  25585. var $1,$2,$receiver;
  25586. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25587. if(($receiver = $1) == null || $receiver.a$nil){
  25588. $1;
  25589. } else {
  25590. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25591. $ctx1.sendIdx[","]=1;
  25592. $self._error_($2);
  25593. }
  25594. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25595. return self;
  25596. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25597. },
  25598. args: ["aClass", "aClassName"],
  25599. 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",
  25600. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25601. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25602. }),
  25603. $globals.Environment);
  25604. $core.addMethod(
  25605. $core.method({
  25606. selector: "doItReceiver",
  25607. protocol: "accessing",
  25608. fn: function (){
  25609. var self=this,$self=this;
  25610. return $core.withContext(function($ctx1) {
  25611. return $recv($globals.DoIt)._new();
  25612. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25613. },
  25614. args: [],
  25615. source: "doItReceiver\x0a\x09^ DoIt new",
  25616. referencedClasses: ["DoIt"],
  25617. messageSends: ["new"]
  25618. }),
  25619. $globals.Environment);
  25620. $core.addMethod(
  25621. $core.method({
  25622. selector: "evaluate:for:",
  25623. protocol: "evaluating",
  25624. fn: function (aString,anObject){
  25625. var self=this,$self=this;
  25626. return $core.withContext(function($ctx1) {
  25627. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25628. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25629. },
  25630. args: ["aString", "anObject"],
  25631. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25632. referencedClasses: ["Evaluator"],
  25633. messageSends: ["evaluate:for:"]
  25634. }),
  25635. $globals.Environment);
  25636. $core.addMethod(
  25637. $core.method({
  25638. selector: "evaluate:on:do:",
  25639. protocol: "error handling",
  25640. fn: function (aBlock,anErrorClass,exceptionBlock){
  25641. var self=this,$self=this;
  25642. return $core.withContext(function($ctx1) {
  25643. var $1;
  25644. $recv(aBlock)._tryCatch_((function(exception){
  25645. return $core.withContext(function($ctx2) {
  25646. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25647. if($core.assert($1)){
  25648. return $recv(exceptionBlock)._value_(exception);
  25649. } else {
  25650. return $recv(exception)._pass();
  25651. }
  25652. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25653. }));
  25654. return self;
  25655. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25656. },
  25657. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25658. 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 pass ] ]",
  25659. referencedClasses: [],
  25660. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "pass"]
  25661. }),
  25662. $globals.Environment);
  25663. $core.addMethod(
  25664. $core.method({
  25665. selector: "inspect:",
  25666. protocol: "actions",
  25667. fn: function (anObject){
  25668. var self=this,$self=this;
  25669. return $core.withContext(function($ctx1) {
  25670. $recv($globals.Inspector)._inspect_(anObject);
  25671. return self;
  25672. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25673. },
  25674. args: ["anObject"],
  25675. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25676. referencedClasses: ["Inspector"],
  25677. messageSends: ["inspect:"]
  25678. }),
  25679. $globals.Environment);
  25680. $core.addMethod(
  25681. $core.method({
  25682. selector: "moveClass:toPackage:",
  25683. protocol: "actions",
  25684. fn: function (aClass,aPackageName){
  25685. var self=this,$self=this;
  25686. var package_;
  25687. return $core.withContext(function($ctx1) {
  25688. var $1,$2,$receiver;
  25689. package_=$recv($globals.Package)._named_(aPackageName);
  25690. $1=package_;
  25691. if(($receiver = $1) == null || $receiver.a$nil){
  25692. $self._error_("Invalid package name");
  25693. } else {
  25694. $1;
  25695. }
  25696. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25697. if($core.assert($2)){
  25698. return self;
  25699. }
  25700. $recv(aClass)._package_(package_);
  25701. $recv(aClass)._recompile();
  25702. return self;
  25703. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25704. },
  25705. args: ["aClass", "aPackageName"],
  25706. 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",
  25707. referencedClasses: ["Package"],
  25708. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25709. }),
  25710. $globals.Environment);
  25711. $core.addMethod(
  25712. $core.method({
  25713. selector: "moveMethod:toClass:",
  25714. protocol: "actions",
  25715. fn: function (aMethod,aClassName){
  25716. var self=this,$self=this;
  25717. var destinationClass;
  25718. return $core.withContext(function($ctx1) {
  25719. var $2,$3,$1,$5,$4;
  25720. destinationClass=$self._classNamed_(aClassName);
  25721. $2=destinationClass;
  25722. $3=$recv(aMethod)._methodClass();
  25723. $ctx1.sendIdx["methodClass"]=1;
  25724. $1=$recv($2).__eq_eq($3);
  25725. if($core.assert($1)){
  25726. return self;
  25727. }
  25728. $5=$recv(aMethod)._methodClass();
  25729. $ctx1.sendIdx["methodClass"]=2;
  25730. $4=$recv($5)._isMetaclass();
  25731. if($core.assert($4)){
  25732. destinationClass=$recv(destinationClass)._theMetaClass();
  25733. destinationClass;
  25734. }
  25735. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25736. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25737. return self;
  25738. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25739. },
  25740. args: ["aMethod", "aClassName"],
  25741. 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",
  25742. referencedClasses: [],
  25743. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25744. }),
  25745. $globals.Environment);
  25746. $core.addMethod(
  25747. $core.method({
  25748. selector: "moveMethod:toProtocol:",
  25749. protocol: "actions",
  25750. fn: function (aMethod,aProtocol){
  25751. var self=this,$self=this;
  25752. return $core.withContext(function($ctx1) {
  25753. $recv(aMethod)._protocol_(aProtocol);
  25754. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25755. return self;
  25756. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25757. },
  25758. args: ["aMethod", "aProtocol"],
  25759. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25760. referencedClasses: [],
  25761. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25762. }),
  25763. $globals.Environment);
  25764. $core.addMethod(
  25765. $core.method({
  25766. selector: "packages",
  25767. protocol: "accessing",
  25768. fn: function (){
  25769. var self=this,$self=this;
  25770. return $core.withContext(function($ctx1) {
  25771. return $recv($globals.Smalltalk)._packages();
  25772. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25773. },
  25774. args: [],
  25775. source: "packages\x0a\x09^ Smalltalk packages",
  25776. referencedClasses: ["Smalltalk"],
  25777. messageSends: ["packages"]
  25778. }),
  25779. $globals.Environment);
  25780. $core.addMethod(
  25781. $core.method({
  25782. selector: "registerErrorHandler:",
  25783. protocol: "services",
  25784. fn: function (anErrorHandler){
  25785. var self=this,$self=this;
  25786. return $core.withContext(function($ctx1) {
  25787. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25788. return self;
  25789. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25790. },
  25791. args: ["anErrorHandler"],
  25792. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25793. referencedClasses: ["ErrorHandler"],
  25794. messageSends: ["register:"]
  25795. }),
  25796. $globals.Environment);
  25797. $core.addMethod(
  25798. $core.method({
  25799. selector: "registerFinder:",
  25800. protocol: "services",
  25801. fn: function (aFinder){
  25802. var self=this,$self=this;
  25803. return $core.withContext(function($ctx1) {
  25804. $recv($globals.Finder)._register_(aFinder);
  25805. return self;
  25806. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25807. },
  25808. args: ["aFinder"],
  25809. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25810. referencedClasses: ["Finder"],
  25811. messageSends: ["register:"]
  25812. }),
  25813. $globals.Environment);
  25814. $core.addMethod(
  25815. $core.method({
  25816. selector: "registerInspector:",
  25817. protocol: "services",
  25818. fn: function (anInspector){
  25819. var self=this,$self=this;
  25820. return $core.withContext(function($ctx1) {
  25821. $recv($globals.Inspector)._register_(anInspector);
  25822. return self;
  25823. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25824. },
  25825. args: ["anInspector"],
  25826. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25827. referencedClasses: ["Inspector"],
  25828. messageSends: ["register:"]
  25829. }),
  25830. $globals.Environment);
  25831. $core.addMethod(
  25832. $core.method({
  25833. selector: "registerProgressHandler:",
  25834. protocol: "services",
  25835. fn: function (aProgressHandler){
  25836. var self=this,$self=this;
  25837. return $core.withContext(function($ctx1) {
  25838. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25839. return self;
  25840. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25841. },
  25842. args: ["aProgressHandler"],
  25843. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25844. referencedClasses: ["ProgressHandler"],
  25845. messageSends: ["register:"]
  25846. }),
  25847. $globals.Environment);
  25848. $core.addMethod(
  25849. $core.method({
  25850. selector: "registerTranscript:",
  25851. protocol: "services",
  25852. fn: function (aTranscript){
  25853. var self=this,$self=this;
  25854. return $core.withContext(function($ctx1) {
  25855. $recv($globals.Transcript)._register_(aTranscript);
  25856. return self;
  25857. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25858. },
  25859. args: ["aTranscript"],
  25860. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25861. referencedClasses: ["Transcript"],
  25862. messageSends: ["register:"]
  25863. }),
  25864. $globals.Environment);
  25865. $core.addMethod(
  25866. $core.method({
  25867. selector: "removeClass:",
  25868. protocol: "actions",
  25869. fn: function (aClass){
  25870. var self=this,$self=this;
  25871. return $core.withContext(function($ctx1) {
  25872. $recv($globals.Smalltalk)._removeClass_(aClass);
  25873. return self;
  25874. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25875. },
  25876. args: ["aClass"],
  25877. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25878. referencedClasses: ["Smalltalk"],
  25879. messageSends: ["removeClass:"]
  25880. }),
  25881. $globals.Environment);
  25882. $core.addMethod(
  25883. $core.method({
  25884. selector: "removeMethod:",
  25885. protocol: "actions",
  25886. fn: function (aMethod){
  25887. var self=this,$self=this;
  25888. return $core.withContext(function($ctx1) {
  25889. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25890. return self;
  25891. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25892. },
  25893. args: ["aMethod"],
  25894. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25895. referencedClasses: [],
  25896. messageSends: ["removeCompiledMethod:", "methodClass"]
  25897. }),
  25898. $globals.Environment);
  25899. $core.addMethod(
  25900. $core.method({
  25901. selector: "removeProtocol:from:",
  25902. protocol: "actions",
  25903. fn: function (aString,aClass){
  25904. var self=this,$self=this;
  25905. return $core.withContext(function($ctx1) {
  25906. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25907. return $core.withContext(function($ctx2) {
  25908. return $recv(aClass)._removeCompiledMethod_(each);
  25909. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25910. }));
  25911. return self;
  25912. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25913. },
  25914. args: ["aString", "aClass"],
  25915. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25916. referencedClasses: [],
  25917. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25918. }),
  25919. $globals.Environment);
  25920. $core.addMethod(
  25921. $core.method({
  25922. selector: "renameClass:to:",
  25923. protocol: "actions",
  25924. fn: function (aClass,aClassName){
  25925. var self=this,$self=this;
  25926. return $core.withContext(function($ctx1) {
  25927. var $1,$2,$receiver;
  25928. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25929. if(($receiver = $1) == null || $receiver.a$nil){
  25930. $1;
  25931. } else {
  25932. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25933. $ctx1.sendIdx[","]=1;
  25934. $self._error_($2);
  25935. }
  25936. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25937. return self;
  25938. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25939. },
  25940. args: ["aClass", "aClassName"],
  25941. 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",
  25942. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25943. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25944. }),
  25945. $globals.Environment);
  25946. $core.addMethod(
  25947. $core.method({
  25948. selector: "renamePackage:to:",
  25949. protocol: "actions",
  25950. fn: function (aPackageName,aNewPackageName){
  25951. var self=this,$self=this;
  25952. return $core.withContext(function($ctx1) {
  25953. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25954. return self;
  25955. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25956. },
  25957. args: ["aPackageName", "aNewPackageName"],
  25958. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25959. referencedClasses: ["Smalltalk"],
  25960. messageSends: ["renamePackage:to:"]
  25961. }),
  25962. $globals.Environment);
  25963. $core.addMethod(
  25964. $core.method({
  25965. selector: "renameProtocol:to:in:",
  25966. protocol: "actions",
  25967. fn: function (aString,anotherString,aClass){
  25968. var self=this,$self=this;
  25969. return $core.withContext(function($ctx1) {
  25970. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25971. return $core.withContext(function($ctx2) {
  25972. return $recv(each)._protocol_(anotherString);
  25973. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25974. }));
  25975. return self;
  25976. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  25977. },
  25978. args: ["aString", "anotherString", "aClass"],
  25979. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  25980. referencedClasses: [],
  25981. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  25982. }),
  25983. $globals.Environment);
  25984. $core.addMethod(
  25985. $core.method({
  25986. selector: "setClassCommentOf:to:",
  25987. protocol: "actions",
  25988. fn: function (aClass,aString){
  25989. var self=this,$self=this;
  25990. return $core.withContext(function($ctx1) {
  25991. $recv(aClass)._comment_(aString);
  25992. return self;
  25993. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  25994. },
  25995. args: ["aClass", "aString"],
  25996. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  25997. referencedClasses: [],
  25998. messageSends: ["comment:"]
  25999. }),
  26000. $globals.Environment);
  26001. $core.addMethod(
  26002. $core.method({
  26003. selector: "systemAnnouncer",
  26004. protocol: "accessing",
  26005. fn: function (){
  26006. var self=this,$self=this;
  26007. return $core.withContext(function($ctx1) {
  26008. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  26009. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  26010. },
  26011. args: [],
  26012. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  26013. referencedClasses: ["Smalltalk"],
  26014. messageSends: ["current", "at:", "globals"]
  26015. }),
  26016. $globals.Environment);
  26017. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  26018. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  26019. $core.addMethod(
  26020. $core.method({
  26021. selector: "do:on:displaying:",
  26022. protocol: "progress handling",
  26023. fn: function (aBlock,aCollection,aString){
  26024. var self=this,$self=this;
  26025. return $core.withContext(function($ctx1) {
  26026. $recv(aCollection)._do_(aBlock);
  26027. return self;
  26028. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  26029. },
  26030. args: ["aBlock", "aCollection", "aString"],
  26031. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  26032. referencedClasses: [],
  26033. messageSends: ["do:"]
  26034. }),
  26035. $globals.NullProgressHandler);
  26036. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  26037. $core.addMethod(
  26038. $core.method({
  26039. selector: "initialize",
  26040. protocol: "initialization",
  26041. fn: function (){
  26042. var self=this,$self=this;
  26043. return $core.withContext(function($ctx1) {
  26044. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  26045. return self;
  26046. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  26047. },
  26048. args: [],
  26049. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  26050. referencedClasses: ["ProgressHandler"],
  26051. messageSends: ["registerIfNone:", "new"]
  26052. }),
  26053. $globals.NullProgressHandler.a$cls);
  26054. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  26055. $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.";
  26056. $globals.Service.a$cls.iVarNames = ["current"];
  26057. $core.addMethod(
  26058. $core.method({
  26059. selector: "current",
  26060. protocol: "accessing",
  26061. fn: function (){
  26062. var self=this,$self=this;
  26063. return $self["@current"];
  26064. },
  26065. args: [],
  26066. source: "current\x0a\x09^ current",
  26067. referencedClasses: [],
  26068. messageSends: []
  26069. }),
  26070. $globals.Service.a$cls);
  26071. $core.addMethod(
  26072. $core.method({
  26073. selector: "new",
  26074. protocol: "instance creation",
  26075. fn: function (){
  26076. var self=this,$self=this;
  26077. return $core.withContext(function($ctx1) {
  26078. $self._shouldNotImplement();
  26079. return self;
  26080. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  26081. },
  26082. args: [],
  26083. source: "new\x0a\x09self shouldNotImplement",
  26084. referencedClasses: [],
  26085. messageSends: ["shouldNotImplement"]
  26086. }),
  26087. $globals.Service.a$cls);
  26088. $core.addMethod(
  26089. $core.method({
  26090. selector: "register:",
  26091. protocol: "registration",
  26092. fn: function (anObject){
  26093. var self=this,$self=this;
  26094. $self["@current"]=anObject;
  26095. return self;
  26096. },
  26097. args: ["anObject"],
  26098. source: "register: anObject\x0a\x09current := anObject",
  26099. referencedClasses: [],
  26100. messageSends: []
  26101. }),
  26102. $globals.Service.a$cls);
  26103. $core.addMethod(
  26104. $core.method({
  26105. selector: "registerIfNone:",
  26106. protocol: "registration",
  26107. fn: function (anObject){
  26108. var self=this,$self=this;
  26109. return $core.withContext(function($ctx1) {
  26110. var $1,$receiver;
  26111. $1=$self._current();
  26112. if(($receiver = $1) == null || $receiver.a$nil){
  26113. $self._register_(anObject);
  26114. } else {
  26115. $1;
  26116. }
  26117. return self;
  26118. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26119. },
  26120. args: ["anObject"],
  26121. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26122. referencedClasses: [],
  26123. messageSends: ["ifNil:", "current", "register:"]
  26124. }),
  26125. $globals.Service.a$cls);
  26126. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26127. $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.";
  26128. $core.addMethod(
  26129. $core.method({
  26130. selector: "handleError:",
  26131. protocol: "error handling",
  26132. fn: function (anError){
  26133. var self=this,$self=this;
  26134. return $core.withContext(function($ctx1) {
  26135. var $1;
  26136. $1=$recv((function(){
  26137. return $core.withContext(function($ctx2) {
  26138. return $recv(anError)._isSmalltalkError();
  26139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26140. }))._tryCatch_((function(){
  26141. return false;
  26142. }));
  26143. if($core.assert($1)){
  26144. $self._handleUnhandledError_(anError);
  26145. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26146. } else {
  26147. var smalltalkError;
  26148. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26149. $recv(smalltalkError)._wrap();
  26150. $self._handleUnhandledError_(smalltalkError);
  26151. }
  26152. return self;
  26153. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26154. },
  26155. args: ["anError"],
  26156. source: "handleError: anError\x0a\x09([ anError isSmalltalkError ] tryCatch: [ false ])\x0a\x09\x09ifTrue: [ self handleUnhandledError: anError ]\x0a\x09\x09ifFalse: [\x0a\x09\x09\x09| smalltalkError |\x0a\x09\x09\x09smalltalkError := JavaScriptException on: anError.\x0a\x09\x09\x09smalltalkError wrap.\x0a\x09\x09\x09self handleUnhandledError: smalltalkError ]",
  26157. referencedClasses: ["JavaScriptException"],
  26158. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26159. }),
  26160. $globals.ErrorHandler.a$cls);
  26161. $core.addMethod(
  26162. $core.method({
  26163. selector: "handleUnhandledError:",
  26164. protocol: "error handling",
  26165. fn: function (anError){
  26166. var self=this,$self=this;
  26167. return $core.withContext(function($ctx1) {
  26168. var $1;
  26169. $1=$recv(anError)._wasHandled();
  26170. if(!$core.assert($1)){
  26171. $recv($self._current())._handleError_(anError);
  26172. $recv(anError)._beHandled();
  26173. }
  26174. return self;
  26175. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26176. },
  26177. args: ["anError"],
  26178. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26179. referencedClasses: [],
  26180. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26181. }),
  26182. $globals.ErrorHandler.a$cls);
  26183. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26184. $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.";
  26185. $core.addMethod(
  26186. $core.method({
  26187. selector: "findClass:",
  26188. protocol: "finding",
  26189. fn: function (aClass){
  26190. var self=this,$self=this;
  26191. return $core.withContext(function($ctx1) {
  26192. return $recv($self._current())._findClass_(aClass);
  26193. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26194. },
  26195. args: ["aClass"],
  26196. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26197. referencedClasses: [],
  26198. messageSends: ["findClass:", "current"]
  26199. }),
  26200. $globals.Finder.a$cls);
  26201. $core.addMethod(
  26202. $core.method({
  26203. selector: "findMethod:",
  26204. protocol: "finding",
  26205. fn: function (aCompiledMethod){
  26206. var self=this,$self=this;
  26207. return $core.withContext(function($ctx1) {
  26208. return $recv($self._current())._findMethod_(aCompiledMethod);
  26209. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26210. },
  26211. args: ["aCompiledMethod"],
  26212. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26213. referencedClasses: [],
  26214. messageSends: ["findMethod:", "current"]
  26215. }),
  26216. $globals.Finder.a$cls);
  26217. $core.addMethod(
  26218. $core.method({
  26219. selector: "findString:",
  26220. protocol: "finding",
  26221. fn: function (aString){
  26222. var self=this,$self=this;
  26223. return $core.withContext(function($ctx1) {
  26224. return $recv($self._current())._findString_(aString);
  26225. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26226. },
  26227. args: ["aString"],
  26228. source: "findString: aString\x0a\x09^ self current findString: aString",
  26229. referencedClasses: [],
  26230. messageSends: ["findString:", "current"]
  26231. }),
  26232. $globals.Finder.a$cls);
  26233. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26234. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26235. $core.addMethod(
  26236. $core.method({
  26237. selector: "inspect:",
  26238. protocol: "inspecting",
  26239. fn: function (anObject){
  26240. var self=this,$self=this;
  26241. return $core.withContext(function($ctx1) {
  26242. return $recv($self._current())._inspect_(anObject);
  26243. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26244. },
  26245. args: ["anObject"],
  26246. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26247. referencedClasses: [],
  26248. messageSends: ["inspect:", "current"]
  26249. }),
  26250. $globals.Inspector.a$cls);
  26251. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26252. $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";
  26253. $core.addMethod(
  26254. $core.method({
  26255. selector: "globals",
  26256. protocol: "accessing",
  26257. fn: function (){
  26258. var self=this,$self=this;
  26259. return $core.withContext(function($ctx1) {
  26260. return $recv($self._current())._globals();
  26261. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26262. },
  26263. args: [],
  26264. source: "globals\x0a\x09^ self current globals",
  26265. referencedClasses: [],
  26266. messageSends: ["globals", "current"]
  26267. }),
  26268. $globals.Platform.a$cls);
  26269. $core.addMethod(
  26270. $core.method({
  26271. selector: "includesGlobal:",
  26272. protocol: "testing",
  26273. fn: function (aString){
  26274. var self=this,$self=this;
  26275. return $core.withContext(function($ctx1) {
  26276. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26277. return true;
  26278. }),(function(){
  26279. return false;
  26280. }));
  26281. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26282. },
  26283. args: ["aString"],
  26284. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26285. referencedClasses: [],
  26286. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26287. }),
  26288. $globals.Platform.a$cls);
  26289. $core.addMethod(
  26290. $core.method({
  26291. selector: "newXhr",
  26292. protocol: "accessing",
  26293. fn: function (){
  26294. var self=this,$self=this;
  26295. return $core.withContext(function($ctx1) {
  26296. return $recv($self._current())._newXhr();
  26297. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26298. },
  26299. args: [],
  26300. source: "newXhr\x0a\x09^ self current newXhr",
  26301. referencedClasses: [],
  26302. messageSends: ["newXhr", "current"]
  26303. }),
  26304. $globals.Platform.a$cls);
  26305. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26306. $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`.";
  26307. $core.addMethod(
  26308. $core.method({
  26309. selector: "do:on:displaying:",
  26310. protocol: "progress handling",
  26311. fn: function (aBlock,aCollection,aString){
  26312. var self=this,$self=this;
  26313. return $core.withContext(function($ctx1) {
  26314. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26315. return self;
  26316. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26317. },
  26318. args: ["aBlock", "aCollection", "aString"],
  26319. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26320. referencedClasses: [],
  26321. messageSends: ["do:on:displaying:", "current"]
  26322. }),
  26323. $globals.ProgressHandler.a$cls);
  26324. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26325. $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:'.";
  26326. $core.addMethod(
  26327. $core.method({
  26328. selector: "alert:",
  26329. protocol: "dialogs",
  26330. fn: function (aString){
  26331. var self=this,$self=this;
  26332. return $core.withContext(function($ctx1) {
  26333. return $recv($self._current())._alert_(aString);
  26334. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26335. },
  26336. args: ["aString"],
  26337. source: "alert: aString\x0a\x09^ self current alert: aString",
  26338. referencedClasses: [],
  26339. messageSends: ["alert:", "current"]
  26340. }),
  26341. $globals.Terminal.a$cls);
  26342. $core.addMethod(
  26343. $core.method({
  26344. selector: "confirm:",
  26345. protocol: "dialogs",
  26346. fn: function (aString){
  26347. var self=this,$self=this;
  26348. return $core.withContext(function($ctx1) {
  26349. return $recv($self._current())._confirm_(aString);
  26350. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26351. },
  26352. args: ["aString"],
  26353. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26354. referencedClasses: [],
  26355. messageSends: ["confirm:", "current"]
  26356. }),
  26357. $globals.Terminal.a$cls);
  26358. $core.addMethod(
  26359. $core.method({
  26360. selector: "prompt:",
  26361. protocol: "dialogs",
  26362. fn: function (aString){
  26363. var self=this,$self=this;
  26364. return $core.withContext(function($ctx1) {
  26365. return $recv($self._current())._prompt_(aString);
  26366. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26367. },
  26368. args: ["aString"],
  26369. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26370. referencedClasses: [],
  26371. messageSends: ["prompt:", "current"]
  26372. }),
  26373. $globals.Terminal.a$cls);
  26374. $core.addMethod(
  26375. $core.method({
  26376. selector: "prompt:default:",
  26377. protocol: "dialogs",
  26378. fn: function (aString,defaultString){
  26379. var self=this,$self=this;
  26380. return $core.withContext(function($ctx1) {
  26381. return $recv($self._current())._prompt_default_(aString,defaultString);
  26382. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26383. },
  26384. args: ["aString", "defaultString"],
  26385. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26386. referencedClasses: [],
  26387. messageSends: ["prompt:default:", "current"]
  26388. }),
  26389. $globals.Terminal.a$cls);
  26390. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26391. $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.";
  26392. $core.addMethod(
  26393. $core.method({
  26394. selector: "clear",
  26395. protocol: "printing",
  26396. fn: function (){
  26397. var self=this,$self=this;
  26398. return $core.withContext(function($ctx1) {
  26399. $recv($self._current())._clear();
  26400. return self;
  26401. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26402. },
  26403. args: [],
  26404. source: "clear\x0a\x09self current clear",
  26405. referencedClasses: [],
  26406. messageSends: ["clear", "current"]
  26407. }),
  26408. $globals.Transcript.a$cls);
  26409. $core.addMethod(
  26410. $core.method({
  26411. selector: "cr",
  26412. protocol: "printing",
  26413. fn: function (){
  26414. var self=this,$self=this;
  26415. return $core.withContext(function($ctx1) {
  26416. $recv($self._current())._show_($recv($globals.String)._cr());
  26417. return self;
  26418. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26419. },
  26420. args: [],
  26421. source: "cr\x0a\x09self current show: String cr",
  26422. referencedClasses: ["String"],
  26423. messageSends: ["show:", "current", "cr"]
  26424. }),
  26425. $globals.Transcript.a$cls);
  26426. $core.addMethod(
  26427. $core.method({
  26428. selector: "inspect:",
  26429. protocol: "printing",
  26430. fn: function (anObject){
  26431. var self=this,$self=this;
  26432. return $core.withContext(function($ctx1) {
  26433. $self._show_(anObject);
  26434. return self;
  26435. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26436. },
  26437. args: ["anObject"],
  26438. source: "inspect: anObject\x0a\x09self show: anObject",
  26439. referencedClasses: [],
  26440. messageSends: ["show:"]
  26441. }),
  26442. $globals.Transcript.a$cls);
  26443. $core.addMethod(
  26444. $core.method({
  26445. selector: "open",
  26446. protocol: "instance creation",
  26447. fn: function (){
  26448. var self=this,$self=this;
  26449. return $core.withContext(function($ctx1) {
  26450. $recv($self._current())._open();
  26451. return self;
  26452. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26453. },
  26454. args: [],
  26455. source: "open\x0a\x09self current open",
  26456. referencedClasses: [],
  26457. messageSends: ["open", "current"]
  26458. }),
  26459. $globals.Transcript.a$cls);
  26460. $core.addMethod(
  26461. $core.method({
  26462. selector: "show:",
  26463. protocol: "printing",
  26464. fn: function (anObject){
  26465. var self=this,$self=this;
  26466. return $core.withContext(function($ctx1) {
  26467. $recv($self._current())._show_(anObject);
  26468. return self;
  26469. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26470. },
  26471. args: ["anObject"],
  26472. source: "show: anObject\x0a\x09self current show: anObject",
  26473. referencedClasses: [],
  26474. messageSends: ["show:", "current"]
  26475. }),
  26476. $globals.Transcript.a$cls);
  26477. $core.addMethod(
  26478. $core.method({
  26479. selector: "inspectOn:",
  26480. protocol: "*Platform-Services",
  26481. fn: function (anInspector){
  26482. var self=this,$self=this;
  26483. var variables;
  26484. return $core.withContext(function($ctx1) {
  26485. variables=$recv($globals.Dictionary)._new();
  26486. $recv(variables)._at_put_("#self",self);
  26487. $ctx1.sendIdx["at:put:"]=1;
  26488. $recv(variables)._at_put_("#keys",$self._keys());
  26489. $ctx1.sendIdx["at:put:"]=2;
  26490. $self._keysAndValuesDo_((function(key,value){
  26491. return $core.withContext(function($ctx2) {
  26492. return $recv(variables)._at_put_(key,value);
  26493. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26494. }));
  26495. $recv(anInspector)._setLabel_($self._printString());
  26496. $recv(anInspector)._setVariables_(variables);
  26497. return self;
  26498. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26499. },
  26500. args: ["anInspector"],
  26501. 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",
  26502. referencedClasses: ["Dictionary"],
  26503. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26504. }),
  26505. $globals.AssociativeCollection);
  26506. $core.addMethod(
  26507. $core.method({
  26508. selector: "inspectOn:",
  26509. protocol: "*Platform-Services",
  26510. fn: function (anInspector){
  26511. var self=this,$self=this;
  26512. var variables;
  26513. return $core.withContext(function($ctx1) {
  26514. variables=$recv($globals.Dictionary)._new();
  26515. $recv(variables)._at_put_("#self",self);
  26516. $ctx1.sendIdx["at:put:"]=1;
  26517. $self._withIndexDo_((function(each,i){
  26518. return $core.withContext(function($ctx2) {
  26519. return $recv(variables)._at_put_(i,each);
  26520. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26521. }));
  26522. $recv(anInspector)._setLabel_($self._printString());
  26523. $recv(anInspector)._setVariables_(variables);
  26524. return self;
  26525. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26526. },
  26527. args: ["anInspector"],
  26528. 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",
  26529. referencedClasses: ["Dictionary"],
  26530. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26531. }),
  26532. $globals.Collection);
  26533. $core.addMethod(
  26534. $core.method({
  26535. selector: "inspectOn:",
  26536. protocol: "*Platform-Services",
  26537. fn: function (anInspector){
  26538. var self=this,$self=this;
  26539. var variables;
  26540. return $core.withContext(function($ctx1) {
  26541. variables=$recv($globals.Dictionary)._new();
  26542. $recv(variables)._at_put_("#self",self);
  26543. $ctx1.sendIdx["at:put:"]=1;
  26544. $recv(variables)._at_put_("#year",$self._year());
  26545. $ctx1.sendIdx["at:put:"]=2;
  26546. $recv(variables)._at_put_("#month",$self._month());
  26547. $ctx1.sendIdx["at:put:"]=3;
  26548. $recv(variables)._at_put_("#day",$self._day());
  26549. $ctx1.sendIdx["at:put:"]=4;
  26550. $recv(variables)._at_put_("#hours",$self._hours());
  26551. $ctx1.sendIdx["at:put:"]=5;
  26552. $recv(variables)._at_put_("#minutes",$self._minutes());
  26553. $ctx1.sendIdx["at:put:"]=6;
  26554. $recv(variables)._at_put_("#seconds",$self._seconds());
  26555. $ctx1.sendIdx["at:put:"]=7;
  26556. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26557. $recv(anInspector)._setLabel_($self._printString());
  26558. $recv(anInspector)._setVariables_(variables);
  26559. return self;
  26560. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26561. },
  26562. args: ["anInspector"],
  26563. 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",
  26564. referencedClasses: ["Dictionary"],
  26565. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26566. }),
  26567. $globals.Date);
  26568. $core.addMethod(
  26569. $core.method({
  26570. selector: "inspectOn:",
  26571. protocol: "*Platform-Services",
  26572. fn: function (anInspector){
  26573. var self=this,$self=this;
  26574. var variables;
  26575. return $core.withContext(function($ctx1) {
  26576. variables=$recv($globals.Dictionary)._new();
  26577. $recv(variables)._at_put_("#self",$self._jsObject());
  26578. $recv(anInspector)._setLabel_($self._printString());
  26579. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26580. $recv(anInspector)._setVariables_(variables);
  26581. return self;
  26582. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26583. },
  26584. args: ["anInspector"],
  26585. 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",
  26586. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26587. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26588. }),
  26589. $globals.JSObjectProxy);
  26590. $core.addMethod(
  26591. $core.method({
  26592. selector: "inspectOn:",
  26593. protocol: "*Platform-Services",
  26594. fn: function (anInspector){
  26595. var self=this,$self=this;
  26596. var variables;
  26597. return $core.withContext(function($ctx1) {
  26598. variables=$recv($globals.Dictionary)._new();
  26599. $recv(variables)._at_put_("#self",self);
  26600. $ctx1.sendIdx["at:put:"]=1;
  26601. $recv(variables)._at_put_("#home",$self._home());
  26602. $ctx1.sendIdx["at:put:"]=2;
  26603. $recv(variables)._at_put_("#receiver",$self._receiver());
  26604. $ctx1.sendIdx["at:put:"]=3;
  26605. $recv(variables)._at_put_("#selector",$self._selector());
  26606. $ctx1.sendIdx["at:put:"]=4;
  26607. $recv(variables)._at_put_("#locals",$self._locals());
  26608. $ctx1.sendIdx["at:put:"]=5;
  26609. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26610. return $core.withContext(function($ctx2) {
  26611. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26612. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26613. }));
  26614. $recv(anInspector)._setLabel_($self._printString());
  26615. $recv(anInspector)._setVariables_(variables);
  26616. return self;
  26617. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26618. },
  26619. args: ["anInspector"],
  26620. 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",
  26621. referencedClasses: ["Dictionary"],
  26622. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26623. }),
  26624. $globals.MethodContext);
  26625. $core.addMethod(
  26626. $core.method({
  26627. selector: "inspectOn:",
  26628. protocol: "*Platform-Services",
  26629. fn: function (anInspector){
  26630. var self=this,$self=this;
  26631. var variables;
  26632. return $core.withContext(function($ctx1) {
  26633. variables=$recv($globals.Dictionary)._new();
  26634. $recv(variables)._at_put_("#self",self);
  26635. $ctx1.sendIdx["at:put:"]=1;
  26636. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26637. return $core.withContext(function($ctx2) {
  26638. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26639. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26640. }));
  26641. $recv(anInspector)._setLabel_($self._printString());
  26642. $recv(anInspector)._setVariables_(variables);
  26643. return self;
  26644. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26645. },
  26646. args: ["anInspector"],
  26647. 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",
  26648. referencedClasses: ["Dictionary"],
  26649. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26650. }),
  26651. $globals.Object);
  26652. $core.addMethod(
  26653. $core.method({
  26654. selector: "do:displayingProgress:",
  26655. protocol: "*Platform-Services",
  26656. fn: function (aBlock,aString){
  26657. var self=this,$self=this;
  26658. return $core.withContext(function($ctx1) {
  26659. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26660. return self;
  26661. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26662. },
  26663. args: ["aBlock", "aString"],
  26664. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26665. referencedClasses: ["ProgressHandler"],
  26666. messageSends: ["do:on:displaying:"]
  26667. }),
  26668. $globals.SequenceableCollection);
  26669. $core.addMethod(
  26670. $core.method({
  26671. selector: "inspectOn:",
  26672. protocol: "*Platform-Services",
  26673. fn: function (anInspector){
  26674. var self=this,$self=this;
  26675. var variables,i;
  26676. return $core.withContext(function($ctx1) {
  26677. variables=$recv($globals.Dictionary)._new();
  26678. $recv(variables)._at_put_("#self",self);
  26679. $ctx1.sendIdx["at:put:"]=1;
  26680. i=(1);
  26681. $self._do_((function(each){
  26682. return $core.withContext(function($ctx2) {
  26683. $recv(variables)._at_put_(i,each);
  26684. i=$recv(i).__plus((1));
  26685. return i;
  26686. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26687. }));
  26688. $recv(anInspector)._setLabel_($self._printString());
  26689. $recv(anInspector)._setVariables_(variables);
  26690. return self;
  26691. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26692. },
  26693. args: ["anInspector"],
  26694. 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",
  26695. referencedClasses: ["Dictionary"],
  26696. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26697. }),
  26698. $globals.Set);
  26699. $core.addMethod(
  26700. $core.method({
  26701. selector: "inspectOn:",
  26702. protocol: "*Platform-Services",
  26703. fn: function (anInspector){
  26704. var self=this,$self=this;
  26705. var label;
  26706. return $core.withContext(function($ctx1) {
  26707. var $3,$2,$1,$5,$4;
  26708. (
  26709. $ctx1.supercall = true,
  26710. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26711. $ctx1.supercall = false;
  26712. $3=$self._printString();
  26713. $ctx1.sendIdx["printString"]=1;
  26714. $2=$recv($3)._size();
  26715. $1=$recv($2).__gt((30));
  26716. if($core.assert($1)){
  26717. $5=$self._printString();
  26718. $ctx1.sendIdx["printString"]=2;
  26719. $4=$recv($5)._copyFrom_to_((1),(30));
  26720. label=$recv($4).__comma("...'");
  26721. label;
  26722. } else {
  26723. label=$self._printString();
  26724. label;
  26725. }
  26726. $recv(anInspector)._setLabel_(label);
  26727. return self;
  26728. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26729. },
  26730. args: ["anInspector"],
  26731. 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",
  26732. referencedClasses: [],
  26733. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26734. }),
  26735. $globals.String);
  26736. });
  26737. define('amber/deploy',[
  26738. './helpers',
  26739. './boot', // pre-fetch, dep of ./helpers
  26740. // --- packages of the core Amber begin here ---
  26741. 'amber_core/Kernel-Helpers',
  26742. 'amber_core/Kernel-Objects',
  26743. 'amber_core/Kernel-Classes',
  26744. 'amber_core/Kernel-Methods',
  26745. 'amber_core/Kernel-Collections',
  26746. 'amber_core/Kernel-Dag',
  26747. 'amber_core/Kernel-Infrastructure',
  26748. 'amber_core/Kernel-Promises',
  26749. 'amber_core/Kernel-Exceptions',
  26750. 'amber_core/Kernel-Announcements',
  26751. 'amber_core/Platform-Services',
  26752. // --- packages of the core Amber end here ---
  26753. ], function (amber) {
  26754. return amber;
  26755. });
  26756. // jshint ignore:start
  26757. define('amber/parser',['./boot'], function($boot) {
  26758. var $globals = $boot.globals;
  26759. $globals.SmalltalkParser = (function() {
  26760. "use strict";
  26761. /*
  26762. * Generated by PEG.js 0.9.0.
  26763. *
  26764. * http://pegjs.org/
  26765. */
  26766. function peg$subclass(child, parent) {
  26767. function ctor() { this.constructor = child; }
  26768. ctor.prototype = parent.prototype;
  26769. child.prototype = new ctor();
  26770. }
  26771. function peg$SyntaxError(message, expected, found, location) {
  26772. this.message = message;
  26773. this.expected = expected;
  26774. this.found = found;
  26775. this.location = location;
  26776. this.name = "SyntaxError";
  26777. if (typeof Error.captureStackTrace === "function") {
  26778. Error.captureStackTrace(this, peg$SyntaxError);
  26779. }
  26780. }
  26781. peg$subclass(peg$SyntaxError, Error);
  26782. function peg$parse(input) {
  26783. var options = arguments.length > 1 ? arguments[1] : {},
  26784. parser = this,
  26785. peg$FAILED = {},
  26786. peg$startRuleFunctions = { start: peg$parsestart },
  26787. peg$startRuleFunction = peg$parsestart,
  26788. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26789. 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]" },
  26790. peg$c2 = "\"",
  26791. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26792. peg$c4 = /^[^"]/,
  26793. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26794. peg$c6 = ".",
  26795. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26796. peg$c8 = /^[a-zA-Z]/,
  26797. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26798. peg$c10 = /^[a-zA-Z0-9]/,
  26799. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26800. peg$c12 = ":",
  26801. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26802. peg$c14 = /^[A-Z]/,
  26803. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26804. peg$c16 = function(val) {
  26805. return $globals.ValueNode._new()
  26806. ._location_(location())
  26807. ._source_(text())
  26808. ._value_(val);
  26809. },
  26810. peg$c17 = "'",
  26811. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26812. peg$c19 = "''",
  26813. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26814. peg$c21 = function() {return '\'';},
  26815. peg$c22 = /^[^']/,
  26816. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26817. peg$c24 = function(val) {return val.join('');},
  26818. peg$c25 = "$",
  26819. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26820. peg$c27 = { type: "any", description: "any character" },
  26821. peg$c28 = function(char) {
  26822. return $globals.ValueNode._new()
  26823. ._location_(location())
  26824. ._source_(text())
  26825. ._value_(char);
  26826. },
  26827. peg$c29 = "#",
  26828. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26829. peg$c31 = function(rest) {return rest;},
  26830. peg$c32 = "e",
  26831. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26832. peg$c34 = function(n) {return parseFloat(n);},
  26833. peg$c35 = "-",
  26834. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26835. peg$c37 = "16r",
  26836. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26837. peg$c39 = /^[0-9a-fA-F]/,
  26838. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26839. peg$c41 = function(neg, num) {
  26840. return parseInt(((neg || '') + num), 16);
  26841. },
  26842. peg$c42 = /^[0-9]/,
  26843. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26844. peg$c44 = function(n) {return parseFloat(n, 10);},
  26845. peg$c45 = function(n) {return parseInt(n, 10);},
  26846. peg$c46 = "#(",
  26847. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26848. peg$c48 = ")",
  26849. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26850. peg$c50 = function(rest) {
  26851. return rest
  26852. ._location_(location())
  26853. ._source_(text());
  26854. },
  26855. peg$c51 = "(",
  26856. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26857. peg$c53 = function(lit) {return lit._value();},
  26858. peg$c54 = function(lits) {
  26859. return $globals.ValueNode._new()
  26860. ._value_(lits);
  26861. },
  26862. peg$c55 = "{",
  26863. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26864. peg$c57 = "}",
  26865. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26866. peg$c59 = function(expressions) {
  26867. return $globals.DynamicArrayNode._new()
  26868. ._location_(location())
  26869. ._source_(text())
  26870. ._dagChildren_(expressions || []);
  26871. },
  26872. peg$c60 = "#{",
  26873. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26874. peg$c62 = function(expressions) {
  26875. return $globals.DynamicDictionaryNode._new()
  26876. ._location_(location())
  26877. ._source_(text())
  26878. ._dagChildren_(expressions || []);
  26879. },
  26880. peg$c63 = "true",
  26881. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26882. peg$c65 = function() {return true;},
  26883. peg$c66 = "false",
  26884. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26885. peg$c68 = function() {return false;},
  26886. peg$c69 = "nil",
  26887. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26888. peg$c71 = function() {return null;},
  26889. peg$c72 = function(identifier) {
  26890. return $globals.VariableNode._new()
  26891. ._location_(location())
  26892. ._source_(text())
  26893. ._value_(identifier);
  26894. },
  26895. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26896. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26897. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26898. peg$c76 = function(pairs) {
  26899. var selector = '';
  26900. var params = [];
  26901. for(var i = 0; i < pairs.length; i++) {
  26902. selector += pairs[i].key;
  26903. params.push(pairs[i].arg);
  26904. }
  26905. return [selector, params];
  26906. },
  26907. peg$c77 = function(selector, arg) {
  26908. return [selector, [arg]];
  26909. },
  26910. peg$c78 = function(selector) {return [selector, []];},
  26911. peg$c79 = function(expression) {
  26912. return expression;
  26913. },
  26914. peg$c80 = function(first, others) {
  26915. return [first].concat(others);
  26916. },
  26917. peg$c81 = function(selector) {
  26918. return $globals.Message._selector_arguments_(selector, []);
  26919. },
  26920. peg$c82 = function(pairs) {
  26921. var selector = '';
  26922. var args = [];
  26923. for(var i = 0; i < pairs.length; i++) {
  26924. selector += pairs[i].key;
  26925. args.push(pairs[i].arg._value());
  26926. }
  26927. return $globals.Message._selector_arguments_(selector, args)
  26928. },
  26929. peg$c83 = "<",
  26930. peg$c84 = { type: "literal", value: "<", description: "\"<\"" },
  26931. peg$c85 = ">",
  26932. peg$c86 = { type: "literal", value: ">", description: "\">\"" },
  26933. peg$c87 = function(message) {return message;},
  26934. peg$c88 = ":=",
  26935. peg$c89 = { type: "literal", value: ":=", description: "\":=\"" },
  26936. peg$c90 = function(variable, expression) {
  26937. return $globals.AssignmentNode._new()
  26938. ._location_(location())
  26939. ._source_(text())
  26940. ._left_(variable)
  26941. ._right_(expression);
  26942. },
  26943. peg$c91 = "^",
  26944. peg$c92 = { type: "literal", value: "^", description: "\"^\"" },
  26945. peg$c93 = function(expression) {
  26946. return $globals.ReturnNode._new()
  26947. ._location_(location())
  26948. ._source_(text())
  26949. ._dagChildren_([expression]);
  26950. },
  26951. peg$c94 = "|",
  26952. peg$c95 = { type: "literal", value: "|", description: "\"|\"" },
  26953. peg$c96 = function(variable) {return variable;},
  26954. peg$c97 = function(vars) {
  26955. return vars;
  26956. },
  26957. peg$c98 = function(param) {return param;},
  26958. peg$c99 = function(params) {
  26959. return params;
  26960. },
  26961. peg$c100 = function(ret) {return [ret];},
  26962. peg$c101 = function(exps, ret) {
  26963. var expressions = exps;
  26964. expressions.push(ret);
  26965. return expressions;
  26966. },
  26967. peg$c102 = function(expressions) {return expressions || [];},
  26968. peg$c103 = function(aPragmas, temps, zPragmas, statements) {
  26969. return $globals.SequenceNode._new()
  26970. ._location_(location())
  26971. ._source_(text())
  26972. ._temps_(temps || [])
  26973. ._pragmas_((aPragmas || []).concat(zPragmas || []))
  26974. ._dagChildren_(statements || []);
  26975. },
  26976. peg$c104 = "[",
  26977. peg$c105 = { type: "literal", value: "[", description: "\"[\"" },
  26978. peg$c106 = "]",
  26979. peg$c107 = { type: "literal", value: "]", description: "\"]\"" },
  26980. peg$c108 = function(params, sequence) {
  26981. return $globals.BlockNode._new()
  26982. ._location_(location())
  26983. ._source_(text())
  26984. ._parameters_(params || [])
  26985. ._dagChildren_([sequence._asBlockSequenceNode()]);
  26986. },
  26987. peg$c109 = function(selector) {
  26988. return $globals.SendNode._new()
  26989. ._location_(location())
  26990. ._source_(text())
  26991. ._selector_(selector);
  26992. },
  26993. peg$c110 = function(receiver, tail) {
  26994. return receiver._withTail_(tail);
  26995. },
  26996. peg$c111 = function(selector, arg) {
  26997. return $globals.SendNode._new()
  26998. ._location_(location())
  26999. ._source_(text())
  27000. ._selector_(selector)
  27001. ._arguments_([arg]);
  27002. },
  27003. peg$c112 = function(unarys, binarys) { return unarys.concat(binarys); },
  27004. peg$c113 = function(pairs) {
  27005. var selector = '';
  27006. var args = [];
  27007. for(var i = 0; i < pairs.length; i++) {
  27008. selector += pairs[i].key;
  27009. args.push(pairs[i].arg);
  27010. }
  27011. return $globals.SendNode._new()
  27012. ._location_(location())
  27013. ._source_(text())
  27014. ._selector_(selector)
  27015. ._arguments_(args);
  27016. },
  27017. peg$c114 = function(binarys, final) {
  27018. if (final) binarys.push(final);
  27019. return binarys;
  27020. },
  27021. peg$c115 = function(receiver, tail) {return tail.length > 0;},
  27022. peg$c116 = ";",
  27023. peg$c117 = { type: "literal", value: ";", description: "\";\"" },
  27024. peg$c118 = function(receiver, tail, mess) {return mess;},
  27025. peg$c119 = function(receiver, tail, messages) {
  27026. messages.unshift(receiver._withTail_(tail));
  27027. return $globals.CascadeNode._new()
  27028. ._location_(location())
  27029. ._source_(text())
  27030. ._dagChildren_(messages);
  27031. },
  27032. peg$c120 = function(pattern, sequence) {
  27033. return $globals.MethodNode._new()
  27034. ._location_(location())
  27035. ._source_(text())
  27036. ._selector_(pattern[0])
  27037. ._arguments_(pattern[1])
  27038. ._dagChildren_([sequence]);
  27039. },
  27040. peg$c121 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  27041. peg$c122 = function(receiver, tail) {
  27042. var last = tail.pop();
  27043. return [receiver._withTail_(tail), last._arguments()[0]];
  27044. },
  27045. peg$c123 = function(first, others) {
  27046. return first.concat.apply(first, others);
  27047. },
  27048. peg$currPos = 0,
  27049. peg$savedPos = 0,
  27050. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  27051. peg$maxFailPos = 0,
  27052. peg$maxFailExpected = [],
  27053. peg$silentFails = 0,
  27054. peg$resultsCache = {},
  27055. peg$result;
  27056. if ("startRule" in options) {
  27057. if (!(options.startRule in peg$startRuleFunctions)) {
  27058. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  27059. }
  27060. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  27061. }
  27062. function text() {
  27063. return input.substring(peg$savedPos, peg$currPos);
  27064. }
  27065. function location() {
  27066. return peg$computeLocation(peg$savedPos, peg$currPos);
  27067. }
  27068. function expected(description) {
  27069. throw peg$buildException(
  27070. null,
  27071. [{ type: "other", description: description }],
  27072. input.substring(peg$savedPos, peg$currPos),
  27073. peg$computeLocation(peg$savedPos, peg$currPos)
  27074. );
  27075. }
  27076. function error(message) {
  27077. throw peg$buildException(
  27078. message,
  27079. null,
  27080. input.substring(peg$savedPos, peg$currPos),
  27081. peg$computeLocation(peg$savedPos, peg$currPos)
  27082. );
  27083. }
  27084. function peg$computePosDetails(pos) {
  27085. var details = peg$posDetailsCache[pos],
  27086. p, ch;
  27087. if (details) {
  27088. return details;
  27089. } else {
  27090. p = pos - 1;
  27091. while (!peg$posDetailsCache[p]) {
  27092. p--;
  27093. }
  27094. details = peg$posDetailsCache[p];
  27095. details = {
  27096. line: details.line,
  27097. column: details.column,
  27098. seenCR: details.seenCR
  27099. };
  27100. while (p < pos) {
  27101. ch = input.charAt(p);
  27102. if (ch === "\n") {
  27103. if (!details.seenCR) { details.line++; }
  27104. details.column = 1;
  27105. details.seenCR = false;
  27106. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  27107. details.line++;
  27108. details.column = 1;
  27109. details.seenCR = true;
  27110. } else {
  27111. details.column++;
  27112. details.seenCR = false;
  27113. }
  27114. p++;
  27115. }
  27116. peg$posDetailsCache[pos] = details;
  27117. return details;
  27118. }
  27119. }
  27120. function peg$computeLocation(startPos, endPos) {
  27121. var startPosDetails = peg$computePosDetails(startPos),
  27122. endPosDetails = peg$computePosDetails(endPos);
  27123. return {
  27124. start: {
  27125. offset: startPos,
  27126. line: startPosDetails.line,
  27127. column: startPosDetails.column
  27128. },
  27129. end: {
  27130. offset: endPos,
  27131. line: endPosDetails.line,
  27132. column: endPosDetails.column
  27133. }
  27134. };
  27135. }
  27136. function peg$fail(expected) {
  27137. if (peg$currPos < peg$maxFailPos) { return; }
  27138. if (peg$currPos > peg$maxFailPos) {
  27139. peg$maxFailPos = peg$currPos;
  27140. peg$maxFailExpected = [];
  27141. }
  27142. peg$maxFailExpected.push(expected);
  27143. }
  27144. function peg$buildException(message, expected, found, location) {
  27145. function cleanupExpected(expected) {
  27146. var i = 1;
  27147. expected.sort(function(a, b) {
  27148. if (a.description < b.description) {
  27149. return -1;
  27150. } else if (a.description > b.description) {
  27151. return 1;
  27152. } else {
  27153. return 0;
  27154. }
  27155. });
  27156. while (i < expected.length) {
  27157. if (expected[i - 1] === expected[i]) {
  27158. expected.splice(i, 1);
  27159. } else {
  27160. i++;
  27161. }
  27162. }
  27163. }
  27164. function buildMessage(expected, found) {
  27165. function stringEscape(s) {
  27166. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27167. return s
  27168. .replace(/\\/g, '\\\\')
  27169. .replace(/"/g, '\\"')
  27170. .replace(/\x08/g, '\\b')
  27171. .replace(/\t/g, '\\t')
  27172. .replace(/\n/g, '\\n')
  27173. .replace(/\f/g, '\\f')
  27174. .replace(/\r/g, '\\r')
  27175. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27176. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27177. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27178. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27179. }
  27180. var expectedDescs = new Array(expected.length),
  27181. expectedDesc, foundDesc, i;
  27182. for (i = 0; i < expected.length; i++) {
  27183. expectedDescs[i] = expected[i].description;
  27184. }
  27185. expectedDesc = expected.length > 1
  27186. ? expectedDescs.slice(0, -1).join(", ")
  27187. + " or "
  27188. + expectedDescs[expected.length - 1]
  27189. : expectedDescs[0];
  27190. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27191. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27192. }
  27193. if (expected !== null) {
  27194. cleanupExpected(expected);
  27195. }
  27196. return new peg$SyntaxError(
  27197. message !== null ? message : buildMessage(expected, found),
  27198. expected,
  27199. found,
  27200. location
  27201. );
  27202. }
  27203. function peg$parsestart() {
  27204. var s0;
  27205. var key = peg$currPos * 66 + 0,
  27206. cached = peg$resultsCache[key];
  27207. if (cached) {
  27208. peg$currPos = cached.nextPos;
  27209. return cached.result;
  27210. }
  27211. s0 = peg$parsemethod();
  27212. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27213. return s0;
  27214. }
  27215. function peg$parseseparator() {
  27216. var s0, s1;
  27217. var key = peg$currPos * 66 + 1,
  27218. cached = peg$resultsCache[key];
  27219. if (cached) {
  27220. peg$currPos = cached.nextPos;
  27221. return cached.result;
  27222. }
  27223. s0 = [];
  27224. if (peg$c0.test(input.charAt(peg$currPos))) {
  27225. s1 = input.charAt(peg$currPos);
  27226. peg$currPos++;
  27227. } else {
  27228. s1 = peg$FAILED;
  27229. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27230. }
  27231. if (s1 !== peg$FAILED) {
  27232. while (s1 !== peg$FAILED) {
  27233. s0.push(s1);
  27234. if (peg$c0.test(input.charAt(peg$currPos))) {
  27235. s1 = input.charAt(peg$currPos);
  27236. peg$currPos++;
  27237. } else {
  27238. s1 = peg$FAILED;
  27239. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27240. }
  27241. }
  27242. } else {
  27243. s0 = peg$FAILED;
  27244. }
  27245. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27246. return s0;
  27247. }
  27248. function peg$parsecomments() {
  27249. var s0, s1, s2, s3, s4;
  27250. var key = peg$currPos * 66 + 2,
  27251. cached = peg$resultsCache[key];
  27252. if (cached) {
  27253. peg$currPos = cached.nextPos;
  27254. return cached.result;
  27255. }
  27256. s0 = [];
  27257. s1 = peg$currPos;
  27258. if (input.charCodeAt(peg$currPos) === 34) {
  27259. s2 = peg$c2;
  27260. peg$currPos++;
  27261. } else {
  27262. s2 = peg$FAILED;
  27263. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27264. }
  27265. if (s2 !== peg$FAILED) {
  27266. s3 = [];
  27267. if (peg$c4.test(input.charAt(peg$currPos))) {
  27268. s4 = input.charAt(peg$currPos);
  27269. peg$currPos++;
  27270. } else {
  27271. s4 = peg$FAILED;
  27272. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27273. }
  27274. while (s4 !== peg$FAILED) {
  27275. s3.push(s4);
  27276. if (peg$c4.test(input.charAt(peg$currPos))) {
  27277. s4 = input.charAt(peg$currPos);
  27278. peg$currPos++;
  27279. } else {
  27280. s4 = peg$FAILED;
  27281. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27282. }
  27283. }
  27284. if (s3 !== peg$FAILED) {
  27285. if (input.charCodeAt(peg$currPos) === 34) {
  27286. s4 = peg$c2;
  27287. peg$currPos++;
  27288. } else {
  27289. s4 = peg$FAILED;
  27290. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27291. }
  27292. if (s4 !== peg$FAILED) {
  27293. s2 = [s2, s3, s4];
  27294. s1 = s2;
  27295. } else {
  27296. peg$currPos = s1;
  27297. s1 = peg$FAILED;
  27298. }
  27299. } else {
  27300. peg$currPos = s1;
  27301. s1 = peg$FAILED;
  27302. }
  27303. } else {
  27304. peg$currPos = s1;
  27305. s1 = peg$FAILED;
  27306. }
  27307. if (s1 !== peg$FAILED) {
  27308. while (s1 !== peg$FAILED) {
  27309. s0.push(s1);
  27310. s1 = peg$currPos;
  27311. if (input.charCodeAt(peg$currPos) === 34) {
  27312. s2 = peg$c2;
  27313. peg$currPos++;
  27314. } else {
  27315. s2 = peg$FAILED;
  27316. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27317. }
  27318. if (s2 !== peg$FAILED) {
  27319. s3 = [];
  27320. if (peg$c4.test(input.charAt(peg$currPos))) {
  27321. s4 = input.charAt(peg$currPos);
  27322. peg$currPos++;
  27323. } else {
  27324. s4 = peg$FAILED;
  27325. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27326. }
  27327. while (s4 !== peg$FAILED) {
  27328. s3.push(s4);
  27329. if (peg$c4.test(input.charAt(peg$currPos))) {
  27330. s4 = input.charAt(peg$currPos);
  27331. peg$currPos++;
  27332. } else {
  27333. s4 = peg$FAILED;
  27334. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27335. }
  27336. }
  27337. if (s3 !== peg$FAILED) {
  27338. if (input.charCodeAt(peg$currPos) === 34) {
  27339. s4 = peg$c2;
  27340. peg$currPos++;
  27341. } else {
  27342. s4 = peg$FAILED;
  27343. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27344. }
  27345. if (s4 !== peg$FAILED) {
  27346. s2 = [s2, s3, s4];
  27347. s1 = s2;
  27348. } else {
  27349. peg$currPos = s1;
  27350. s1 = peg$FAILED;
  27351. }
  27352. } else {
  27353. peg$currPos = s1;
  27354. s1 = peg$FAILED;
  27355. }
  27356. } else {
  27357. peg$currPos = s1;
  27358. s1 = peg$FAILED;
  27359. }
  27360. }
  27361. } else {
  27362. s0 = peg$FAILED;
  27363. }
  27364. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27365. return s0;
  27366. }
  27367. function peg$parsews() {
  27368. var s0, s1;
  27369. var key = peg$currPos * 66 + 3,
  27370. cached = peg$resultsCache[key];
  27371. if (cached) {
  27372. peg$currPos = cached.nextPos;
  27373. return cached.result;
  27374. }
  27375. s0 = [];
  27376. s1 = peg$parseseparator();
  27377. if (s1 === peg$FAILED) {
  27378. s1 = peg$parsecomments();
  27379. }
  27380. while (s1 !== peg$FAILED) {
  27381. s0.push(s1);
  27382. s1 = peg$parseseparator();
  27383. if (s1 === peg$FAILED) {
  27384. s1 = peg$parsecomments();
  27385. }
  27386. }
  27387. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27388. return s0;
  27389. }
  27390. function peg$parsemaybeDotsWs() {
  27391. var s0, s1;
  27392. var key = peg$currPos * 66 + 4,
  27393. cached = peg$resultsCache[key];
  27394. if (cached) {
  27395. peg$currPos = cached.nextPos;
  27396. return cached.result;
  27397. }
  27398. s0 = [];
  27399. if (input.charCodeAt(peg$currPos) === 46) {
  27400. s1 = peg$c6;
  27401. peg$currPos++;
  27402. } else {
  27403. s1 = peg$FAILED;
  27404. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27405. }
  27406. if (s1 === peg$FAILED) {
  27407. s1 = peg$parseseparator();
  27408. if (s1 === peg$FAILED) {
  27409. s1 = peg$parsecomments();
  27410. }
  27411. }
  27412. while (s1 !== peg$FAILED) {
  27413. s0.push(s1);
  27414. if (input.charCodeAt(peg$currPos) === 46) {
  27415. s1 = peg$c6;
  27416. peg$currPos++;
  27417. } else {
  27418. s1 = peg$FAILED;
  27419. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27420. }
  27421. if (s1 === peg$FAILED) {
  27422. s1 = peg$parseseparator();
  27423. if (s1 === peg$FAILED) {
  27424. s1 = peg$parsecomments();
  27425. }
  27426. }
  27427. }
  27428. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27429. return s0;
  27430. }
  27431. function peg$parsesomeDotsWs() {
  27432. var s0, s1, s2, s3;
  27433. var key = peg$currPos * 66 + 5,
  27434. cached = peg$resultsCache[key];
  27435. if (cached) {
  27436. peg$currPos = cached.nextPos;
  27437. return cached.result;
  27438. }
  27439. s0 = peg$currPos;
  27440. s1 = peg$parsews();
  27441. if (s1 !== peg$FAILED) {
  27442. if (input.charCodeAt(peg$currPos) === 46) {
  27443. s2 = peg$c6;
  27444. peg$currPos++;
  27445. } else {
  27446. s2 = peg$FAILED;
  27447. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27448. }
  27449. if (s2 !== peg$FAILED) {
  27450. s3 = peg$parsemaybeDotsWs();
  27451. if (s3 !== peg$FAILED) {
  27452. s1 = [s1, s2, s3];
  27453. s0 = s1;
  27454. } else {
  27455. peg$currPos = s0;
  27456. s0 = peg$FAILED;
  27457. }
  27458. } else {
  27459. peg$currPos = s0;
  27460. s0 = peg$FAILED;
  27461. }
  27462. } else {
  27463. peg$currPos = s0;
  27464. s0 = peg$FAILED;
  27465. }
  27466. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27467. return s0;
  27468. }
  27469. function peg$parseidentifier() {
  27470. var s0, s1, s2, s3, s4;
  27471. var key = peg$currPos * 66 + 6,
  27472. cached = peg$resultsCache[key];
  27473. if (cached) {
  27474. peg$currPos = cached.nextPos;
  27475. return cached.result;
  27476. }
  27477. s0 = peg$currPos;
  27478. s1 = peg$currPos;
  27479. if (peg$c8.test(input.charAt(peg$currPos))) {
  27480. s2 = input.charAt(peg$currPos);
  27481. peg$currPos++;
  27482. } else {
  27483. s2 = peg$FAILED;
  27484. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27485. }
  27486. if (s2 !== peg$FAILED) {
  27487. s3 = [];
  27488. if (peg$c10.test(input.charAt(peg$currPos))) {
  27489. s4 = input.charAt(peg$currPos);
  27490. peg$currPos++;
  27491. } else {
  27492. s4 = peg$FAILED;
  27493. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27494. }
  27495. while (s4 !== peg$FAILED) {
  27496. s3.push(s4);
  27497. if (peg$c10.test(input.charAt(peg$currPos))) {
  27498. s4 = input.charAt(peg$currPos);
  27499. peg$currPos++;
  27500. } else {
  27501. s4 = peg$FAILED;
  27502. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27503. }
  27504. }
  27505. if (s3 !== peg$FAILED) {
  27506. s2 = [s2, s3];
  27507. s1 = s2;
  27508. } else {
  27509. peg$currPos = s1;
  27510. s1 = peg$FAILED;
  27511. }
  27512. } else {
  27513. peg$currPos = s1;
  27514. s1 = peg$FAILED;
  27515. }
  27516. if (s1 !== peg$FAILED) {
  27517. s0 = input.substring(s0, peg$currPos);
  27518. } else {
  27519. s0 = s1;
  27520. }
  27521. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27522. return s0;
  27523. }
  27524. function peg$parsekeyword() {
  27525. var s0, s1, s2, s3;
  27526. var key = peg$currPos * 66 + 7,
  27527. cached = peg$resultsCache[key];
  27528. if (cached) {
  27529. peg$currPos = cached.nextPos;
  27530. return cached.result;
  27531. }
  27532. s0 = peg$currPos;
  27533. s1 = peg$currPos;
  27534. s2 = peg$parseidentifier();
  27535. if (s2 !== peg$FAILED) {
  27536. if (input.charCodeAt(peg$currPos) === 58) {
  27537. s3 = peg$c12;
  27538. peg$currPos++;
  27539. } else {
  27540. s3 = peg$FAILED;
  27541. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27542. }
  27543. if (s3 !== peg$FAILED) {
  27544. s2 = [s2, s3];
  27545. s1 = s2;
  27546. } else {
  27547. peg$currPos = s1;
  27548. s1 = peg$FAILED;
  27549. }
  27550. } else {
  27551. peg$currPos = s1;
  27552. s1 = peg$FAILED;
  27553. }
  27554. if (s1 !== peg$FAILED) {
  27555. s0 = input.substring(s0, peg$currPos);
  27556. } else {
  27557. s0 = s1;
  27558. }
  27559. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27560. return s0;
  27561. }
  27562. function peg$parseclassName() {
  27563. var s0, s1, s2, s3, s4;
  27564. var key = peg$currPos * 66 + 8,
  27565. cached = peg$resultsCache[key];
  27566. if (cached) {
  27567. peg$currPos = cached.nextPos;
  27568. return cached.result;
  27569. }
  27570. s0 = peg$currPos;
  27571. s1 = peg$currPos;
  27572. if (peg$c14.test(input.charAt(peg$currPos))) {
  27573. s2 = input.charAt(peg$currPos);
  27574. peg$currPos++;
  27575. } else {
  27576. s2 = peg$FAILED;
  27577. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27578. }
  27579. if (s2 !== peg$FAILED) {
  27580. s3 = [];
  27581. if (peg$c10.test(input.charAt(peg$currPos))) {
  27582. s4 = input.charAt(peg$currPos);
  27583. peg$currPos++;
  27584. } else {
  27585. s4 = peg$FAILED;
  27586. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27587. }
  27588. while (s4 !== peg$FAILED) {
  27589. s3.push(s4);
  27590. if (peg$c10.test(input.charAt(peg$currPos))) {
  27591. s4 = input.charAt(peg$currPos);
  27592. peg$currPos++;
  27593. } else {
  27594. s4 = peg$FAILED;
  27595. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27596. }
  27597. }
  27598. if (s3 !== peg$FAILED) {
  27599. s2 = [s2, s3];
  27600. s1 = s2;
  27601. } else {
  27602. peg$currPos = s1;
  27603. s1 = peg$FAILED;
  27604. }
  27605. } else {
  27606. peg$currPos = s1;
  27607. s1 = peg$FAILED;
  27608. }
  27609. if (s1 !== peg$FAILED) {
  27610. s0 = input.substring(s0, peg$currPos);
  27611. } else {
  27612. s0 = s1;
  27613. }
  27614. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27615. return s0;
  27616. }
  27617. function peg$parsestring() {
  27618. var s0, s1;
  27619. var key = peg$currPos * 66 + 9,
  27620. cached = peg$resultsCache[key];
  27621. if (cached) {
  27622. peg$currPos = cached.nextPos;
  27623. return cached.result;
  27624. }
  27625. s0 = peg$currPos;
  27626. s1 = peg$parserawString();
  27627. if (s1 !== peg$FAILED) {
  27628. peg$savedPos = s0;
  27629. s1 = peg$c16(s1);
  27630. }
  27631. s0 = s1;
  27632. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27633. return s0;
  27634. }
  27635. function peg$parserawString() {
  27636. var s0, s1, s2, s3, s4;
  27637. var key = peg$currPos * 66 + 10,
  27638. cached = peg$resultsCache[key];
  27639. if (cached) {
  27640. peg$currPos = cached.nextPos;
  27641. return cached.result;
  27642. }
  27643. s0 = peg$currPos;
  27644. if (input.charCodeAt(peg$currPos) === 39) {
  27645. s1 = peg$c17;
  27646. peg$currPos++;
  27647. } else {
  27648. s1 = peg$FAILED;
  27649. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27650. }
  27651. if (s1 !== peg$FAILED) {
  27652. s2 = [];
  27653. s3 = peg$currPos;
  27654. if (input.substr(peg$currPos, 2) === peg$c19) {
  27655. s4 = peg$c19;
  27656. peg$currPos += 2;
  27657. } else {
  27658. s4 = peg$FAILED;
  27659. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27660. }
  27661. if (s4 !== peg$FAILED) {
  27662. peg$savedPos = s3;
  27663. s4 = peg$c21();
  27664. }
  27665. s3 = s4;
  27666. if (s3 === peg$FAILED) {
  27667. if (peg$c22.test(input.charAt(peg$currPos))) {
  27668. s3 = input.charAt(peg$currPos);
  27669. peg$currPos++;
  27670. } else {
  27671. s3 = peg$FAILED;
  27672. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27673. }
  27674. }
  27675. while (s3 !== peg$FAILED) {
  27676. s2.push(s3);
  27677. s3 = peg$currPos;
  27678. if (input.substr(peg$currPos, 2) === peg$c19) {
  27679. s4 = peg$c19;
  27680. peg$currPos += 2;
  27681. } else {
  27682. s4 = peg$FAILED;
  27683. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27684. }
  27685. if (s4 !== peg$FAILED) {
  27686. peg$savedPos = s3;
  27687. s4 = peg$c21();
  27688. }
  27689. s3 = s4;
  27690. if (s3 === peg$FAILED) {
  27691. if (peg$c22.test(input.charAt(peg$currPos))) {
  27692. s3 = input.charAt(peg$currPos);
  27693. peg$currPos++;
  27694. } else {
  27695. s3 = peg$FAILED;
  27696. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27697. }
  27698. }
  27699. }
  27700. if (s2 !== peg$FAILED) {
  27701. if (input.charCodeAt(peg$currPos) === 39) {
  27702. s3 = peg$c17;
  27703. peg$currPos++;
  27704. } else {
  27705. s3 = peg$FAILED;
  27706. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27707. }
  27708. if (s3 !== peg$FAILED) {
  27709. peg$savedPos = s0;
  27710. s1 = peg$c24(s2);
  27711. s0 = s1;
  27712. } else {
  27713. peg$currPos = s0;
  27714. s0 = peg$FAILED;
  27715. }
  27716. } else {
  27717. peg$currPos = s0;
  27718. s0 = peg$FAILED;
  27719. }
  27720. } else {
  27721. peg$currPos = s0;
  27722. s0 = peg$FAILED;
  27723. }
  27724. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27725. return s0;
  27726. }
  27727. function peg$parsecharacter() {
  27728. var s0, s1, s2;
  27729. var key = peg$currPos * 66 + 11,
  27730. cached = peg$resultsCache[key];
  27731. if (cached) {
  27732. peg$currPos = cached.nextPos;
  27733. return cached.result;
  27734. }
  27735. s0 = peg$currPos;
  27736. if (input.charCodeAt(peg$currPos) === 36) {
  27737. s1 = peg$c25;
  27738. peg$currPos++;
  27739. } else {
  27740. s1 = peg$FAILED;
  27741. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27742. }
  27743. if (s1 !== peg$FAILED) {
  27744. if (input.length > peg$currPos) {
  27745. s2 = input.charAt(peg$currPos);
  27746. peg$currPos++;
  27747. } else {
  27748. s2 = peg$FAILED;
  27749. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27750. }
  27751. if (s2 !== peg$FAILED) {
  27752. peg$savedPos = s0;
  27753. s1 = peg$c28(s2);
  27754. s0 = s1;
  27755. } else {
  27756. peg$currPos = s0;
  27757. s0 = peg$FAILED;
  27758. }
  27759. } else {
  27760. peg$currPos = s0;
  27761. s0 = peg$FAILED;
  27762. }
  27763. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27764. return s0;
  27765. }
  27766. function peg$parsesymbol() {
  27767. var s0, s1, s2;
  27768. var key = peg$currPos * 66 + 12,
  27769. cached = peg$resultsCache[key];
  27770. if (cached) {
  27771. peg$currPos = cached.nextPos;
  27772. return cached.result;
  27773. }
  27774. s0 = peg$currPos;
  27775. if (input.charCodeAt(peg$currPos) === 35) {
  27776. s1 = peg$c29;
  27777. peg$currPos++;
  27778. } else {
  27779. s1 = peg$FAILED;
  27780. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27781. }
  27782. if (s1 !== peg$FAILED) {
  27783. s2 = peg$parsebareSymbol();
  27784. if (s2 !== peg$FAILED) {
  27785. peg$savedPos = s0;
  27786. s1 = peg$c31(s2);
  27787. s0 = s1;
  27788. } else {
  27789. peg$currPos = s0;
  27790. s0 = peg$FAILED;
  27791. }
  27792. } else {
  27793. peg$currPos = s0;
  27794. s0 = peg$FAILED;
  27795. }
  27796. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27797. return s0;
  27798. }
  27799. function peg$parsebareSymbol() {
  27800. var s0, s1, s2, s3;
  27801. var key = peg$currPos * 66 + 13,
  27802. cached = peg$resultsCache[key];
  27803. if (cached) {
  27804. peg$currPos = cached.nextPos;
  27805. return cached.result;
  27806. }
  27807. s0 = peg$currPos;
  27808. s1 = peg$currPos;
  27809. s2 = [];
  27810. s3 = peg$parsekeyword();
  27811. if (s3 !== peg$FAILED) {
  27812. while (s3 !== peg$FAILED) {
  27813. s2.push(s3);
  27814. s3 = peg$parsekeyword();
  27815. }
  27816. } else {
  27817. s2 = peg$FAILED;
  27818. }
  27819. if (s2 !== peg$FAILED) {
  27820. s1 = input.substring(s1, peg$currPos);
  27821. } else {
  27822. s1 = s2;
  27823. }
  27824. if (s1 === peg$FAILED) {
  27825. s1 = peg$parsebinarySelector();
  27826. if (s1 === peg$FAILED) {
  27827. s1 = peg$parseidentifier();
  27828. if (s1 === peg$FAILED) {
  27829. s1 = peg$parserawString();
  27830. }
  27831. }
  27832. }
  27833. if (s1 !== peg$FAILED) {
  27834. peg$savedPos = s0;
  27835. s1 = peg$c16(s1);
  27836. }
  27837. s0 = s1;
  27838. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27839. return s0;
  27840. }
  27841. function peg$parsenumber() {
  27842. var s0, s1;
  27843. var key = peg$currPos * 66 + 14,
  27844. cached = peg$resultsCache[key];
  27845. if (cached) {
  27846. peg$currPos = cached.nextPos;
  27847. return cached.result;
  27848. }
  27849. s0 = peg$currPos;
  27850. s1 = peg$parserawNumber();
  27851. if (s1 !== peg$FAILED) {
  27852. peg$savedPos = s0;
  27853. s1 = peg$c16(s1);
  27854. }
  27855. s0 = s1;
  27856. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27857. return s0;
  27858. }
  27859. function peg$parserawNumber() {
  27860. var s0;
  27861. var key = peg$currPos * 66 + 15,
  27862. cached = peg$resultsCache[key];
  27863. if (cached) {
  27864. peg$currPos = cached.nextPos;
  27865. return cached.result;
  27866. }
  27867. s0 = peg$parsenumberExp();
  27868. if (s0 === peg$FAILED) {
  27869. s0 = peg$parsehex();
  27870. if (s0 === peg$FAILED) {
  27871. s0 = peg$parsefloat();
  27872. if (s0 === peg$FAILED) {
  27873. s0 = peg$parseinteger();
  27874. }
  27875. }
  27876. }
  27877. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27878. return s0;
  27879. }
  27880. function peg$parsenumberExp() {
  27881. var s0, s1, s2, s3, s4, s5;
  27882. var key = peg$currPos * 66 + 16,
  27883. cached = peg$resultsCache[key];
  27884. if (cached) {
  27885. peg$currPos = cached.nextPos;
  27886. return cached.result;
  27887. }
  27888. s0 = peg$currPos;
  27889. s1 = peg$currPos;
  27890. s2 = peg$currPos;
  27891. s3 = peg$parsefloat();
  27892. if (s3 === peg$FAILED) {
  27893. s3 = peg$parseinteger();
  27894. }
  27895. if (s3 !== peg$FAILED) {
  27896. if (input.charCodeAt(peg$currPos) === 101) {
  27897. s4 = peg$c32;
  27898. peg$currPos++;
  27899. } else {
  27900. s4 = peg$FAILED;
  27901. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27902. }
  27903. if (s4 !== peg$FAILED) {
  27904. s5 = peg$parseinteger();
  27905. if (s5 !== peg$FAILED) {
  27906. s3 = [s3, s4, s5];
  27907. s2 = s3;
  27908. } else {
  27909. peg$currPos = s2;
  27910. s2 = peg$FAILED;
  27911. }
  27912. } else {
  27913. peg$currPos = s2;
  27914. s2 = peg$FAILED;
  27915. }
  27916. } else {
  27917. peg$currPos = s2;
  27918. s2 = peg$FAILED;
  27919. }
  27920. if (s2 !== peg$FAILED) {
  27921. s1 = input.substring(s1, peg$currPos);
  27922. } else {
  27923. s1 = s2;
  27924. }
  27925. if (s1 !== peg$FAILED) {
  27926. peg$savedPos = s0;
  27927. s1 = peg$c34(s1);
  27928. }
  27929. s0 = s1;
  27930. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27931. return s0;
  27932. }
  27933. function peg$parsehex() {
  27934. var s0, s1, s2, s3, s4, s5;
  27935. var key = peg$currPos * 66 + 17,
  27936. cached = peg$resultsCache[key];
  27937. if (cached) {
  27938. peg$currPos = cached.nextPos;
  27939. return cached.result;
  27940. }
  27941. s0 = peg$currPos;
  27942. if (input.charCodeAt(peg$currPos) === 45) {
  27943. s1 = peg$c35;
  27944. peg$currPos++;
  27945. } else {
  27946. s1 = peg$FAILED;
  27947. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27948. }
  27949. if (s1 === peg$FAILED) {
  27950. s1 = null;
  27951. }
  27952. if (s1 !== peg$FAILED) {
  27953. if (input.substr(peg$currPos, 3) === peg$c37) {
  27954. s2 = peg$c37;
  27955. peg$currPos += 3;
  27956. } else {
  27957. s2 = peg$FAILED;
  27958. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27959. }
  27960. if (s2 !== peg$FAILED) {
  27961. s3 = peg$currPos;
  27962. s4 = [];
  27963. if (peg$c39.test(input.charAt(peg$currPos))) {
  27964. s5 = input.charAt(peg$currPos);
  27965. peg$currPos++;
  27966. } else {
  27967. s5 = peg$FAILED;
  27968. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27969. }
  27970. if (s5 !== peg$FAILED) {
  27971. while (s5 !== peg$FAILED) {
  27972. s4.push(s5);
  27973. if (peg$c39.test(input.charAt(peg$currPos))) {
  27974. s5 = input.charAt(peg$currPos);
  27975. peg$currPos++;
  27976. } else {
  27977. s5 = peg$FAILED;
  27978. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  27979. }
  27980. }
  27981. } else {
  27982. s4 = peg$FAILED;
  27983. }
  27984. if (s4 !== peg$FAILED) {
  27985. s3 = input.substring(s3, peg$currPos);
  27986. } else {
  27987. s3 = s4;
  27988. }
  27989. if (s3 !== peg$FAILED) {
  27990. peg$savedPos = s0;
  27991. s1 = peg$c41(s1, s3);
  27992. s0 = s1;
  27993. } else {
  27994. peg$currPos = s0;
  27995. s0 = peg$FAILED;
  27996. }
  27997. } else {
  27998. peg$currPos = s0;
  27999. s0 = peg$FAILED;
  28000. }
  28001. } else {
  28002. peg$currPos = s0;
  28003. s0 = peg$FAILED;
  28004. }
  28005. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28006. return s0;
  28007. }
  28008. function peg$parsefloat() {
  28009. var s0, s1, s2, s3, s4, s5, s6, s7;
  28010. var key = peg$currPos * 66 + 18,
  28011. cached = peg$resultsCache[key];
  28012. if (cached) {
  28013. peg$currPos = cached.nextPos;
  28014. return cached.result;
  28015. }
  28016. s0 = peg$currPos;
  28017. s1 = peg$currPos;
  28018. s2 = peg$currPos;
  28019. if (input.charCodeAt(peg$currPos) === 45) {
  28020. s3 = peg$c35;
  28021. peg$currPos++;
  28022. } else {
  28023. s3 = peg$FAILED;
  28024. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28025. }
  28026. if (s3 === peg$FAILED) {
  28027. s3 = null;
  28028. }
  28029. if (s3 !== peg$FAILED) {
  28030. s4 = [];
  28031. if (peg$c42.test(input.charAt(peg$currPos))) {
  28032. s5 = input.charAt(peg$currPos);
  28033. peg$currPos++;
  28034. } else {
  28035. s5 = peg$FAILED;
  28036. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28037. }
  28038. if (s5 !== peg$FAILED) {
  28039. while (s5 !== peg$FAILED) {
  28040. s4.push(s5);
  28041. if (peg$c42.test(input.charAt(peg$currPos))) {
  28042. s5 = input.charAt(peg$currPos);
  28043. peg$currPos++;
  28044. } else {
  28045. s5 = peg$FAILED;
  28046. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28047. }
  28048. }
  28049. } else {
  28050. s4 = peg$FAILED;
  28051. }
  28052. if (s4 !== peg$FAILED) {
  28053. if (input.charCodeAt(peg$currPos) === 46) {
  28054. s5 = peg$c6;
  28055. peg$currPos++;
  28056. } else {
  28057. s5 = peg$FAILED;
  28058. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28059. }
  28060. if (s5 !== peg$FAILED) {
  28061. s6 = [];
  28062. if (peg$c42.test(input.charAt(peg$currPos))) {
  28063. s7 = input.charAt(peg$currPos);
  28064. peg$currPos++;
  28065. } else {
  28066. s7 = peg$FAILED;
  28067. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28068. }
  28069. if (s7 !== peg$FAILED) {
  28070. while (s7 !== peg$FAILED) {
  28071. s6.push(s7);
  28072. if (peg$c42.test(input.charAt(peg$currPos))) {
  28073. s7 = input.charAt(peg$currPos);
  28074. peg$currPos++;
  28075. } else {
  28076. s7 = peg$FAILED;
  28077. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28078. }
  28079. }
  28080. } else {
  28081. s6 = peg$FAILED;
  28082. }
  28083. if (s6 !== peg$FAILED) {
  28084. s3 = [s3, s4, s5, s6];
  28085. s2 = s3;
  28086. } else {
  28087. peg$currPos = s2;
  28088. s2 = peg$FAILED;
  28089. }
  28090. } else {
  28091. peg$currPos = s2;
  28092. s2 = peg$FAILED;
  28093. }
  28094. } else {
  28095. peg$currPos = s2;
  28096. s2 = peg$FAILED;
  28097. }
  28098. } else {
  28099. peg$currPos = s2;
  28100. s2 = peg$FAILED;
  28101. }
  28102. if (s2 !== peg$FAILED) {
  28103. s1 = input.substring(s1, peg$currPos);
  28104. } else {
  28105. s1 = s2;
  28106. }
  28107. if (s1 !== peg$FAILED) {
  28108. peg$savedPos = s0;
  28109. s1 = peg$c44(s1);
  28110. }
  28111. s0 = s1;
  28112. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28113. return s0;
  28114. }
  28115. function peg$parseinteger() {
  28116. var s0, s1, s2, s3, s4, s5;
  28117. var key = peg$currPos * 66 + 19,
  28118. cached = peg$resultsCache[key];
  28119. if (cached) {
  28120. peg$currPos = cached.nextPos;
  28121. return cached.result;
  28122. }
  28123. s0 = peg$currPos;
  28124. s1 = peg$currPos;
  28125. s2 = peg$currPos;
  28126. if (input.charCodeAt(peg$currPos) === 45) {
  28127. s3 = peg$c35;
  28128. peg$currPos++;
  28129. } else {
  28130. s3 = peg$FAILED;
  28131. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28132. }
  28133. if (s3 === peg$FAILED) {
  28134. s3 = null;
  28135. }
  28136. if (s3 !== peg$FAILED) {
  28137. s4 = [];
  28138. if (peg$c42.test(input.charAt(peg$currPos))) {
  28139. s5 = input.charAt(peg$currPos);
  28140. peg$currPos++;
  28141. } else {
  28142. s5 = peg$FAILED;
  28143. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28144. }
  28145. if (s5 !== peg$FAILED) {
  28146. while (s5 !== peg$FAILED) {
  28147. s4.push(s5);
  28148. if (peg$c42.test(input.charAt(peg$currPos))) {
  28149. s5 = input.charAt(peg$currPos);
  28150. peg$currPos++;
  28151. } else {
  28152. s5 = peg$FAILED;
  28153. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28154. }
  28155. }
  28156. } else {
  28157. s4 = peg$FAILED;
  28158. }
  28159. if (s4 !== peg$FAILED) {
  28160. s3 = [s3, s4];
  28161. s2 = s3;
  28162. } else {
  28163. peg$currPos = s2;
  28164. s2 = peg$FAILED;
  28165. }
  28166. } else {
  28167. peg$currPos = s2;
  28168. s2 = peg$FAILED;
  28169. }
  28170. if (s2 !== peg$FAILED) {
  28171. s1 = input.substring(s1, peg$currPos);
  28172. } else {
  28173. s1 = s2;
  28174. }
  28175. if (s1 !== peg$FAILED) {
  28176. peg$savedPos = s0;
  28177. s1 = peg$c45(s1);
  28178. }
  28179. s0 = s1;
  28180. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28181. return s0;
  28182. }
  28183. function peg$parseliteralArray() {
  28184. var s0, s1, s2, s3, s4;
  28185. var key = peg$currPos * 66 + 20,
  28186. cached = peg$resultsCache[key];
  28187. if (cached) {
  28188. peg$currPos = cached.nextPos;
  28189. return cached.result;
  28190. }
  28191. s0 = peg$currPos;
  28192. if (input.substr(peg$currPos, 2) === peg$c46) {
  28193. s1 = peg$c46;
  28194. peg$currPos += 2;
  28195. } else {
  28196. s1 = peg$FAILED;
  28197. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28198. }
  28199. if (s1 !== peg$FAILED) {
  28200. s2 = peg$parsewsLiteralArrayContents();
  28201. if (s2 !== peg$FAILED) {
  28202. s3 = peg$parsews();
  28203. if (s3 !== peg$FAILED) {
  28204. if (input.charCodeAt(peg$currPos) === 41) {
  28205. s4 = peg$c48;
  28206. peg$currPos++;
  28207. } else {
  28208. s4 = peg$FAILED;
  28209. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28210. }
  28211. if (s4 !== peg$FAILED) {
  28212. peg$savedPos = s0;
  28213. s1 = peg$c50(s2);
  28214. s0 = s1;
  28215. } else {
  28216. peg$currPos = s0;
  28217. s0 = peg$FAILED;
  28218. }
  28219. } else {
  28220. peg$currPos = s0;
  28221. s0 = peg$FAILED;
  28222. }
  28223. } else {
  28224. peg$currPos = s0;
  28225. s0 = peg$FAILED;
  28226. }
  28227. } else {
  28228. peg$currPos = s0;
  28229. s0 = peg$FAILED;
  28230. }
  28231. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28232. return s0;
  28233. }
  28234. function peg$parsebareLiteralArray() {
  28235. var s0, s1, s2, s3, s4;
  28236. var key = peg$currPos * 66 + 21,
  28237. cached = peg$resultsCache[key];
  28238. if (cached) {
  28239. peg$currPos = cached.nextPos;
  28240. return cached.result;
  28241. }
  28242. s0 = peg$currPos;
  28243. if (input.charCodeAt(peg$currPos) === 40) {
  28244. s1 = peg$c51;
  28245. peg$currPos++;
  28246. } else {
  28247. s1 = peg$FAILED;
  28248. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28249. }
  28250. if (s1 !== peg$FAILED) {
  28251. s2 = peg$parsewsLiteralArrayContents();
  28252. if (s2 !== peg$FAILED) {
  28253. s3 = peg$parsews();
  28254. if (s3 !== peg$FAILED) {
  28255. if (input.charCodeAt(peg$currPos) === 41) {
  28256. s4 = peg$c48;
  28257. peg$currPos++;
  28258. } else {
  28259. s4 = peg$FAILED;
  28260. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28261. }
  28262. if (s4 !== peg$FAILED) {
  28263. peg$savedPos = s0;
  28264. s1 = peg$c50(s2);
  28265. s0 = s1;
  28266. } else {
  28267. peg$currPos = s0;
  28268. s0 = peg$FAILED;
  28269. }
  28270. } else {
  28271. peg$currPos = s0;
  28272. s0 = peg$FAILED;
  28273. }
  28274. } else {
  28275. peg$currPos = s0;
  28276. s0 = peg$FAILED;
  28277. }
  28278. } else {
  28279. peg$currPos = s0;
  28280. s0 = peg$FAILED;
  28281. }
  28282. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28283. return s0;
  28284. }
  28285. function peg$parseliteralArrayElement() {
  28286. var s0;
  28287. var key = peg$currPos * 66 + 22,
  28288. cached = peg$resultsCache[key];
  28289. if (cached) {
  28290. peg$currPos = cached.nextPos;
  28291. return cached.result;
  28292. }
  28293. s0 = peg$parseparseTimeLiteral();
  28294. if (s0 === peg$FAILED) {
  28295. s0 = peg$parsebareLiteralArray();
  28296. if (s0 === peg$FAILED) {
  28297. s0 = peg$parsebareSymbol();
  28298. }
  28299. }
  28300. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28301. return s0;
  28302. }
  28303. function peg$parsewsLiteralArrayContents() {
  28304. var s0, s1, s2, s3, s4;
  28305. var key = peg$currPos * 66 + 23,
  28306. cached = peg$resultsCache[key];
  28307. if (cached) {
  28308. peg$currPos = cached.nextPos;
  28309. return cached.result;
  28310. }
  28311. s0 = peg$currPos;
  28312. s1 = [];
  28313. s2 = peg$currPos;
  28314. s3 = peg$parsews();
  28315. if (s3 !== peg$FAILED) {
  28316. s4 = peg$parseliteralArrayElement();
  28317. if (s4 !== peg$FAILED) {
  28318. peg$savedPos = s2;
  28319. s3 = peg$c53(s4);
  28320. s2 = s3;
  28321. } else {
  28322. peg$currPos = s2;
  28323. s2 = peg$FAILED;
  28324. }
  28325. } else {
  28326. peg$currPos = s2;
  28327. s2 = peg$FAILED;
  28328. }
  28329. while (s2 !== peg$FAILED) {
  28330. s1.push(s2);
  28331. s2 = peg$currPos;
  28332. s3 = peg$parsews();
  28333. if (s3 !== peg$FAILED) {
  28334. s4 = peg$parseliteralArrayElement();
  28335. if (s4 !== peg$FAILED) {
  28336. peg$savedPos = s2;
  28337. s3 = peg$c53(s4);
  28338. s2 = s3;
  28339. } else {
  28340. peg$currPos = s2;
  28341. s2 = peg$FAILED;
  28342. }
  28343. } else {
  28344. peg$currPos = s2;
  28345. s2 = peg$FAILED;
  28346. }
  28347. }
  28348. if (s1 !== peg$FAILED) {
  28349. peg$savedPos = s0;
  28350. s1 = peg$c54(s1);
  28351. }
  28352. s0 = s1;
  28353. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28354. return s0;
  28355. }
  28356. function peg$parsedynamicArray() {
  28357. var s0, s1, s2, s3, s4;
  28358. var key = peg$currPos * 66 + 24,
  28359. cached = peg$resultsCache[key];
  28360. if (cached) {
  28361. peg$currPos = cached.nextPos;
  28362. return cached.result;
  28363. }
  28364. s0 = peg$currPos;
  28365. if (input.charCodeAt(peg$currPos) === 123) {
  28366. s1 = peg$c55;
  28367. peg$currPos++;
  28368. } else {
  28369. s1 = peg$FAILED;
  28370. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28371. }
  28372. if (s1 !== peg$FAILED) {
  28373. s2 = peg$parsewsExpressions();
  28374. if (s2 === peg$FAILED) {
  28375. s2 = null;
  28376. }
  28377. if (s2 !== peg$FAILED) {
  28378. s3 = peg$parsemaybeDotsWs();
  28379. if (s3 !== peg$FAILED) {
  28380. if (input.charCodeAt(peg$currPos) === 125) {
  28381. s4 = peg$c57;
  28382. peg$currPos++;
  28383. } else {
  28384. s4 = peg$FAILED;
  28385. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28386. }
  28387. if (s4 !== peg$FAILED) {
  28388. peg$savedPos = s0;
  28389. s1 = peg$c59(s2);
  28390. s0 = s1;
  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. } else {
  28404. peg$currPos = s0;
  28405. s0 = peg$FAILED;
  28406. }
  28407. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28408. return s0;
  28409. }
  28410. function peg$parsedynamicDictionary() {
  28411. var s0, s1, s2, s3, s4;
  28412. var key = peg$currPos * 66 + 25,
  28413. cached = peg$resultsCache[key];
  28414. if (cached) {
  28415. peg$currPos = cached.nextPos;
  28416. return cached.result;
  28417. }
  28418. s0 = peg$currPos;
  28419. if (input.substr(peg$currPos, 2) === peg$c60) {
  28420. s1 = peg$c60;
  28421. peg$currPos += 2;
  28422. } else {
  28423. s1 = peg$FAILED;
  28424. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28425. }
  28426. if (s1 !== peg$FAILED) {
  28427. s2 = peg$parsewsAssociations();
  28428. if (s2 === peg$FAILED) {
  28429. s2 = null;
  28430. }
  28431. if (s2 !== peg$FAILED) {
  28432. s3 = peg$parsemaybeDotsWs();
  28433. if (s3 !== peg$FAILED) {
  28434. if (input.charCodeAt(peg$currPos) === 125) {
  28435. s4 = peg$c57;
  28436. peg$currPos++;
  28437. } else {
  28438. s4 = peg$FAILED;
  28439. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28440. }
  28441. if (s4 !== peg$FAILED) {
  28442. peg$savedPos = s0;
  28443. s1 = peg$c62(s2);
  28444. s0 = s1;
  28445. } else {
  28446. peg$currPos = s0;
  28447. s0 = peg$FAILED;
  28448. }
  28449. } else {
  28450. peg$currPos = s0;
  28451. s0 = peg$FAILED;
  28452. }
  28453. } else {
  28454. peg$currPos = s0;
  28455. s0 = peg$FAILED;
  28456. }
  28457. } else {
  28458. peg$currPos = s0;
  28459. s0 = peg$FAILED;
  28460. }
  28461. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28462. return s0;
  28463. }
  28464. function peg$parsepseudoVariable() {
  28465. var s0, s1, s2;
  28466. var key = peg$currPos * 66 + 26,
  28467. cached = peg$resultsCache[key];
  28468. if (cached) {
  28469. peg$currPos = cached.nextPos;
  28470. return cached.result;
  28471. }
  28472. s0 = peg$currPos;
  28473. s1 = peg$currPos;
  28474. if (input.substr(peg$currPos, 4) === peg$c63) {
  28475. s2 = peg$c63;
  28476. peg$currPos += 4;
  28477. } else {
  28478. s2 = peg$FAILED;
  28479. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28480. }
  28481. if (s2 !== peg$FAILED) {
  28482. peg$savedPos = s1;
  28483. s2 = peg$c65();
  28484. }
  28485. s1 = s2;
  28486. if (s1 === peg$FAILED) {
  28487. s1 = peg$currPos;
  28488. if (input.substr(peg$currPos, 5) === peg$c66) {
  28489. s2 = peg$c66;
  28490. peg$currPos += 5;
  28491. } else {
  28492. s2 = peg$FAILED;
  28493. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28494. }
  28495. if (s2 !== peg$FAILED) {
  28496. peg$savedPos = s1;
  28497. s2 = peg$c68();
  28498. }
  28499. s1 = s2;
  28500. if (s1 === peg$FAILED) {
  28501. s1 = peg$currPos;
  28502. if (input.substr(peg$currPos, 3) === peg$c69) {
  28503. s2 = peg$c69;
  28504. peg$currPos += 3;
  28505. } else {
  28506. s2 = peg$FAILED;
  28507. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28508. }
  28509. if (s2 !== peg$FAILED) {
  28510. peg$savedPos = s1;
  28511. s2 = peg$c71();
  28512. }
  28513. s1 = s2;
  28514. }
  28515. }
  28516. if (s1 !== peg$FAILED) {
  28517. peg$savedPos = s0;
  28518. s1 = peg$c16(s1);
  28519. }
  28520. s0 = s1;
  28521. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28522. return s0;
  28523. }
  28524. function peg$parseparseTimeLiteral() {
  28525. var s0;
  28526. var key = peg$currPos * 66 + 27,
  28527. cached = peg$resultsCache[key];
  28528. if (cached) {
  28529. peg$currPos = cached.nextPos;
  28530. return cached.result;
  28531. }
  28532. s0 = peg$parsepseudoVariable();
  28533. if (s0 === peg$FAILED) {
  28534. s0 = peg$parsenumber();
  28535. if (s0 === peg$FAILED) {
  28536. s0 = peg$parseliteralArray();
  28537. if (s0 === peg$FAILED) {
  28538. s0 = peg$parsestring();
  28539. if (s0 === peg$FAILED) {
  28540. s0 = peg$parsesymbol();
  28541. if (s0 === peg$FAILED) {
  28542. s0 = peg$parsecharacter();
  28543. }
  28544. }
  28545. }
  28546. }
  28547. }
  28548. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28549. return s0;
  28550. }
  28551. function peg$parseruntimeLiteral() {
  28552. var s0;
  28553. var key = peg$currPos * 66 + 28,
  28554. cached = peg$resultsCache[key];
  28555. if (cached) {
  28556. peg$currPos = cached.nextPos;
  28557. return cached.result;
  28558. }
  28559. s0 = peg$parsedynamicDictionary();
  28560. if (s0 === peg$FAILED) {
  28561. s0 = peg$parsedynamicArray();
  28562. if (s0 === peg$FAILED) {
  28563. s0 = peg$parseblock();
  28564. }
  28565. }
  28566. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28567. return s0;
  28568. }
  28569. function peg$parseliteral() {
  28570. var s0;
  28571. var key = peg$currPos * 66 + 29,
  28572. cached = peg$resultsCache[key];
  28573. if (cached) {
  28574. peg$currPos = cached.nextPos;
  28575. return cached.result;
  28576. }
  28577. s0 = peg$parseruntimeLiteral();
  28578. if (s0 === peg$FAILED) {
  28579. s0 = peg$parseparseTimeLiteral();
  28580. }
  28581. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28582. return s0;
  28583. }
  28584. function peg$parsevariable() {
  28585. var s0, s1;
  28586. var key = peg$currPos * 66 + 30,
  28587. cached = peg$resultsCache[key];
  28588. if (cached) {
  28589. peg$currPos = cached.nextPos;
  28590. return cached.result;
  28591. }
  28592. s0 = peg$currPos;
  28593. s1 = peg$parseidentifier();
  28594. if (s1 !== peg$FAILED) {
  28595. peg$savedPos = s0;
  28596. s1 = peg$c72(s1);
  28597. }
  28598. s0 = s1;
  28599. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28600. return s0;
  28601. }
  28602. function peg$parsebinarySelector() {
  28603. var s0, s1, s2;
  28604. var key = peg$currPos * 66 + 31,
  28605. cached = peg$resultsCache[key];
  28606. if (cached) {
  28607. peg$currPos = cached.nextPos;
  28608. return cached.result;
  28609. }
  28610. s0 = peg$currPos;
  28611. s1 = [];
  28612. if (peg$c73.test(input.charAt(peg$currPos))) {
  28613. s2 = input.charAt(peg$currPos);
  28614. peg$currPos++;
  28615. } else {
  28616. s2 = peg$FAILED;
  28617. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28618. }
  28619. if (s2 !== peg$FAILED) {
  28620. while (s2 !== peg$FAILED) {
  28621. s1.push(s2);
  28622. if (peg$c73.test(input.charAt(peg$currPos))) {
  28623. s2 = input.charAt(peg$currPos);
  28624. peg$currPos++;
  28625. } else {
  28626. s2 = peg$FAILED;
  28627. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28628. }
  28629. }
  28630. } else {
  28631. s1 = peg$FAILED;
  28632. }
  28633. if (s1 !== peg$FAILED) {
  28634. s0 = input.substring(s0, peg$currPos);
  28635. } else {
  28636. s0 = s1;
  28637. }
  28638. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28639. return s0;
  28640. }
  28641. function peg$parsewsKeywordPattern() {
  28642. var s0, s1, s2, s3, s4, s5, s6;
  28643. var key = peg$currPos * 66 + 32,
  28644. cached = peg$resultsCache[key];
  28645. if (cached) {
  28646. peg$currPos = cached.nextPos;
  28647. return cached.result;
  28648. }
  28649. s0 = peg$currPos;
  28650. s1 = [];
  28651. s2 = peg$currPos;
  28652. s3 = peg$parsews();
  28653. if (s3 !== peg$FAILED) {
  28654. s4 = peg$parsekeyword();
  28655. if (s4 !== peg$FAILED) {
  28656. s5 = peg$parsews();
  28657. if (s5 !== peg$FAILED) {
  28658. s6 = peg$parseidentifier();
  28659. if (s6 !== peg$FAILED) {
  28660. peg$savedPos = s2;
  28661. s3 = peg$c75(s4, s6);
  28662. s2 = s3;
  28663. } else {
  28664. peg$currPos = s2;
  28665. s2 = peg$FAILED;
  28666. }
  28667. } else {
  28668. peg$currPos = s2;
  28669. s2 = peg$FAILED;
  28670. }
  28671. } else {
  28672. peg$currPos = s2;
  28673. s2 = peg$FAILED;
  28674. }
  28675. } else {
  28676. peg$currPos = s2;
  28677. s2 = peg$FAILED;
  28678. }
  28679. if (s2 !== peg$FAILED) {
  28680. while (s2 !== peg$FAILED) {
  28681. s1.push(s2);
  28682. s2 = peg$currPos;
  28683. s3 = peg$parsews();
  28684. if (s3 !== peg$FAILED) {
  28685. s4 = peg$parsekeyword();
  28686. if (s4 !== peg$FAILED) {
  28687. s5 = peg$parsews();
  28688. if (s5 !== peg$FAILED) {
  28689. s6 = peg$parseidentifier();
  28690. if (s6 !== peg$FAILED) {
  28691. peg$savedPos = s2;
  28692. s3 = peg$c75(s4, s6);
  28693. s2 = s3;
  28694. } else {
  28695. peg$currPos = s2;
  28696. s2 = peg$FAILED;
  28697. }
  28698. } else {
  28699. peg$currPos = s2;
  28700. s2 = peg$FAILED;
  28701. }
  28702. } else {
  28703. peg$currPos = s2;
  28704. s2 = peg$FAILED;
  28705. }
  28706. } else {
  28707. peg$currPos = s2;
  28708. s2 = peg$FAILED;
  28709. }
  28710. }
  28711. } else {
  28712. s1 = peg$FAILED;
  28713. }
  28714. if (s1 !== peg$FAILED) {
  28715. peg$savedPos = s0;
  28716. s1 = peg$c76(s1);
  28717. }
  28718. s0 = s1;
  28719. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28720. return s0;
  28721. }
  28722. function peg$parsewsBinaryPattern() {
  28723. var s0, s1, s2, s3, s4;
  28724. var key = peg$currPos * 66 + 33,
  28725. cached = peg$resultsCache[key];
  28726. if (cached) {
  28727. peg$currPos = cached.nextPos;
  28728. return cached.result;
  28729. }
  28730. s0 = peg$currPos;
  28731. s1 = peg$parsews();
  28732. if (s1 !== peg$FAILED) {
  28733. s2 = peg$parsebinarySelector();
  28734. if (s2 !== peg$FAILED) {
  28735. s3 = peg$parsews();
  28736. if (s3 !== peg$FAILED) {
  28737. s4 = peg$parseidentifier();
  28738. if (s4 !== peg$FAILED) {
  28739. peg$savedPos = s0;
  28740. s1 = peg$c77(s2, s4);
  28741. s0 = s1;
  28742. } else {
  28743. peg$currPos = s0;
  28744. s0 = peg$FAILED;
  28745. }
  28746. } else {
  28747. peg$currPos = s0;
  28748. s0 = peg$FAILED;
  28749. }
  28750. } else {
  28751. peg$currPos = s0;
  28752. s0 = peg$FAILED;
  28753. }
  28754. } else {
  28755. peg$currPos = s0;
  28756. s0 = peg$FAILED;
  28757. }
  28758. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28759. return s0;
  28760. }
  28761. function peg$parsewsUnaryPattern() {
  28762. var s0, s1, s2;
  28763. var key = peg$currPos * 66 + 34,
  28764. cached = peg$resultsCache[key];
  28765. if (cached) {
  28766. peg$currPos = cached.nextPos;
  28767. return cached.result;
  28768. }
  28769. s0 = peg$currPos;
  28770. s1 = peg$parsews();
  28771. if (s1 !== peg$FAILED) {
  28772. s2 = peg$parseidentifier();
  28773. if (s2 !== peg$FAILED) {
  28774. peg$savedPos = s0;
  28775. s1 = peg$c78(s2);
  28776. s0 = s1;
  28777. } else {
  28778. peg$currPos = s0;
  28779. s0 = peg$FAILED;
  28780. }
  28781. } else {
  28782. peg$currPos = s0;
  28783. s0 = peg$FAILED;
  28784. }
  28785. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28786. return s0;
  28787. }
  28788. function peg$parseexpression() {
  28789. var s0;
  28790. var key = peg$currPos * 66 + 35,
  28791. cached = peg$resultsCache[key];
  28792. if (cached) {
  28793. peg$currPos = cached.nextPos;
  28794. return cached.result;
  28795. }
  28796. s0 = peg$parseassignment();
  28797. if (s0 === peg$FAILED) {
  28798. s0 = peg$parsecascade();
  28799. if (s0 === peg$FAILED) {
  28800. s0 = peg$parsekeywordSend();
  28801. }
  28802. }
  28803. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28804. return s0;
  28805. }
  28806. function peg$parsewsExpressionsRest() {
  28807. var s0, s1, s2;
  28808. var key = peg$currPos * 66 + 36,
  28809. cached = peg$resultsCache[key];
  28810. if (cached) {
  28811. peg$currPos = cached.nextPos;
  28812. return cached.result;
  28813. }
  28814. s0 = peg$currPos;
  28815. s1 = peg$parsesomeDotsWs();
  28816. if (s1 !== peg$FAILED) {
  28817. s2 = peg$parseexpression();
  28818. if (s2 !== peg$FAILED) {
  28819. peg$savedPos = s0;
  28820. s1 = peg$c79(s2);
  28821. s0 = s1;
  28822. } else {
  28823. peg$currPos = s0;
  28824. s0 = peg$FAILED;
  28825. }
  28826. } else {
  28827. peg$currPos = s0;
  28828. s0 = peg$FAILED;
  28829. }
  28830. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28831. return s0;
  28832. }
  28833. function peg$parsewsExpressions() {
  28834. var s0, s1, s2, s3, s4;
  28835. var key = peg$currPos * 66 + 37,
  28836. cached = peg$resultsCache[key];
  28837. if (cached) {
  28838. peg$currPos = cached.nextPos;
  28839. return cached.result;
  28840. }
  28841. s0 = peg$currPos;
  28842. s1 = peg$parsemaybeDotsWs();
  28843. if (s1 !== peg$FAILED) {
  28844. s2 = peg$parseexpression();
  28845. if (s2 !== peg$FAILED) {
  28846. s3 = [];
  28847. s4 = peg$parsewsExpressionsRest();
  28848. while (s4 !== peg$FAILED) {
  28849. s3.push(s4);
  28850. s4 = peg$parsewsExpressionsRest();
  28851. }
  28852. if (s3 !== peg$FAILED) {
  28853. peg$savedPos = s0;
  28854. s1 = peg$c80(s2, s3);
  28855. s0 = s1;
  28856. } else {
  28857. peg$currPos = s0;
  28858. s0 = peg$FAILED;
  28859. }
  28860. } else {
  28861. peg$currPos = s0;
  28862. s0 = peg$FAILED;
  28863. }
  28864. } else {
  28865. peg$currPos = s0;
  28866. s0 = peg$FAILED;
  28867. }
  28868. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28869. return s0;
  28870. }
  28871. function peg$parsewsUnaryPragmaMessage() {
  28872. var s0, s1, s2, s3, s4;
  28873. var key = peg$currPos * 66 + 38,
  28874. cached = peg$resultsCache[key];
  28875. if (cached) {
  28876. peg$currPos = cached.nextPos;
  28877. return cached.result;
  28878. }
  28879. s0 = peg$currPos;
  28880. s1 = peg$parsews();
  28881. if (s1 !== peg$FAILED) {
  28882. s2 = peg$parseidentifier();
  28883. if (s2 !== peg$FAILED) {
  28884. s3 = peg$currPos;
  28885. peg$silentFails++;
  28886. if (input.charCodeAt(peg$currPos) === 58) {
  28887. s4 = peg$c12;
  28888. peg$currPos++;
  28889. } else {
  28890. s4 = peg$FAILED;
  28891. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28892. }
  28893. peg$silentFails--;
  28894. if (s4 === peg$FAILED) {
  28895. s3 = void 0;
  28896. } else {
  28897. peg$currPos = s3;
  28898. s3 = peg$FAILED;
  28899. }
  28900. if (s3 !== peg$FAILED) {
  28901. peg$savedPos = s0;
  28902. s1 = peg$c81(s2);
  28903. s0 = s1;
  28904. } else {
  28905. peg$currPos = s0;
  28906. s0 = peg$FAILED;
  28907. }
  28908. } else {
  28909. peg$currPos = s0;
  28910. s0 = peg$FAILED;
  28911. }
  28912. } else {
  28913. peg$currPos = s0;
  28914. s0 = peg$FAILED;
  28915. }
  28916. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28917. return s0;
  28918. }
  28919. function peg$parsewsKeywordPragmaMessage() {
  28920. var s0, s1, s2, s3, s4, s5, s6;
  28921. var key = peg$currPos * 66 + 39,
  28922. cached = peg$resultsCache[key];
  28923. if (cached) {
  28924. peg$currPos = cached.nextPos;
  28925. return cached.result;
  28926. }
  28927. s0 = peg$currPos;
  28928. s1 = [];
  28929. s2 = peg$currPos;
  28930. s3 = peg$parsews();
  28931. if (s3 !== peg$FAILED) {
  28932. s4 = peg$parsekeyword();
  28933. if (s4 !== peg$FAILED) {
  28934. s5 = peg$parsews();
  28935. if (s5 !== peg$FAILED) {
  28936. s6 = peg$parseparseTimeLiteral();
  28937. if (s6 !== peg$FAILED) {
  28938. peg$savedPos = s2;
  28939. s3 = peg$c75(s4, s6);
  28940. s2 = s3;
  28941. } else {
  28942. peg$currPos = s2;
  28943. s2 = peg$FAILED;
  28944. }
  28945. } else {
  28946. peg$currPos = s2;
  28947. s2 = peg$FAILED;
  28948. }
  28949. } else {
  28950. peg$currPos = s2;
  28951. s2 = peg$FAILED;
  28952. }
  28953. } else {
  28954. peg$currPos = s2;
  28955. s2 = peg$FAILED;
  28956. }
  28957. if (s2 !== peg$FAILED) {
  28958. while (s2 !== peg$FAILED) {
  28959. s1.push(s2);
  28960. s2 = peg$currPos;
  28961. s3 = peg$parsews();
  28962. if (s3 !== peg$FAILED) {
  28963. s4 = peg$parsekeyword();
  28964. if (s4 !== peg$FAILED) {
  28965. s5 = peg$parsews();
  28966. if (s5 !== peg$FAILED) {
  28967. s6 = peg$parseparseTimeLiteral();
  28968. if (s6 !== peg$FAILED) {
  28969. peg$savedPos = s2;
  28970. s3 = peg$c75(s4, s6);
  28971. s2 = s3;
  28972. } else {
  28973. peg$currPos = s2;
  28974. s2 = peg$FAILED;
  28975. }
  28976. } else {
  28977. peg$currPos = s2;
  28978. s2 = peg$FAILED;
  28979. }
  28980. } else {
  28981. peg$currPos = s2;
  28982. s2 = peg$FAILED;
  28983. }
  28984. } else {
  28985. peg$currPos = s2;
  28986. s2 = peg$FAILED;
  28987. }
  28988. }
  28989. } else {
  28990. s1 = peg$FAILED;
  28991. }
  28992. if (s1 !== peg$FAILED) {
  28993. peg$savedPos = s0;
  28994. s1 = peg$c82(s1);
  28995. }
  28996. s0 = s1;
  28997. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28998. return s0;
  28999. }
  29000. function peg$parsewsPragmaMessage() {
  29001. var s0;
  29002. var key = peg$currPos * 66 + 40,
  29003. cached = peg$resultsCache[key];
  29004. if (cached) {
  29005. peg$currPos = cached.nextPos;
  29006. return cached.result;
  29007. }
  29008. s0 = peg$parsewsUnaryPragmaMessage();
  29009. if (s0 === peg$FAILED) {
  29010. s0 = peg$parsewsKeywordPragmaMessage();
  29011. }
  29012. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29013. return s0;
  29014. }
  29015. function peg$parsewsPragmas() {
  29016. var s0, s1, s2, s3, s4, s5, s6;
  29017. var key = peg$currPos * 66 + 41,
  29018. cached = peg$resultsCache[key];
  29019. if (cached) {
  29020. peg$currPos = cached.nextPos;
  29021. return cached.result;
  29022. }
  29023. s0 = [];
  29024. s1 = peg$currPos;
  29025. s2 = peg$parsews();
  29026. if (s2 !== peg$FAILED) {
  29027. if (input.charCodeAt(peg$currPos) === 60) {
  29028. s3 = peg$c83;
  29029. peg$currPos++;
  29030. } else {
  29031. s3 = peg$FAILED;
  29032. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29033. }
  29034. if (s3 !== peg$FAILED) {
  29035. s4 = peg$parsewsPragmaMessage();
  29036. if (s4 !== peg$FAILED) {
  29037. s5 = peg$parsews();
  29038. if (s5 !== peg$FAILED) {
  29039. if (input.charCodeAt(peg$currPos) === 62) {
  29040. s6 = peg$c85;
  29041. peg$currPos++;
  29042. } else {
  29043. s6 = peg$FAILED;
  29044. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29045. }
  29046. if (s6 !== peg$FAILED) {
  29047. peg$savedPos = s1;
  29048. s2 = peg$c87(s4);
  29049. s1 = s2;
  29050. } else {
  29051. peg$currPos = s1;
  29052. s1 = peg$FAILED;
  29053. }
  29054. } else {
  29055. peg$currPos = s1;
  29056. s1 = peg$FAILED;
  29057. }
  29058. } else {
  29059. peg$currPos = s1;
  29060. s1 = peg$FAILED;
  29061. }
  29062. } else {
  29063. peg$currPos = s1;
  29064. s1 = peg$FAILED;
  29065. }
  29066. } else {
  29067. peg$currPos = s1;
  29068. s1 = peg$FAILED;
  29069. }
  29070. while (s1 !== peg$FAILED) {
  29071. s0.push(s1);
  29072. s1 = peg$currPos;
  29073. s2 = peg$parsews();
  29074. if (s2 !== peg$FAILED) {
  29075. if (input.charCodeAt(peg$currPos) === 60) {
  29076. s3 = peg$c83;
  29077. peg$currPos++;
  29078. } else {
  29079. s3 = peg$FAILED;
  29080. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29081. }
  29082. if (s3 !== peg$FAILED) {
  29083. s4 = peg$parsewsPragmaMessage();
  29084. if (s4 !== peg$FAILED) {
  29085. s5 = peg$parsews();
  29086. if (s5 !== peg$FAILED) {
  29087. if (input.charCodeAt(peg$currPos) === 62) {
  29088. s6 = peg$c85;
  29089. peg$currPos++;
  29090. } else {
  29091. s6 = peg$FAILED;
  29092. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29093. }
  29094. if (s6 !== peg$FAILED) {
  29095. peg$savedPos = s1;
  29096. s2 = peg$c87(s4);
  29097. s1 = s2;
  29098. } else {
  29099. peg$currPos = s1;
  29100. s1 = peg$FAILED;
  29101. }
  29102. } else {
  29103. peg$currPos = s1;
  29104. s1 = peg$FAILED;
  29105. }
  29106. } else {
  29107. peg$currPos = s1;
  29108. s1 = peg$FAILED;
  29109. }
  29110. } else {
  29111. peg$currPos = s1;
  29112. s1 = peg$FAILED;
  29113. }
  29114. } else {
  29115. peg$currPos = s1;
  29116. s1 = peg$FAILED;
  29117. }
  29118. }
  29119. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29120. return s0;
  29121. }
  29122. function peg$parseassignment() {
  29123. var s0, s1, s2, s3, s4, s5;
  29124. var key = peg$currPos * 66 + 42,
  29125. cached = peg$resultsCache[key];
  29126. if (cached) {
  29127. peg$currPos = cached.nextPos;
  29128. return cached.result;
  29129. }
  29130. s0 = peg$currPos;
  29131. s1 = peg$parsevariable();
  29132. if (s1 !== peg$FAILED) {
  29133. s2 = peg$parsews();
  29134. if (s2 !== peg$FAILED) {
  29135. if (input.substr(peg$currPos, 2) === peg$c88) {
  29136. s3 = peg$c88;
  29137. peg$currPos += 2;
  29138. } else {
  29139. s3 = peg$FAILED;
  29140. if (peg$silentFails === 0) { peg$fail(peg$c89); }
  29141. }
  29142. if (s3 !== peg$FAILED) {
  29143. s4 = peg$parsews();
  29144. if (s4 !== peg$FAILED) {
  29145. s5 = peg$parseexpression();
  29146. if (s5 !== peg$FAILED) {
  29147. peg$savedPos = s0;
  29148. s1 = peg$c90(s1, s5);
  29149. s0 = s1;
  29150. } else {
  29151. peg$currPos = s0;
  29152. s0 = peg$FAILED;
  29153. }
  29154. } else {
  29155. peg$currPos = s0;
  29156. s0 = peg$FAILED;
  29157. }
  29158. } else {
  29159. peg$currPos = s0;
  29160. s0 = peg$FAILED;
  29161. }
  29162. } else {
  29163. peg$currPos = s0;
  29164. s0 = peg$FAILED;
  29165. }
  29166. } else {
  29167. peg$currPos = s0;
  29168. s0 = peg$FAILED;
  29169. }
  29170. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29171. return s0;
  29172. }
  29173. function peg$parseret() {
  29174. var s0, s1, s2, s3;
  29175. var key = peg$currPos * 66 + 43,
  29176. cached = peg$resultsCache[key];
  29177. if (cached) {
  29178. peg$currPos = cached.nextPos;
  29179. return cached.result;
  29180. }
  29181. s0 = peg$currPos;
  29182. if (input.charCodeAt(peg$currPos) === 94) {
  29183. s1 = peg$c91;
  29184. peg$currPos++;
  29185. } else {
  29186. s1 = peg$FAILED;
  29187. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  29188. }
  29189. if (s1 !== peg$FAILED) {
  29190. s2 = peg$parsews();
  29191. if (s2 !== peg$FAILED) {
  29192. s3 = peg$parseexpression();
  29193. if (s3 !== peg$FAILED) {
  29194. peg$savedPos = s0;
  29195. s1 = peg$c93(s3);
  29196. s0 = s1;
  29197. } else {
  29198. peg$currPos = s0;
  29199. s0 = peg$FAILED;
  29200. }
  29201. } else {
  29202. peg$currPos = s0;
  29203. s0 = peg$FAILED;
  29204. }
  29205. } else {
  29206. peg$currPos = s0;
  29207. s0 = peg$FAILED;
  29208. }
  29209. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29210. return s0;
  29211. }
  29212. function peg$parsetemps() {
  29213. var s0, s1, s2, s3, s4, s5;
  29214. var key = peg$currPos * 66 + 44,
  29215. cached = peg$resultsCache[key];
  29216. if (cached) {
  29217. peg$currPos = cached.nextPos;
  29218. return cached.result;
  29219. }
  29220. s0 = peg$currPos;
  29221. if (input.charCodeAt(peg$currPos) === 124) {
  29222. s1 = peg$c94;
  29223. peg$currPos++;
  29224. } else {
  29225. s1 = peg$FAILED;
  29226. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29227. }
  29228. if (s1 !== peg$FAILED) {
  29229. s2 = [];
  29230. s3 = peg$currPos;
  29231. s4 = peg$parsews();
  29232. if (s4 !== peg$FAILED) {
  29233. s5 = peg$parseidentifier();
  29234. if (s5 !== peg$FAILED) {
  29235. peg$savedPos = s3;
  29236. s4 = peg$c96(s5);
  29237. s3 = s4;
  29238. } else {
  29239. peg$currPos = s3;
  29240. s3 = peg$FAILED;
  29241. }
  29242. } else {
  29243. peg$currPos = s3;
  29244. s3 = peg$FAILED;
  29245. }
  29246. while (s3 !== peg$FAILED) {
  29247. s2.push(s3);
  29248. s3 = peg$currPos;
  29249. s4 = peg$parsews();
  29250. if (s4 !== peg$FAILED) {
  29251. s5 = peg$parseidentifier();
  29252. if (s5 !== peg$FAILED) {
  29253. peg$savedPos = s3;
  29254. s4 = peg$c96(s5);
  29255. s3 = s4;
  29256. } else {
  29257. peg$currPos = s3;
  29258. s3 = peg$FAILED;
  29259. }
  29260. } else {
  29261. peg$currPos = s3;
  29262. s3 = peg$FAILED;
  29263. }
  29264. }
  29265. if (s2 !== peg$FAILED) {
  29266. s3 = peg$parsews();
  29267. if (s3 !== peg$FAILED) {
  29268. if (input.charCodeAt(peg$currPos) === 124) {
  29269. s4 = peg$c94;
  29270. peg$currPos++;
  29271. } else {
  29272. s4 = peg$FAILED;
  29273. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29274. }
  29275. if (s4 !== peg$FAILED) {
  29276. peg$savedPos = s0;
  29277. s1 = peg$c97(s2);
  29278. s0 = s1;
  29279. } else {
  29280. peg$currPos = s0;
  29281. s0 = peg$FAILED;
  29282. }
  29283. } else {
  29284. peg$currPos = s0;
  29285. s0 = peg$FAILED;
  29286. }
  29287. } else {
  29288. peg$currPos = s0;
  29289. s0 = peg$FAILED;
  29290. }
  29291. } else {
  29292. peg$currPos = s0;
  29293. s0 = peg$FAILED;
  29294. }
  29295. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29296. return s0;
  29297. }
  29298. function peg$parsewsBlockParamList() {
  29299. var s0, s1, s2, s3, s4, s5, s6;
  29300. var key = peg$currPos * 66 + 45,
  29301. cached = peg$resultsCache[key];
  29302. if (cached) {
  29303. peg$currPos = cached.nextPos;
  29304. return cached.result;
  29305. }
  29306. s0 = peg$currPos;
  29307. s1 = [];
  29308. s2 = peg$currPos;
  29309. s3 = peg$parsews();
  29310. if (s3 !== peg$FAILED) {
  29311. if (input.charCodeAt(peg$currPos) === 58) {
  29312. s4 = peg$c12;
  29313. peg$currPos++;
  29314. } else {
  29315. s4 = peg$FAILED;
  29316. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29317. }
  29318. if (s4 !== peg$FAILED) {
  29319. s5 = peg$parsews();
  29320. if (s5 !== peg$FAILED) {
  29321. s6 = peg$parseidentifier();
  29322. if (s6 !== peg$FAILED) {
  29323. peg$savedPos = s2;
  29324. s3 = peg$c98(s6);
  29325. s2 = s3;
  29326. } else {
  29327. peg$currPos = s2;
  29328. s2 = peg$FAILED;
  29329. }
  29330. } else {
  29331. peg$currPos = s2;
  29332. s2 = peg$FAILED;
  29333. }
  29334. } else {
  29335. peg$currPos = s2;
  29336. s2 = peg$FAILED;
  29337. }
  29338. } else {
  29339. peg$currPos = s2;
  29340. s2 = peg$FAILED;
  29341. }
  29342. if (s2 !== peg$FAILED) {
  29343. while (s2 !== peg$FAILED) {
  29344. s1.push(s2);
  29345. s2 = peg$currPos;
  29346. s3 = peg$parsews();
  29347. if (s3 !== peg$FAILED) {
  29348. if (input.charCodeAt(peg$currPos) === 58) {
  29349. s4 = peg$c12;
  29350. peg$currPos++;
  29351. } else {
  29352. s4 = peg$FAILED;
  29353. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29354. }
  29355. if (s4 !== peg$FAILED) {
  29356. s5 = peg$parsews();
  29357. if (s5 !== peg$FAILED) {
  29358. s6 = peg$parseidentifier();
  29359. if (s6 !== peg$FAILED) {
  29360. peg$savedPos = s2;
  29361. s3 = peg$c98(s6);
  29362. s2 = s3;
  29363. } else {
  29364. peg$currPos = s2;
  29365. s2 = peg$FAILED;
  29366. }
  29367. } else {
  29368. peg$currPos = s2;
  29369. s2 = peg$FAILED;
  29370. }
  29371. } else {
  29372. peg$currPos = s2;
  29373. s2 = peg$FAILED;
  29374. }
  29375. } else {
  29376. peg$currPos = s2;
  29377. s2 = peg$FAILED;
  29378. }
  29379. }
  29380. } else {
  29381. s1 = peg$FAILED;
  29382. }
  29383. if (s1 !== peg$FAILED) {
  29384. s2 = peg$parsews();
  29385. if (s2 !== peg$FAILED) {
  29386. if (input.charCodeAt(peg$currPos) === 124) {
  29387. s3 = peg$c94;
  29388. peg$currPos++;
  29389. } else {
  29390. s3 = peg$FAILED;
  29391. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29392. }
  29393. if (s3 !== peg$FAILED) {
  29394. peg$savedPos = s0;
  29395. s1 = peg$c99(s1);
  29396. s0 = s1;
  29397. } else {
  29398. peg$currPos = s0;
  29399. s0 = peg$FAILED;
  29400. }
  29401. } else {
  29402. peg$currPos = s0;
  29403. s0 = peg$FAILED;
  29404. }
  29405. } else {
  29406. peg$currPos = s0;
  29407. s0 = peg$FAILED;
  29408. }
  29409. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29410. return s0;
  29411. }
  29412. function peg$parsesubexpression() {
  29413. var s0, s1, s2, s3, s4, s5;
  29414. var key = peg$currPos * 66 + 46,
  29415. cached = peg$resultsCache[key];
  29416. if (cached) {
  29417. peg$currPos = cached.nextPos;
  29418. return cached.result;
  29419. }
  29420. s0 = peg$currPos;
  29421. if (input.charCodeAt(peg$currPos) === 40) {
  29422. s1 = peg$c51;
  29423. peg$currPos++;
  29424. } else {
  29425. s1 = peg$FAILED;
  29426. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29427. }
  29428. if (s1 !== peg$FAILED) {
  29429. s2 = peg$parsews();
  29430. if (s2 !== peg$FAILED) {
  29431. s3 = peg$parseexpression();
  29432. if (s3 !== peg$FAILED) {
  29433. s4 = peg$parsews();
  29434. if (s4 !== peg$FAILED) {
  29435. if (input.charCodeAt(peg$currPos) === 41) {
  29436. s5 = peg$c48;
  29437. peg$currPos++;
  29438. } else {
  29439. s5 = peg$FAILED;
  29440. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29441. }
  29442. if (s5 !== peg$FAILED) {
  29443. peg$savedPos = s0;
  29444. s1 = peg$c79(s3);
  29445. s0 = s1;
  29446. } else {
  29447. peg$currPos = s0;
  29448. s0 = peg$FAILED;
  29449. }
  29450. } else {
  29451. peg$currPos = s0;
  29452. s0 = peg$FAILED;
  29453. }
  29454. } else {
  29455. peg$currPos = s0;
  29456. s0 = peg$FAILED;
  29457. }
  29458. } else {
  29459. peg$currPos = s0;
  29460. s0 = peg$FAILED;
  29461. }
  29462. } else {
  29463. peg$currPos = s0;
  29464. s0 = peg$FAILED;
  29465. }
  29466. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29467. return s0;
  29468. }
  29469. function peg$parsewsStatements() {
  29470. var s0, s1, s2, s3;
  29471. var key = peg$currPos * 66 + 47,
  29472. cached = peg$resultsCache[key];
  29473. if (cached) {
  29474. peg$currPos = cached.nextPos;
  29475. return cached.result;
  29476. }
  29477. s0 = peg$currPos;
  29478. s1 = peg$parsemaybeDotsWs();
  29479. if (s1 !== peg$FAILED) {
  29480. s2 = peg$parseret();
  29481. if (s2 !== peg$FAILED) {
  29482. peg$savedPos = s0;
  29483. s1 = peg$c100(s2);
  29484. s0 = s1;
  29485. } else {
  29486. peg$currPos = s0;
  29487. s0 = peg$FAILED;
  29488. }
  29489. } else {
  29490. peg$currPos = s0;
  29491. s0 = peg$FAILED;
  29492. }
  29493. if (s0 === peg$FAILED) {
  29494. s0 = peg$currPos;
  29495. s1 = peg$parsewsExpressions();
  29496. if (s1 !== peg$FAILED) {
  29497. s2 = peg$parsesomeDotsWs();
  29498. if (s2 !== peg$FAILED) {
  29499. s3 = peg$parseret();
  29500. if (s3 !== peg$FAILED) {
  29501. peg$savedPos = s0;
  29502. s1 = peg$c101(s1, s3);
  29503. s0 = s1;
  29504. } else {
  29505. peg$currPos = s0;
  29506. s0 = peg$FAILED;
  29507. }
  29508. } else {
  29509. peg$currPos = s0;
  29510. s0 = peg$FAILED;
  29511. }
  29512. } else {
  29513. peg$currPos = s0;
  29514. s0 = peg$FAILED;
  29515. }
  29516. if (s0 === peg$FAILED) {
  29517. s0 = peg$currPos;
  29518. s1 = peg$parsewsExpressions();
  29519. if (s1 === peg$FAILED) {
  29520. s1 = null;
  29521. }
  29522. if (s1 !== peg$FAILED) {
  29523. peg$savedPos = s0;
  29524. s1 = peg$c102(s1);
  29525. }
  29526. s0 = s1;
  29527. }
  29528. }
  29529. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29530. return s0;
  29531. }
  29532. function peg$parsewsSequenceWs() {
  29533. var s0, s1, s2, s3, s4, s5, s6;
  29534. var key = peg$currPos * 66 + 48,
  29535. cached = peg$resultsCache[key];
  29536. if (cached) {
  29537. peg$currPos = cached.nextPos;
  29538. return cached.result;
  29539. }
  29540. s0 = peg$currPos;
  29541. s1 = peg$parsewsPragmas();
  29542. if (s1 === peg$FAILED) {
  29543. s1 = null;
  29544. }
  29545. if (s1 !== peg$FAILED) {
  29546. s2 = peg$parsews();
  29547. if (s2 !== peg$FAILED) {
  29548. s3 = peg$parsetemps();
  29549. if (s3 === peg$FAILED) {
  29550. s3 = null;
  29551. }
  29552. if (s3 !== peg$FAILED) {
  29553. s4 = peg$parsewsPragmas();
  29554. if (s4 === peg$FAILED) {
  29555. s4 = null;
  29556. }
  29557. if (s4 !== peg$FAILED) {
  29558. s5 = peg$parsewsStatements();
  29559. if (s5 === peg$FAILED) {
  29560. s5 = null;
  29561. }
  29562. if (s5 !== peg$FAILED) {
  29563. s6 = peg$parsemaybeDotsWs();
  29564. if (s6 !== peg$FAILED) {
  29565. peg$savedPos = s0;
  29566. s1 = peg$c103(s1, s3, s4, s5);
  29567. s0 = s1;
  29568. } else {
  29569. peg$currPos = s0;
  29570. s0 = peg$FAILED;
  29571. }
  29572. } else {
  29573. peg$currPos = s0;
  29574. s0 = peg$FAILED;
  29575. }
  29576. } else {
  29577. peg$currPos = s0;
  29578. s0 = peg$FAILED;
  29579. }
  29580. } else {
  29581. peg$currPos = s0;
  29582. s0 = peg$FAILED;
  29583. }
  29584. } else {
  29585. peg$currPos = s0;
  29586. s0 = peg$FAILED;
  29587. }
  29588. } else {
  29589. peg$currPos = s0;
  29590. s0 = peg$FAILED;
  29591. }
  29592. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29593. return s0;
  29594. }
  29595. function peg$parseblock() {
  29596. var s0, s1, s2, s3, s4;
  29597. var key = peg$currPos * 66 + 49,
  29598. cached = peg$resultsCache[key];
  29599. if (cached) {
  29600. peg$currPos = cached.nextPos;
  29601. return cached.result;
  29602. }
  29603. s0 = peg$currPos;
  29604. if (input.charCodeAt(peg$currPos) === 91) {
  29605. s1 = peg$c104;
  29606. peg$currPos++;
  29607. } else {
  29608. s1 = peg$FAILED;
  29609. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  29610. }
  29611. if (s1 !== peg$FAILED) {
  29612. s2 = peg$parsewsBlockParamList();
  29613. if (s2 === peg$FAILED) {
  29614. s2 = null;
  29615. }
  29616. if (s2 !== peg$FAILED) {
  29617. s3 = peg$parsewsSequenceWs();
  29618. if (s3 !== peg$FAILED) {
  29619. if (input.charCodeAt(peg$currPos) === 93) {
  29620. s4 = peg$c106;
  29621. peg$currPos++;
  29622. } else {
  29623. s4 = peg$FAILED;
  29624. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  29625. }
  29626. if (s4 !== peg$FAILED) {
  29627. peg$savedPos = s0;
  29628. s1 = peg$c108(s2, s3);
  29629. s0 = s1;
  29630. } else {
  29631. peg$currPos = s0;
  29632. s0 = peg$FAILED;
  29633. }
  29634. } else {
  29635. peg$currPos = s0;
  29636. s0 = peg$FAILED;
  29637. }
  29638. } else {
  29639. peg$currPos = s0;
  29640. s0 = peg$FAILED;
  29641. }
  29642. } else {
  29643. peg$currPos = s0;
  29644. s0 = peg$FAILED;
  29645. }
  29646. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29647. return s0;
  29648. }
  29649. function peg$parseoperand() {
  29650. var s0;
  29651. var key = peg$currPos * 66 + 50,
  29652. cached = peg$resultsCache[key];
  29653. if (cached) {
  29654. peg$currPos = cached.nextPos;
  29655. return cached.result;
  29656. }
  29657. s0 = peg$parseliteral();
  29658. if (s0 === peg$FAILED) {
  29659. s0 = peg$parsevariable();
  29660. if (s0 === peg$FAILED) {
  29661. s0 = peg$parsesubexpression();
  29662. }
  29663. }
  29664. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29665. return s0;
  29666. }
  29667. function peg$parsewsUnaryMessage() {
  29668. var s0, s1, s2, s3, s4;
  29669. var key = peg$currPos * 66 + 51,
  29670. cached = peg$resultsCache[key];
  29671. if (cached) {
  29672. peg$currPos = cached.nextPos;
  29673. return cached.result;
  29674. }
  29675. s0 = peg$currPos;
  29676. s1 = peg$parsews();
  29677. if (s1 !== peg$FAILED) {
  29678. s2 = peg$parseidentifier();
  29679. if (s2 !== peg$FAILED) {
  29680. s3 = peg$currPos;
  29681. peg$silentFails++;
  29682. if (input.charCodeAt(peg$currPos) === 58) {
  29683. s4 = peg$c12;
  29684. peg$currPos++;
  29685. } else {
  29686. s4 = peg$FAILED;
  29687. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29688. }
  29689. peg$silentFails--;
  29690. if (s4 === peg$FAILED) {
  29691. s3 = void 0;
  29692. } else {
  29693. peg$currPos = s3;
  29694. s3 = peg$FAILED;
  29695. }
  29696. if (s3 !== peg$FAILED) {
  29697. peg$savedPos = s0;
  29698. s1 = peg$c109(s2);
  29699. s0 = s1;
  29700. } else {
  29701. peg$currPos = s0;
  29702. s0 = peg$FAILED;
  29703. }
  29704. } else {
  29705. peg$currPos = s0;
  29706. s0 = peg$FAILED;
  29707. }
  29708. } else {
  29709. peg$currPos = s0;
  29710. s0 = peg$FAILED;
  29711. }
  29712. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29713. return s0;
  29714. }
  29715. function peg$parsewsUnaryTail() {
  29716. var s0, s1;
  29717. var key = peg$currPos * 66 + 52,
  29718. cached = peg$resultsCache[key];
  29719. if (cached) {
  29720. peg$currPos = cached.nextPos;
  29721. return cached.result;
  29722. }
  29723. s0 = [];
  29724. s1 = peg$parsewsUnaryMessage();
  29725. while (s1 !== peg$FAILED) {
  29726. s0.push(s1);
  29727. s1 = peg$parsewsUnaryMessage();
  29728. }
  29729. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29730. return s0;
  29731. }
  29732. function peg$parseunarySend() {
  29733. var s0, s1, s2;
  29734. var key = peg$currPos * 66 + 53,
  29735. cached = peg$resultsCache[key];
  29736. if (cached) {
  29737. peg$currPos = cached.nextPos;
  29738. return cached.result;
  29739. }
  29740. s0 = peg$currPos;
  29741. s1 = peg$parseoperand();
  29742. if (s1 !== peg$FAILED) {
  29743. s2 = peg$parsewsUnaryTail();
  29744. if (s2 !== peg$FAILED) {
  29745. peg$savedPos = s0;
  29746. s1 = peg$c110(s1, s2);
  29747. s0 = s1;
  29748. } else {
  29749. peg$currPos = s0;
  29750. s0 = peg$FAILED;
  29751. }
  29752. } else {
  29753. peg$currPos = s0;
  29754. s0 = peg$FAILED;
  29755. }
  29756. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29757. return s0;
  29758. }
  29759. function peg$parsewsBinaryMessage() {
  29760. var s0, s1, s2, s3, s4;
  29761. var key = peg$currPos * 66 + 54,
  29762. cached = peg$resultsCache[key];
  29763. if (cached) {
  29764. peg$currPos = cached.nextPos;
  29765. return cached.result;
  29766. }
  29767. s0 = peg$currPos;
  29768. s1 = peg$parsews();
  29769. if (s1 !== peg$FAILED) {
  29770. s2 = peg$parsebinarySelector();
  29771. if (s2 !== peg$FAILED) {
  29772. s3 = peg$parsews();
  29773. if (s3 !== peg$FAILED) {
  29774. s4 = peg$parseunarySend();
  29775. if (s4 !== peg$FAILED) {
  29776. peg$savedPos = s0;
  29777. s1 = peg$c111(s2, s4);
  29778. s0 = s1;
  29779. } else {
  29780. peg$currPos = s0;
  29781. s0 = peg$FAILED;
  29782. }
  29783. } else {
  29784. peg$currPos = s0;
  29785. s0 = peg$FAILED;
  29786. }
  29787. } else {
  29788. peg$currPos = s0;
  29789. s0 = peg$FAILED;
  29790. }
  29791. } else {
  29792. peg$currPos = s0;
  29793. s0 = peg$FAILED;
  29794. }
  29795. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29796. return s0;
  29797. }
  29798. function peg$parsewsBinaryTail() {
  29799. var s0, s1, s2, s3;
  29800. var key = peg$currPos * 66 + 55,
  29801. cached = peg$resultsCache[key];
  29802. if (cached) {
  29803. peg$currPos = cached.nextPos;
  29804. return cached.result;
  29805. }
  29806. s0 = peg$currPos;
  29807. s1 = peg$parsewsUnaryTail();
  29808. if (s1 !== peg$FAILED) {
  29809. s2 = [];
  29810. s3 = peg$parsewsBinaryMessage();
  29811. while (s3 !== peg$FAILED) {
  29812. s2.push(s3);
  29813. s3 = peg$parsewsBinaryMessage();
  29814. }
  29815. if (s2 !== peg$FAILED) {
  29816. peg$savedPos = s0;
  29817. s1 = peg$c112(s1, s2);
  29818. s0 = s1;
  29819. } else {
  29820. peg$currPos = s0;
  29821. s0 = peg$FAILED;
  29822. }
  29823. } else {
  29824. peg$currPos = s0;
  29825. s0 = peg$FAILED;
  29826. }
  29827. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29828. return s0;
  29829. }
  29830. function peg$parsebinarySend() {
  29831. var s0, s1, s2;
  29832. var key = peg$currPos * 66 + 56,
  29833. cached = peg$resultsCache[key];
  29834. if (cached) {
  29835. peg$currPos = cached.nextPos;
  29836. return cached.result;
  29837. }
  29838. s0 = peg$currPos;
  29839. s1 = peg$parseoperand();
  29840. if (s1 !== peg$FAILED) {
  29841. s2 = peg$parsewsBinaryTail();
  29842. if (s2 !== peg$FAILED) {
  29843. peg$savedPos = s0;
  29844. s1 = peg$c110(s1, s2);
  29845. s0 = s1;
  29846. } else {
  29847. peg$currPos = s0;
  29848. s0 = peg$FAILED;
  29849. }
  29850. } else {
  29851. peg$currPos = s0;
  29852. s0 = peg$FAILED;
  29853. }
  29854. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29855. return s0;
  29856. }
  29857. function peg$parsewsKeywordMessage() {
  29858. var s0, s1, s2, s3, s4, s5, s6;
  29859. var key = peg$currPos * 66 + 57,
  29860. cached = peg$resultsCache[key];
  29861. if (cached) {
  29862. peg$currPos = cached.nextPos;
  29863. return cached.result;
  29864. }
  29865. s0 = peg$currPos;
  29866. s1 = [];
  29867. s2 = peg$currPos;
  29868. s3 = peg$parsews();
  29869. if (s3 !== peg$FAILED) {
  29870. s4 = peg$parsekeyword();
  29871. if (s4 !== peg$FAILED) {
  29872. s5 = peg$parsews();
  29873. if (s5 !== peg$FAILED) {
  29874. s6 = peg$parsebinarySend();
  29875. if (s6 !== peg$FAILED) {
  29876. peg$savedPos = s2;
  29877. s3 = peg$c75(s4, s6);
  29878. s2 = s3;
  29879. } else {
  29880. peg$currPos = s2;
  29881. s2 = peg$FAILED;
  29882. }
  29883. } else {
  29884. peg$currPos = s2;
  29885. s2 = peg$FAILED;
  29886. }
  29887. } else {
  29888. peg$currPos = s2;
  29889. s2 = peg$FAILED;
  29890. }
  29891. } else {
  29892. peg$currPos = s2;
  29893. s2 = peg$FAILED;
  29894. }
  29895. if (s2 !== peg$FAILED) {
  29896. while (s2 !== peg$FAILED) {
  29897. s1.push(s2);
  29898. s2 = peg$currPos;
  29899. s3 = peg$parsews();
  29900. if (s3 !== peg$FAILED) {
  29901. s4 = peg$parsekeyword();
  29902. if (s4 !== peg$FAILED) {
  29903. s5 = peg$parsews();
  29904. if (s5 !== peg$FAILED) {
  29905. s6 = peg$parsebinarySend();
  29906. if (s6 !== peg$FAILED) {
  29907. peg$savedPos = s2;
  29908. s3 = peg$c75(s4, s6);
  29909. s2 = s3;
  29910. } else {
  29911. peg$currPos = s2;
  29912. s2 = peg$FAILED;
  29913. }
  29914. } else {
  29915. peg$currPos = s2;
  29916. s2 = peg$FAILED;
  29917. }
  29918. } else {
  29919. peg$currPos = s2;
  29920. s2 = peg$FAILED;
  29921. }
  29922. } else {
  29923. peg$currPos = s2;
  29924. s2 = peg$FAILED;
  29925. }
  29926. }
  29927. } else {
  29928. s1 = peg$FAILED;
  29929. }
  29930. if (s1 !== peg$FAILED) {
  29931. peg$savedPos = s0;
  29932. s1 = peg$c113(s1);
  29933. }
  29934. s0 = s1;
  29935. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29936. return s0;
  29937. }
  29938. function peg$parsewsKeywordTail() {
  29939. var s0, s1, s2;
  29940. var key = peg$currPos * 66 + 58,
  29941. cached = peg$resultsCache[key];
  29942. if (cached) {
  29943. peg$currPos = cached.nextPos;
  29944. return cached.result;
  29945. }
  29946. s0 = peg$currPos;
  29947. s1 = peg$parsewsBinaryTail();
  29948. if (s1 !== peg$FAILED) {
  29949. s2 = peg$parsewsKeywordMessage();
  29950. if (s2 === peg$FAILED) {
  29951. s2 = null;
  29952. }
  29953. if (s2 !== peg$FAILED) {
  29954. peg$savedPos = s0;
  29955. s1 = peg$c114(s1, s2);
  29956. s0 = s1;
  29957. } else {
  29958. peg$currPos = s0;
  29959. s0 = peg$FAILED;
  29960. }
  29961. } else {
  29962. peg$currPos = s0;
  29963. s0 = peg$FAILED;
  29964. }
  29965. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29966. return s0;
  29967. }
  29968. function peg$parsekeywordSend() {
  29969. var s0, s1, s2;
  29970. var key = peg$currPos * 66 + 59,
  29971. cached = peg$resultsCache[key];
  29972. if (cached) {
  29973. peg$currPos = cached.nextPos;
  29974. return cached.result;
  29975. }
  29976. s0 = peg$currPos;
  29977. s1 = peg$parseoperand();
  29978. if (s1 !== peg$FAILED) {
  29979. s2 = peg$parsewsKeywordTail();
  29980. if (s2 !== peg$FAILED) {
  29981. peg$savedPos = s0;
  29982. s1 = peg$c110(s1, s2);
  29983. s0 = s1;
  29984. } else {
  29985. peg$currPos = s0;
  29986. s0 = peg$FAILED;
  29987. }
  29988. } else {
  29989. peg$currPos = s0;
  29990. s0 = peg$FAILED;
  29991. }
  29992. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29993. return s0;
  29994. }
  29995. function peg$parsewsMessage() {
  29996. var s0;
  29997. var key = peg$currPos * 66 + 60,
  29998. cached = peg$resultsCache[key];
  29999. if (cached) {
  30000. peg$currPos = cached.nextPos;
  30001. return cached.result;
  30002. }
  30003. s0 = peg$parsewsBinaryMessage();
  30004. if (s0 === peg$FAILED) {
  30005. s0 = peg$parsewsUnaryMessage();
  30006. if (s0 === peg$FAILED) {
  30007. s0 = peg$parsewsKeywordMessage();
  30008. }
  30009. }
  30010. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30011. return s0;
  30012. }
  30013. function peg$parsecascade() {
  30014. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  30015. var key = peg$currPos * 66 + 61,
  30016. cached = peg$resultsCache[key];
  30017. if (cached) {
  30018. peg$currPos = cached.nextPos;
  30019. return cached.result;
  30020. }
  30021. s0 = peg$currPos;
  30022. s1 = peg$parseoperand();
  30023. if (s1 !== peg$FAILED) {
  30024. s2 = peg$parsewsKeywordTail();
  30025. if (s2 !== peg$FAILED) {
  30026. peg$savedPos = peg$currPos;
  30027. s3 = peg$c115(s1, s2);
  30028. if (s3) {
  30029. s3 = void 0;
  30030. } else {
  30031. s3 = peg$FAILED;
  30032. }
  30033. if (s3 !== peg$FAILED) {
  30034. s4 = [];
  30035. s5 = peg$currPos;
  30036. s6 = peg$parsews();
  30037. if (s6 !== peg$FAILED) {
  30038. if (input.charCodeAt(peg$currPos) === 59) {
  30039. s7 = peg$c116;
  30040. peg$currPos++;
  30041. } else {
  30042. s7 = peg$FAILED;
  30043. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  30044. }
  30045. if (s7 !== peg$FAILED) {
  30046. s8 = peg$parsewsMessage();
  30047. if (s8 !== peg$FAILED) {
  30048. peg$savedPos = s5;
  30049. s6 = peg$c118(s1, s2, s8);
  30050. s5 = s6;
  30051. } else {
  30052. peg$currPos = s5;
  30053. s5 = peg$FAILED;
  30054. }
  30055. } else {
  30056. peg$currPos = s5;
  30057. s5 = peg$FAILED;
  30058. }
  30059. } else {
  30060. peg$currPos = s5;
  30061. s5 = peg$FAILED;
  30062. }
  30063. if (s5 !== peg$FAILED) {
  30064. while (s5 !== peg$FAILED) {
  30065. s4.push(s5);
  30066. s5 = peg$currPos;
  30067. s6 = peg$parsews();
  30068. if (s6 !== peg$FAILED) {
  30069. if (input.charCodeAt(peg$currPos) === 59) {
  30070. s7 = peg$c116;
  30071. peg$currPos++;
  30072. } else {
  30073. s7 = peg$FAILED;
  30074. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  30075. }
  30076. if (s7 !== peg$FAILED) {
  30077. s8 = peg$parsewsMessage();
  30078. if (s8 !== peg$FAILED) {
  30079. peg$savedPos = s5;
  30080. s6 = peg$c118(s1, s2, s8);
  30081. s5 = s6;
  30082. } else {
  30083. peg$currPos = s5;
  30084. s5 = peg$FAILED;
  30085. }
  30086. } else {
  30087. peg$currPos = s5;
  30088. s5 = peg$FAILED;
  30089. }
  30090. } else {
  30091. peg$currPos = s5;
  30092. s5 = peg$FAILED;
  30093. }
  30094. }
  30095. } else {
  30096. s4 = peg$FAILED;
  30097. }
  30098. if (s4 !== peg$FAILED) {
  30099. peg$savedPos = s0;
  30100. s1 = peg$c119(s1, s2, s4);
  30101. s0 = s1;
  30102. } else {
  30103. peg$currPos = s0;
  30104. s0 = peg$FAILED;
  30105. }
  30106. } else {
  30107. peg$currPos = s0;
  30108. s0 = peg$FAILED;
  30109. }
  30110. } else {
  30111. peg$currPos = s0;
  30112. s0 = peg$FAILED;
  30113. }
  30114. } else {
  30115. peg$currPos = s0;
  30116. s0 = peg$FAILED;
  30117. }
  30118. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30119. return s0;
  30120. }
  30121. function peg$parsemethod() {
  30122. var s0, s1, s2;
  30123. var key = peg$currPos * 66 + 62,
  30124. cached = peg$resultsCache[key];
  30125. if (cached) {
  30126. peg$currPos = cached.nextPos;
  30127. return cached.result;
  30128. }
  30129. s0 = peg$currPos;
  30130. s1 = peg$parsewsKeywordPattern();
  30131. if (s1 === peg$FAILED) {
  30132. s1 = peg$parsewsBinaryPattern();
  30133. if (s1 === peg$FAILED) {
  30134. s1 = peg$parsewsUnaryPattern();
  30135. }
  30136. }
  30137. if (s1 !== peg$FAILED) {
  30138. s2 = peg$parsewsSequenceWs();
  30139. if (s2 !== peg$FAILED) {
  30140. peg$savedPos = s0;
  30141. s1 = peg$c120(s1, s2);
  30142. s0 = s1;
  30143. } else {
  30144. peg$currPos = s0;
  30145. s0 = peg$FAILED;
  30146. }
  30147. } else {
  30148. peg$currPos = s0;
  30149. s0 = peg$FAILED;
  30150. }
  30151. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30152. return s0;
  30153. }
  30154. function peg$parseassociationSend() {
  30155. var s0, s1, s2, s3;
  30156. var key = peg$currPos * 66 + 63,
  30157. cached = peg$resultsCache[key];
  30158. if (cached) {
  30159. peg$currPos = cached.nextPos;
  30160. return cached.result;
  30161. }
  30162. s0 = peg$currPos;
  30163. s1 = peg$parseoperand();
  30164. if (s1 !== peg$FAILED) {
  30165. s2 = peg$parsewsBinaryTail();
  30166. if (s2 !== peg$FAILED) {
  30167. peg$savedPos = peg$currPos;
  30168. s3 = peg$c121(s1, s2);
  30169. if (s3) {
  30170. s3 = void 0;
  30171. } else {
  30172. s3 = peg$FAILED;
  30173. }
  30174. if (s3 !== peg$FAILED) {
  30175. peg$savedPos = s0;
  30176. s1 = peg$c122(s1, s2);
  30177. s0 = s1;
  30178. } else {
  30179. peg$currPos = s0;
  30180. s0 = peg$FAILED;
  30181. }
  30182. } else {
  30183. peg$currPos = s0;
  30184. s0 = peg$FAILED;
  30185. }
  30186. } else {
  30187. peg$currPos = s0;
  30188. s0 = peg$FAILED;
  30189. }
  30190. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30191. return s0;
  30192. }
  30193. function peg$parsewsAssociationsRest() {
  30194. var s0, s1, s2;
  30195. var key = peg$currPos * 66 + 64,
  30196. cached = peg$resultsCache[key];
  30197. if (cached) {
  30198. peg$currPos = cached.nextPos;
  30199. return cached.result;
  30200. }
  30201. s0 = peg$currPos;
  30202. s1 = peg$parsesomeDotsWs();
  30203. if (s1 !== peg$FAILED) {
  30204. s2 = peg$parseassociationSend();
  30205. if (s2 !== peg$FAILED) {
  30206. peg$savedPos = s0;
  30207. s1 = peg$c79(s2);
  30208. s0 = s1;
  30209. } else {
  30210. peg$currPos = s0;
  30211. s0 = peg$FAILED;
  30212. }
  30213. } else {
  30214. peg$currPos = s0;
  30215. s0 = peg$FAILED;
  30216. }
  30217. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30218. return s0;
  30219. }
  30220. function peg$parsewsAssociations() {
  30221. var s0, s1, s2, s3, s4;
  30222. var key = peg$currPos * 66 + 65,
  30223. cached = peg$resultsCache[key];
  30224. if (cached) {
  30225. peg$currPos = cached.nextPos;
  30226. return cached.result;
  30227. }
  30228. s0 = peg$currPos;
  30229. s1 = peg$parsemaybeDotsWs();
  30230. if (s1 !== peg$FAILED) {
  30231. s2 = peg$parseassociationSend();
  30232. if (s2 !== peg$FAILED) {
  30233. s3 = [];
  30234. s4 = peg$parsewsAssociationsRest();
  30235. while (s4 !== peg$FAILED) {
  30236. s3.push(s4);
  30237. s4 = peg$parsewsAssociationsRest();
  30238. }
  30239. if (s3 !== peg$FAILED) {
  30240. peg$savedPos = s0;
  30241. s1 = peg$c123(s2, s3);
  30242. s0 = s1;
  30243. } else {
  30244. peg$currPos = s0;
  30245. s0 = peg$FAILED;
  30246. }
  30247. } else {
  30248. peg$currPos = s0;
  30249. s0 = peg$FAILED;
  30250. }
  30251. } else {
  30252. peg$currPos = s0;
  30253. s0 = peg$FAILED;
  30254. }
  30255. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30256. return s0;
  30257. }
  30258. peg$result = peg$startRuleFunction();
  30259. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30260. return peg$result;
  30261. } else {
  30262. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30263. peg$fail({ type: "end", description: "end of input" });
  30264. }
  30265. throw peg$buildException(
  30266. null,
  30267. peg$maxFailExpected,
  30268. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30269. peg$maxFailPos < input.length
  30270. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30271. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30272. );
  30273. }
  30274. }
  30275. return {
  30276. SyntaxError: peg$SyntaxError,
  30277. parse: peg$parse
  30278. };
  30279. })();
  30280. });
  30281. 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";
  30282. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30283. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30284. $core.addPackage("Platform-ImportExport");
  30285. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  30286. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30287. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30288. $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.";
  30289. $core.addMethod(
  30290. $core.method({
  30291. selector: "exportPackage:on:",
  30292. protocol: "output",
  30293. fn: function (aPackage,aStream){
  30294. var self=this,$self=this;
  30295. return $core.withContext(function($ctx1) {
  30296. $self._subclassResponsibility();
  30297. return self;
  30298. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30299. },
  30300. args: ["aPackage", "aStream"],
  30301. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30302. referencedClasses: [],
  30303. messageSends: ["subclassResponsibility"]
  30304. }),
  30305. $globals.AbstractExporter);
  30306. $core.addMethod(
  30307. $core.method({
  30308. selector: "extensionMethodsOfPackage:",
  30309. protocol: "accessing",
  30310. fn: function (aPackage){
  30311. var self=this,$self=this;
  30312. var result;
  30313. return $core.withContext(function($ctx1) {
  30314. result=$recv($globals.OrderedCollection)._new();
  30315. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30316. return $core.withContext(function($ctx2) {
  30317. return $recv(result)._addAll_($recv(each)._ownMethods());
  30318. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30319. }));
  30320. return result;
  30321. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30322. },
  30323. args: ["aPackage"],
  30324. 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",
  30325. referencedClasses: ["OrderedCollection"],
  30326. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30327. }),
  30328. $globals.AbstractExporter);
  30329. $core.addMethod(
  30330. $core.method({
  30331. selector: "extensionProtocolsOfPackage:",
  30332. protocol: "accessing",
  30333. fn: function (aPackage){
  30334. var self=this,$self=this;
  30335. var extensionName,result;
  30336. return $core.withContext(function($ctx1) {
  30337. var $1,$2,$3;
  30338. $1=$recv(aPackage)._name();
  30339. $ctx1.sendIdx["name"]=1;
  30340. extensionName="*".__comma($1);
  30341. result=$recv($globals.OrderedCollection)._new();
  30342. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30343. return $core.withContext(function($ctx2) {
  30344. $2=$recv(a)._name();
  30345. $ctx2.sendIdx["name"]=2;
  30346. return $recv($2).__lt($recv(b)._name());
  30347. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30348. })))._do_((function(each){
  30349. return $core.withContext(function($ctx2) {
  30350. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30351. return $core.withContext(function($ctx3) {
  30352. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30353. if($core.assert($3)){
  30354. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30355. }
  30356. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30357. }));
  30358. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30359. }));
  30360. $ctx1.sendIdx["do:"]=1;
  30361. return result;
  30362. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30363. },
  30364. args: ["aPackage"],
  30365. 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",
  30366. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30367. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30368. }),
  30369. $globals.AbstractExporter);
  30370. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30371. $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.";
  30372. $core.addMethod(
  30373. $core.method({
  30374. selector: "chunkEscape:",
  30375. protocol: "convenience",
  30376. fn: function (aString){
  30377. var self=this,$self=this;
  30378. return $core.withContext(function($ctx1) {
  30379. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30380. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30381. },
  30382. args: ["aString"],
  30383. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30384. referencedClasses: [],
  30385. messageSends: ["trimBoth", "replace:with:"]
  30386. }),
  30387. $globals.ChunkExporter);
  30388. $core.addMethod(
  30389. $core.method({
  30390. selector: "exportBehavior:on:",
  30391. protocol: "output",
  30392. fn: function (aBehavior,aStream){
  30393. var self=this,$self=this;
  30394. return $core.withContext(function($ctx1) {
  30395. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30396. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30397. return self;
  30398. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30399. },
  30400. args: ["aBehavior", "aStream"],
  30401. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30402. referencedClasses: [],
  30403. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30404. }),
  30405. $globals.ChunkExporter);
  30406. $core.addMethod(
  30407. $core.method({
  30408. selector: "exportCategoryEpilogueOf:on:",
  30409. protocol: "output",
  30410. fn: function (aCategory,aStream){
  30411. var self=this,$self=this;
  30412. return $core.withContext(function($ctx1) {
  30413. $recv(aStream)._write_(" !");
  30414. $recv(aStream)._lf();
  30415. $ctx1.sendIdx["lf"]=1;
  30416. $recv(aStream)._lf();
  30417. return self;
  30418. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30419. },
  30420. args: ["aCategory", "aStream"],
  30421. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30422. referencedClasses: [],
  30423. messageSends: ["write:", "lf"]
  30424. }),
  30425. $globals.ChunkExporter);
  30426. $core.addMethod(
  30427. $core.method({
  30428. selector: "exportCategoryPrologueOf:on:",
  30429. protocol: "output",
  30430. fn: function (aCategory,aStream){
  30431. var self=this,$self=this;
  30432. return $core.withContext(function($ctx1) {
  30433. $recv(aStream)._write_("!");
  30434. $ctx1.sendIdx["write:"]=1;
  30435. $recv(aStream)._print_($recv(aCategory)._theClass());
  30436. $ctx1.sendIdx["print:"]=1;
  30437. $recv(aStream)._write_(" methodsFor: ");
  30438. $ctx1.sendIdx["write:"]=2;
  30439. $recv(aStream)._print_(aCategory);
  30440. $recv(aStream)._write_("!");
  30441. return self;
  30442. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30443. },
  30444. args: ["aCategory", "aStream"],
  30445. 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: '!'",
  30446. referencedClasses: [],
  30447. messageSends: ["write:", "print:", "theClass"]
  30448. }),
  30449. $globals.ChunkExporter);
  30450. $core.addMethod(
  30451. $core.method({
  30452. selector: "exportDefinitionOf:on:",
  30453. protocol: "output",
  30454. fn: function (aClass,aStream){
  30455. var self=this,$self=this;
  30456. return $core.withContext(function($ctx1) {
  30457. var $1,$2,$3,$4;
  30458. $recv(aStream)._print_($recv(aClass)._superclass());
  30459. $ctx1.sendIdx["print:"]=1;
  30460. $recv(aStream)._write_(" subclass: ");
  30461. $ctx1.sendIdx["write:"]=1;
  30462. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30463. $1=$recv(aStream)._lf();
  30464. $ctx1.sendIdx["lf"]=1;
  30465. $recv(aStream)._tab();
  30466. $ctx1.sendIdx["tab"]=1;
  30467. $recv(aStream)._write_("instanceVariableNames: ");
  30468. $ctx1.sendIdx["write:"]=2;
  30469. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30470. $ctx1.sendIdx["print:"]=2;
  30471. $recv(aStream)._lf();
  30472. $ctx1.sendIdx["lf"]=2;
  30473. $recv(aStream)._tab();
  30474. $recv(aStream)._write_("package: ");
  30475. $ctx1.sendIdx["write:"]=3;
  30476. $recv(aStream)._print_($recv(aClass)._category());
  30477. $ctx1.sendIdx["print:"]=3;
  30478. $recv(aStream)._write_("!");
  30479. $ctx1.sendIdx["write:"]=4;
  30480. $2=$recv(aStream)._lf();
  30481. $ctx1.sendIdx["lf"]=3;
  30482. $3=$recv(aClass)._comment();
  30483. $ctx1.sendIdx["comment"]=1;
  30484. $recv($3)._ifNotEmpty_((function(){
  30485. return $core.withContext(function($ctx2) {
  30486. $recv(aStream)._write_("!");
  30487. $ctx2.sendIdx["write:"]=5;
  30488. $recv(aStream)._print_(aClass);
  30489. $recv(aStream)._write_(" commentStamp!");
  30490. $ctx2.sendIdx["write:"]=6;
  30491. $recv(aStream)._lf();
  30492. $ctx2.sendIdx["lf"]=4;
  30493. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30494. $4=$recv(aStream)._lf();
  30495. $ctx2.sendIdx["lf"]=5;
  30496. return $4;
  30497. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30498. }));
  30499. $recv(aStream)._lf();
  30500. return self;
  30501. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30502. },
  30503. args: ["aClass", "aStream"],
  30504. 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",
  30505. referencedClasses: [],
  30506. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30507. }),
  30508. $globals.ChunkExporter);
  30509. $core.addMethod(
  30510. $core.method({
  30511. selector: "exportMetaDefinitionOf:on:",
  30512. protocol: "output",
  30513. fn: function (aClass,aStream){
  30514. var self=this,$self=this;
  30515. var classIvars,classTraitComposition;
  30516. return $core.withContext(function($ctx1) {
  30517. var $1,$2;
  30518. $1=$recv(aClass)._class();
  30519. $ctx1.sendIdx["class"]=1;
  30520. classIvars=$recv($1)._instanceVariableNames();
  30521. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30522. $2=$recv(classIvars)._notEmpty();
  30523. if($core.assert($2)){
  30524. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30525. $ctx1.sendIdx["print:"]=1;
  30526. $recv(aStream)._space();
  30527. $recv(aStream)._write_("instanceVariableNames: ");
  30528. $ctx1.sendIdx["write:"]=1;
  30529. $recv(aStream)._print_(" "._join_(classIvars));
  30530. $recv(aStream)._write_("!");
  30531. $recv(aStream)._lf();
  30532. $ctx1.sendIdx["lf"]=1;
  30533. $recv(aStream)._lf();
  30534. }
  30535. return self;
  30536. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30537. },
  30538. args: ["aClass", "aStream"],
  30539. 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 ]",
  30540. referencedClasses: [],
  30541. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30542. }),
  30543. $globals.ChunkExporter);
  30544. $core.addMethod(
  30545. $core.method({
  30546. selector: "exportMethod:on:",
  30547. protocol: "output",
  30548. fn: function (aMethod,aStream){
  30549. var self=this,$self=this;
  30550. return $core.withContext(function($ctx1) {
  30551. $recv(aStream)._lf();
  30552. $ctx1.sendIdx["lf"]=1;
  30553. $recv(aStream)._lf();
  30554. $ctx1.sendIdx["lf"]=2;
  30555. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30556. $ctx1.sendIdx["write:"]=1;
  30557. $recv(aStream)._lf();
  30558. $recv(aStream)._write_("!");
  30559. return self;
  30560. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30561. },
  30562. args: ["aMethod", "aStream"],
  30563. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30564. referencedClasses: [],
  30565. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30566. }),
  30567. $globals.ChunkExporter);
  30568. $core.addMethod(
  30569. $core.method({
  30570. selector: "exportPackage:on:",
  30571. protocol: "output",
  30572. fn: function (aPackage,aStream){
  30573. var self=this,$self=this;
  30574. return $core.withContext(function($ctx1) {
  30575. var $1,$receiver;
  30576. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30577. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30578. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30579. return $core.withContext(function($ctx2) {
  30580. $self._exportBehavior_on_(each,aStream);
  30581. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30582. $1=$recv(each)._theMetaClass();
  30583. if(($receiver = $1) == null || $receiver.a$nil){
  30584. return $1;
  30585. } else {
  30586. var meta;
  30587. meta=$receiver;
  30588. return $self._exportBehavior_on_(meta,aStream);
  30589. }
  30590. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30591. }));
  30592. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30593. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30594. return self;
  30595. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30596. },
  30597. args: ["aPackage", "aStream"],
  30598. 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",
  30599. referencedClasses: [],
  30600. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30601. }),
  30602. $globals.ChunkExporter);
  30603. $core.addMethod(
  30604. $core.method({
  30605. selector: "exportPackageDefinitionOf:on:",
  30606. protocol: "output",
  30607. fn: function (aPackage,aStream){
  30608. var self=this,$self=this;
  30609. return $core.withContext(function($ctx1) {
  30610. $recv(aStream)._write_("Smalltalk createPackage: ");
  30611. $ctx1.sendIdx["write:"]=1;
  30612. $recv(aStream)._print_($recv(aPackage)._name());
  30613. $recv(aStream)._write_("!");
  30614. $recv(aStream)._lf();
  30615. return self;
  30616. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30617. },
  30618. args: ["aPackage", "aStream"],
  30619. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30620. referencedClasses: [],
  30621. messageSends: ["write:", "print:", "name", "lf"]
  30622. }),
  30623. $globals.ChunkExporter);
  30624. $core.addMethod(
  30625. $core.method({
  30626. selector: "exportPackageImportsOf:on:",
  30627. protocol: "output",
  30628. fn: function (aPackage,aStream){
  30629. var self=this,$self=this;
  30630. return $core.withContext(function($ctx1) {
  30631. var $1;
  30632. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30633. return $core.withContext(function($ctx2) {
  30634. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30635. $ctx2.sendIdx["write:"]=1;
  30636. $1=$recv(aPackage)._name();
  30637. $ctx2.sendIdx["name"]=1;
  30638. $recv(aStream)._print_($1);
  30639. $ctx2.sendIdx["print:"]=1;
  30640. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30641. $ctx2.sendIdx["write:"]=2;
  30642. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30643. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30644. return $recv(aStream)._lf();
  30645. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30646. }));
  30647. return self;
  30648. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30649. },
  30650. args: ["aPackage", "aStream"],
  30651. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage imports ifNotEmpty: [ :imports | aStream\x0a\x09\x09write: '(Smalltalk packageAt: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: ' ifAbsent: [ self error: ';\x0a\x09\x09print: 'Package not created: ', aPackage name;\x0a\x09\x09write: { ' ]) imports: '. self chunkEscape: aPackage importsDefinition. '!' };\x0a\x09\x09lf ]",
  30652. referencedClasses: [],
  30653. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30654. }),
  30655. $globals.ChunkExporter);
  30656. $core.addMethod(
  30657. $core.method({
  30658. selector: "exportPackageTraitCompositionsOf:on:",
  30659. protocol: "output",
  30660. fn: function (aPackage,aStream){
  30661. var self=this,$self=this;
  30662. return $core.withContext(function($ctx1) {
  30663. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30664. return $core.withContext(function($ctx2) {
  30665. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30666. return $core.withContext(function($ctx3) {
  30667. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30668. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30669. }));
  30670. $recv(aStream)._write_("! !");
  30671. $recv(aStream)._lf();
  30672. $ctx2.sendIdx["lf"]=1;
  30673. return $recv(aStream)._lf();
  30674. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30675. }));
  30676. return self;
  30677. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30678. },
  30679. args: ["aPackage", "aStream"],
  30680. 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 ]",
  30681. referencedClasses: [],
  30682. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30683. }),
  30684. $globals.ChunkExporter);
  30685. $core.addMethod(
  30686. $core.method({
  30687. selector: "exportProtocol:on:",
  30688. protocol: "output",
  30689. fn: function (aProtocol,aStream){
  30690. var self=this,$self=this;
  30691. return $core.withContext(function($ctx1) {
  30692. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30693. return $core.withContext(function($ctx2) {
  30694. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30695. $recv(methods)._do_((function(method){
  30696. return $core.withContext(function($ctx3) {
  30697. return $self._exportMethod_on_(method,aStream);
  30698. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30699. }));
  30700. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30701. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30702. }));
  30703. return self;
  30704. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30705. },
  30706. args: ["aProtocol", "aStream"],
  30707. 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 ]",
  30708. referencedClasses: [],
  30709. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30710. }),
  30711. $globals.ChunkExporter);
  30712. $core.addMethod(
  30713. $core.method({
  30714. selector: "exportProtocolEpilogueOf:on:",
  30715. protocol: "output",
  30716. fn: function (aProtocol,aStream){
  30717. var self=this,$self=this;
  30718. return $core.withContext(function($ctx1) {
  30719. $recv(aStream)._write_(" !");
  30720. $recv(aStream)._lf();
  30721. $ctx1.sendIdx["lf"]=1;
  30722. $recv(aStream)._lf();
  30723. return self;
  30724. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30725. },
  30726. args: ["aProtocol", "aStream"],
  30727. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30728. referencedClasses: [],
  30729. messageSends: ["write:", "lf"]
  30730. }),
  30731. $globals.ChunkExporter);
  30732. $core.addMethod(
  30733. $core.method({
  30734. selector: "exportProtocolPrologueOf:on:",
  30735. protocol: "output",
  30736. fn: function (aProtocol,aStream){
  30737. var self=this,$self=this;
  30738. return $core.withContext(function($ctx1) {
  30739. $recv(aStream)._write_("!");
  30740. $ctx1.sendIdx["write:"]=1;
  30741. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30742. $ctx1.sendIdx["print:"]=1;
  30743. $recv(aStream)._write_(" methodsFor: ");
  30744. $ctx1.sendIdx["write:"]=2;
  30745. $recv(aStream)._print_($recv(aProtocol)._name());
  30746. $recv(aStream)._write_("!");
  30747. return self;
  30748. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30749. },
  30750. args: ["aProtocol", "aStream"],
  30751. 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: '!'",
  30752. referencedClasses: [],
  30753. messageSends: ["write:", "print:", "theClass", "name"]
  30754. }),
  30755. $globals.ChunkExporter);
  30756. $core.addMethod(
  30757. $core.method({
  30758. selector: "exportProtocols:on:",
  30759. protocol: "output",
  30760. fn: function (aCollection,aStream){
  30761. var self=this,$self=this;
  30762. return $core.withContext(function($ctx1) {
  30763. $recv(aCollection)._do_((function(each){
  30764. return $core.withContext(function($ctx2) {
  30765. return $self._exportProtocol_on_(each,aStream);
  30766. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30767. }));
  30768. return self;
  30769. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30770. },
  30771. args: ["aCollection", "aStream"],
  30772. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30773. referencedClasses: [],
  30774. messageSends: ["do:", "exportProtocol:on:"]
  30775. }),
  30776. $globals.ChunkExporter);
  30777. $core.addMethod(
  30778. $core.method({
  30779. selector: "exportTraitComposition:of:on:",
  30780. protocol: "output",
  30781. fn: function (aTraitComposition,aBehavior,aStream){
  30782. var self=this,$self=this;
  30783. return $core.withContext(function($ctx1) {
  30784. $recv(aStream)._print_(aBehavior);
  30785. $recv(aStream)._write_(" setTraitComposition: ");
  30786. $ctx1.sendIdx["write:"]=1;
  30787. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30788. $ctx1.sendIdx["write:"]=2;
  30789. $recv(aStream)._write_(" asTraitComposition!");
  30790. $recv(aStream)._lf();
  30791. return self;
  30792. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30793. },
  30794. args: ["aTraitComposition", "aBehavior", "aStream"],
  30795. 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",
  30796. referencedClasses: [],
  30797. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30798. }),
  30799. $globals.ChunkExporter);
  30800. $core.addMethod(
  30801. $core.method({
  30802. selector: "exportTraitDefinitionOf:on:",
  30803. protocol: "output",
  30804. fn: function (aClass,aStream){
  30805. var self=this,$self=this;
  30806. return $core.withContext(function($ctx1) {
  30807. var $1,$2,$3,$4;
  30808. $recv(aStream)._write_("Trait named: ");
  30809. $ctx1.sendIdx["write:"]=1;
  30810. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30811. $1=$recv(aStream)._lf();
  30812. $ctx1.sendIdx["lf"]=1;
  30813. $recv(aStream)._tab();
  30814. $recv(aStream)._write_("package: ");
  30815. $ctx1.sendIdx["write:"]=2;
  30816. $recv(aStream)._print_($recv(aClass)._category());
  30817. $ctx1.sendIdx["print:"]=1;
  30818. $recv(aStream)._write_("!");
  30819. $ctx1.sendIdx["write:"]=3;
  30820. $2=$recv(aStream)._lf();
  30821. $ctx1.sendIdx["lf"]=2;
  30822. $3=$recv(aClass)._comment();
  30823. $ctx1.sendIdx["comment"]=1;
  30824. $recv($3)._ifNotEmpty_((function(){
  30825. return $core.withContext(function($ctx2) {
  30826. $recv(aStream)._write_("!");
  30827. $ctx2.sendIdx["write:"]=4;
  30828. $recv(aStream)._print_(aClass);
  30829. $recv(aStream)._write_(" commentStamp!");
  30830. $ctx2.sendIdx["write:"]=5;
  30831. $recv(aStream)._lf();
  30832. $ctx2.sendIdx["lf"]=3;
  30833. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30834. $4=$recv(aStream)._lf();
  30835. $ctx2.sendIdx["lf"]=4;
  30836. return $4;
  30837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30838. }));
  30839. $recv(aStream)._lf();
  30840. return self;
  30841. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30842. },
  30843. args: ["aClass", "aStream"],
  30844. 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",
  30845. referencedClasses: [],
  30846. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30847. }),
  30848. $globals.ChunkExporter);
  30849. $core.addMethod(
  30850. $core.method({
  30851. selector: "extensionCategoriesOfPackage:",
  30852. protocol: "accessing",
  30853. fn: function (aPackage){
  30854. var self=this,$self=this;
  30855. var name,map,result;
  30856. return $core.withContext(function($ctx1) {
  30857. var $1;
  30858. name=$recv(aPackage)._name();
  30859. result=$recv($globals.OrderedCollection)._new();
  30860. $ctx1.sendIdx["new"]=1;
  30861. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30862. return $core.withContext(function($ctx2) {
  30863. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30864. return $core.withContext(function($ctx3) {
  30865. map=$recv($globals.Dictionary)._new();
  30866. $recv(aClass)._protocolsDo_((function(category,methods){
  30867. return $core.withContext(function($ctx4) {
  30868. $1=$recv(category).__eq("*".__comma(name));
  30869. if($core.assert($1)){
  30870. return $recv(map)._at_put_(category,methods);
  30871. }
  30872. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30873. }));
  30874. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30875. return $core.withContext(function($ctx4) {
  30876. return $recv(a).__lt_eq(b);
  30877. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30878. })))._collect_((function(category){
  30879. return $core.withContext(function($ctx4) {
  30880. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30881. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30882. })));
  30883. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30884. }));
  30885. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30886. }));
  30887. $ctx1.sendIdx["do:"]=1;
  30888. return result;
  30889. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30890. },
  30891. args: ["aPackage"],
  30892. 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",
  30893. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30894. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30895. }),
  30896. $globals.ChunkExporter);
  30897. $core.addMethod(
  30898. $core.method({
  30899. selector: "ownCategoriesOfClass:",
  30900. protocol: "accessing",
  30901. fn: function (aClass){
  30902. var self=this,$self=this;
  30903. var map;
  30904. return $core.withContext(function($ctx1) {
  30905. var $1;
  30906. map=$recv($globals.Dictionary)._new();
  30907. $recv(aClass)._protocolsDo_((function(each,methods){
  30908. return $core.withContext(function($ctx2) {
  30909. $1=$recv(each)._match_("^\x5c*");
  30910. if(!$core.assert($1)){
  30911. return $recv(map)._at_put_(each,methods);
  30912. }
  30913. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30914. }));
  30915. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30916. return $core.withContext(function($ctx2) {
  30917. return $recv(a).__lt_eq(b);
  30918. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30919. })))._collect_((function(each){
  30920. return $core.withContext(function($ctx2) {
  30921. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30923. }));
  30924. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30925. },
  30926. args: ["aClass"],
  30927. 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) ]",
  30928. referencedClasses: ["Dictionary", "MethodCategory"],
  30929. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30930. }),
  30931. $globals.ChunkExporter);
  30932. $core.addMethod(
  30933. $core.method({
  30934. selector: "ownCategoriesOfMetaClass:",
  30935. protocol: "accessing",
  30936. fn: function (aClass){
  30937. var self=this,$self=this;
  30938. return $core.withContext(function($ctx1) {
  30939. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30940. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30941. },
  30942. args: ["aClass"],
  30943. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30944. referencedClasses: [],
  30945. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30946. }),
  30947. $globals.ChunkExporter);
  30948. $core.addMethod(
  30949. $core.method({
  30950. selector: "ownMethodProtocolsOfClass:",
  30951. protocol: "accessing",
  30952. fn: function (aClass){
  30953. var self=this,$self=this;
  30954. return $core.withContext(function($ctx1) {
  30955. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30956. return $core.withContext(function($ctx2) {
  30957. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30958. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30959. }));
  30960. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30961. },
  30962. args: ["aClass"],
  30963. 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 ]",
  30964. referencedClasses: ["ExportMethodProtocol"],
  30965. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30966. }),
  30967. $globals.ChunkExporter);
  30968. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30969. $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.).";
  30970. $core.addMethod(
  30971. $core.method({
  30972. selector: "exportBehavior:on:",
  30973. protocol: "output",
  30974. fn: function (aBehavior,aStream){
  30975. var self=this,$self=this;
  30976. return $core.withContext(function($ctx1) {
  30977. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30978. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  30979. return $core.withContext(function($ctx2) {
  30980. return $self._exportMethod_on_(method,aStream);
  30981. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  30982. }));
  30983. return self;
  30984. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  30985. },
  30986. args: ["aBehavior", "aStream"],
  30987. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  30988. referencedClasses: [],
  30989. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  30990. }),
  30991. $globals.Exporter);
  30992. $core.addMethod(
  30993. $core.method({
  30994. selector: "exportDefinitionOf:on:",
  30995. protocol: "output",
  30996. fn: function (aClass,aStream){
  30997. var self=this,$self=this;
  30998. return $core.withContext(function($ctx1) {
  30999. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  31000. $recv(aStream)._lf();
  31001. $ctx1.sendIdx["lf"]=1;
  31002. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31003. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31004. $5=$recv(aClass)._superclass();
  31005. if(($receiver = $5) == null || $receiver.a$nil){
  31006. $4="null";
  31007. } else {
  31008. var superclass;
  31009. superclass=$receiver;
  31010. $4=$recv(superclass)._asJavaScriptSource();
  31011. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31012. }
  31013. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  31014. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31015. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  31016. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31017. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  31018. $1=$recv(aStream)._write_($2);
  31019. $ctx1.sendIdx["write:"]=1;
  31020. $8=$recv(aClass)._comment();
  31021. $ctx1.sendIdx["comment"]=1;
  31022. $recv($8)._ifNotEmpty_((function(){
  31023. return $core.withContext(function($ctx2) {
  31024. $recv(aStream)._lf();
  31025. $ctx2.sendIdx["lf"]=2;
  31026. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31027. $ctx2.sendIdx["write:"]=2;
  31028. $recv(aStream)._lf();
  31029. $ctx2.sendIdx["lf"]=3;
  31030. $10=$recv(aClass)._asJavaScriptSource();
  31031. $ctx2.sendIdx["asJavaScriptSource"]=5;
  31032. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31033. $recv(aStream)._write_($9);
  31034. $ctx2.sendIdx["write:"]=3;
  31035. $recv(aStream)._lf();
  31036. $ctx2.sendIdx["lf"]=4;
  31037. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31039. }));
  31040. $recv(aStream)._lf();
  31041. return self;
  31042. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31043. },
  31044. args: ["aClass", "aStream"],
  31045. 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",
  31046. referencedClasses: [],
  31047. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31048. }),
  31049. $globals.Exporter);
  31050. $core.addMethod(
  31051. $core.method({
  31052. selector: "exportMetaDefinitionOf:on:",
  31053. protocol: "output",
  31054. fn: function (aClass,aStream){
  31055. var self=this,$self=this;
  31056. return $core.withContext(function($ctx1) {
  31057. var $2,$1,$4,$3;
  31058. $recv(aStream)._lf();
  31059. $ctx1.sendIdx["lf"]=1;
  31060. $2=$recv(aClass)._theMetaClass();
  31061. $ctx1.sendIdx["theMetaClass"]=1;
  31062. $1=$recv($2)._instanceVariableNames();
  31063. $recv($1)._ifNotEmpty_((function(classIvars){
  31064. return $core.withContext(function($ctx2) {
  31065. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  31066. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31067. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  31068. $recv(aStream)._write_($3);
  31069. return $recv(aStream)._lf();
  31070. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  31071. }));
  31072. return self;
  31073. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31074. },
  31075. args: ["aClass", "aStream"],
  31076. 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 ]",
  31077. referencedClasses: [],
  31078. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  31079. }),
  31080. $globals.Exporter);
  31081. $core.addMethod(
  31082. $core.method({
  31083. selector: "exportMethod:on:",
  31084. protocol: "output",
  31085. fn: function (aMethod,aStream){
  31086. var self=this,$self=this;
  31087. return $core.withContext(function($ctx1) {
  31088. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  31089. $recv(aStream)._write_("$core.addMethod(");
  31090. $ctx1.sendIdx["write:"]=1;
  31091. $recv(aStream)._lf();
  31092. $ctx1.sendIdx["lf"]=1;
  31093. $recv(aStream)._write_("$core.method({");
  31094. $ctx1.sendIdx["write:"]=2;
  31095. $recv(aStream)._lf();
  31096. $ctx1.sendIdx["lf"]=2;
  31097. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  31098. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31099. $1=["selector: ",$2,","];
  31100. $recv(aStream)._write_($1);
  31101. $ctx1.sendIdx["write:"]=3;
  31102. $recv(aStream)._lf();
  31103. $ctx1.sendIdx["lf"]=3;
  31104. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  31105. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31106. $3=["protocol: ",$4,","];
  31107. $recv(aStream)._write_($3);
  31108. $ctx1.sendIdx["write:"]=4;
  31109. $recv(aStream)._lf();
  31110. $ctx1.sendIdx["lf"]=4;
  31111. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  31112. $ctx1.sendIdx["write:"]=5;
  31113. $recv(aStream)._lf();
  31114. $ctx1.sendIdx["lf"]=5;
  31115. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31116. $ctx1.sendIdx["write:"]=6;
  31117. $recv(aStream)._lf();
  31118. $ctx1.sendIdx["lf"]=6;
  31119. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  31120. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31121. $5=["args: ",$6,","];
  31122. $recv(aStream)._write_($5);
  31123. $ctx1.sendIdx["write:"]=7;
  31124. $recv(aStream)._lf();
  31125. $ctx1.sendIdx["lf"]=7;
  31126. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  31127. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31128. $7=["source: ",$8,","];
  31129. $recv(aStream)._write_($7);
  31130. $ctx1.sendIdx["write:"]=8;
  31131. $recv(aStream)._lf();
  31132. $ctx1.sendIdx["lf"]=8;
  31133. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  31134. $ctx1.sendIdx["asJavaScriptSource"]=5;
  31135. $9=["referencedClasses: ",$10,","];
  31136. $recv(aStream)._write_($9);
  31137. $ctx1.sendIdx["write:"]=9;
  31138. $recv(aStream)._lf();
  31139. $ctx1.sendIdx["lf"]=9;
  31140. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31141. $ctx1.sendIdx["write:"]=10;
  31142. $recv(aStream)._lf();
  31143. $ctx1.sendIdx["lf"]=10;
  31144. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  31145. $ctx1.sendIdx["asJavaScriptSource"]=6;
  31146. $11=["messageSends: ",$12];
  31147. $recv(aStream)._write_($11);
  31148. $ctx1.sendIdx["write:"]=11;
  31149. $recv(aStream)._lf();
  31150. $ctx1.sendIdx["lf"]=11;
  31151. $recv(aStream)._write_("}),");
  31152. $ctx1.sendIdx["write:"]=12;
  31153. $recv(aStream)._lf();
  31154. $ctx1.sendIdx["lf"]=12;
  31155. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  31156. $recv(aStream)._lf();
  31157. $ctx1.sendIdx["lf"]=13;
  31158. $recv(aStream)._lf();
  31159. return self;
  31160. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31161. },
  31162. args: ["aMethod", "aStream"],
  31163. 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",
  31164. referencedClasses: [],
  31165. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31166. }),
  31167. $globals.Exporter);
  31168. $core.addMethod(
  31169. $core.method({
  31170. selector: "exportPackage:on:",
  31171. protocol: "output",
  31172. fn: function (aPackage,aStream){
  31173. var self=this,$self=this;
  31174. return $core.withContext(function($ctx1) {
  31175. var $1,$receiver;
  31176. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31177. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31178. $self._exportPackageContextOf_on_(aPackage,aStream);
  31179. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31180. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31181. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31182. return $core.withContext(function($ctx2) {
  31183. $self._exportBehavior_on_(each,aStream);
  31184. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31185. $1=$recv(each)._theMetaClass();
  31186. if(($receiver = $1) == null || $receiver.a$nil){
  31187. return $1;
  31188. } else {
  31189. var meta;
  31190. meta=$receiver;
  31191. return $self._exportBehavior_on_(meta,aStream);
  31192. }
  31193. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31194. }));
  31195. $ctx1.sendIdx["do:"]=1;
  31196. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31197. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31198. return $core.withContext(function($ctx2) {
  31199. return $self._exportMethod_on_(each,aStream);
  31200. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31201. }));
  31202. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31203. return self;
  31204. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31205. },
  31206. args: ["aPackage", "aStream"],
  31207. 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",
  31208. referencedClasses: [],
  31209. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31210. }),
  31211. $globals.Exporter);
  31212. $core.addMethod(
  31213. $core.method({
  31214. selector: "exportPackageBodyBlockPrologueOf:on:",
  31215. protocol: "output",
  31216. fn: function (aPackage,aStream){
  31217. var self=this,$self=this;
  31218. return $core.withContext(function($ctx1) {
  31219. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  31220. $ctx1.sendIdx["write:"]=1;
  31221. $recv(aStream)._lf();
  31222. $ctx1.sendIdx["lf"]=1;
  31223. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31224. $recv(aStream)._lf();
  31225. return self;
  31226. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31227. },
  31228. args: ["aPackage", "aStream"],
  31229. source: "exportPackageBodyBlockPrologueOf: aPackage on: aStream\x0a\x09aStream\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",
  31230. referencedClasses: [],
  31231. messageSends: ["write:", "lf"]
  31232. }),
  31233. $globals.Exporter);
  31234. $core.addMethod(
  31235. $core.method({
  31236. selector: "exportPackageContextOf:on:",
  31237. protocol: "output",
  31238. fn: function (aPackage,aStream){
  31239. var self=this,$self=this;
  31240. return $core.withContext(function($ctx1) {
  31241. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  31242. $recv(aStream)._lf();
  31243. return self;
  31244. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31245. },
  31246. args: ["aPackage", "aStream"],
  31247. source: "exportPackageContextOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'($core.packageDescriptors||$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",
  31248. referencedClasses: [],
  31249. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31250. }),
  31251. $globals.Exporter);
  31252. $core.addMethod(
  31253. $core.method({
  31254. selector: "exportPackageDefinitionOf:on:",
  31255. protocol: "output",
  31256. fn: function (aPackage,aStream){
  31257. var self=this,$self=this;
  31258. return $core.withContext(function($ctx1) {
  31259. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31260. $recv(aStream)._lf();
  31261. return self;
  31262. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31263. },
  31264. args: ["aPackage", "aStream"],
  31265. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31266. referencedClasses: [],
  31267. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31268. }),
  31269. $globals.Exporter);
  31270. $core.addMethod(
  31271. $core.method({
  31272. selector: "exportPackageEpilogueOf:on:",
  31273. protocol: "output",
  31274. fn: function (aPackage,aStream){
  31275. var self=this,$self=this;
  31276. return $core.withContext(function($ctx1) {
  31277. $self._subclassResponsibility();
  31278. return self;
  31279. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31280. },
  31281. args: ["aPackage", "aStream"],
  31282. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31283. referencedClasses: [],
  31284. messageSends: ["subclassResponsibility"]
  31285. }),
  31286. $globals.Exporter);
  31287. $core.addMethod(
  31288. $core.method({
  31289. selector: "exportPackageImportsOf:on:",
  31290. protocol: "output",
  31291. fn: function (aPackage,aStream){
  31292. var self=this,$self=this;
  31293. return $core.withContext(function($ctx1) {
  31294. var $2,$1;
  31295. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31296. return $core.withContext(function($ctx2) {
  31297. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  31298. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31299. $1=["($core.packageDescriptors||$core.packages)[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  31300. $recv(aStream)._write_($1);
  31301. return $recv(aStream)._lf();
  31302. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31303. }));
  31304. return self;
  31305. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31306. },
  31307. args: ["aPackage", "aStream"],
  31308. source: "exportPackageImportsOf: aPackage on: aStream\x0a\x09aPackage importsAsJson ifNotEmpty: [ :imports |\x0a\x09\x09aStream\x0a\x09\x09\x09write: {\x0a\x09\x09\x09\x09'($core.packageDescriptors||$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 ]",
  31309. referencedClasses: [],
  31310. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  31311. }),
  31312. $globals.Exporter);
  31313. $core.addMethod(
  31314. $core.method({
  31315. selector: "exportPackagePrologueOf:on:",
  31316. protocol: "output",
  31317. fn: function (aPackage,aStream){
  31318. var self=this,$self=this;
  31319. return $core.withContext(function($ctx1) {
  31320. $self._subclassResponsibility();
  31321. return self;
  31322. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31323. },
  31324. args: ["aPackage", "aStream"],
  31325. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31326. referencedClasses: [],
  31327. messageSends: ["subclassResponsibility"]
  31328. }),
  31329. $globals.Exporter);
  31330. $core.addMethod(
  31331. $core.method({
  31332. selector: "exportPackageTraitCompositionsOf:on:",
  31333. protocol: "output",
  31334. fn: function (aPackage,aStream){
  31335. var self=this,$self=this;
  31336. return $core.withContext(function($ctx1) {
  31337. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31338. return $core.withContext(function($ctx2) {
  31339. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31340. return $core.withContext(function($ctx3) {
  31341. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31342. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31343. }));
  31344. return $recv(aStream)._lf();
  31345. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31346. }));
  31347. return self;
  31348. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31349. },
  31350. args: ["aPackage", "aStream"],
  31351. 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 ]",
  31352. referencedClasses: [],
  31353. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31354. }),
  31355. $globals.Exporter);
  31356. $core.addMethod(
  31357. $core.method({
  31358. selector: "exportPackageTransportOf:on:",
  31359. protocol: "output",
  31360. fn: function (aPackage,aStream){
  31361. var self=this,$self=this;
  31362. return $core.withContext(function($ctx1) {
  31363. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31364. $recv(aStream)._lf();
  31365. return self;
  31366. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31367. },
  31368. args: ["aPackage", "aStream"],
  31369. source: "exportPackageTransportOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: {\x0a\x09\x09\x09'($core.packageDescriptors||$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",
  31370. referencedClasses: [],
  31371. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  31372. }),
  31373. $globals.Exporter);
  31374. $core.addMethod(
  31375. $core.method({
  31376. selector: "exportTraitComposition:of:on:",
  31377. protocol: "output",
  31378. fn: function (aTraitComposition,aBehavior,aStream){
  31379. var self=this,$self=this;
  31380. return $core.withContext(function($ctx1) {
  31381. var $2,$1;
  31382. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31383. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31384. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31385. $recv(aStream)._write_($1);
  31386. $recv(aStream)._lf();
  31387. return self;
  31388. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31389. },
  31390. args: ["aTraitComposition", "aBehavior", "aStream"],
  31391. 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",
  31392. referencedClasses: [],
  31393. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31394. }),
  31395. $globals.Exporter);
  31396. $core.addMethod(
  31397. $core.method({
  31398. selector: "exportTraitDefinitionOf:on:",
  31399. protocol: "output",
  31400. fn: function (aClass,aStream){
  31401. var self=this,$self=this;
  31402. return $core.withContext(function($ctx1) {
  31403. var $3,$4,$2,$1,$5,$7,$6;
  31404. $recv(aStream)._lf();
  31405. $ctx1.sendIdx["lf"]=1;
  31406. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31407. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31408. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31409. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31410. $2=["$core.addTrait(",$3,", ",$4,");"];
  31411. $1=$recv(aStream)._write_($2);
  31412. $ctx1.sendIdx["write:"]=1;
  31413. $5=$recv(aClass)._comment();
  31414. $ctx1.sendIdx["comment"]=1;
  31415. $recv($5)._ifNotEmpty_((function(){
  31416. return $core.withContext(function($ctx2) {
  31417. $recv(aStream)._lf();
  31418. $ctx2.sendIdx["lf"]=2;
  31419. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31420. $ctx2.sendIdx["write:"]=2;
  31421. $recv(aStream)._lf();
  31422. $ctx2.sendIdx["lf"]=3;
  31423. $7=$recv(aClass)._asJavaScriptSource();
  31424. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31425. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31426. $recv(aStream)._write_($6);
  31427. $ctx2.sendIdx["write:"]=3;
  31428. $recv(aStream)._lf();
  31429. $ctx2.sendIdx["lf"]=4;
  31430. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31431. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31432. }));
  31433. $recv(aStream)._lf();
  31434. return self;
  31435. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31436. },
  31437. args: ["aClass", "aStream"],
  31438. 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",
  31439. referencedClasses: [],
  31440. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31441. }),
  31442. $globals.Exporter);
  31443. $core.addMethod(
  31444. $core.method({
  31445. selector: "ownMethodsOfClass:",
  31446. protocol: "accessing",
  31447. fn: function (aClass){
  31448. var self=this,$self=this;
  31449. return $core.withContext(function($ctx1) {
  31450. var $1;
  31451. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31452. return $core.withContext(function($ctx2) {
  31453. $1=$recv(a)._selector();
  31454. $ctx2.sendIdx["selector"]=1;
  31455. return $recv($1).__lt_eq($recv(b)._selector());
  31456. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31457. })))._reject_((function(each){
  31458. return $core.withContext(function($ctx2) {
  31459. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31460. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31461. }));
  31462. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31463. },
  31464. args: ["aClass"],
  31465. 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*') ]",
  31466. referencedClasses: [],
  31467. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31468. }),
  31469. $globals.Exporter);
  31470. $core.addMethod(
  31471. $core.method({
  31472. selector: "ownMethodsOfMetaClass:",
  31473. protocol: "accessing",
  31474. fn: function (aClass){
  31475. var self=this,$self=this;
  31476. return $core.withContext(function($ctx1) {
  31477. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31478. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31479. },
  31480. args: ["aClass"],
  31481. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31482. referencedClasses: [],
  31483. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31484. }),
  31485. $globals.Exporter);
  31486. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31487. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31488. $core.addMethod(
  31489. $core.method({
  31490. selector: "amdNamesOfPackages:",
  31491. protocol: "private",
  31492. fn: function (anArray){
  31493. var self=this,$self=this;
  31494. return $core.withContext(function($ctx1) {
  31495. var $1;
  31496. return $recv($recv(anArray)._select_((function(each){
  31497. return $core.withContext(function($ctx2) {
  31498. $1=$self._amdNamespaceOfPackage_(each);
  31499. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31500. return $recv($1)._notNil();
  31501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31502. })))._collect_((function(each){
  31503. return $core.withContext(function($ctx2) {
  31504. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31505. $ctx2.sendIdx[","]=1;
  31506. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31507. }));
  31508. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31509. },
  31510. args: ["anArray"],
  31511. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31512. referencedClasses: [],
  31513. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31514. }),
  31515. $globals.AmdExporter);
  31516. $core.addMethod(
  31517. $core.method({
  31518. selector: "amdNamespaceOfPackage:",
  31519. protocol: "private",
  31520. fn: function (aPackage){
  31521. var self=this,$self=this;
  31522. return $core.withContext(function($ctx1) {
  31523. var $3,$2,$1;
  31524. $3=$recv(aPackage)._transport();
  31525. $ctx1.sendIdx["transport"]=1;
  31526. $2=$recv($3)._type();
  31527. $1=$recv($2).__eq("amd");
  31528. if($core.assert($1)){
  31529. return $recv($recv(aPackage)._transport())._namespace();
  31530. } else {
  31531. return nil;
  31532. }
  31533. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31534. },
  31535. args: ["aPackage"],
  31536. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31537. referencedClasses: [],
  31538. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31539. }),
  31540. $globals.AmdExporter);
  31541. $core.addMethod(
  31542. $core.method({
  31543. selector: "exportPackageEpilogueOf:on:",
  31544. protocol: "output",
  31545. fn: function (aPackage,aStream){
  31546. var self=this,$self=this;
  31547. return $core.withContext(function($ctx1) {
  31548. $recv(aStream)._write_("});");
  31549. $recv(aStream)._lf();
  31550. return self;
  31551. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31552. },
  31553. args: ["aPackage", "aStream"],
  31554. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31555. referencedClasses: [],
  31556. messageSends: ["write:", "lf"]
  31557. }),
  31558. $globals.AmdExporter);
  31559. $core.addMethod(
  31560. $core.method({
  31561. selector: "exportPackagePrologueOf:on:",
  31562. protocol: "output",
  31563. fn: function (aPackage,aStream){
  31564. var self=this,$self=this;
  31565. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31566. return $core.withContext(function($ctx1) {
  31567. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31568. pragmaStart="";
  31569. pragmaEnd="";
  31570. importsForOutput=$self._importsForOutput_(aPackage);
  31571. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31572. $1=$recv(importsForOutput)._value();
  31573. $ctx1.sendIdx["value"]=1;
  31574. $recv($1)._ifNotEmpty_((function(){
  31575. return $core.withContext(function($ctx2) {
  31576. $3=$recv($globals.String)._lf();
  31577. $ctx2.sendIdx["lf"]=1;
  31578. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31579. $ctx2.sendIdx[","]=2;
  31580. $4=$recv($globals.String)._lf();
  31581. $ctx2.sendIdx["lf"]=2;
  31582. pragmaStart=$recv($2).__comma($4);
  31583. $ctx2.sendIdx[","]=1;
  31584. $6=$recv($globals.String)._lf();
  31585. $ctx2.sendIdx["lf"]=3;
  31586. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31587. $ctx2.sendIdx[","]=4;
  31588. $7=$recv($globals.String)._lf();
  31589. $ctx2.sendIdx["lf"]=4;
  31590. pragmaEnd=$recv($5).__comma($7);
  31591. $ctx2.sendIdx[","]=3;
  31592. return pragmaEnd;
  31593. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31594. }));
  31595. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31596. $ctx1.sendIdx[","]=7;
  31597. $13=$recv($14).__comma([":2:"]);
  31598. $ctx1.sendIdx[","]=6;
  31599. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31600. $ctx1.sendIdx[","]=5;
  31601. $11=$recv($12)._asJavaScriptSource();
  31602. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31603. $ctx1.sendIdx["replace:with:"]=2;
  31604. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31605. $ctx1.sendIdx["replace:with:"]=1;
  31606. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31607. $ctx1.sendIdx[","]=8;
  31608. $17=$recv($18)._join_(",");
  31609. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31610. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31611. $ctx1.sendIdx["replace:with:"]=3;
  31612. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31613. $recv(aStream)._write_($8);
  31614. $recv(aStream)._lf();
  31615. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31616. return self;
  31617. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31618. },
  31619. args: ["aPackage", "aStream"],
  31620. 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",
  31621. referencedClasses: ["String"],
  31622. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31623. }),
  31624. $globals.AmdExporter);
  31625. $core.addMethod(
  31626. $core.method({
  31627. selector: "importsForOutput:",
  31628. protocol: "private",
  31629. fn: function (aPackage){
  31630. var self=this,$self=this;
  31631. var namedImports,anonImports,importVarNames;
  31632. return $core.withContext(function($ctx1) {
  31633. var $1;
  31634. namedImports=[];
  31635. anonImports=[];
  31636. importVarNames=[];
  31637. $recv($recv(aPackage)._imports())._do_((function(each){
  31638. return $core.withContext(function($ctx2) {
  31639. $1=$recv(each)._isString();
  31640. if($core.assert($1)){
  31641. return $recv(anonImports)._add_(each);
  31642. $ctx2.sendIdx["add:"]=1;
  31643. } else {
  31644. $recv(namedImports)._add_($recv(each)._value());
  31645. $ctx2.sendIdx["add:"]=2;
  31646. return $recv(importVarNames)._add_($recv(each)._key());
  31647. }
  31648. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31649. }));
  31650. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31651. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31652. },
  31653. args: ["aPackage"],
  31654. 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)",
  31655. referencedClasses: [],
  31656. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31657. }),
  31658. $globals.AmdExporter);
  31659. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31660. $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";
  31661. $core.addMethod(
  31662. $core.method({
  31663. selector: "last",
  31664. protocol: "accessing",
  31665. fn: function (){
  31666. var self=this,$self=this;
  31667. return $self["@last"];
  31668. },
  31669. args: [],
  31670. source: "last\x0a\x09^ last",
  31671. referencedClasses: [],
  31672. messageSends: []
  31673. }),
  31674. $globals.ChunkParser);
  31675. $core.addMethod(
  31676. $core.method({
  31677. selector: "nextChunk",
  31678. protocol: "reading",
  31679. fn: function (){
  31680. var self=this,$self=this;
  31681. var char,result,chunk;
  31682. return $core.withContext(function($ctx1) {
  31683. var $1,$2,$3,$4;
  31684. var $early={};
  31685. try {
  31686. result=""._writeStream();
  31687. $recv((function(){
  31688. return $core.withContext(function($ctx2) {
  31689. char=$recv($self["@stream"])._next();
  31690. $ctx2.sendIdx["next"]=1;
  31691. return $recv(char)._notNil();
  31692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31693. }))._whileTrue_((function(){
  31694. return $core.withContext(function($ctx2) {
  31695. $1=$recv(char).__eq("!");
  31696. $ctx2.sendIdx["="]=1;
  31697. if($core.assert($1)){
  31698. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31699. if($core.assert($2)){
  31700. $recv($self["@stream"])._next();
  31701. } else {
  31702. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31703. $3=$self["@last"];
  31704. throw $early=[$3];
  31705. }
  31706. }
  31707. return $recv(result)._nextPut_(char);
  31708. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31709. }));
  31710. $self["@last"]=nil;
  31711. $4=$self["@last"];
  31712. return $4;
  31713. }
  31714. catch(e) {if(e===$early)return e[0]; throw e}
  31715. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31716. },
  31717. args: [],
  31718. 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",
  31719. referencedClasses: [],
  31720. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31721. }),
  31722. $globals.ChunkParser);
  31723. $core.addMethod(
  31724. $core.method({
  31725. selector: "stream:",
  31726. protocol: "accessing",
  31727. fn: function (aStream){
  31728. var self=this,$self=this;
  31729. $self["@stream"]=aStream;
  31730. return self;
  31731. },
  31732. args: ["aStream"],
  31733. source: "stream: aStream\x0a\x09stream := aStream",
  31734. referencedClasses: [],
  31735. messageSends: []
  31736. }),
  31737. $globals.ChunkParser);
  31738. $core.addMethod(
  31739. $core.method({
  31740. selector: "on:",
  31741. protocol: "instance creation",
  31742. fn: function (aStream){
  31743. var self=this,$self=this;
  31744. return $core.withContext(function($ctx1) {
  31745. return $recv($self._new())._stream_(aStream);
  31746. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31747. },
  31748. args: ["aStream"],
  31749. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31750. referencedClasses: [],
  31751. messageSends: ["stream:", "new"]
  31752. }),
  31753. $globals.ChunkParser.a$cls);
  31754. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31755. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31756. $core.addMethod(
  31757. $core.method({
  31758. selector: "class:",
  31759. protocol: "accessing",
  31760. fn: function (aClass){
  31761. var self=this,$self=this;
  31762. $self["@class"]=aClass;
  31763. return self;
  31764. },
  31765. args: ["aClass"],
  31766. source: "class: aClass\x0a\x09class := aClass",
  31767. referencedClasses: [],
  31768. messageSends: []
  31769. }),
  31770. $globals.ClassCommentReader);
  31771. $core.addMethod(
  31772. $core.method({
  31773. selector: "initialize",
  31774. protocol: "initialization",
  31775. fn: function (){
  31776. var self=this,$self=this;
  31777. return $core.withContext(function($ctx1) {
  31778. (
  31779. $ctx1.supercall = true,
  31780. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31781. $ctx1.supercall = false;
  31782. return self;
  31783. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31784. },
  31785. args: [],
  31786. source: "initialize\x0a\x09super initialize.",
  31787. referencedClasses: [],
  31788. messageSends: ["initialize"]
  31789. }),
  31790. $globals.ClassCommentReader);
  31791. $core.addMethod(
  31792. $core.method({
  31793. selector: "scanFrom:",
  31794. protocol: "fileIn",
  31795. fn: function (aChunkParser){
  31796. var self=this,$self=this;
  31797. var chunk;
  31798. return $core.withContext(function($ctx1) {
  31799. chunk=$recv(aChunkParser)._nextChunk();
  31800. $recv(chunk)._ifNotEmpty_((function(){
  31801. return $core.withContext(function($ctx2) {
  31802. return $self._setComment_(chunk);
  31803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31804. }));
  31805. return self;
  31806. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31807. },
  31808. args: ["aChunkParser"],
  31809. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31810. referencedClasses: [],
  31811. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31812. }),
  31813. $globals.ClassCommentReader);
  31814. $core.addMethod(
  31815. $core.method({
  31816. selector: "setComment:",
  31817. protocol: "private",
  31818. fn: function (aString){
  31819. var self=this,$self=this;
  31820. return $core.withContext(function($ctx1) {
  31821. $recv($self["@class"])._comment_(aString);
  31822. return self;
  31823. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31824. },
  31825. args: ["aString"],
  31826. source: "setComment: aString\x0a\x09class comment: aString",
  31827. referencedClasses: [],
  31828. messageSends: ["comment:"]
  31829. }),
  31830. $globals.ClassCommentReader);
  31831. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31832. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31833. $core.addMethod(
  31834. $core.method({
  31835. selector: "class:category:",
  31836. protocol: "accessing",
  31837. fn: function (aClass,aString){
  31838. var self=this,$self=this;
  31839. $self["@class"]=aClass;
  31840. $self["@category"]=aString;
  31841. return self;
  31842. },
  31843. args: ["aClass", "aString"],
  31844. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31845. referencedClasses: [],
  31846. messageSends: []
  31847. }),
  31848. $globals.ClassProtocolReader);
  31849. $core.addMethod(
  31850. $core.method({
  31851. selector: "compileMethod:",
  31852. protocol: "private",
  31853. fn: function (aString){
  31854. var self=this,$self=this;
  31855. return $core.withContext(function($ctx1) {
  31856. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31857. return self;
  31858. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31859. },
  31860. args: ["aString"],
  31861. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31862. referencedClasses: ["Compiler"],
  31863. messageSends: ["install:forClass:protocol:", "new"]
  31864. }),
  31865. $globals.ClassProtocolReader);
  31866. $core.addMethod(
  31867. $core.method({
  31868. selector: "initialize",
  31869. protocol: "initialization",
  31870. fn: function (){
  31871. var self=this,$self=this;
  31872. return $core.withContext(function($ctx1) {
  31873. (
  31874. $ctx1.supercall = true,
  31875. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31876. $ctx1.supercall = false;
  31877. return self;
  31878. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31879. },
  31880. args: [],
  31881. source: "initialize\x0a\x09super initialize.",
  31882. referencedClasses: [],
  31883. messageSends: ["initialize"]
  31884. }),
  31885. $globals.ClassProtocolReader);
  31886. $core.addMethod(
  31887. $core.method({
  31888. selector: "scanFrom:",
  31889. protocol: "fileIn",
  31890. fn: function (aChunkParser){
  31891. var self=this,$self=this;
  31892. var chunk;
  31893. return $core.withContext(function($ctx1) {
  31894. $recv((function(){
  31895. return $core.withContext(function($ctx2) {
  31896. chunk=$recv(aChunkParser)._nextChunk();
  31897. return $recv(chunk)._isEmpty();
  31898. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31899. }))._whileFalse_((function(){
  31900. return $core.withContext(function($ctx2) {
  31901. return $self._compileMethod_(chunk);
  31902. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31903. }));
  31904. return self;
  31905. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31906. },
  31907. args: ["aChunkParser"],
  31908. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31909. referencedClasses: [],
  31910. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31911. }),
  31912. $globals.ClassProtocolReader);
  31913. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31914. $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.";
  31915. $core.addMethod(
  31916. $core.method({
  31917. selector: "methods",
  31918. protocol: "accessing",
  31919. fn: function (){
  31920. var self=this,$self=this;
  31921. return $core.withContext(function($ctx1) {
  31922. var $1;
  31923. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31924. return $core.withContext(function($ctx2) {
  31925. $1=$recv(a)._selector();
  31926. $ctx2.sendIdx["selector"]=1;
  31927. return $recv($1).__lt_eq($recv(b)._selector());
  31928. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31929. }));
  31930. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31931. },
  31932. args: [],
  31933. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31934. referencedClasses: [],
  31935. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31936. }),
  31937. $globals.ExportMethodProtocol);
  31938. $core.addMethod(
  31939. $core.method({
  31940. selector: "name",
  31941. protocol: "accessing",
  31942. fn: function (){
  31943. var self=this,$self=this;
  31944. return $self["@name"];
  31945. },
  31946. args: [],
  31947. source: "name\x0a\x09^ name",
  31948. referencedClasses: [],
  31949. messageSends: []
  31950. }),
  31951. $globals.ExportMethodProtocol);
  31952. $core.addMethod(
  31953. $core.method({
  31954. selector: "name:",
  31955. protocol: "accessing",
  31956. fn: function (aString){
  31957. var self=this,$self=this;
  31958. $self["@name"]=aString;
  31959. return self;
  31960. },
  31961. args: ["aString"],
  31962. source: "name: aString\x0a\x09name := aString",
  31963. referencedClasses: [],
  31964. messageSends: []
  31965. }),
  31966. $globals.ExportMethodProtocol);
  31967. $core.addMethod(
  31968. $core.method({
  31969. selector: "ownMethods",
  31970. protocol: "accessing",
  31971. fn: function (){
  31972. var self=this,$self=this;
  31973. return $core.withContext(function($ctx1) {
  31974. var $1;
  31975. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  31976. return $core.withContext(function($ctx2) {
  31977. $1=$recv(a)._selector();
  31978. $ctx2.sendIdx["selector"]=1;
  31979. return $recv($1).__lt_eq($recv(b)._selector());
  31980. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31981. }));
  31982. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  31983. },
  31984. args: [],
  31985. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31986. referencedClasses: [],
  31987. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  31988. }),
  31989. $globals.ExportMethodProtocol);
  31990. $core.addMethod(
  31991. $core.method({
  31992. selector: "theClass",
  31993. protocol: "accessing",
  31994. fn: function (){
  31995. var self=this,$self=this;
  31996. return $self["@theClass"];
  31997. },
  31998. args: [],
  31999. source: "theClass\x0a\x09^ theClass",
  32000. referencedClasses: [],
  32001. messageSends: []
  32002. }),
  32003. $globals.ExportMethodProtocol);
  32004. $core.addMethod(
  32005. $core.method({
  32006. selector: "theClass:",
  32007. protocol: "accessing",
  32008. fn: function (aClass){
  32009. var self=this,$self=this;
  32010. $self["@theClass"]=aClass;
  32011. return self;
  32012. },
  32013. args: ["aClass"],
  32014. source: "theClass: aClass\x0a\x09theClass := aClass",
  32015. referencedClasses: [],
  32016. messageSends: []
  32017. }),
  32018. $globals.ExportMethodProtocol);
  32019. $core.addMethod(
  32020. $core.method({
  32021. selector: "name:theClass:",
  32022. protocol: "instance creation",
  32023. fn: function (aString,aClass){
  32024. var self=this,$self=this;
  32025. return $core.withContext(function($ctx1) {
  32026. var $1;
  32027. $1=$self._new();
  32028. $recv($1)._name_(aString);
  32029. $recv($1)._theClass_(aClass);
  32030. return $recv($1)._yourself();
  32031. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  32032. },
  32033. args: ["aString", "aClass"],
  32034. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  32035. referencedClasses: [],
  32036. messageSends: ["name:", "new", "theClass:", "yourself"]
  32037. }),
  32038. $globals.ExportMethodProtocol.a$cls);
  32039. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  32040. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  32041. $core.addMethod(
  32042. $core.method({
  32043. selector: "import:",
  32044. protocol: "fileIn",
  32045. fn: function (aStream){
  32046. var self=this,$self=this;
  32047. var chunk,result,parser,lastEmpty;
  32048. return $core.withContext(function($ctx1) {
  32049. var $1;
  32050. parser=$recv($globals.ChunkParser)._on_(aStream);
  32051. lastEmpty=false;
  32052. $self["@lastSection"]="n/a, not started";
  32053. $self["@lastChunk"]=nil;
  32054. $recv((function(){
  32055. return $core.withContext(function($ctx2) {
  32056. $recv((function(){
  32057. return $core.withContext(function($ctx3) {
  32058. chunk=$recv(parser)._nextChunk();
  32059. return $recv(chunk)._isNil();
  32060. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32061. }))._whileFalse_((function(){
  32062. return $core.withContext(function($ctx3) {
  32063. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  32064. lastEmpty=true;
  32065. return lastEmpty;
  32066. }),(function(){
  32067. return $core.withContext(function($ctx4) {
  32068. $self["@lastSection"]=chunk;
  32069. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  32070. $1=lastEmpty;
  32071. if($core.assert($1)){
  32072. lastEmpty=false;
  32073. return $recv(result)._scanFrom_(parser);
  32074. }
  32075. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  32076. }));
  32077. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32078. }));
  32079. $self["@lastSection"]="n/a, finished";
  32080. return $self["@lastSection"];
  32081. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32082. }))._on_do_($globals.Error,(function(e){
  32083. return $core.withContext(function($ctx2) {
  32084. $self["@lastChunk"]=$recv(parser)._last();
  32085. return $recv(e)._pass();
  32086. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  32087. }));
  32088. return self;
  32089. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  32090. },
  32091. args: ["aStream"],
  32092. 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 pass ].",
  32093. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  32094. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  32095. }),
  32096. $globals.Importer);
  32097. $core.addMethod(
  32098. $core.method({
  32099. selector: "lastChunk",
  32100. protocol: "accessing",
  32101. fn: function (){
  32102. var self=this,$self=this;
  32103. return $self["@lastChunk"];
  32104. },
  32105. args: [],
  32106. source: "lastChunk\x0a\x09^ lastChunk",
  32107. referencedClasses: [],
  32108. messageSends: []
  32109. }),
  32110. $globals.Importer);
  32111. $core.addMethod(
  32112. $core.method({
  32113. selector: "lastSection",
  32114. protocol: "accessing",
  32115. fn: function (){
  32116. var self=this,$self=this;
  32117. return $self["@lastSection"];
  32118. },
  32119. args: [],
  32120. source: "lastSection\x0a\x09^ lastSection",
  32121. referencedClasses: [],
  32122. messageSends: []
  32123. }),
  32124. $globals.Importer);
  32125. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32126. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32127. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32128. $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.";
  32129. $core.addMethod(
  32130. $core.method({
  32131. selector: "ajaxPutAt:data:onSuccess:onError:",
  32132. protocol: "private",
  32133. fn: function (aURL,aString,aBlock,anotherBlock){
  32134. var self=this,$self=this;
  32135. var xhr;
  32136. return $core.withContext(function($ctx1) {
  32137. var $1,$4,$3,$2;
  32138. xhr=$recv($globals.Platform)._newXhr();
  32139. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32140. $recv(xhr)._onreadystatechange_((function(){
  32141. return $core.withContext(function($ctx2) {
  32142. $1=$recv($recv(xhr)._readyState()).__eq((4));
  32143. if($core.assert($1)){
  32144. $4=$recv(xhr)._status();
  32145. $ctx2.sendIdx["status"]=1;
  32146. $3=$recv($4).__gt_eq((200));
  32147. $2=$recv($3)._and_((function(){
  32148. return $core.withContext(function($ctx3) {
  32149. return $recv($recv(xhr)._status()).__lt((300));
  32150. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32151. }));
  32152. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32153. }
  32154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32155. }));
  32156. $recv(xhr)._send_(aString);
  32157. return self;
  32158. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32159. },
  32160. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32161. 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",
  32162. referencedClasses: ["Platform"],
  32163. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32164. }),
  32165. $globals.PackageHandler);
  32166. $core.addMethod(
  32167. $core.method({
  32168. selector: "chunkContentsFor:",
  32169. protocol: "accessing",
  32170. fn: function (aPackage){
  32171. var self=this,$self=this;
  32172. return $core.withContext(function($ctx1) {
  32173. return $recv($globals.String)._streamContents_((function(str){
  32174. return $core.withContext(function($ctx2) {
  32175. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32176. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32177. }));
  32178. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32179. },
  32180. args: ["aPackage"],
  32181. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32182. referencedClasses: ["String"],
  32183. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32184. }),
  32185. $globals.PackageHandler);
  32186. $core.addMethod(
  32187. $core.method({
  32188. selector: "chunkExporter",
  32189. protocol: "factory",
  32190. fn: function (){
  32191. var self=this,$self=this;
  32192. return $core.withContext(function($ctx1) {
  32193. return $recv($self._chunkExporterClass())._new();
  32194. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32195. },
  32196. args: [],
  32197. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32198. referencedClasses: [],
  32199. messageSends: ["new", "chunkExporterClass"]
  32200. }),
  32201. $globals.PackageHandler);
  32202. $core.addMethod(
  32203. $core.method({
  32204. selector: "chunkExporterClass",
  32205. protocol: "accessing",
  32206. fn: function (){
  32207. var self=this,$self=this;
  32208. return $globals.ChunkExporter;
  32209. },
  32210. args: [],
  32211. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32212. referencedClasses: ["ChunkExporter"],
  32213. messageSends: []
  32214. }),
  32215. $globals.PackageHandler);
  32216. $core.addMethod(
  32217. $core.method({
  32218. selector: "commit:",
  32219. protocol: "committing",
  32220. fn: function (aPackage){
  32221. var self=this,$self=this;
  32222. return $core.withContext(function($ctx1) {
  32223. var $1,$2;
  32224. $self._commit_onSuccess_onError_(aPackage,(function(){
  32225. }),(function(error){
  32226. return $core.withContext(function($ctx2) {
  32227. $1=$recv($globals.PackageCommitError)._new();
  32228. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32229. $ctx2.sendIdx[","]=1;
  32230. $recv($1)._messageText_($2);
  32231. return $recv($1)._signal();
  32232. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32233. }));
  32234. return self;
  32235. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32236. },
  32237. args: ["aPackage"],
  32238. 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 ]",
  32239. referencedClasses: ["PackageCommitError"],
  32240. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32241. }),
  32242. $globals.PackageHandler);
  32243. $core.addMethod(
  32244. $core.method({
  32245. selector: "commit:onSuccess:onError:",
  32246. protocol: "committing",
  32247. fn: function (aPackage,aBlock,anotherBlock){
  32248. var self=this,$self=this;
  32249. return $core.withContext(function($ctx1) {
  32250. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32251. return $core.withContext(function($ctx2) {
  32252. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32253. return $core.withContext(function($ctx3) {
  32254. $recv(aPackage)._beClean();
  32255. return $recv(aBlock)._value();
  32256. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32257. }),anotherBlock);
  32258. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32259. }),anotherBlock);
  32260. return self;
  32261. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32262. },
  32263. args: ["aPackage", "aBlock", "anotherBlock"],
  32264. 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",
  32265. referencedClasses: [],
  32266. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32267. }),
  32268. $globals.PackageHandler);
  32269. $core.addMethod(
  32270. $core.method({
  32271. selector: "commitJsFileFor:onSuccess:onError:",
  32272. protocol: "committing",
  32273. fn: function (aPackage,aBlock,anotherBlock){
  32274. var self=this,$self=this;
  32275. return $core.withContext(function($ctx1) {
  32276. var $2,$1;
  32277. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32278. $ctx1.sendIdx[","]=2;
  32279. $1=$recv($2).__comma(".js");
  32280. $ctx1.sendIdx[","]=1;
  32281. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32282. return self;
  32283. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32284. },
  32285. args: ["aPackage", "aBlock", "anotherBlock"],
  32286. 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",
  32287. referencedClasses: [],
  32288. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32289. }),
  32290. $globals.PackageHandler);
  32291. $core.addMethod(
  32292. $core.method({
  32293. selector: "commitPathJsFor:",
  32294. protocol: "accessing",
  32295. fn: function (aPackage){
  32296. var self=this,$self=this;
  32297. return $core.withContext(function($ctx1) {
  32298. $self._subclassResponsibility();
  32299. return self;
  32300. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32301. },
  32302. args: ["aPackage"],
  32303. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32304. referencedClasses: [],
  32305. messageSends: ["subclassResponsibility"]
  32306. }),
  32307. $globals.PackageHandler);
  32308. $core.addMethod(
  32309. $core.method({
  32310. selector: "commitPathStFor:",
  32311. protocol: "accessing",
  32312. fn: function (aPackage){
  32313. var self=this,$self=this;
  32314. return $core.withContext(function($ctx1) {
  32315. $self._subclassResponsibility();
  32316. return self;
  32317. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32318. },
  32319. args: ["aPackage"],
  32320. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32321. referencedClasses: [],
  32322. messageSends: ["subclassResponsibility"]
  32323. }),
  32324. $globals.PackageHandler);
  32325. $core.addMethod(
  32326. $core.method({
  32327. selector: "commitStFileFor:onSuccess:onError:",
  32328. protocol: "committing",
  32329. fn: function (aPackage,aBlock,anotherBlock){
  32330. var self=this,$self=this;
  32331. return $core.withContext(function($ctx1) {
  32332. var $2,$1;
  32333. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32334. $ctx1.sendIdx[","]=2;
  32335. $1=$recv($2).__comma(".st");
  32336. $ctx1.sendIdx[","]=1;
  32337. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32338. return self;
  32339. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32340. },
  32341. args: ["aPackage", "aBlock", "anotherBlock"],
  32342. 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",
  32343. referencedClasses: [],
  32344. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32345. }),
  32346. $globals.PackageHandler);
  32347. $core.addMethod(
  32348. $core.method({
  32349. selector: "contentsFor:",
  32350. protocol: "accessing",
  32351. fn: function (aPackage){
  32352. var self=this,$self=this;
  32353. return $core.withContext(function($ctx1) {
  32354. return $recv($globals.String)._streamContents_((function(str){
  32355. return $core.withContext(function($ctx2) {
  32356. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32357. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32358. }));
  32359. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32360. },
  32361. args: ["aPackage"],
  32362. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32363. referencedClasses: ["String"],
  32364. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32365. }),
  32366. $globals.PackageHandler);
  32367. $core.addMethod(
  32368. $core.method({
  32369. selector: "exporter",
  32370. protocol: "factory",
  32371. fn: function (){
  32372. var self=this,$self=this;
  32373. return $core.withContext(function($ctx1) {
  32374. return $recv($self._exporterClass())._new();
  32375. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32376. },
  32377. args: [],
  32378. source: "exporter\x0a\x09^ self exporterClass new",
  32379. referencedClasses: [],
  32380. messageSends: ["new", "exporterClass"]
  32381. }),
  32382. $globals.PackageHandler);
  32383. $core.addMethod(
  32384. $core.method({
  32385. selector: "exporterClass",
  32386. protocol: "accessing",
  32387. fn: function (){
  32388. var self=this,$self=this;
  32389. return $core.withContext(function($ctx1) {
  32390. $self._subclassResponsibility();
  32391. return self;
  32392. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32393. },
  32394. args: [],
  32395. source: "exporterClass\x0a\x09self subclassResponsibility",
  32396. referencedClasses: [],
  32397. messageSends: ["subclassResponsibility"]
  32398. }),
  32399. $globals.PackageHandler);
  32400. $core.addMethod(
  32401. $core.method({
  32402. selector: "load:",
  32403. protocol: "loading",
  32404. fn: function (aPackage){
  32405. var self=this,$self=this;
  32406. return $core.withContext(function($ctx1) {
  32407. $self._subclassResponsibility();
  32408. return self;
  32409. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32410. },
  32411. args: ["aPackage"],
  32412. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  32413. referencedClasses: [],
  32414. messageSends: ["subclassResponsibility"]
  32415. }),
  32416. $globals.PackageHandler);
  32417. $core.addMethod(
  32418. $core.method({
  32419. selector: "onCommitError:",
  32420. protocol: "error handling",
  32421. fn: function (anError){
  32422. var self=this,$self=this;
  32423. return $core.withContext(function($ctx1) {
  32424. var $1,$2;
  32425. $1=$recv($globals.PackageCommitError)._new();
  32426. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32427. $ctx1.sendIdx[","]=1;
  32428. $recv($1)._messageText_($2);
  32429. $recv($1)._signal();
  32430. return self;
  32431. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32432. },
  32433. args: ["anError"],
  32434. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32435. referencedClasses: ["PackageCommitError"],
  32436. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32437. }),
  32438. $globals.PackageHandler);
  32439. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32440. $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.";
  32441. $core.addMethod(
  32442. $core.method({
  32443. selector: "commitPathJsFor:",
  32444. protocol: "accessing",
  32445. fn: function (aPackage){
  32446. var self=this,$self=this;
  32447. return $core.withContext(function($ctx1) {
  32448. return $self._toUrl_($self._namespaceFor_(aPackage));
  32449. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32450. },
  32451. args: ["aPackage"],
  32452. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32453. referencedClasses: [],
  32454. messageSends: ["toUrl:", "namespaceFor:"]
  32455. }),
  32456. $globals.AmdPackageHandler);
  32457. $core.addMethod(
  32458. $core.method({
  32459. selector: "commitPathStFor:",
  32460. protocol: "accessing",
  32461. fn: function (aPackage){
  32462. var self=this,$self=this;
  32463. var path,pathWithout;
  32464. return $core.withContext(function($ctx1) {
  32465. var $1,$2;
  32466. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32467. $ctx1.sendIdx[","]=1;
  32468. path=$self._toUrl_($1);
  32469. pathWithout=$self._commitPathJsFor_(aPackage);
  32470. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32471. if($core.assert($2)){
  32472. return pathWithout;
  32473. } else {
  32474. return path;
  32475. }
  32476. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32477. },
  32478. args: ["aPackage"],
  32479. 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 ]",
  32480. referencedClasses: [],
  32481. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32482. }),
  32483. $globals.AmdPackageHandler);
  32484. $core.addMethod(
  32485. $core.method({
  32486. selector: "exporterClass",
  32487. protocol: "accessing",
  32488. fn: function (){
  32489. var self=this,$self=this;
  32490. return $globals.AmdExporter;
  32491. },
  32492. args: [],
  32493. source: "exporterClass\x0a\x09^ AmdExporter",
  32494. referencedClasses: ["AmdExporter"],
  32495. messageSends: []
  32496. }),
  32497. $globals.AmdPackageHandler);
  32498. $core.addMethod(
  32499. $core.method({
  32500. selector: "load:",
  32501. protocol: "loading",
  32502. fn: function (aPackage){
  32503. var self=this,$self=this;
  32504. return $core.withContext(function($ctx1) {
  32505. var $1,$3,$2,$receiver;
  32506. return $recv($globals.Promise)._new_((function(model){
  32507. return $core.withContext(function($ctx2) {
  32508. $1=$recv($globals.Smalltalk)._amdRequire();
  32509. if(($receiver = $1) == null || $receiver.a$nil){
  32510. return $self._error_("AMD loader not present");
  32511. } else {
  32512. var require;
  32513. require=$receiver;
  32514. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32515. $ctx2.sendIdx[","]=1;
  32516. $2=[$3];
  32517. return $recv(require)._value_value_value_($2,(function(result){
  32518. return $core.withContext(function($ctx3) {
  32519. return $recv(model)._value_(result);
  32520. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  32521. }),(function(error){
  32522. return $core.withContext(function($ctx3) {
  32523. return $recv(model)._signal_(error);
  32524. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  32525. }));
  32526. }
  32527. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  32528. }));
  32529. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32530. },
  32531. args: ["aPackage"],
  32532. source: "load: aPackage\x0a\x09^ Promise new: [ :model |\x0a\x09\x09Smalltalk amdRequire\x0a\x09\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09\x09ifNotNil: [ :require |\x0a\x09\x09\x09\x09require\x0a\x09\x09\x09\x09\x09value: { (self namespaceFor: aPackage), '/', aPackage name }\x0a\x09\x09\x09\x09\x09value: [ :result | model value: result ]\x0a\x09\x09\x09\x09\x09value: [ :error | model signal: error ] ] ]",
  32533. referencedClasses: ["Promise", "Smalltalk"],
  32534. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  32535. }),
  32536. $globals.AmdPackageHandler);
  32537. $core.addMethod(
  32538. $core.method({
  32539. selector: "namespaceFor:",
  32540. protocol: "committing",
  32541. fn: function (aPackage){
  32542. var self=this,$self=this;
  32543. return $core.withContext(function($ctx1) {
  32544. return $recv($recv(aPackage)._transport())._namespace();
  32545. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32546. },
  32547. args: ["aPackage"],
  32548. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32549. referencedClasses: [],
  32550. messageSends: ["namespace", "transport"]
  32551. }),
  32552. $globals.AmdPackageHandler);
  32553. $core.addMethod(
  32554. $core.method({
  32555. selector: "toUrl:",
  32556. protocol: "private",
  32557. fn: function (aString){
  32558. var self=this,$self=this;
  32559. return $core.withContext(function($ctx1) {
  32560. var $1,$receiver;
  32561. $1=$recv($globals.Smalltalk)._amdRequire();
  32562. if(($receiver = $1) == null || $receiver.a$nil){
  32563. return $self._error_("AMD loader not present");
  32564. } else {
  32565. var require;
  32566. require=$receiver;
  32567. return $recv($recv(require)._basicAt_("toUrl"))._value_(aString);
  32568. }
  32569. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32570. },
  32571. args: ["aString"],
  32572. 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 ]",
  32573. referencedClasses: ["Smalltalk"],
  32574. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "value:", "basicAt:"]
  32575. }),
  32576. $globals.AmdPackageHandler);
  32577. $core.addMethod(
  32578. $core.method({
  32579. selector: "defaultNamespace",
  32580. protocol: "commit paths",
  32581. fn: function (){
  32582. var self=this,$self=this;
  32583. return $core.withContext(function($ctx1) {
  32584. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32585. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32586. },
  32587. args: [],
  32588. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32589. referencedClasses: ["Smalltalk"],
  32590. messageSends: ["defaultAmdNamespace"]
  32591. }),
  32592. $globals.AmdPackageHandler.a$cls);
  32593. $core.addMethod(
  32594. $core.method({
  32595. selector: "defaultNamespace:",
  32596. protocol: "commit paths",
  32597. fn: function (aString){
  32598. var self=this,$self=this;
  32599. return $core.withContext(function($ctx1) {
  32600. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32601. return self;
  32602. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32603. },
  32604. args: ["aString"],
  32605. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32606. referencedClasses: ["Smalltalk"],
  32607. messageSends: ["defaultAmdNamespace:"]
  32608. }),
  32609. $globals.AmdPackageHandler.a$cls);
  32610. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32611. $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.";
  32612. $core.addMethod(
  32613. $core.method({
  32614. selector: "asJavaScriptObject",
  32615. protocol: "converting",
  32616. fn: function (){
  32617. var self=this,$self=this;
  32618. return $core.withContext(function($ctx1) {
  32619. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32620. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32621. },
  32622. args: [],
  32623. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32624. referencedClasses: [],
  32625. messageSends: ["type"]
  32626. }),
  32627. $globals.PackageTransport);
  32628. $core.addMethod(
  32629. $core.method({
  32630. selector: "commit",
  32631. protocol: "committing",
  32632. fn: function (){
  32633. var self=this,$self=this;
  32634. return $core.withContext(function($ctx1) {
  32635. $recv($self._commitHandler())._commit_($self._package());
  32636. return self;
  32637. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32638. },
  32639. args: [],
  32640. source: "commit\x0a\x09self commitHandler commit: self package",
  32641. referencedClasses: [],
  32642. messageSends: ["commit:", "commitHandler", "package"]
  32643. }),
  32644. $globals.PackageTransport);
  32645. $core.addMethod(
  32646. $core.method({
  32647. selector: "commitHandler",
  32648. protocol: "factory",
  32649. fn: function (){
  32650. var self=this,$self=this;
  32651. return $core.withContext(function($ctx1) {
  32652. return $recv($self._commitHandlerClass())._new();
  32653. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32654. },
  32655. args: [],
  32656. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32657. referencedClasses: [],
  32658. messageSends: ["new", "commitHandlerClass"]
  32659. }),
  32660. $globals.PackageTransport);
  32661. $core.addMethod(
  32662. $core.method({
  32663. selector: "commitHandlerClass",
  32664. protocol: "accessing",
  32665. fn: function (){
  32666. var self=this,$self=this;
  32667. return $core.withContext(function($ctx1) {
  32668. $self._subclassResponsibility();
  32669. return self;
  32670. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32671. },
  32672. args: [],
  32673. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32674. referencedClasses: [],
  32675. messageSends: ["subclassResponsibility"]
  32676. }),
  32677. $globals.PackageTransport);
  32678. $core.addMethod(
  32679. $core.method({
  32680. selector: "commitOnSuccess:onError:",
  32681. protocol: "committing",
  32682. fn: function (aBlock,anotherBlock){
  32683. var self=this,$self=this;
  32684. return $core.withContext(function($ctx1) {
  32685. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32686. return self;
  32687. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32688. },
  32689. args: ["aBlock", "anotherBlock"],
  32690. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32691. referencedClasses: [],
  32692. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32693. }),
  32694. $globals.PackageTransport);
  32695. $core.addMethod(
  32696. $core.method({
  32697. selector: "definition",
  32698. protocol: "accessing",
  32699. fn: function (){
  32700. var self=this,$self=this;
  32701. return "";
  32702. },
  32703. args: [],
  32704. source: "definition\x0a\x09^ ''",
  32705. referencedClasses: [],
  32706. messageSends: []
  32707. }),
  32708. $globals.PackageTransport);
  32709. $core.addMethod(
  32710. $core.method({
  32711. selector: "load",
  32712. protocol: "loading",
  32713. fn: function (){
  32714. var self=this,$self=this;
  32715. return $core.withContext(function($ctx1) {
  32716. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  32717. return $core.withContext(function($ctx2) {
  32718. return $recv($globals.Smalltalk)._postLoad();
  32719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32720. }));
  32721. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32722. },
  32723. args: [],
  32724. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  32725. referencedClasses: ["Smalltalk"],
  32726. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  32727. }),
  32728. $globals.PackageTransport);
  32729. $core.addMethod(
  32730. $core.method({
  32731. selector: "package",
  32732. protocol: "accessing",
  32733. fn: function (){
  32734. var self=this,$self=this;
  32735. return $self["@package"];
  32736. },
  32737. args: [],
  32738. source: "package\x0a\x09^ package",
  32739. referencedClasses: [],
  32740. messageSends: []
  32741. }),
  32742. $globals.PackageTransport);
  32743. $core.addMethod(
  32744. $core.method({
  32745. selector: "package:",
  32746. protocol: "accessing",
  32747. fn: function (aPackage){
  32748. var self=this,$self=this;
  32749. $self["@package"]=aPackage;
  32750. return self;
  32751. },
  32752. args: ["aPackage"],
  32753. source: "package: aPackage\x0a\x09package := aPackage",
  32754. referencedClasses: [],
  32755. messageSends: []
  32756. }),
  32757. $globals.PackageTransport);
  32758. $core.addMethod(
  32759. $core.method({
  32760. selector: "setupFromJson:",
  32761. protocol: "initialization",
  32762. fn: function (anObject){
  32763. var self=this,$self=this;
  32764. return self;
  32765. },
  32766. args: ["anObject"],
  32767. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32768. referencedClasses: [],
  32769. messageSends: []
  32770. }),
  32771. $globals.PackageTransport);
  32772. $core.addMethod(
  32773. $core.method({
  32774. selector: "type",
  32775. protocol: "accessing",
  32776. fn: function (){
  32777. var self=this,$self=this;
  32778. return $core.withContext(function($ctx1) {
  32779. return $recv($self._class())._type();
  32780. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32781. },
  32782. args: [],
  32783. source: "type\x0a\x09^ self class type",
  32784. referencedClasses: [],
  32785. messageSends: ["type", "class"]
  32786. }),
  32787. $globals.PackageTransport);
  32788. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32789. $core.addMethod(
  32790. $core.method({
  32791. selector: "classRegisteredFor:",
  32792. protocol: "accessing",
  32793. fn: function (aString){
  32794. var self=this,$self=this;
  32795. return $core.withContext(function($ctx1) {
  32796. return $recv($self["@registry"])._at_(aString);
  32797. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32798. },
  32799. args: ["aString"],
  32800. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32801. referencedClasses: [],
  32802. messageSends: ["at:"]
  32803. }),
  32804. $globals.PackageTransport.a$cls);
  32805. $core.addMethod(
  32806. $core.method({
  32807. selector: "defaultType",
  32808. protocol: "accessing",
  32809. fn: function (){
  32810. var self=this,$self=this;
  32811. return $core.withContext(function($ctx1) {
  32812. return $recv($globals.AmdPackageTransport)._type();
  32813. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32814. },
  32815. args: [],
  32816. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32817. referencedClasses: ["AmdPackageTransport"],
  32818. messageSends: ["type"]
  32819. }),
  32820. $globals.PackageTransport.a$cls);
  32821. $core.addMethod(
  32822. $core.method({
  32823. selector: "for:",
  32824. protocol: "instance creation",
  32825. fn: function (aString){
  32826. var self=this,$self=this;
  32827. return $core.withContext(function($ctx1) {
  32828. return $recv($self._classRegisteredFor_(aString))._new();
  32829. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32830. },
  32831. args: ["aString"],
  32832. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32833. referencedClasses: [],
  32834. messageSends: ["new", "classRegisteredFor:"]
  32835. }),
  32836. $globals.PackageTransport.a$cls);
  32837. $core.addMethod(
  32838. $core.method({
  32839. selector: "fromJson:",
  32840. protocol: "instance creation",
  32841. fn: function (anObject){
  32842. var self=this,$self=this;
  32843. return $core.withContext(function($ctx1) {
  32844. var $1,$2,$receiver;
  32845. if(($receiver = anObject) == null || $receiver.a$nil){
  32846. $1=$self._for_($self._defaultType());
  32847. $ctx1.sendIdx["for:"]=1;
  32848. return $1;
  32849. } else {
  32850. anObject;
  32851. }
  32852. $2=$self._for_($recv(anObject)._type());
  32853. $recv($2)._setupFromJson_(anObject);
  32854. return $recv($2)._yourself();
  32855. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32856. },
  32857. args: ["anObject"],
  32858. 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",
  32859. referencedClasses: [],
  32860. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32861. }),
  32862. $globals.PackageTransport.a$cls);
  32863. $core.addMethod(
  32864. $core.method({
  32865. selector: "initialize",
  32866. protocol: "initialization",
  32867. fn: function (){
  32868. var self=this,$self=this;
  32869. return $core.withContext(function($ctx1) {
  32870. var $1;
  32871. (
  32872. $ctx1.supercall = true,
  32873. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32874. $ctx1.supercall = false;
  32875. $1=$self.__eq_eq($globals.PackageTransport);
  32876. if($core.assert($1)){
  32877. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32878. $self["@registry"];
  32879. } else {
  32880. $self._register();
  32881. }
  32882. return self;
  32883. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32884. },
  32885. args: [],
  32886. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32887. referencedClasses: ["PackageTransport"],
  32888. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32889. }),
  32890. $globals.PackageTransport.a$cls);
  32891. $core.addMethod(
  32892. $core.method({
  32893. selector: "register",
  32894. protocol: "registration",
  32895. fn: function (){
  32896. var self=this,$self=this;
  32897. return $core.withContext(function($ctx1) {
  32898. $recv($globals.PackageTransport)._register_(self);
  32899. return self;
  32900. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32901. },
  32902. args: [],
  32903. source: "register\x0a\x09PackageTransport register: self",
  32904. referencedClasses: ["PackageTransport"],
  32905. messageSends: ["register:"]
  32906. }),
  32907. $globals.PackageTransport.a$cls);
  32908. $core.addMethod(
  32909. $core.method({
  32910. selector: "register:",
  32911. protocol: "registration",
  32912. fn: function (aClass){
  32913. var self=this,$self=this;
  32914. return $core.withContext(function($ctx1) {
  32915. var $1,$receiver;
  32916. $1=$recv(aClass)._type();
  32917. $ctx1.sendIdx["type"]=1;
  32918. if(($receiver = $1) == null || $receiver.a$nil){
  32919. $1;
  32920. } else {
  32921. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32922. }
  32923. return self;
  32924. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32925. },
  32926. args: ["aClass"],
  32927. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32928. referencedClasses: [],
  32929. messageSends: ["ifNotNil:", "type", "at:put:"]
  32930. }),
  32931. $globals.PackageTransport.a$cls);
  32932. $core.addMethod(
  32933. $core.method({
  32934. selector: "type",
  32935. protocol: "accessing",
  32936. fn: function (){
  32937. var self=this,$self=this;
  32938. return nil;
  32939. },
  32940. args: [],
  32941. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32942. referencedClasses: [],
  32943. messageSends: []
  32944. }),
  32945. $globals.PackageTransport.a$cls);
  32946. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32947. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32948. $core.addMethod(
  32949. $core.method({
  32950. selector: "asJavaScriptObject",
  32951. protocol: "converting",
  32952. fn: function (){
  32953. var self=this,$self=this;
  32954. return $core.withContext(function($ctx1) {
  32955. var $1;
  32956. $1=(
  32957. $ctx1.supercall = true,
  32958. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32959. $ctx1.supercall = false;
  32960. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32961. return $recv($1)._yourself();
  32962. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32963. },
  32964. args: [],
  32965. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32966. referencedClasses: [],
  32967. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  32968. }),
  32969. $globals.AmdPackageTransport);
  32970. $core.addMethod(
  32971. $core.method({
  32972. selector: "commitHandlerClass",
  32973. protocol: "accessing",
  32974. fn: function (){
  32975. var self=this,$self=this;
  32976. return $globals.AmdPackageHandler;
  32977. },
  32978. args: [],
  32979. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  32980. referencedClasses: ["AmdPackageHandler"],
  32981. messageSends: []
  32982. }),
  32983. $globals.AmdPackageTransport);
  32984. $core.addMethod(
  32985. $core.method({
  32986. selector: "defaultNamespace",
  32987. protocol: "defaults",
  32988. fn: function (){
  32989. var self=this,$self=this;
  32990. return $core.withContext(function($ctx1) {
  32991. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32992. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  32993. },
  32994. args: [],
  32995. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32996. referencedClasses: ["Smalltalk"],
  32997. messageSends: ["defaultAmdNamespace"]
  32998. }),
  32999. $globals.AmdPackageTransport);
  33000. $core.addMethod(
  33001. $core.method({
  33002. selector: "definition",
  33003. protocol: "accessing",
  33004. fn: function (){
  33005. var self=this,$self=this;
  33006. return $core.withContext(function($ctx1) {
  33007. return $recv($globals.String)._streamContents_((function(stream){
  33008. return $core.withContext(function($ctx2) {
  33009. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  33010. return $recv(stream)._print_($self._namespace());
  33011. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  33012. }));
  33013. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  33014. },
  33015. args: [],
  33016. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  33017. referencedClasses: ["String"],
  33018. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  33019. }),
  33020. $globals.AmdPackageTransport);
  33021. $core.addMethod(
  33022. $core.method({
  33023. selector: "namespace",
  33024. protocol: "accessing",
  33025. fn: function (){
  33026. var self=this,$self=this;
  33027. return $core.withContext(function($ctx1) {
  33028. var $1,$receiver;
  33029. $1=$self["@namespace"];
  33030. if(($receiver = $1) == null || $receiver.a$nil){
  33031. return $self._defaultNamespace();
  33032. } else {
  33033. return $1;
  33034. }
  33035. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  33036. },
  33037. args: [],
  33038. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  33039. referencedClasses: [],
  33040. messageSends: ["ifNil:", "defaultNamespace"]
  33041. }),
  33042. $globals.AmdPackageTransport);
  33043. $core.addMethod(
  33044. $core.method({
  33045. selector: "namespace:",
  33046. protocol: "accessing",
  33047. fn: function (aString){
  33048. var self=this,$self=this;
  33049. $self["@namespace"]=aString;
  33050. return self;
  33051. },
  33052. args: ["aString"],
  33053. source: "namespace: aString\x0a\x09namespace := aString",
  33054. referencedClasses: [],
  33055. messageSends: []
  33056. }),
  33057. $globals.AmdPackageTransport);
  33058. $core.addMethod(
  33059. $core.method({
  33060. selector: "printOn:",
  33061. protocol: "printing",
  33062. fn: function (aStream){
  33063. var self=this,$self=this;
  33064. return $core.withContext(function($ctx1) {
  33065. (
  33066. $ctx1.supercall = true,
  33067. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  33068. $ctx1.supercall = false;
  33069. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  33070. $ctx1.sendIdx["nextPutAll:"]=1;
  33071. $recv(aStream)._nextPutAll_($self._namespace());
  33072. $ctx1.sendIdx["nextPutAll:"]=2;
  33073. $recv(aStream)._nextPutAll_(")");
  33074. return self;
  33075. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  33076. },
  33077. args: ["aStream"],
  33078. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  33079. referencedClasses: [],
  33080. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  33081. }),
  33082. $globals.AmdPackageTransport);
  33083. $core.addMethod(
  33084. $core.method({
  33085. selector: "setPath:",
  33086. protocol: "actions",
  33087. fn: function (aString){
  33088. var self=this,$self=this;
  33089. return $core.withContext(function($ctx1) {
  33090. $recv($recv(require)._basicAt_("config"))._value_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  33091. return self;
  33092. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  33093. },
  33094. args: ["aString"],
  33095. 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}.",
  33096. referencedClasses: [],
  33097. messageSends: ["value:", "basicAt:", "namespace"]
  33098. }),
  33099. $globals.AmdPackageTransport);
  33100. $core.addMethod(
  33101. $core.method({
  33102. selector: "setupFromJson:",
  33103. protocol: "initialization",
  33104. fn: function (anObject){
  33105. var self=this,$self=this;
  33106. return $core.withContext(function($ctx1) {
  33107. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  33108. return self;
  33109. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  33110. },
  33111. args: ["anObject"],
  33112. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  33113. referencedClasses: [],
  33114. messageSends: ["namespace:", "at:"]
  33115. }),
  33116. $globals.AmdPackageTransport);
  33117. $core.addMethod(
  33118. $core.method({
  33119. selector: "namespace:",
  33120. protocol: "instance creation",
  33121. fn: function (aString){
  33122. var self=this,$self=this;
  33123. return $core.withContext(function($ctx1) {
  33124. var $1;
  33125. $1=$self._new();
  33126. $recv($1)._namespace_(aString);
  33127. return $recv($1)._yourself();
  33128. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  33129. },
  33130. args: ["aString"],
  33131. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33132. referencedClasses: [],
  33133. messageSends: ["namespace:", "new", "yourself"]
  33134. }),
  33135. $globals.AmdPackageTransport.a$cls);
  33136. $core.addMethod(
  33137. $core.method({
  33138. selector: "type",
  33139. protocol: "accessing",
  33140. fn: function (){
  33141. var self=this,$self=this;
  33142. return "amd";
  33143. },
  33144. args: [],
  33145. source: "type\x0a\x09^ 'amd'",
  33146. referencedClasses: [],
  33147. messageSends: []
  33148. }),
  33149. $globals.AmdPackageTransport.a$cls);
  33150. $core.addMethod(
  33151. $core.method({
  33152. selector: "exportBehaviorDefinitionTo:using:",
  33153. protocol: "*Platform-ImportExport",
  33154. fn: function (aStream,anExporter){
  33155. var self=this,$self=this;
  33156. return $core.withContext(function($ctx1) {
  33157. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33158. return self;
  33159. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  33160. },
  33161. args: ["aStream", "anExporter"],
  33162. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33163. referencedClasses: [],
  33164. messageSends: ["exportDefinitionOf:on:"]
  33165. }),
  33166. $globals.Class);
  33167. $core.addMethod(
  33168. $core.method({
  33169. selector: "exportBehaviorDefinitionTo:using:",
  33170. protocol: "*Platform-ImportExport",
  33171. fn: function (aStream,anExporter){
  33172. var self=this,$self=this;
  33173. return $core.withContext(function($ctx1) {
  33174. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33175. return self;
  33176. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33177. },
  33178. args: ["aStream", "anExporter"],
  33179. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33180. referencedClasses: [],
  33181. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33182. }),
  33183. $globals.Metaclass);
  33184. $core.addMethod(
  33185. $core.method({
  33186. selector: "commit",
  33187. protocol: "*Platform-ImportExport",
  33188. fn: function (){
  33189. var self=this,$self=this;
  33190. return $core.withContext(function($ctx1) {
  33191. return $recv($self._transport())._commit();
  33192. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33193. },
  33194. args: [],
  33195. source: "commit\x0a\x09^ self transport commit",
  33196. referencedClasses: [],
  33197. messageSends: ["commit", "transport"]
  33198. }),
  33199. $globals.Package);
  33200. $core.addMethod(
  33201. $core.method({
  33202. selector: "load",
  33203. protocol: "*Platform-ImportExport",
  33204. fn: function (){
  33205. var self=this,$self=this;
  33206. return $core.withContext(function($ctx1) {
  33207. return $recv($self._transport())._load();
  33208. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33209. },
  33210. args: [],
  33211. source: "load\x0a\x09^ self transport load",
  33212. referencedClasses: [],
  33213. messageSends: ["load", "transport"]
  33214. }),
  33215. $globals.Package);
  33216. $core.addMethod(
  33217. $core.method({
  33218. selector: "loadFromNamespace:",
  33219. protocol: "*Platform-ImportExport",
  33220. fn: function (aString){
  33221. var self=this,$self=this;
  33222. return $core.withContext(function($ctx1) {
  33223. var $1;
  33224. $1=$self._transport();
  33225. $recv($1)._namespace_(aString);
  33226. return $recv($1)._load();
  33227. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33228. },
  33229. args: ["aString"],
  33230. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33231. referencedClasses: [],
  33232. messageSends: ["namespace:", "transport", "load"]
  33233. }),
  33234. $globals.Package);
  33235. $core.addMethod(
  33236. $core.method({
  33237. selector: "load:",
  33238. protocol: "*Platform-ImportExport",
  33239. fn: function (aPackageName){
  33240. var self=this,$self=this;
  33241. return $core.withContext(function($ctx1) {
  33242. return $recv($self._named_(aPackageName))._load();
  33243. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33244. },
  33245. args: ["aPackageName"],
  33246. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  33247. referencedClasses: [],
  33248. messageSends: ["load", "named:"]
  33249. }),
  33250. $globals.Package.a$cls);
  33251. $core.addMethod(
  33252. $core.method({
  33253. selector: "load:fromNamespace:",
  33254. protocol: "*Platform-ImportExport",
  33255. fn: function (aPackageName,aString){
  33256. var self=this,$self=this;
  33257. return $core.withContext(function($ctx1) {
  33258. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33259. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33260. },
  33261. args: ["aPackageName", "aString"],
  33262. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  33263. referencedClasses: [],
  33264. messageSends: ["loadFromNamespace:", "named:"]
  33265. }),
  33266. $globals.Package.a$cls);
  33267. $core.addMethod(
  33268. $core.method({
  33269. selector: "methodsFor:",
  33270. protocol: "*Platform-ImportExport",
  33271. fn: function (aString){
  33272. var self=this,$self=this;
  33273. return $core.withContext(function($ctx1) {
  33274. var $1;
  33275. $1=$recv($globals.ClassProtocolReader)._new();
  33276. $recv($1)._class_category_(self,aString);
  33277. return $recv($1)._yourself();
  33278. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33279. },
  33280. args: ["aString"],
  33281. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33282. referencedClasses: ["ClassProtocolReader"],
  33283. messageSends: ["class:category:", "new", "yourself"]
  33284. }),
  33285. $globals.TBehaviorProvider);
  33286. $core.addMethod(
  33287. $core.method({
  33288. selector: "methodsFor:stamp:",
  33289. protocol: "*Platform-ImportExport",
  33290. fn: function (aString,aStamp){
  33291. var self=this,$self=this;
  33292. return $core.withContext(function($ctx1) {
  33293. return $self._methodsFor_(aString);
  33294. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33295. },
  33296. args: ["aString", "aStamp"],
  33297. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33298. referencedClasses: [],
  33299. messageSends: ["methodsFor:"]
  33300. }),
  33301. $globals.TBehaviorProvider);
  33302. $core.addMethod(
  33303. $core.method({
  33304. selector: "commentStamp",
  33305. protocol: "*Platform-ImportExport",
  33306. fn: function (){
  33307. var self=this,$self=this;
  33308. return $core.withContext(function($ctx1) {
  33309. var $1;
  33310. $1=$recv($globals.ClassCommentReader)._new();
  33311. $recv($1)._class_(self);
  33312. return $recv($1)._yourself();
  33313. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33314. },
  33315. args: [],
  33316. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33317. referencedClasses: ["ClassCommentReader"],
  33318. messageSends: ["class:", "new", "yourself"]
  33319. }),
  33320. $globals.TMasterBehavior);
  33321. $core.addMethod(
  33322. $core.method({
  33323. selector: "commentStamp:prior:",
  33324. protocol: "*Platform-ImportExport",
  33325. fn: function (aStamp,prior){
  33326. var self=this,$self=this;
  33327. return $core.withContext(function($ctx1) {
  33328. return $self._commentStamp();
  33329. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33330. },
  33331. args: ["aStamp", "prior"],
  33332. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33333. referencedClasses: [],
  33334. messageSends: ["commentStamp"]
  33335. }),
  33336. $globals.TMasterBehavior);
  33337. $core.addMethod(
  33338. $core.method({
  33339. selector: "exportBehaviorDefinitionTo:using:",
  33340. protocol: "*Platform-ImportExport",
  33341. fn: function (aStream,anExporter){
  33342. var self=this,$self=this;
  33343. return $core.withContext(function($ctx1) {
  33344. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33345. return self;
  33346. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33347. },
  33348. args: ["aStream", "anExporter"],
  33349. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33350. referencedClasses: [],
  33351. messageSends: ["exportTraitDefinitionOf:on:"]
  33352. }),
  33353. $globals.Trait);
  33354. });
  33355. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods"], function($boot){"use strict";
  33356. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33357. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33358. $core.addPackage("Compiler-AST");
  33359. ($core.packageDescriptors||$core.packages)["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  33360. ($core.packageDescriptors||$core.packages)["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33361. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33362. $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.";
  33363. $core.addMethod(
  33364. $core.method({
  33365. selector: "inPosition:",
  33366. protocol: "testing",
  33367. fn: function (aPoint){
  33368. var self=this,$self=this;
  33369. return $core.withContext(function($ctx1) {
  33370. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33371. return $core.withContext(function($ctx2) {
  33372. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33374. }));
  33375. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33376. },
  33377. args: ["aPoint"],
  33378. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33379. referencedClasses: [],
  33380. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33381. }),
  33382. $globals.ASTNode);
  33383. $core.addMethod(
  33384. $core.method({
  33385. selector: "isAssignmentNode",
  33386. protocol: "testing",
  33387. fn: function (){
  33388. var self=this,$self=this;
  33389. return false;
  33390. },
  33391. args: [],
  33392. source: "isAssignmentNode\x0a\x09^ false",
  33393. referencedClasses: [],
  33394. messageSends: []
  33395. }),
  33396. $globals.ASTNode);
  33397. $core.addMethod(
  33398. $core.method({
  33399. selector: "isBlockNode",
  33400. protocol: "testing",
  33401. fn: function (){
  33402. var self=this,$self=this;
  33403. return false;
  33404. },
  33405. args: [],
  33406. source: "isBlockNode\x0a\x09^ false",
  33407. referencedClasses: [],
  33408. messageSends: []
  33409. }),
  33410. $globals.ASTNode);
  33411. $core.addMethod(
  33412. $core.method({
  33413. selector: "isBlockSequenceNode",
  33414. protocol: "testing",
  33415. fn: function (){
  33416. var self=this,$self=this;
  33417. return false;
  33418. },
  33419. args: [],
  33420. source: "isBlockSequenceNode\x0a\x09^ false",
  33421. referencedClasses: [],
  33422. messageSends: []
  33423. }),
  33424. $globals.ASTNode);
  33425. $core.addMethod(
  33426. $core.method({
  33427. selector: "isCascadeNode",
  33428. protocol: "testing",
  33429. fn: function (){
  33430. var self=this,$self=this;
  33431. return false;
  33432. },
  33433. args: [],
  33434. source: "isCascadeNode\x0a\x09^ false",
  33435. referencedClasses: [],
  33436. messageSends: []
  33437. }),
  33438. $globals.ASTNode);
  33439. $core.addMethod(
  33440. $core.method({
  33441. selector: "isImmutable",
  33442. protocol: "testing",
  33443. fn: function (){
  33444. var self=this,$self=this;
  33445. return false;
  33446. },
  33447. args: [],
  33448. source: "isImmutable\x0a\x09^ false",
  33449. referencedClasses: [],
  33450. messageSends: []
  33451. }),
  33452. $globals.ASTNode);
  33453. $core.addMethod(
  33454. $core.method({
  33455. selector: "isJSStatementNode",
  33456. protocol: "testing",
  33457. fn: function (){
  33458. var self=this,$self=this;
  33459. return false;
  33460. },
  33461. args: [],
  33462. source: "isJSStatementNode\x0a\x09^ false",
  33463. referencedClasses: [],
  33464. messageSends: []
  33465. }),
  33466. $globals.ASTNode);
  33467. $core.addMethod(
  33468. $core.method({
  33469. selector: "isNavigationNode",
  33470. protocol: "testing",
  33471. fn: function (){
  33472. var self=this,$self=this;
  33473. return false;
  33474. },
  33475. args: [],
  33476. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  33477. referencedClasses: [],
  33478. messageSends: []
  33479. }),
  33480. $globals.ASTNode);
  33481. $core.addMethod(
  33482. $core.method({
  33483. selector: "isReturnNode",
  33484. protocol: "testing",
  33485. fn: function (){
  33486. var self=this,$self=this;
  33487. return false;
  33488. },
  33489. args: [],
  33490. source: "isReturnNode\x0a\x09^ false",
  33491. referencedClasses: [],
  33492. messageSends: []
  33493. }),
  33494. $globals.ASTNode);
  33495. $core.addMethod(
  33496. $core.method({
  33497. selector: "isSendNode",
  33498. protocol: "testing",
  33499. fn: function (){
  33500. var self=this,$self=this;
  33501. return false;
  33502. },
  33503. args: [],
  33504. source: "isSendNode\x0a\x09^ false",
  33505. referencedClasses: [],
  33506. messageSends: []
  33507. }),
  33508. $globals.ASTNode);
  33509. $core.addMethod(
  33510. $core.method({
  33511. selector: "isSequenceNode",
  33512. protocol: "testing",
  33513. fn: function (){
  33514. var self=this,$self=this;
  33515. return false;
  33516. },
  33517. args: [],
  33518. source: "isSequenceNode\x0a\x09^ false",
  33519. referencedClasses: [],
  33520. messageSends: []
  33521. }),
  33522. $globals.ASTNode);
  33523. $core.addMethod(
  33524. $core.method({
  33525. selector: "isSuperKeyword",
  33526. protocol: "testing",
  33527. fn: function (){
  33528. var self=this,$self=this;
  33529. return false;
  33530. },
  33531. args: [],
  33532. source: "isSuperKeyword\x0a\x09^ false",
  33533. referencedClasses: [],
  33534. messageSends: []
  33535. }),
  33536. $globals.ASTNode);
  33537. $core.addMethod(
  33538. $core.method({
  33539. selector: "isValueNode",
  33540. protocol: "testing",
  33541. fn: function (){
  33542. var self=this,$self=this;
  33543. return false;
  33544. },
  33545. args: [],
  33546. source: "isValueNode\x0a\x09^ false",
  33547. referencedClasses: [],
  33548. messageSends: []
  33549. }),
  33550. $globals.ASTNode);
  33551. $core.addMethod(
  33552. $core.method({
  33553. selector: "isVariableNode",
  33554. protocol: "testing",
  33555. fn: function (){
  33556. var self=this,$self=this;
  33557. return false;
  33558. },
  33559. args: [],
  33560. source: "isVariableNode\x0a\x09^ false",
  33561. referencedClasses: [],
  33562. messageSends: []
  33563. }),
  33564. $globals.ASTNode);
  33565. $core.addMethod(
  33566. $core.method({
  33567. selector: "location:",
  33568. protocol: "accessing",
  33569. fn: function (aLocation){
  33570. var self=this,$self=this;
  33571. return $core.withContext(function($ctx1) {
  33572. var $3,$2,$1;
  33573. $3=$recv(aLocation)._start();
  33574. $ctx1.sendIdx["start"]=1;
  33575. $2=$recv($3)._line();
  33576. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33577. $self._position_($1);
  33578. return self;
  33579. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33580. },
  33581. args: ["aLocation"],
  33582. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33583. referencedClasses: [],
  33584. messageSends: ["position:", "@", "line", "start", "column"]
  33585. }),
  33586. $globals.ASTNode);
  33587. $core.addMethod(
  33588. $core.method({
  33589. selector: "method",
  33590. protocol: "accessing",
  33591. fn: function (){
  33592. var self=this,$self=this;
  33593. return $core.withContext(function($ctx1) {
  33594. var $1,$receiver;
  33595. $1=$self._parent();
  33596. if(($receiver = $1) == null || $receiver.a$nil){
  33597. return $1;
  33598. } else {
  33599. var node;
  33600. node=$receiver;
  33601. return $recv(node)._method();
  33602. }
  33603. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33604. },
  33605. args: [],
  33606. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33607. referencedClasses: [],
  33608. messageSends: ["ifNotNil:", "parent", "method"]
  33609. }),
  33610. $globals.ASTNode);
  33611. $core.addMethod(
  33612. $core.method({
  33613. selector: "navigationNodeAt:ifAbsent:",
  33614. protocol: "accessing",
  33615. fn: function (aPoint,aBlock){
  33616. var self=this,$self=this;
  33617. var children;
  33618. return $core.withContext(function($ctx1) {
  33619. var $2,$1;
  33620. var $early={};
  33621. try {
  33622. children=$recv($self._allDagChildren())._select_((function(each){
  33623. return $core.withContext(function($ctx2) {
  33624. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33625. return $core.withContext(function($ctx3) {
  33626. return $recv(each)._inPosition_(aPoint);
  33627. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33628. }));
  33629. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33630. }));
  33631. $recv(children)._ifEmpty_((function(){
  33632. return $core.withContext(function($ctx2) {
  33633. throw $early=[$recv(aBlock)._value()];
  33634. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33635. }));
  33636. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33637. return $core.withContext(function($ctx2) {
  33638. $2=$recv(a)._positionStart();
  33639. $ctx2.sendIdx["positionStart"]=1;
  33640. $1=$recv($2)._dist_(aPoint);
  33641. $ctx2.sendIdx["dist:"]=1;
  33642. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33643. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33644. })))._first();
  33645. }
  33646. catch(e) {if(e===$early)return e[0]; throw e}
  33647. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33648. },
  33649. args: ["aPoint", "aBlock"],
  33650. 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",
  33651. referencedClasses: [],
  33652. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33653. }),
  33654. $globals.ASTNode);
  33655. $core.addMethod(
  33656. $core.method({
  33657. selector: "parent",
  33658. protocol: "accessing",
  33659. fn: function (){
  33660. var self=this,$self=this;
  33661. return $self["@parent"];
  33662. },
  33663. args: [],
  33664. source: "parent\x0a\x09^ parent",
  33665. referencedClasses: [],
  33666. messageSends: []
  33667. }),
  33668. $globals.ASTNode);
  33669. $core.addMethod(
  33670. $core.method({
  33671. selector: "parent:",
  33672. protocol: "accessing",
  33673. fn: function (aNode){
  33674. var self=this,$self=this;
  33675. $self["@parent"]=aNode;
  33676. return self;
  33677. },
  33678. args: ["aNode"],
  33679. source: "parent: aNode\x0a\x09parent := aNode",
  33680. referencedClasses: [],
  33681. messageSends: []
  33682. }),
  33683. $globals.ASTNode);
  33684. $core.addMethod(
  33685. $core.method({
  33686. selector: "position",
  33687. protocol: "accessing",
  33688. fn: function (){
  33689. var self=this,$self=this;
  33690. return $core.withContext(function($ctx1) {
  33691. var $1,$2,$receiver;
  33692. $1=$self["@position"];
  33693. if(($receiver = $1) == null || $receiver.a$nil){
  33694. $2=$self._parent();
  33695. if(($receiver = $2) == null || $receiver.a$nil){
  33696. return $2;
  33697. } else {
  33698. var node;
  33699. node=$receiver;
  33700. return $recv(node)._position();
  33701. }
  33702. } else {
  33703. return $1;
  33704. }
  33705. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33706. },
  33707. args: [],
  33708. 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 ] ]",
  33709. referencedClasses: [],
  33710. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33711. }),
  33712. $globals.ASTNode);
  33713. $core.addMethod(
  33714. $core.method({
  33715. selector: "position:",
  33716. protocol: "accessing",
  33717. fn: function (aPosition){
  33718. var self=this,$self=this;
  33719. $self["@position"]=aPosition;
  33720. return self;
  33721. },
  33722. args: ["aPosition"],
  33723. source: "position: aPosition\x0a\x09position := aPosition",
  33724. referencedClasses: [],
  33725. messageSends: []
  33726. }),
  33727. $globals.ASTNode);
  33728. $core.addMethod(
  33729. $core.method({
  33730. selector: "positionEnd",
  33731. protocol: "accessing",
  33732. fn: function (){
  33733. var self=this,$self=this;
  33734. return $core.withContext(function($ctx1) {
  33735. var $1,$6,$5,$4,$3,$2;
  33736. $1=$self._positionStart();
  33737. $6=$self._source();
  33738. $ctx1.sendIdx["source"]=1;
  33739. $5=$recv($6)._lines();
  33740. $ctx1.sendIdx["lines"]=1;
  33741. $4=$recv($5)._size();
  33742. $ctx1.sendIdx["size"]=1;
  33743. $3=$recv($4).__minus((1));
  33744. $ctx1.sendIdx["-"]=1;
  33745. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  33746. return $recv($1).__plus($2);
  33747. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33748. },
  33749. args: [],
  33750. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33751. referencedClasses: [],
  33752. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33753. }),
  33754. $globals.ASTNode);
  33755. $core.addMethod(
  33756. $core.method({
  33757. selector: "positionStart",
  33758. protocol: "accessing",
  33759. fn: function (){
  33760. var self=this,$self=this;
  33761. return $core.withContext(function($ctx1) {
  33762. return $self._position();
  33763. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33764. },
  33765. args: [],
  33766. source: "positionStart\x0a\x09^ self position",
  33767. referencedClasses: [],
  33768. messageSends: ["position"]
  33769. }),
  33770. $globals.ASTNode);
  33771. $core.addMethod(
  33772. $core.method({
  33773. selector: "requiresSmalltalkContext",
  33774. protocol: "testing",
  33775. fn: function (){
  33776. var self=this,$self=this;
  33777. return $core.withContext(function($ctx1) {
  33778. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  33779. return $core.withContext(function($ctx2) {
  33780. return $recv(each)._requiresSmalltalkContext();
  33781. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33782. }),(function(){
  33783. return nil;
  33784. })))._notNil();
  33785. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33786. },
  33787. args: [],
  33788. 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",
  33789. referencedClasses: [],
  33790. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33791. }),
  33792. $globals.ASTNode);
  33793. $core.addMethod(
  33794. $core.method({
  33795. selector: "shouldBeAliased",
  33796. protocol: "accessing",
  33797. fn: function (){
  33798. var self=this,$self=this;
  33799. return $core.withContext(function($ctx1) {
  33800. var $1,$receiver;
  33801. $1=$self["@shouldBeAliased"];
  33802. if(($receiver = $1) == null || $receiver.a$nil){
  33803. return false;
  33804. } else {
  33805. return $1;
  33806. }
  33807. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33808. },
  33809. args: [],
  33810. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33811. referencedClasses: [],
  33812. messageSends: ["ifNil:"]
  33813. }),
  33814. $globals.ASTNode);
  33815. $core.addMethod(
  33816. $core.method({
  33817. selector: "shouldBeAliased:",
  33818. protocol: "accessing",
  33819. fn: function (aBoolean){
  33820. var self=this,$self=this;
  33821. $self["@shouldBeAliased"]=aBoolean;
  33822. return self;
  33823. },
  33824. args: ["aBoolean"],
  33825. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33826. referencedClasses: [],
  33827. messageSends: []
  33828. }),
  33829. $globals.ASTNode);
  33830. $core.addMethod(
  33831. $core.method({
  33832. selector: "size",
  33833. protocol: "accessing",
  33834. fn: function (){
  33835. var self=this,$self=this;
  33836. return $core.withContext(function($ctx1) {
  33837. return $recv($self._source())._size();
  33838. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33839. },
  33840. args: [],
  33841. source: "size\x0a\x09^ self source size",
  33842. referencedClasses: [],
  33843. messageSends: ["size", "source"]
  33844. }),
  33845. $globals.ASTNode);
  33846. $core.addMethod(
  33847. $core.method({
  33848. selector: "source",
  33849. protocol: "accessing",
  33850. fn: function (){
  33851. var self=this,$self=this;
  33852. return $core.withContext(function($ctx1) {
  33853. var $1,$receiver;
  33854. $1=$self["@source"];
  33855. if(($receiver = $1) == null || $receiver.a$nil){
  33856. return "";
  33857. } else {
  33858. return $1;
  33859. }
  33860. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33861. },
  33862. args: [],
  33863. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33864. referencedClasses: [],
  33865. messageSends: ["ifNil:"]
  33866. }),
  33867. $globals.ASTNode);
  33868. $core.addMethod(
  33869. $core.method({
  33870. selector: "source:",
  33871. protocol: "accessing",
  33872. fn: function (aString){
  33873. var self=this,$self=this;
  33874. $self["@source"]=aString;
  33875. return self;
  33876. },
  33877. args: ["aString"],
  33878. source: "source: aString\x0a\x09source := aString",
  33879. referencedClasses: [],
  33880. messageSends: []
  33881. }),
  33882. $globals.ASTNode);
  33883. $core.addMethod(
  33884. $core.method({
  33885. selector: "withTail:",
  33886. protocol: "building",
  33887. fn: function (aCollection){
  33888. var self=this,$self=this;
  33889. return $core.withContext(function($ctx1) {
  33890. var $1;
  33891. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33892. return $core.withContext(function($ctx2) {
  33893. $1=$recv($globals.SendNode)._new();
  33894. $recv($1)._position_($recv(send)._position());
  33895. $recv($1)._source_($recv(send)._source());
  33896. $recv($1)._receiver_(receiver);
  33897. $recv($1)._selector_($recv(send)._selector());
  33898. $recv($1)._arguments_($recv(send)._arguments());
  33899. return $recv($1)._yourself();
  33900. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33901. }));
  33902. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33903. },
  33904. args: ["aCollection"],
  33905. 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 ]",
  33906. referencedClasses: ["SendNode"],
  33907. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33908. }),
  33909. $globals.ASTNode);
  33910. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33911. $globals.AssignmentNode.comment="I represent an assignment node.";
  33912. $core.addMethod(
  33913. $core.method({
  33914. selector: "acceptDagVisitor:",
  33915. protocol: "visiting",
  33916. fn: function (aVisitor){
  33917. var self=this,$self=this;
  33918. return $core.withContext(function($ctx1) {
  33919. return $recv(aVisitor)._visitAssignmentNode_(self);
  33920. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33921. },
  33922. args: ["aVisitor"],
  33923. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33924. referencedClasses: [],
  33925. messageSends: ["visitAssignmentNode:"]
  33926. }),
  33927. $globals.AssignmentNode);
  33928. $core.addMethod(
  33929. $core.method({
  33930. selector: "dagChildren",
  33931. protocol: "accessing",
  33932. fn: function (){
  33933. var self=this,$self=this;
  33934. return $core.withContext(function($ctx1) {
  33935. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  33936. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  33937. },
  33938. args: [],
  33939. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  33940. referencedClasses: ["Array"],
  33941. messageSends: ["with:with:", "left", "right"]
  33942. }),
  33943. $globals.AssignmentNode);
  33944. $core.addMethod(
  33945. $core.method({
  33946. selector: "isAssignmentNode",
  33947. protocol: "testing",
  33948. fn: function (){
  33949. var self=this,$self=this;
  33950. return true;
  33951. },
  33952. args: [],
  33953. source: "isAssignmentNode\x0a\x09^ true",
  33954. referencedClasses: [],
  33955. messageSends: []
  33956. }),
  33957. $globals.AssignmentNode);
  33958. $core.addMethod(
  33959. $core.method({
  33960. selector: "left",
  33961. protocol: "accessing",
  33962. fn: function (){
  33963. var self=this,$self=this;
  33964. return $self["@left"];
  33965. },
  33966. args: [],
  33967. source: "left\x0a\x09^ left",
  33968. referencedClasses: [],
  33969. messageSends: []
  33970. }),
  33971. $globals.AssignmentNode);
  33972. $core.addMethod(
  33973. $core.method({
  33974. selector: "left:",
  33975. protocol: "accessing",
  33976. fn: function (aNode){
  33977. var self=this,$self=this;
  33978. $self["@left"]=aNode;
  33979. return self;
  33980. },
  33981. args: ["aNode"],
  33982. source: "left: aNode\x0a\x09left := aNode",
  33983. referencedClasses: [],
  33984. messageSends: []
  33985. }),
  33986. $globals.AssignmentNode);
  33987. $core.addMethod(
  33988. $core.method({
  33989. selector: "right",
  33990. protocol: "accessing",
  33991. fn: function (){
  33992. var self=this,$self=this;
  33993. return $self["@right"];
  33994. },
  33995. args: [],
  33996. source: "right\x0a\x09^ right",
  33997. referencedClasses: [],
  33998. messageSends: []
  33999. }),
  34000. $globals.AssignmentNode);
  34001. $core.addMethod(
  34002. $core.method({
  34003. selector: "right:",
  34004. protocol: "accessing",
  34005. fn: function (aNode){
  34006. var self=this,$self=this;
  34007. $self["@right"]=aNode;
  34008. return self;
  34009. },
  34010. args: ["aNode"],
  34011. source: "right: aNode\x0a\x09right := aNode",
  34012. referencedClasses: [],
  34013. messageSends: []
  34014. }),
  34015. $globals.AssignmentNode);
  34016. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  34017. $globals.BlockNode.comment="I represent an block closure node.";
  34018. $core.addMethod(
  34019. $core.method({
  34020. selector: "acceptDagVisitor:",
  34021. protocol: "visiting",
  34022. fn: function (aVisitor){
  34023. var self=this,$self=this;
  34024. return $core.withContext(function($ctx1) {
  34025. return $recv(aVisitor)._visitBlockNode_(self);
  34026. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  34027. },
  34028. args: ["aVisitor"],
  34029. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  34030. referencedClasses: [],
  34031. messageSends: ["visitBlockNode:"]
  34032. }),
  34033. $globals.BlockNode);
  34034. $core.addMethod(
  34035. $core.method({
  34036. selector: "isBlockNode",
  34037. protocol: "testing",
  34038. fn: function (){
  34039. var self=this,$self=this;
  34040. return true;
  34041. },
  34042. args: [],
  34043. source: "isBlockNode\x0a\x09^ true",
  34044. referencedClasses: [],
  34045. messageSends: []
  34046. }),
  34047. $globals.BlockNode);
  34048. $core.addMethod(
  34049. $core.method({
  34050. selector: "parameters",
  34051. protocol: "accessing",
  34052. fn: function (){
  34053. var self=this,$self=this;
  34054. return $core.withContext(function($ctx1) {
  34055. var $1,$receiver;
  34056. $1=$self["@parameters"];
  34057. if(($receiver = $1) == null || $receiver.a$nil){
  34058. $self["@parameters"]=$recv($globals.Array)._new();
  34059. return $self["@parameters"];
  34060. } else {
  34061. return $1;
  34062. }
  34063. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  34064. },
  34065. args: [],
  34066. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  34067. referencedClasses: ["Array"],
  34068. messageSends: ["ifNil:", "new"]
  34069. }),
  34070. $globals.BlockNode);
  34071. $core.addMethod(
  34072. $core.method({
  34073. selector: "parameters:",
  34074. protocol: "accessing",
  34075. fn: function (aCollection){
  34076. var self=this,$self=this;
  34077. $self["@parameters"]=aCollection;
  34078. return self;
  34079. },
  34080. args: ["aCollection"],
  34081. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  34082. referencedClasses: [],
  34083. messageSends: []
  34084. }),
  34085. $globals.BlockNode);
  34086. $core.addMethod(
  34087. $core.method({
  34088. selector: "scope",
  34089. protocol: "accessing",
  34090. fn: function (){
  34091. var self=this,$self=this;
  34092. return $self["@scope"];
  34093. },
  34094. args: [],
  34095. source: "scope\x0a\x09^ scope",
  34096. referencedClasses: [],
  34097. messageSends: []
  34098. }),
  34099. $globals.BlockNode);
  34100. $core.addMethod(
  34101. $core.method({
  34102. selector: "scope:",
  34103. protocol: "accessing",
  34104. fn: function (aLexicalScope){
  34105. var self=this,$self=this;
  34106. $self["@scope"]=aLexicalScope;
  34107. return self;
  34108. },
  34109. args: ["aLexicalScope"],
  34110. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34111. referencedClasses: [],
  34112. messageSends: []
  34113. }),
  34114. $globals.BlockNode);
  34115. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34116. $globals.CascadeNode.comment="I represent an cascade node.";
  34117. $core.addMethod(
  34118. $core.method({
  34119. selector: "acceptDagVisitor:",
  34120. protocol: "visiting",
  34121. fn: function (aVisitor){
  34122. var self=this,$self=this;
  34123. return $core.withContext(function($ctx1) {
  34124. return $recv(aVisitor)._visitCascadeNode_(self);
  34125. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34126. },
  34127. args: ["aVisitor"],
  34128. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34129. referencedClasses: [],
  34130. messageSends: ["visitCascadeNode:"]
  34131. }),
  34132. $globals.CascadeNode);
  34133. $core.addMethod(
  34134. $core.method({
  34135. selector: "isCascadeNode",
  34136. protocol: "testing",
  34137. fn: function (){
  34138. var self=this,$self=this;
  34139. return true;
  34140. },
  34141. args: [],
  34142. source: "isCascadeNode\x0a\x09^ true",
  34143. referencedClasses: [],
  34144. messageSends: []
  34145. }),
  34146. $globals.CascadeNode);
  34147. $core.addMethod(
  34148. $core.method({
  34149. selector: "receiver",
  34150. protocol: "accessing",
  34151. fn: function (){
  34152. var self=this,$self=this;
  34153. return $self["@receiver"];
  34154. },
  34155. args: [],
  34156. source: "receiver\x0a\x09^ receiver",
  34157. referencedClasses: [],
  34158. messageSends: []
  34159. }),
  34160. $globals.CascadeNode);
  34161. $core.addMethod(
  34162. $core.method({
  34163. selector: "receiver:",
  34164. protocol: "accessing",
  34165. fn: function (aNode){
  34166. var self=this,$self=this;
  34167. $self["@receiver"]=aNode;
  34168. return self;
  34169. },
  34170. args: ["aNode"],
  34171. source: "receiver: aNode\x0a\x09receiver := aNode",
  34172. referencedClasses: [],
  34173. messageSends: []
  34174. }),
  34175. $globals.CascadeNode);
  34176. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34177. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34178. $core.addMethod(
  34179. $core.method({
  34180. selector: "acceptDagVisitor:",
  34181. protocol: "visiting",
  34182. fn: function (aVisitor){
  34183. var self=this,$self=this;
  34184. return $core.withContext(function($ctx1) {
  34185. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34186. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34187. },
  34188. args: ["aVisitor"],
  34189. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34190. referencedClasses: [],
  34191. messageSends: ["visitDynamicArrayNode:"]
  34192. }),
  34193. $globals.DynamicArrayNode);
  34194. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34195. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34196. $core.addMethod(
  34197. $core.method({
  34198. selector: "acceptDagVisitor:",
  34199. protocol: "visiting",
  34200. fn: function (aVisitor){
  34201. var self=this,$self=this;
  34202. return $core.withContext(function($ctx1) {
  34203. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34204. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34205. },
  34206. args: ["aVisitor"],
  34207. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34208. referencedClasses: [],
  34209. messageSends: ["visitDynamicDictionaryNode:"]
  34210. }),
  34211. $globals.DynamicDictionaryNode);
  34212. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34213. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34214. $core.addMethod(
  34215. $core.method({
  34216. selector: "acceptDagVisitor:",
  34217. protocol: "visiting",
  34218. fn: function (aVisitor){
  34219. var self=this,$self=this;
  34220. return $core.withContext(function($ctx1) {
  34221. return $recv(aVisitor)._visitJSStatementNode_(self);
  34222. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34223. },
  34224. args: ["aVisitor"],
  34225. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34226. referencedClasses: [],
  34227. messageSends: ["visitJSStatementNode:"]
  34228. }),
  34229. $globals.JSStatementNode);
  34230. $core.addMethod(
  34231. $core.method({
  34232. selector: "isJSStatementNode",
  34233. protocol: "testing",
  34234. fn: function (){
  34235. var self=this,$self=this;
  34236. return true;
  34237. },
  34238. args: [],
  34239. source: "isJSStatementNode\x0a\x09^ true",
  34240. referencedClasses: [],
  34241. messageSends: []
  34242. }),
  34243. $globals.JSStatementNode);
  34244. $core.addMethod(
  34245. $core.method({
  34246. selector: "requiresSmalltalkContext",
  34247. protocol: "testing",
  34248. fn: function (){
  34249. var self=this,$self=this;
  34250. return true;
  34251. },
  34252. args: [],
  34253. source: "requiresSmalltalkContext\x0a\x09^ true",
  34254. referencedClasses: [],
  34255. messageSends: []
  34256. }),
  34257. $globals.JSStatementNode);
  34258. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34259. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34260. $core.addMethod(
  34261. $core.method({
  34262. selector: "acceptDagVisitor:",
  34263. protocol: "visiting",
  34264. fn: function (aVisitor){
  34265. var self=this,$self=this;
  34266. return $core.withContext(function($ctx1) {
  34267. return $recv(aVisitor)._visitMethodNode_(self);
  34268. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34269. },
  34270. args: ["aVisitor"],
  34271. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34272. referencedClasses: [],
  34273. messageSends: ["visitMethodNode:"]
  34274. }),
  34275. $globals.MethodNode);
  34276. $core.addMethod(
  34277. $core.method({
  34278. selector: "arguments",
  34279. protocol: "accessing",
  34280. fn: function (){
  34281. var self=this,$self=this;
  34282. return $core.withContext(function($ctx1) {
  34283. var $1,$receiver;
  34284. $1=$self["@arguments"];
  34285. if(($receiver = $1) == null || $receiver.a$nil){
  34286. return [];
  34287. } else {
  34288. return $1;
  34289. }
  34290. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34291. },
  34292. args: [],
  34293. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34294. referencedClasses: [],
  34295. messageSends: ["ifNil:"]
  34296. }),
  34297. $globals.MethodNode);
  34298. $core.addMethod(
  34299. $core.method({
  34300. selector: "arguments:",
  34301. protocol: "accessing",
  34302. fn: function (aCollection){
  34303. var self=this,$self=this;
  34304. $self["@arguments"]=aCollection;
  34305. return self;
  34306. },
  34307. args: ["aCollection"],
  34308. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34309. referencedClasses: [],
  34310. messageSends: []
  34311. }),
  34312. $globals.MethodNode);
  34313. $core.addMethod(
  34314. $core.method({
  34315. selector: "classReferences",
  34316. protocol: "accessing",
  34317. fn: function (){
  34318. var self=this,$self=this;
  34319. return $self["@classReferences"];
  34320. },
  34321. args: [],
  34322. source: "classReferences\x0a\x09^ classReferences",
  34323. referencedClasses: [],
  34324. messageSends: []
  34325. }),
  34326. $globals.MethodNode);
  34327. $core.addMethod(
  34328. $core.method({
  34329. selector: "classReferences:",
  34330. protocol: "accessing",
  34331. fn: function (aCollection){
  34332. var self=this,$self=this;
  34333. $self["@classReferences"]=aCollection;
  34334. return self;
  34335. },
  34336. args: ["aCollection"],
  34337. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34338. referencedClasses: [],
  34339. messageSends: []
  34340. }),
  34341. $globals.MethodNode);
  34342. $core.addMethod(
  34343. $core.method({
  34344. selector: "messageSends",
  34345. protocol: "accessing",
  34346. fn: function (){
  34347. var self=this,$self=this;
  34348. return $core.withContext(function($ctx1) {
  34349. return $recv($self._sendIndexes())._keys();
  34350. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34351. },
  34352. args: [],
  34353. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34354. referencedClasses: [],
  34355. messageSends: ["keys", "sendIndexes"]
  34356. }),
  34357. $globals.MethodNode);
  34358. $core.addMethod(
  34359. $core.method({
  34360. selector: "method",
  34361. protocol: "accessing",
  34362. fn: function (){
  34363. var self=this,$self=this;
  34364. return self;
  34365. },
  34366. args: [],
  34367. source: "method\x0a\x09^ self",
  34368. referencedClasses: [],
  34369. messageSends: []
  34370. }),
  34371. $globals.MethodNode);
  34372. $core.addMethod(
  34373. $core.method({
  34374. selector: "scope",
  34375. protocol: "accessing",
  34376. fn: function (){
  34377. var self=this,$self=this;
  34378. return $self["@scope"];
  34379. },
  34380. args: [],
  34381. source: "scope\x0a\x09^ scope",
  34382. referencedClasses: [],
  34383. messageSends: []
  34384. }),
  34385. $globals.MethodNode);
  34386. $core.addMethod(
  34387. $core.method({
  34388. selector: "scope:",
  34389. protocol: "accessing",
  34390. fn: function (aMethodScope){
  34391. var self=this,$self=this;
  34392. $self["@scope"]=aMethodScope;
  34393. return self;
  34394. },
  34395. args: ["aMethodScope"],
  34396. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  34397. referencedClasses: [],
  34398. messageSends: []
  34399. }),
  34400. $globals.MethodNode);
  34401. $core.addMethod(
  34402. $core.method({
  34403. selector: "selector",
  34404. protocol: "accessing",
  34405. fn: function (){
  34406. var self=this,$self=this;
  34407. return $self["@selector"];
  34408. },
  34409. args: [],
  34410. source: "selector\x0a\x09^ selector",
  34411. referencedClasses: [],
  34412. messageSends: []
  34413. }),
  34414. $globals.MethodNode);
  34415. $core.addMethod(
  34416. $core.method({
  34417. selector: "selector:",
  34418. protocol: "accessing",
  34419. fn: function (aString){
  34420. var self=this,$self=this;
  34421. $self["@selector"]=aString;
  34422. return self;
  34423. },
  34424. args: ["aString"],
  34425. source: "selector: aString\x0a\x09selector := aString",
  34426. referencedClasses: [],
  34427. messageSends: []
  34428. }),
  34429. $globals.MethodNode);
  34430. $core.addMethod(
  34431. $core.method({
  34432. selector: "sendIndexes",
  34433. protocol: "accessing",
  34434. fn: function (){
  34435. var self=this,$self=this;
  34436. return $self["@sendIndexes"];
  34437. },
  34438. args: [],
  34439. source: "sendIndexes\x0a\x09^ sendIndexes",
  34440. referencedClasses: [],
  34441. messageSends: []
  34442. }),
  34443. $globals.MethodNode);
  34444. $core.addMethod(
  34445. $core.method({
  34446. selector: "sendIndexes:",
  34447. protocol: "accessing",
  34448. fn: function (aDictionary){
  34449. var self=this,$self=this;
  34450. $self["@sendIndexes"]=aDictionary;
  34451. return self;
  34452. },
  34453. args: ["aDictionary"],
  34454. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  34455. referencedClasses: [],
  34456. messageSends: []
  34457. }),
  34458. $globals.MethodNode);
  34459. $core.addMethod(
  34460. $core.method({
  34461. selector: "sequenceNode",
  34462. protocol: "accessing",
  34463. fn: function (){
  34464. var self=this,$self=this;
  34465. return $core.withContext(function($ctx1) {
  34466. var $1;
  34467. var $early={};
  34468. try {
  34469. $recv($self._dagChildren())._do_((function(each){
  34470. return $core.withContext(function($ctx2) {
  34471. $1=$recv(each)._isSequenceNode();
  34472. if($core.assert($1)){
  34473. throw $early=[each];
  34474. }
  34475. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34476. }));
  34477. return nil;
  34478. }
  34479. catch(e) {if(e===$early)return e[0]; throw e}
  34480. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  34481. },
  34482. args: [],
  34483. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  34484. referencedClasses: [],
  34485. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  34486. }),
  34487. $globals.MethodNode);
  34488. $core.addMethod(
  34489. $core.method({
  34490. selector: "source",
  34491. protocol: "accessing",
  34492. fn: function (){
  34493. var self=this,$self=this;
  34494. return $self["@source"];
  34495. },
  34496. args: [],
  34497. source: "source\x0a\x09^ source",
  34498. referencedClasses: [],
  34499. messageSends: []
  34500. }),
  34501. $globals.MethodNode);
  34502. $core.addMethod(
  34503. $core.method({
  34504. selector: "source:",
  34505. protocol: "accessing",
  34506. fn: function (aString){
  34507. var self=this,$self=this;
  34508. $self["@source"]=aString;
  34509. return self;
  34510. },
  34511. args: ["aString"],
  34512. source: "source: aString\x0a\x09source := aString",
  34513. referencedClasses: [],
  34514. messageSends: []
  34515. }),
  34516. $globals.MethodNode);
  34517. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34518. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34519. $core.addMethod(
  34520. $core.method({
  34521. selector: "acceptDagVisitor:",
  34522. protocol: "visiting",
  34523. fn: function (aVisitor){
  34524. var self=this,$self=this;
  34525. return $core.withContext(function($ctx1) {
  34526. return $recv(aVisitor)._visitReturnNode_(self);
  34527. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34528. },
  34529. args: ["aVisitor"],
  34530. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34531. referencedClasses: [],
  34532. messageSends: ["visitReturnNode:"]
  34533. }),
  34534. $globals.ReturnNode);
  34535. $core.addMethod(
  34536. $core.method({
  34537. selector: "isReturnNode",
  34538. protocol: "testing",
  34539. fn: function (){
  34540. var self=this,$self=this;
  34541. return true;
  34542. },
  34543. args: [],
  34544. source: "isReturnNode\x0a\x09^ true",
  34545. referencedClasses: [],
  34546. messageSends: []
  34547. }),
  34548. $globals.ReturnNode);
  34549. $core.addMethod(
  34550. $core.method({
  34551. selector: "nonLocalReturn",
  34552. protocol: "testing",
  34553. fn: function (){
  34554. var self=this,$self=this;
  34555. return $core.withContext(function($ctx1) {
  34556. return $recv($recv($self._scope())._isMethodScope())._not();
  34557. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34558. },
  34559. args: [],
  34560. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34561. referencedClasses: [],
  34562. messageSends: ["not", "isMethodScope", "scope"]
  34563. }),
  34564. $globals.ReturnNode);
  34565. $core.addMethod(
  34566. $core.method({
  34567. selector: "scope",
  34568. protocol: "accessing",
  34569. fn: function (){
  34570. var self=this,$self=this;
  34571. return $self["@scope"];
  34572. },
  34573. args: [],
  34574. source: "scope\x0a\x09^ scope",
  34575. referencedClasses: [],
  34576. messageSends: []
  34577. }),
  34578. $globals.ReturnNode);
  34579. $core.addMethod(
  34580. $core.method({
  34581. selector: "scope:",
  34582. protocol: "accessing",
  34583. fn: function (aLexicalScope){
  34584. var self=this,$self=this;
  34585. $self["@scope"]=aLexicalScope;
  34586. return self;
  34587. },
  34588. args: ["aLexicalScope"],
  34589. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34590. referencedClasses: [],
  34591. messageSends: []
  34592. }),
  34593. $globals.ReturnNode);
  34594. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34595. $globals.SendNode.comment="I represent an message send node.";
  34596. $core.addMethod(
  34597. $core.method({
  34598. selector: "acceptDagVisitor:",
  34599. protocol: "visiting",
  34600. fn: function (aVisitor){
  34601. var self=this,$self=this;
  34602. return $core.withContext(function($ctx1) {
  34603. return $recv(aVisitor)._visitSendNode_(self);
  34604. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34605. },
  34606. args: ["aVisitor"],
  34607. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34608. referencedClasses: [],
  34609. messageSends: ["visitSendNode:"]
  34610. }),
  34611. $globals.SendNode);
  34612. $core.addMethod(
  34613. $core.method({
  34614. selector: "arguments",
  34615. protocol: "accessing",
  34616. fn: function (){
  34617. var self=this,$self=this;
  34618. return $core.withContext(function($ctx1) {
  34619. var $1,$receiver;
  34620. $1=$self["@arguments"];
  34621. if(($receiver = $1) == null || $receiver.a$nil){
  34622. $self["@arguments"]=[];
  34623. return $self["@arguments"];
  34624. } else {
  34625. return $1;
  34626. }
  34627. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34628. },
  34629. args: [],
  34630. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34631. referencedClasses: [],
  34632. messageSends: ["ifNil:"]
  34633. }),
  34634. $globals.SendNode);
  34635. $core.addMethod(
  34636. $core.method({
  34637. selector: "arguments:",
  34638. protocol: "accessing",
  34639. fn: function (aCollection){
  34640. var self=this,$self=this;
  34641. $self["@arguments"]=aCollection;
  34642. return self;
  34643. },
  34644. args: ["aCollection"],
  34645. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34646. referencedClasses: [],
  34647. messageSends: []
  34648. }),
  34649. $globals.SendNode);
  34650. $core.addMethod(
  34651. $core.method({
  34652. selector: "dagChildren",
  34653. protocol: "accessing",
  34654. fn: function (){
  34655. var self=this,$self=this;
  34656. return $core.withContext(function($ctx1) {
  34657. var $1,$2,$3,$receiver;
  34658. $1=$self._receiver();
  34659. $ctx1.sendIdx["receiver"]=1;
  34660. if(($receiver = $1) == null || $receiver.a$nil){
  34661. $2=$self._arguments();
  34662. $ctx1.sendIdx["arguments"]=1;
  34663. return $recv($2)._copy();
  34664. } else {
  34665. $1;
  34666. }
  34667. $3=$recv($globals.Array)._with_($self._receiver());
  34668. $recv($3)._addAll_($self._arguments());
  34669. return $recv($3)._yourself();
  34670. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34671. },
  34672. args: [],
  34673. 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",
  34674. referencedClasses: ["Array"],
  34675. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34676. }),
  34677. $globals.SendNode);
  34678. $core.addMethod(
  34679. $core.method({
  34680. selector: "index",
  34681. protocol: "accessing",
  34682. fn: function (){
  34683. var self=this,$self=this;
  34684. return $self["@index"];
  34685. },
  34686. args: [],
  34687. source: "index\x0a\x09^ index",
  34688. referencedClasses: [],
  34689. messageSends: []
  34690. }),
  34691. $globals.SendNode);
  34692. $core.addMethod(
  34693. $core.method({
  34694. selector: "index:",
  34695. protocol: "accessing",
  34696. fn: function (anInteger){
  34697. var self=this,$self=this;
  34698. $self["@index"]=anInteger;
  34699. return self;
  34700. },
  34701. args: ["anInteger"],
  34702. source: "index: anInteger\x0a\x09index := anInteger",
  34703. referencedClasses: [],
  34704. messageSends: []
  34705. }),
  34706. $globals.SendNode);
  34707. $core.addMethod(
  34708. $core.method({
  34709. selector: "isNavigationNode",
  34710. protocol: "testing",
  34711. fn: function (){
  34712. var self=this,$self=this;
  34713. return true;
  34714. },
  34715. args: [],
  34716. source: "isNavigationNode\x0a\x09^ true",
  34717. referencedClasses: [],
  34718. messageSends: []
  34719. }),
  34720. $globals.SendNode);
  34721. $core.addMethod(
  34722. $core.method({
  34723. selector: "isSendNode",
  34724. protocol: "testing",
  34725. fn: function (){
  34726. var self=this,$self=this;
  34727. return true;
  34728. },
  34729. args: [],
  34730. source: "isSendNode\x0a\x09^ true",
  34731. referencedClasses: [],
  34732. messageSends: []
  34733. }),
  34734. $globals.SendNode);
  34735. $core.addMethod(
  34736. $core.method({
  34737. selector: "navigationLink",
  34738. protocol: "accessing",
  34739. fn: function (){
  34740. var self=this,$self=this;
  34741. return $core.withContext(function($ctx1) {
  34742. return $self._selector();
  34743. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34744. },
  34745. args: [],
  34746. source: "navigationLink\x0a\x09^ self selector",
  34747. referencedClasses: [],
  34748. messageSends: ["selector"]
  34749. }),
  34750. $globals.SendNode);
  34751. $core.addMethod(
  34752. $core.method({
  34753. selector: "receiver",
  34754. protocol: "accessing",
  34755. fn: function (){
  34756. var self=this,$self=this;
  34757. return $self["@receiver"];
  34758. },
  34759. args: [],
  34760. source: "receiver\x0a\x09^ receiver",
  34761. referencedClasses: [],
  34762. messageSends: []
  34763. }),
  34764. $globals.SendNode);
  34765. $core.addMethod(
  34766. $core.method({
  34767. selector: "receiver:",
  34768. protocol: "accessing",
  34769. fn: function (aNode){
  34770. var self=this,$self=this;
  34771. $self["@receiver"]=aNode;
  34772. return self;
  34773. },
  34774. args: ["aNode"],
  34775. source: "receiver: aNode\x0a\x09receiver := aNode",
  34776. referencedClasses: [],
  34777. messageSends: []
  34778. }),
  34779. $globals.SendNode);
  34780. $core.addMethod(
  34781. $core.method({
  34782. selector: "requiresSmalltalkContext",
  34783. protocol: "testing",
  34784. fn: function (){
  34785. var self=this,$self=this;
  34786. return true;
  34787. },
  34788. args: [],
  34789. source: "requiresSmalltalkContext\x0a\x09^ true",
  34790. referencedClasses: [],
  34791. messageSends: []
  34792. }),
  34793. $globals.SendNode);
  34794. $core.addMethod(
  34795. $core.method({
  34796. selector: "selector",
  34797. protocol: "accessing",
  34798. fn: function (){
  34799. var self=this,$self=this;
  34800. return $self["@selector"];
  34801. },
  34802. args: [],
  34803. source: "selector\x0a\x09^ selector",
  34804. referencedClasses: [],
  34805. messageSends: []
  34806. }),
  34807. $globals.SendNode);
  34808. $core.addMethod(
  34809. $core.method({
  34810. selector: "selector:",
  34811. protocol: "accessing",
  34812. fn: function (aString){
  34813. var self=this,$self=this;
  34814. $self["@selector"]=aString;
  34815. return self;
  34816. },
  34817. args: ["aString"],
  34818. source: "selector: aString\x0a\x09selector := aString",
  34819. referencedClasses: [],
  34820. messageSends: []
  34821. }),
  34822. $globals.SendNode);
  34823. $core.addMethod(
  34824. $core.method({
  34825. selector: "shouldBeInlined",
  34826. protocol: "accessing",
  34827. fn: function (){
  34828. var self=this,$self=this;
  34829. return $core.withContext(function($ctx1) {
  34830. var $1,$receiver;
  34831. $1=$self["@shouldBeInlined"];
  34832. if(($receiver = $1) == null || $receiver.a$nil){
  34833. return false;
  34834. } else {
  34835. return $1;
  34836. }
  34837. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34838. },
  34839. args: [],
  34840. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34841. referencedClasses: [],
  34842. messageSends: ["ifNil:"]
  34843. }),
  34844. $globals.SendNode);
  34845. $core.addMethod(
  34846. $core.method({
  34847. selector: "shouldBeInlined:",
  34848. protocol: "accessing",
  34849. fn: function (aBoolean){
  34850. var self=this,$self=this;
  34851. $self["@shouldBeInlined"]=aBoolean;
  34852. return self;
  34853. },
  34854. args: ["aBoolean"],
  34855. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34856. referencedClasses: [],
  34857. messageSends: []
  34858. }),
  34859. $globals.SendNode);
  34860. $core.addMethod(
  34861. $core.method({
  34862. selector: "superSend",
  34863. protocol: "accessing",
  34864. fn: function (){
  34865. var self=this,$self=this;
  34866. return $core.withContext(function($ctx1) {
  34867. var $2,$1;
  34868. $2=$self._receiver();
  34869. $ctx1.sendIdx["receiver"]=1;
  34870. $1=$recv($2)._notNil();
  34871. return $recv($1)._and_((function(){
  34872. return $core.withContext(function($ctx2) {
  34873. return $recv($self._receiver())._isSuperKeyword();
  34874. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34875. }));
  34876. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34877. },
  34878. args: [],
  34879. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34880. referencedClasses: [],
  34881. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34882. }),
  34883. $globals.SendNode);
  34884. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "pragmas", "scope"], "Compiler-AST");
  34885. $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).";
  34886. $core.addMethod(
  34887. $core.method({
  34888. selector: "acceptDagVisitor:",
  34889. protocol: "visiting",
  34890. fn: function (aVisitor){
  34891. var self=this,$self=this;
  34892. return $core.withContext(function($ctx1) {
  34893. return $recv(aVisitor)._visitSequenceNode_(self);
  34894. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34895. },
  34896. args: ["aVisitor"],
  34897. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34898. referencedClasses: [],
  34899. messageSends: ["visitSequenceNode:"]
  34900. }),
  34901. $globals.SequenceNode);
  34902. $core.addMethod(
  34903. $core.method({
  34904. selector: "asBlockSequenceNode",
  34905. protocol: "building",
  34906. fn: function (){
  34907. var self=this,$self=this;
  34908. return $core.withContext(function($ctx1) {
  34909. var $1;
  34910. $1=$recv($globals.BlockSequenceNode)._new();
  34911. $recv($1)._position_($self._position());
  34912. $recv($1)._source_($self._source());
  34913. $recv($1)._dagChildren_($self._dagChildren());
  34914. $recv($1)._temps_($self._temps());
  34915. $recv($1)._pragmas_($self._pragmas());
  34916. return $recv($1)._yourself();
  34917. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34918. },
  34919. args: [],
  34920. 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\x09pragmas: self pragmas;\x0a\x09\x09yourself",
  34921. referencedClasses: ["BlockSequenceNode"],
  34922. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "pragmas:", "pragmas", "yourself"]
  34923. }),
  34924. $globals.SequenceNode);
  34925. $core.addMethod(
  34926. $core.method({
  34927. selector: "isSequenceNode",
  34928. protocol: "testing",
  34929. fn: function (){
  34930. var self=this,$self=this;
  34931. return true;
  34932. },
  34933. args: [],
  34934. source: "isSequenceNode\x0a\x09^ true",
  34935. referencedClasses: [],
  34936. messageSends: []
  34937. }),
  34938. $globals.SequenceNode);
  34939. $core.addMethod(
  34940. $core.method({
  34941. selector: "pragmas",
  34942. protocol: "accessing",
  34943. fn: function (){
  34944. var self=this,$self=this;
  34945. return $core.withContext(function($ctx1) {
  34946. var $1,$receiver;
  34947. $1=$self["@pragmas"];
  34948. if(($receiver = $1) == null || $receiver.a$nil){
  34949. return [];
  34950. } else {
  34951. return $1;
  34952. }
  34953. }, function($ctx1) {$ctx1.fill(self,"pragmas",{},$globals.SequenceNode)});
  34954. },
  34955. args: [],
  34956. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  34957. referencedClasses: [],
  34958. messageSends: ["ifNil:"]
  34959. }),
  34960. $globals.SequenceNode);
  34961. $core.addMethod(
  34962. $core.method({
  34963. selector: "pragmas:",
  34964. protocol: "accessing",
  34965. fn: function (aCollection){
  34966. var self=this,$self=this;
  34967. $self["@pragmas"]=aCollection;
  34968. return self;
  34969. },
  34970. args: ["aCollection"],
  34971. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  34972. referencedClasses: [],
  34973. messageSends: []
  34974. }),
  34975. $globals.SequenceNode);
  34976. $core.addMethod(
  34977. $core.method({
  34978. selector: "scope",
  34979. protocol: "accessing",
  34980. fn: function (){
  34981. var self=this,$self=this;
  34982. return $self["@scope"];
  34983. },
  34984. args: [],
  34985. source: "scope\x0a\x09^ scope",
  34986. referencedClasses: [],
  34987. messageSends: []
  34988. }),
  34989. $globals.SequenceNode);
  34990. $core.addMethod(
  34991. $core.method({
  34992. selector: "scope:",
  34993. protocol: "accessing",
  34994. fn: function (aLexicalScope){
  34995. var self=this,$self=this;
  34996. $self["@scope"]=aLexicalScope;
  34997. return self;
  34998. },
  34999. args: ["aLexicalScope"],
  35000. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35001. referencedClasses: [],
  35002. messageSends: []
  35003. }),
  35004. $globals.SequenceNode);
  35005. $core.addMethod(
  35006. $core.method({
  35007. selector: "temps",
  35008. protocol: "accessing",
  35009. fn: function (){
  35010. var self=this,$self=this;
  35011. return $core.withContext(function($ctx1) {
  35012. var $1,$receiver;
  35013. $1=$self["@temps"];
  35014. if(($receiver = $1) == null || $receiver.a$nil){
  35015. return [];
  35016. } else {
  35017. return $1;
  35018. }
  35019. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  35020. },
  35021. args: [],
  35022. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  35023. referencedClasses: [],
  35024. messageSends: ["ifNil:"]
  35025. }),
  35026. $globals.SequenceNode);
  35027. $core.addMethod(
  35028. $core.method({
  35029. selector: "temps:",
  35030. protocol: "accessing",
  35031. fn: function (aCollection){
  35032. var self=this,$self=this;
  35033. $self["@temps"]=aCollection;
  35034. return self;
  35035. },
  35036. args: ["aCollection"],
  35037. source: "temps: aCollection\x0a\x09temps := aCollection",
  35038. referencedClasses: [],
  35039. messageSends: []
  35040. }),
  35041. $globals.SequenceNode);
  35042. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  35043. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  35044. $core.addMethod(
  35045. $core.method({
  35046. selector: "acceptDagVisitor:",
  35047. protocol: "visiting",
  35048. fn: function (aVisitor){
  35049. var self=this,$self=this;
  35050. return $core.withContext(function($ctx1) {
  35051. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  35052. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  35053. },
  35054. args: ["aVisitor"],
  35055. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  35056. referencedClasses: [],
  35057. messageSends: ["visitBlockSequenceNode:"]
  35058. }),
  35059. $globals.BlockSequenceNode);
  35060. $core.addMethod(
  35061. $core.method({
  35062. selector: "isBlockSequenceNode",
  35063. protocol: "testing",
  35064. fn: function (){
  35065. var self=this,$self=this;
  35066. return true;
  35067. },
  35068. args: [],
  35069. source: "isBlockSequenceNode\x0a\x09^ true",
  35070. referencedClasses: [],
  35071. messageSends: []
  35072. }),
  35073. $globals.BlockSequenceNode);
  35074. $core.addMethod(
  35075. $core.method({
  35076. selector: "pragmas:",
  35077. protocol: "visiting",
  35078. fn: function (aCollection){
  35079. var self=this,$self=this;
  35080. return $core.withContext(function($ctx1) {
  35081. var $1;
  35082. $recv(aCollection)._ifNotEmpty_((function(){
  35083. return $core.withContext(function($ctx2) {
  35084. return $recv($globals.CompilerError)._signal_("Block must have no pragmas.");
  35085. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35086. }));
  35087. $1=(
  35088. $ctx1.supercall = true,
  35089. ($globals.BlockSequenceNode.superclass||$boot.nilAsClass).fn.prototype._pragmas_.apply($self, [aCollection]));
  35090. $ctx1.supercall = false;
  35091. return $1;
  35092. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{aCollection:aCollection},$globals.BlockSequenceNode)});
  35093. },
  35094. args: ["aCollection"],
  35095. source: "pragmas: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'Block must have no pragmas.' ].\x0a\x09^ super pragmas: aCollection",
  35096. referencedClasses: ["CompilerError"],
  35097. messageSends: ["ifNotEmpty:", "signal:", "pragmas:"]
  35098. }),
  35099. $globals.BlockSequenceNode);
  35100. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35101. $globals.ValueNode.comment="I represent a value node.";
  35102. $core.addMethod(
  35103. $core.method({
  35104. selector: "acceptDagVisitor:",
  35105. protocol: "visiting",
  35106. fn: function (aVisitor){
  35107. var self=this,$self=this;
  35108. return $core.withContext(function($ctx1) {
  35109. return $recv(aVisitor)._visitValueNode_(self);
  35110. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35111. },
  35112. args: ["aVisitor"],
  35113. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35114. referencedClasses: [],
  35115. messageSends: ["visitValueNode:"]
  35116. }),
  35117. $globals.ValueNode);
  35118. $core.addMethod(
  35119. $core.method({
  35120. selector: "isImmutable",
  35121. protocol: "testing",
  35122. fn: function (){
  35123. var self=this,$self=this;
  35124. return $core.withContext(function($ctx1) {
  35125. return $recv($self._value())._isImmutable();
  35126. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35127. },
  35128. args: [],
  35129. source: "isImmutable\x0a\x09^ self value isImmutable",
  35130. referencedClasses: [],
  35131. messageSends: ["isImmutable", "value"]
  35132. }),
  35133. $globals.ValueNode);
  35134. $core.addMethod(
  35135. $core.method({
  35136. selector: "isValueNode",
  35137. protocol: "testing",
  35138. fn: function (){
  35139. var self=this,$self=this;
  35140. return true;
  35141. },
  35142. args: [],
  35143. source: "isValueNode\x0a\x09^ true",
  35144. referencedClasses: [],
  35145. messageSends: []
  35146. }),
  35147. $globals.ValueNode);
  35148. $core.addMethod(
  35149. $core.method({
  35150. selector: "value",
  35151. protocol: "accessing",
  35152. fn: function (){
  35153. var self=this,$self=this;
  35154. return $self["@value"];
  35155. },
  35156. args: [],
  35157. source: "value\x0a\x09^ value",
  35158. referencedClasses: [],
  35159. messageSends: []
  35160. }),
  35161. $globals.ValueNode);
  35162. $core.addMethod(
  35163. $core.method({
  35164. selector: "value:",
  35165. protocol: "accessing",
  35166. fn: function (anObject){
  35167. var self=this,$self=this;
  35168. $self["@value"]=anObject;
  35169. return self;
  35170. },
  35171. args: ["anObject"],
  35172. source: "value: anObject\x0a\x09value := anObject",
  35173. referencedClasses: [],
  35174. messageSends: []
  35175. }),
  35176. $globals.ValueNode);
  35177. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35178. $globals.VariableNode.comment="I represent an variable node.";
  35179. $core.addMethod(
  35180. $core.method({
  35181. selector: "acceptDagVisitor:",
  35182. protocol: "visiting",
  35183. fn: function (aVisitor){
  35184. var self=this,$self=this;
  35185. return $core.withContext(function($ctx1) {
  35186. return $recv(aVisitor)._visitVariableNode_(self);
  35187. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35188. },
  35189. args: ["aVisitor"],
  35190. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35191. referencedClasses: [],
  35192. messageSends: ["visitVariableNode:"]
  35193. }),
  35194. $globals.VariableNode);
  35195. $core.addMethod(
  35196. $core.method({
  35197. selector: "alias",
  35198. protocol: "accessing",
  35199. fn: function (){
  35200. var self=this,$self=this;
  35201. return $core.withContext(function($ctx1) {
  35202. return $recv($self._binding())._alias();
  35203. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35204. },
  35205. args: [],
  35206. source: "alias\x0a\x09^ self binding alias",
  35207. referencedClasses: [],
  35208. messageSends: ["alias", "binding"]
  35209. }),
  35210. $globals.VariableNode);
  35211. $core.addMethod(
  35212. $core.method({
  35213. selector: "assigned",
  35214. protocol: "accessing",
  35215. fn: function (){
  35216. var self=this,$self=this;
  35217. return $core.withContext(function($ctx1) {
  35218. var $1,$receiver;
  35219. $1=$self["@assigned"];
  35220. if(($receiver = $1) == null || $receiver.a$nil){
  35221. return false;
  35222. } else {
  35223. return $1;
  35224. }
  35225. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35226. },
  35227. args: [],
  35228. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35229. referencedClasses: [],
  35230. messageSends: ["ifNil:"]
  35231. }),
  35232. $globals.VariableNode);
  35233. $core.addMethod(
  35234. $core.method({
  35235. selector: "assigned:",
  35236. protocol: "accessing",
  35237. fn: function (aBoolean){
  35238. var self=this,$self=this;
  35239. $self["@assigned"]=aBoolean;
  35240. return self;
  35241. },
  35242. args: ["aBoolean"],
  35243. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35244. referencedClasses: [],
  35245. messageSends: []
  35246. }),
  35247. $globals.VariableNode);
  35248. $core.addMethod(
  35249. $core.method({
  35250. selector: "beAssigned",
  35251. protocol: "accessing",
  35252. fn: function (){
  35253. var self=this,$self=this;
  35254. return $core.withContext(function($ctx1) {
  35255. $recv($self._binding())._validateAssignment();
  35256. $self["@assigned"]=true;
  35257. return self;
  35258. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35259. },
  35260. args: [],
  35261. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35262. referencedClasses: [],
  35263. messageSends: ["validateAssignment", "binding"]
  35264. }),
  35265. $globals.VariableNode);
  35266. $core.addMethod(
  35267. $core.method({
  35268. selector: "binding",
  35269. protocol: "accessing",
  35270. fn: function (){
  35271. var self=this,$self=this;
  35272. return $self["@binding"];
  35273. },
  35274. args: [],
  35275. source: "binding\x0a\x09^ binding",
  35276. referencedClasses: [],
  35277. messageSends: []
  35278. }),
  35279. $globals.VariableNode);
  35280. $core.addMethod(
  35281. $core.method({
  35282. selector: "binding:",
  35283. protocol: "accessing",
  35284. fn: function (aScopeVar){
  35285. var self=this,$self=this;
  35286. $self["@binding"]=aScopeVar;
  35287. return self;
  35288. },
  35289. args: ["aScopeVar"],
  35290. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35291. referencedClasses: [],
  35292. messageSends: []
  35293. }),
  35294. $globals.VariableNode);
  35295. $core.addMethod(
  35296. $core.method({
  35297. selector: "isArgument",
  35298. protocol: "testing",
  35299. fn: function (){
  35300. var self=this,$self=this;
  35301. return $core.withContext(function($ctx1) {
  35302. return $recv($self._binding())._isArgVar();
  35303. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35304. },
  35305. args: [],
  35306. source: "isArgument\x0a\x09^ self binding isArgVar",
  35307. referencedClasses: [],
  35308. messageSends: ["isArgVar", "binding"]
  35309. }),
  35310. $globals.VariableNode);
  35311. $core.addMethod(
  35312. $core.method({
  35313. selector: "isImmutable",
  35314. protocol: "testing",
  35315. fn: function (){
  35316. var self=this,$self=this;
  35317. return $core.withContext(function($ctx1) {
  35318. return $recv($self._binding())._isImmutable();
  35319. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35320. },
  35321. args: [],
  35322. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35323. referencedClasses: [],
  35324. messageSends: ["isImmutable", "binding"]
  35325. }),
  35326. $globals.VariableNode);
  35327. $core.addMethod(
  35328. $core.method({
  35329. selector: "isNavigationNode",
  35330. protocol: "testing",
  35331. fn: function (){
  35332. var self=this,$self=this;
  35333. return true;
  35334. },
  35335. args: [],
  35336. source: "isNavigationNode\x0a\x09^ true",
  35337. referencedClasses: [],
  35338. messageSends: []
  35339. }),
  35340. $globals.VariableNode);
  35341. $core.addMethod(
  35342. $core.method({
  35343. selector: "isSuperKeyword",
  35344. protocol: "testing",
  35345. fn: function (){
  35346. var self=this,$self=this;
  35347. return $core.withContext(function($ctx1) {
  35348. return $recv($self._value()).__eq("super");
  35349. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35350. },
  35351. args: [],
  35352. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35353. referencedClasses: [],
  35354. messageSends: ["=", "value"]
  35355. }),
  35356. $globals.VariableNode);
  35357. $core.addMethod(
  35358. $core.method({
  35359. selector: "isVariableNode",
  35360. protocol: "testing",
  35361. fn: function (){
  35362. var self=this,$self=this;
  35363. return true;
  35364. },
  35365. args: [],
  35366. source: "isVariableNode\x0a\x09^ true",
  35367. referencedClasses: [],
  35368. messageSends: []
  35369. }),
  35370. $globals.VariableNode);
  35371. $core.addMethod(
  35372. $core.method({
  35373. selector: "navigationLink",
  35374. protocol: "accessing",
  35375. fn: function (){
  35376. var self=this,$self=this;
  35377. return $core.withContext(function($ctx1) {
  35378. return $self._value();
  35379. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35380. },
  35381. args: [],
  35382. source: "navigationLink\x0a\x09^ self value",
  35383. referencedClasses: [],
  35384. messageSends: ["value"]
  35385. }),
  35386. $globals.VariableNode);
  35387. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  35388. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  35389. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35390. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35391. $core.addMethod(
  35392. $core.method({
  35393. selector: "visit:",
  35394. protocol: "visiting",
  35395. fn: function (aNode){
  35396. var self=this,$self=this;
  35397. return $core.withContext(function($ctx1) {
  35398. var $1;
  35399. $recv($self._path())._ifNotEmpty_((function(p){
  35400. return $core.withContext(function($ctx2) {
  35401. return $recv(aNode)._parent_($recv(p)._last());
  35402. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35403. }));
  35404. $1=(
  35405. $ctx1.supercall = true,
  35406. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35407. $ctx1.supercall = false;
  35408. return $1;
  35409. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35410. },
  35411. args: ["aNode"],
  35412. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35413. referencedClasses: [],
  35414. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35415. }),
  35416. $globals.ParentFakingPathDagVisitor);
  35417. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35418. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35419. $core.addMethod(
  35420. $core.method({
  35421. selector: "visitAssignmentNode:",
  35422. protocol: "visiting",
  35423. fn: function (aNode){
  35424. var self=this,$self=this;
  35425. return $core.withContext(function($ctx1) {
  35426. return $self._visitDagNode_(aNode);
  35427. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35428. },
  35429. args: ["aNode"],
  35430. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35431. referencedClasses: [],
  35432. messageSends: ["visitDagNode:"]
  35433. }),
  35434. $globals.NodeVisitor);
  35435. $core.addMethod(
  35436. $core.method({
  35437. selector: "visitBlockNode:",
  35438. protocol: "visiting",
  35439. fn: function (aNode){
  35440. var self=this,$self=this;
  35441. return $core.withContext(function($ctx1) {
  35442. return $self._visitDagNode_(aNode);
  35443. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35444. },
  35445. args: ["aNode"],
  35446. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35447. referencedClasses: [],
  35448. messageSends: ["visitDagNode:"]
  35449. }),
  35450. $globals.NodeVisitor);
  35451. $core.addMethod(
  35452. $core.method({
  35453. selector: "visitBlockSequenceNode:",
  35454. protocol: "visiting",
  35455. fn: function (aNode){
  35456. var self=this,$self=this;
  35457. return $core.withContext(function($ctx1) {
  35458. return $self._visitSequenceNode_(aNode);
  35459. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35460. },
  35461. args: ["aNode"],
  35462. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  35463. referencedClasses: [],
  35464. messageSends: ["visitSequenceNode:"]
  35465. }),
  35466. $globals.NodeVisitor);
  35467. $core.addMethod(
  35468. $core.method({
  35469. selector: "visitCascadeNode:",
  35470. protocol: "visiting",
  35471. fn: function (aNode){
  35472. var self=this,$self=this;
  35473. return $core.withContext(function($ctx1) {
  35474. return $self._visitDagNode_(aNode);
  35475. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  35476. },
  35477. args: ["aNode"],
  35478. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35479. referencedClasses: [],
  35480. messageSends: ["visitDagNode:"]
  35481. }),
  35482. $globals.NodeVisitor);
  35483. $core.addMethod(
  35484. $core.method({
  35485. selector: "visitDagNode:",
  35486. protocol: "visiting",
  35487. fn: function (aNode){
  35488. var self=this,$self=this;
  35489. return $core.withContext(function($ctx1) {
  35490. return $self._visitDagNodeVariantSimple_(aNode);
  35491. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  35492. },
  35493. args: ["aNode"],
  35494. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  35495. referencedClasses: [],
  35496. messageSends: ["visitDagNodeVariantSimple:"]
  35497. }),
  35498. $globals.NodeVisitor);
  35499. $core.addMethod(
  35500. $core.method({
  35501. selector: "visitDynamicArrayNode:",
  35502. protocol: "visiting",
  35503. fn: function (aNode){
  35504. var self=this,$self=this;
  35505. return $core.withContext(function($ctx1) {
  35506. return $self._visitDagNode_(aNode);
  35507. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  35508. },
  35509. args: ["aNode"],
  35510. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35511. referencedClasses: [],
  35512. messageSends: ["visitDagNode:"]
  35513. }),
  35514. $globals.NodeVisitor);
  35515. $core.addMethod(
  35516. $core.method({
  35517. selector: "visitDynamicDictionaryNode:",
  35518. protocol: "visiting",
  35519. fn: function (aNode){
  35520. var self=this,$self=this;
  35521. return $core.withContext(function($ctx1) {
  35522. return $self._visitDagNode_(aNode);
  35523. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  35524. },
  35525. args: ["aNode"],
  35526. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35527. referencedClasses: [],
  35528. messageSends: ["visitDagNode:"]
  35529. }),
  35530. $globals.NodeVisitor);
  35531. $core.addMethod(
  35532. $core.method({
  35533. selector: "visitJSStatementNode:",
  35534. protocol: "visiting",
  35535. fn: function (aNode){
  35536. var self=this,$self=this;
  35537. return $core.withContext(function($ctx1) {
  35538. return $self._visitDagNode_(aNode);
  35539. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  35540. },
  35541. args: ["aNode"],
  35542. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35543. referencedClasses: [],
  35544. messageSends: ["visitDagNode:"]
  35545. }),
  35546. $globals.NodeVisitor);
  35547. $core.addMethod(
  35548. $core.method({
  35549. selector: "visitMethodNode:",
  35550. protocol: "visiting",
  35551. fn: function (aNode){
  35552. var self=this,$self=this;
  35553. return $core.withContext(function($ctx1) {
  35554. return $self._visitDagNode_(aNode);
  35555. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35556. },
  35557. args: ["aNode"],
  35558. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35559. referencedClasses: [],
  35560. messageSends: ["visitDagNode:"]
  35561. }),
  35562. $globals.NodeVisitor);
  35563. $core.addMethod(
  35564. $core.method({
  35565. selector: "visitReturnNode:",
  35566. protocol: "visiting",
  35567. fn: function (aNode){
  35568. var self=this,$self=this;
  35569. return $core.withContext(function($ctx1) {
  35570. return $self._visitDagNode_(aNode);
  35571. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35572. },
  35573. args: ["aNode"],
  35574. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35575. referencedClasses: [],
  35576. messageSends: ["visitDagNode:"]
  35577. }),
  35578. $globals.NodeVisitor);
  35579. $core.addMethod(
  35580. $core.method({
  35581. selector: "visitSendNode:",
  35582. protocol: "visiting",
  35583. fn: function (aNode){
  35584. var self=this,$self=this;
  35585. return $core.withContext(function($ctx1) {
  35586. return $self._visitDagNode_(aNode);
  35587. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35588. },
  35589. args: ["aNode"],
  35590. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35591. referencedClasses: [],
  35592. messageSends: ["visitDagNode:"]
  35593. }),
  35594. $globals.NodeVisitor);
  35595. $core.addMethod(
  35596. $core.method({
  35597. selector: "visitSequenceNode:",
  35598. protocol: "visiting",
  35599. fn: function (aNode){
  35600. var self=this,$self=this;
  35601. return $core.withContext(function($ctx1) {
  35602. return $self._visitDagNode_(aNode);
  35603. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35604. },
  35605. args: ["aNode"],
  35606. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35607. referencedClasses: [],
  35608. messageSends: ["visitDagNode:"]
  35609. }),
  35610. $globals.NodeVisitor);
  35611. $core.addMethod(
  35612. $core.method({
  35613. selector: "visitValueNode:",
  35614. protocol: "visiting",
  35615. fn: function (aNode){
  35616. var self=this,$self=this;
  35617. return $core.withContext(function($ctx1) {
  35618. return $self._visitDagNode_(aNode);
  35619. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35620. },
  35621. args: ["aNode"],
  35622. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35623. referencedClasses: [],
  35624. messageSends: ["visitDagNode:"]
  35625. }),
  35626. $globals.NodeVisitor);
  35627. $core.addMethod(
  35628. $core.method({
  35629. selector: "visitVariableNode:",
  35630. protocol: "visiting",
  35631. fn: function (aNode){
  35632. var self=this,$self=this;
  35633. return $core.withContext(function($ctx1) {
  35634. return $self._visitDagNode_(aNode);
  35635. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35636. },
  35637. args: ["aNode"],
  35638. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35639. referencedClasses: [],
  35640. messageSends: ["visitDagNode:"]
  35641. }),
  35642. $globals.NodeVisitor);
  35643. $core.addMethod(
  35644. $core.method({
  35645. selector: "ast",
  35646. protocol: "*Compiler-AST",
  35647. fn: function (){
  35648. var self=this,$self=this;
  35649. return $core.withContext(function($ctx1) {
  35650. var $1;
  35651. $1=$self._source();
  35652. $ctx1.sendIdx["source"]=1;
  35653. $recv($1)._ifEmpty_((function(){
  35654. return $core.withContext(function($ctx2) {
  35655. return $recv($globals.CompilerError)._signal_("Method source is empty");
  35656. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35657. }));
  35658. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._methodClass(),$self._protocol());
  35659. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35660. },
  35661. args: [],
  35662. source: "ast\x0a\x09self source ifEmpty: [ CompilerError signal: 'Method source is empty' ].\x0a\x09\x0a\x09^ Compiler new\x0a\x09\x09ast: self source\x0a\x09\x09forClass: self methodClass\x0a\x09\x09protocol: self protocol",
  35663. referencedClasses: ["CompilerError", "Compiler"],
  35664. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "methodClass", "protocol"]
  35665. }),
  35666. $globals.CompiledMethod);
  35667. });
  35668. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35669. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  35670. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35671. $core.addPackage("Compiler-Core");
  35672. ($core.packageDescriptors||$core.packages)["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  35673. ($core.packageDescriptors||$core.packages)["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35674. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  35675. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  35676. $core.addMethod(
  35677. $core.method({
  35678. selector: "compileNode:",
  35679. protocol: "compiling",
  35680. fn: function (aNode){
  35681. var self=this,$self=this;
  35682. return $core.withContext(function($ctx1) {
  35683. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  35684. return $core.withContext(function($ctx2) {
  35685. return $recv(transformer)._value_(input);
  35686. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  35687. }));
  35688. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  35689. },
  35690. args: ["aNode"],
  35691. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  35692. referencedClasses: [],
  35693. messageSends: ["inject:into:", "transformers", "value:"]
  35694. }),
  35695. $globals.AbstractCodeGenerator);
  35696. $core.addMethod(
  35697. $core.method({
  35698. selector: "currentClass",
  35699. protocol: "accessing",
  35700. fn: function (){
  35701. var self=this,$self=this;
  35702. return $self["@currentClass"];
  35703. },
  35704. args: [],
  35705. source: "currentClass\x0a\x09^ currentClass",
  35706. referencedClasses: [],
  35707. messageSends: []
  35708. }),
  35709. $globals.AbstractCodeGenerator);
  35710. $core.addMethod(
  35711. $core.method({
  35712. selector: "currentClass:",
  35713. protocol: "accessing",
  35714. fn: function (aClass){
  35715. var self=this,$self=this;
  35716. $self["@currentClass"]=aClass;
  35717. return self;
  35718. },
  35719. args: ["aClass"],
  35720. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35721. referencedClasses: [],
  35722. messageSends: []
  35723. }),
  35724. $globals.AbstractCodeGenerator);
  35725. $core.addMethod(
  35726. $core.method({
  35727. selector: "currentPackage",
  35728. protocol: "accessing",
  35729. fn: function (){
  35730. var self=this,$self=this;
  35731. return $self["@currentPackage"];
  35732. },
  35733. args: [],
  35734. source: "currentPackage\x0a\x09^ currentPackage",
  35735. referencedClasses: [],
  35736. messageSends: []
  35737. }),
  35738. $globals.AbstractCodeGenerator);
  35739. $core.addMethod(
  35740. $core.method({
  35741. selector: "currentPackage:",
  35742. protocol: "accessing",
  35743. fn: function (anObject){
  35744. var self=this,$self=this;
  35745. $self["@currentPackage"]=anObject;
  35746. return self;
  35747. },
  35748. args: ["anObject"],
  35749. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35750. referencedClasses: [],
  35751. messageSends: []
  35752. }),
  35753. $globals.AbstractCodeGenerator);
  35754. $core.addMethod(
  35755. $core.method({
  35756. selector: "pseudoVariables",
  35757. protocol: "accessing",
  35758. fn: function (){
  35759. var self=this,$self=this;
  35760. return $core.withContext(function($ctx1) {
  35761. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35762. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  35763. },
  35764. args: [],
  35765. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35766. referencedClasses: ["Smalltalk"],
  35767. messageSends: ["pseudoVariableNames"]
  35768. }),
  35769. $globals.AbstractCodeGenerator);
  35770. $core.addMethod(
  35771. $core.method({
  35772. selector: "source",
  35773. protocol: "accessing",
  35774. fn: function (){
  35775. var self=this,$self=this;
  35776. return $core.withContext(function($ctx1) {
  35777. var $1,$receiver;
  35778. $1=$self["@source"];
  35779. if(($receiver = $1) == null || $receiver.a$nil){
  35780. return "";
  35781. } else {
  35782. return $1;
  35783. }
  35784. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  35785. },
  35786. args: [],
  35787. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35788. referencedClasses: [],
  35789. messageSends: ["ifNil:"]
  35790. }),
  35791. $globals.AbstractCodeGenerator);
  35792. $core.addMethod(
  35793. $core.method({
  35794. selector: "source:",
  35795. protocol: "accessing",
  35796. fn: function (aString){
  35797. var self=this,$self=this;
  35798. $self["@source"]=aString;
  35799. return self;
  35800. },
  35801. args: ["aString"],
  35802. source: "source: aString\x0a\x09source := aString",
  35803. referencedClasses: [],
  35804. messageSends: []
  35805. }),
  35806. $globals.AbstractCodeGenerator);
  35807. $core.addMethod(
  35808. $core.method({
  35809. selector: "transformers",
  35810. protocol: "compiling",
  35811. fn: function (){
  35812. var self=this,$self=this;
  35813. var dict;
  35814. return $core.withContext(function($ctx1) {
  35815. dict=$self._transformersDictionary();
  35816. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  35817. return $core.withContext(function($ctx2) {
  35818. return $recv(dict)._at_(each);
  35819. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35820. }));
  35821. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  35822. },
  35823. args: [],
  35824. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  35825. referencedClasses: [],
  35826. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  35827. }),
  35828. $globals.AbstractCodeGenerator);
  35829. $core.addMethod(
  35830. $core.method({
  35831. selector: "transformersDictionary",
  35832. protocol: "compiling",
  35833. fn: function (){
  35834. var self=this,$self=this;
  35835. return $core.withContext(function($ctx1) {
  35836. $self._subclassResponsibility();
  35837. return self;
  35838. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  35839. },
  35840. args: [],
  35841. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  35842. referencedClasses: [],
  35843. messageSends: ["subclassResponsibility"]
  35844. }),
  35845. $globals.AbstractCodeGenerator);
  35846. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  35847. $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.";
  35848. $core.addMethod(
  35849. $core.method({
  35850. selector: "irTranslator",
  35851. protocol: "compiling",
  35852. fn: function (){
  35853. var self=this,$self=this;
  35854. return $core.withContext(function($ctx1) {
  35855. var $1;
  35856. $1=$recv($self._irTranslatorClass())._new();
  35857. $recv($1)._currentClass_($self._currentClass());
  35858. return $recv($1)._yourself();
  35859. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  35860. },
  35861. args: [],
  35862. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  35863. referencedClasses: [],
  35864. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  35865. }),
  35866. $globals.CodeGenerator);
  35867. $core.addMethod(
  35868. $core.method({
  35869. selector: "irTranslatorClass",
  35870. protocol: "compiling",
  35871. fn: function (){
  35872. var self=this,$self=this;
  35873. return $globals.IRJSTranslator;
  35874. },
  35875. args: [],
  35876. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  35877. referencedClasses: ["IRJSTranslator"],
  35878. messageSends: []
  35879. }),
  35880. $globals.CodeGenerator);
  35881. $core.addMethod(
  35882. $core.method({
  35883. selector: "semanticAnalyzer",
  35884. protocol: "compiling",
  35885. fn: function (){
  35886. var self=this,$self=this;
  35887. return $core.withContext(function($ctx1) {
  35888. var $1;
  35889. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  35890. $recv($1)._thePackage_($self._currentPackage());
  35891. return $recv($1)._yourself();
  35892. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  35893. },
  35894. args: [],
  35895. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  35896. referencedClasses: ["SemanticAnalyzer"],
  35897. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  35898. }),
  35899. $globals.CodeGenerator);
  35900. $core.addMethod(
  35901. $core.method({
  35902. selector: "transformersDictionary",
  35903. protocol: "compiling",
  35904. fn: function (){
  35905. var self=this,$self=this;
  35906. return $core.withContext(function($ctx1) {
  35907. var $1,$2,$receiver;
  35908. $1=$self["@transformersDictionary"];
  35909. if(($receiver = $1) == null || $receiver.a$nil){
  35910. $2=$recv($globals.Dictionary)._new();
  35911. $ctx1.sendIdx["new"]=1;
  35912. $recv($2)._at_put_("1000-earlyPragmas",$recv($globals.EarlyPragmator)._new());
  35913. $ctx1.sendIdx["at:put:"]=1;
  35914. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  35915. $ctx1.sendIdx["at:put:"]=2;
  35916. $recv($2)._at_put_("5000-astToIr",$self._translator());
  35917. $ctx1.sendIdx["at:put:"]=3;
  35918. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  35919. $self["@transformersDictionary"]=$recv($2)._yourself();
  35920. return $self["@transformersDictionary"];
  35921. } else {
  35922. return $1;
  35923. }
  35924. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  35925. },
  35926. args: [],
  35927. source: "transformersDictionary\x0a\x09^ transformersDictionary ifNil: [ transformersDictionary := Dictionary new\x0a\x09\x09at: '1000-earlyPragmas' put: EarlyPragmator 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 ]",
  35928. referencedClasses: ["Dictionary", "EarlyPragmator"],
  35929. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  35930. }),
  35931. $globals.CodeGenerator);
  35932. $core.addMethod(
  35933. $core.method({
  35934. selector: "translator",
  35935. protocol: "compiling",
  35936. fn: function (){
  35937. var self=this,$self=this;
  35938. return $core.withContext(function($ctx1) {
  35939. var $1;
  35940. $1=$recv($globals.IRASTTranslator)._new();
  35941. $recv($1)._source_($self._source());
  35942. $recv($1)._theClass_($self._currentClass());
  35943. return $recv($1)._yourself();
  35944. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  35945. },
  35946. args: [],
  35947. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  35948. referencedClasses: ["IRASTTranslator"],
  35949. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  35950. }),
  35951. $globals.CodeGenerator);
  35952. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  35953. $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`";
  35954. $core.addMethod(
  35955. $core.method({
  35956. selector: "ast:forClass:protocol:",
  35957. protocol: "compiling",
  35958. fn: function (aString,aClass,anotherString){
  35959. var self=this,$self=this;
  35960. return $core.withContext(function($ctx1) {
  35961. var $early={};
  35962. try {
  35963. $self._source_(aString);
  35964. $self._forClass_protocol_(aClass,anotherString);
  35965. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  35966. throw $early=[x];
  35967. }));
  35968. $self._compileNode_($self._parse_(aString));
  35969. $recv($globals.CompilerError)._signal_("AST transformation failed.");
  35970. return self;
  35971. }
  35972. catch(e) {if(e===$early)return e[0]; throw e}
  35973. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  35974. },
  35975. args: ["aString", "aClass", "anotherString"],
  35976. source: "ast: aString forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString.\x0a\x0a\x09self codeGenerator transformersDictionary at: '2500-astCheckpoint' put: [ :x | ^x ].\x0a\x09\x0a\x09self compileNode: (self parse: aString).\x0a\x0a\x09CompilerError signal: 'AST transformation failed.'",
  35977. referencedClasses: ["CompilerError"],
  35978. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "signal:"]
  35979. }),
  35980. $globals.Compiler);
  35981. $core.addMethod(
  35982. $core.method({
  35983. selector: "cleanCodeGenerator",
  35984. protocol: "accessing",
  35985. fn: function (){
  35986. var self=this,$self=this;
  35987. $self["@codeGenerator"]=nil;
  35988. return self;
  35989. },
  35990. args: [],
  35991. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  35992. referencedClasses: [],
  35993. messageSends: []
  35994. }),
  35995. $globals.Compiler);
  35996. $core.addMethod(
  35997. $core.method({
  35998. selector: "codeGenerator",
  35999. protocol: "accessing",
  36000. fn: function (){
  36001. var self=this,$self=this;
  36002. return $core.withContext(function($ctx1) {
  36003. var $1,$2,$receiver;
  36004. $1=$self["@codeGenerator"];
  36005. if(($receiver = $1) == null || $receiver.a$nil){
  36006. $2=$recv($self._codeGeneratorClass())._new();
  36007. $recv($2)._source_($self._source());
  36008. $recv($2)._currentClass_($self._currentClass());
  36009. $recv($2)._currentPackage_($self._currentPackage());
  36010. $self["@codeGenerator"]=$recv($2)._yourself();
  36011. return $self["@codeGenerator"];
  36012. } else {
  36013. return $1;
  36014. }
  36015. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{},$globals.Compiler)});
  36016. },
  36017. args: [],
  36018. source: "codeGenerator\x0a\x09^ codeGenerator ifNil: [ codeGenerator := self codeGeneratorClass new\x0a\x09\x09\x09source: self source;\x0a\x09\x09\x09currentClass: self currentClass;\x0a\x09\x09\x09currentPackage: self currentPackage;\x0a\x09\x09\x09yourself ]",
  36019. referencedClasses: [],
  36020. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  36021. }),
  36022. $globals.Compiler);
  36023. $core.addMethod(
  36024. $core.method({
  36025. selector: "codeGeneratorClass",
  36026. protocol: "accessing",
  36027. fn: function (){
  36028. var self=this,$self=this;
  36029. return $core.withContext(function($ctx1) {
  36030. var $1,$receiver;
  36031. $1=$self["@codeGeneratorClass"];
  36032. if(($receiver = $1) == null || $receiver.a$nil){
  36033. return $globals.InliningCodeGenerator;
  36034. } else {
  36035. return $1;
  36036. }
  36037. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  36038. },
  36039. args: [],
  36040. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  36041. referencedClasses: ["InliningCodeGenerator"],
  36042. messageSends: ["ifNil:"]
  36043. }),
  36044. $globals.Compiler);
  36045. $core.addMethod(
  36046. $core.method({
  36047. selector: "codeGeneratorClass:",
  36048. protocol: "accessing",
  36049. fn: function (aClass){
  36050. var self=this,$self=this;
  36051. $self["@codeGeneratorClass"]=aClass;
  36052. return self;
  36053. },
  36054. args: ["aClass"],
  36055. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  36056. referencedClasses: [],
  36057. messageSends: []
  36058. }),
  36059. $globals.Compiler);
  36060. $core.addMethod(
  36061. $core.method({
  36062. selector: "compile:forClass:protocol:",
  36063. protocol: "compiling",
  36064. fn: function (aString,aClass,anotherString){
  36065. var self=this,$self=this;
  36066. return $core.withContext(function($ctx1) {
  36067. $self._source_(aString);
  36068. $self._forClass_protocol_(aClass,anotherString);
  36069. return $self._compileNode_($self._parse_(aString));
  36070. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36071. },
  36072. args: ["aString", "aClass", "anotherString"],
  36073. source: "compile: aString forClass: aClass protocol: anotherString\x0a\x09^ self\x0a\x09\x09source: aString;\x0a\x09\x09forClass: aClass protocol: anotherString;\x0a\x09\x09compileNode: (self parse: aString)",
  36074. referencedClasses: [],
  36075. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  36076. }),
  36077. $globals.Compiler);
  36078. $core.addMethod(
  36079. $core.method({
  36080. selector: "compileExpression:on:",
  36081. protocol: "compiling",
  36082. fn: function (aString,anObject){
  36083. var self=this,$self=this;
  36084. return $core.withContext(function($ctx1) {
  36085. var $1;
  36086. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  36087. $ctx1.sendIdx[","]=1;
  36088. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  36089. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  36090. },
  36091. args: ["aString", "anObject"],
  36092. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  36093. referencedClasses: [],
  36094. messageSends: ["compile:forClass:protocol:", ",", "class"]
  36095. }),
  36096. $globals.Compiler);
  36097. $core.addMethod(
  36098. $core.method({
  36099. selector: "compileNode:",
  36100. protocol: "compiling",
  36101. fn: function (aNode){
  36102. var self=this,$self=this;
  36103. var result;
  36104. return $core.withContext(function($ctx1) {
  36105. result=$recv($self._codeGenerator())._compileNode_(aNode);
  36106. $self._cleanCodeGenerator();
  36107. return result;
  36108. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result},$globals.Compiler)});
  36109. },
  36110. args: ["aNode"],
  36111. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  36112. referencedClasses: [],
  36113. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  36114. }),
  36115. $globals.Compiler);
  36116. $core.addMethod(
  36117. $core.method({
  36118. selector: "currentClass",
  36119. protocol: "accessing",
  36120. fn: function (){
  36121. var self=this,$self=this;
  36122. return $self["@currentClass"];
  36123. },
  36124. args: [],
  36125. source: "currentClass\x0a\x09^ currentClass",
  36126. referencedClasses: [],
  36127. messageSends: []
  36128. }),
  36129. $globals.Compiler);
  36130. $core.addMethod(
  36131. $core.method({
  36132. selector: "currentClass:",
  36133. protocol: "accessing",
  36134. fn: function (aClass){
  36135. var self=this,$self=this;
  36136. $self["@currentClass"]=aClass;
  36137. return self;
  36138. },
  36139. args: ["aClass"],
  36140. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  36141. referencedClasses: [],
  36142. messageSends: []
  36143. }),
  36144. $globals.Compiler);
  36145. $core.addMethod(
  36146. $core.method({
  36147. selector: "currentPackage",
  36148. protocol: "accessing",
  36149. fn: function (){
  36150. var self=this,$self=this;
  36151. return $self["@currentPackage"];
  36152. },
  36153. args: [],
  36154. source: "currentPackage\x0a\x09^ currentPackage",
  36155. referencedClasses: [],
  36156. messageSends: []
  36157. }),
  36158. $globals.Compiler);
  36159. $core.addMethod(
  36160. $core.method({
  36161. selector: "currentPackage:",
  36162. protocol: "accessing",
  36163. fn: function (anObject){
  36164. var self=this,$self=this;
  36165. $self["@currentPackage"]=anObject;
  36166. return self;
  36167. },
  36168. args: ["anObject"],
  36169. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  36170. referencedClasses: [],
  36171. messageSends: []
  36172. }),
  36173. $globals.Compiler);
  36174. $core.addMethod(
  36175. $core.method({
  36176. selector: "eval:",
  36177. protocol: "compiling",
  36178. fn: function (aString){
  36179. var self=this,$self=this;
  36180. return $core.withContext(function($ctx1) {
  36181. return eval(aString);
  36182. return self;
  36183. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  36184. },
  36185. args: ["aString"],
  36186. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  36187. referencedClasses: [],
  36188. messageSends: []
  36189. }),
  36190. $globals.Compiler);
  36191. $core.addMethod(
  36192. $core.method({
  36193. selector: "eval:forPackage:",
  36194. protocol: "compiling",
  36195. fn: function (aString,aPackage){
  36196. var self=this,$self=this;
  36197. return $core.withContext(function($ctx1) {
  36198. var $receiver;
  36199. if(($receiver = aPackage) == null || $receiver.a$nil){
  36200. return $self._eval_(aString);
  36201. $ctx1.sendIdx["eval:"]=1;
  36202. } else {
  36203. return $recv(aPackage)._eval_(aString);
  36204. }
  36205. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  36206. },
  36207. args: ["aString", "aPackage"],
  36208. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  36209. referencedClasses: [],
  36210. messageSends: ["ifNil:ifNotNil:", "eval:"]
  36211. }),
  36212. $globals.Compiler);
  36213. $core.addMethod(
  36214. $core.method({
  36215. selector: "evaluateExpression:",
  36216. protocol: "compiling",
  36217. fn: function (aString){
  36218. var self=this,$self=this;
  36219. return $core.withContext(function($ctx1) {
  36220. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  36221. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  36222. },
  36223. args: ["aString"],
  36224. 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",
  36225. referencedClasses: ["DoIt"],
  36226. messageSends: ["evaluateExpression:on:", "new"]
  36227. }),
  36228. $globals.Compiler);
  36229. $core.addMethod(
  36230. $core.method({
  36231. selector: "evaluateExpression:on:",
  36232. protocol: "compiling",
  36233. fn: function (aString,anObject){
  36234. var self=this,$self=this;
  36235. var result,method;
  36236. return $core.withContext(function($ctx1) {
  36237. var $1;
  36238. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  36239. $recv(method)._protocol_("**xxxDoIt");
  36240. $1=$recv(anObject)._class();
  36241. $ctx1.sendIdx["class"]=1;
  36242. $recv($1)._addCompiledMethod_(method);
  36243. result=$recv(anObject)._xxxDoIt();
  36244. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  36245. return result;
  36246. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  36247. },
  36248. args: ["aString", "anObject"],
  36249. 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",
  36250. referencedClasses: [],
  36251. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  36252. }),
  36253. $globals.Compiler);
  36254. $core.addMethod(
  36255. $core.method({
  36256. selector: "forClass:protocol:",
  36257. protocol: "compiling",
  36258. fn: function (aClass,anotherString){
  36259. var self=this,$self=this;
  36260. return $core.withContext(function($ctx1) {
  36261. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  36262. $self._currentClass_(aClass);
  36263. return self;
  36264. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36265. },
  36266. args: ["aClass", "anotherString"],
  36267. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  36268. referencedClasses: [],
  36269. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  36270. }),
  36271. $globals.Compiler);
  36272. $core.addMethod(
  36273. $core.method({
  36274. selector: "install:forClass:protocol:",
  36275. protocol: "compiling",
  36276. fn: function (aString,aBehavior,anotherString){
  36277. var self=this,$self=this;
  36278. var compiledMethod;
  36279. return $core.withContext(function($ctx1) {
  36280. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  36281. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  36282. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  36283. },
  36284. args: ["aString", "aBehavior", "anotherString"],
  36285. 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",
  36286. referencedClasses: ["ClassBuilder"],
  36287. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  36288. }),
  36289. $globals.Compiler);
  36290. $core.addMethod(
  36291. $core.method({
  36292. selector: "parse:",
  36293. protocol: "compiling",
  36294. fn: function (aString){
  36295. var self=this,$self=this;
  36296. return $core.withContext(function($ctx1) {
  36297. return $recv($globals.Smalltalk)._parse_(aString);
  36298. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  36299. },
  36300. args: ["aString"],
  36301. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  36302. referencedClasses: ["Smalltalk"],
  36303. messageSends: ["parse:"]
  36304. }),
  36305. $globals.Compiler);
  36306. $core.addMethod(
  36307. $core.method({
  36308. selector: "parseExpression:",
  36309. protocol: "compiling",
  36310. fn: function (aString){
  36311. var self=this,$self=this;
  36312. return $core.withContext(function($ctx1) {
  36313. var $1;
  36314. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  36315. $ctx1.sendIdx[","]=1;
  36316. return $self._parse_($1);
  36317. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  36318. },
  36319. args: ["aString"],
  36320. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  36321. referencedClasses: [],
  36322. messageSends: ["parse:", ","]
  36323. }),
  36324. $globals.Compiler);
  36325. $core.addMethod(
  36326. $core.method({
  36327. selector: "recompile:",
  36328. protocol: "compiling",
  36329. fn: function (aClass){
  36330. var self=this,$self=this;
  36331. return $core.withContext(function($ctx1) {
  36332. var $1,$2,$3,$receiver;
  36333. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  36334. return $core.withContext(function($ctx2) {
  36335. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  36336. $ctx2.sendIdx["="]=1;
  36337. if($core.assert($1)){
  36338. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  36339. }
  36340. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36341. }),"Recompiling ".__comma($recv(aClass)._name()));
  36342. $2=$recv(aClass)._theMetaClass();
  36343. if(($receiver = $2) == null || $receiver.a$nil){
  36344. $2;
  36345. } else {
  36346. var meta;
  36347. meta=$receiver;
  36348. $3=$recv(meta).__eq(aClass);
  36349. if(!$core.assert($3)){
  36350. $self._recompile_(meta);
  36351. }
  36352. }
  36353. return self;
  36354. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  36355. },
  36356. args: ["aClass"],
  36357. 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 ] ]",
  36358. referencedClasses: [],
  36359. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  36360. }),
  36361. $globals.Compiler);
  36362. $core.addMethod(
  36363. $core.method({
  36364. selector: "recompileAll",
  36365. protocol: "compiling",
  36366. fn: function (){
  36367. var self=this,$self=this;
  36368. return $core.withContext(function($ctx1) {
  36369. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  36370. return $core.withContext(function($ctx2) {
  36371. return $self._recompile_(each);
  36372. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36373. }),"Compiling all classes...");
  36374. return self;
  36375. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  36376. },
  36377. args: [],
  36378. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  36379. referencedClasses: ["Smalltalk"],
  36380. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  36381. }),
  36382. $globals.Compiler);
  36383. $core.addMethod(
  36384. $core.method({
  36385. selector: "source",
  36386. protocol: "accessing",
  36387. fn: function (){
  36388. var self=this,$self=this;
  36389. return $core.withContext(function($ctx1) {
  36390. var $1,$receiver;
  36391. $1=$self["@source"];
  36392. if(($receiver = $1) == null || $receiver.a$nil){
  36393. return "";
  36394. } else {
  36395. return $1;
  36396. }
  36397. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  36398. },
  36399. args: [],
  36400. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36401. referencedClasses: [],
  36402. messageSends: ["ifNil:"]
  36403. }),
  36404. $globals.Compiler);
  36405. $core.addMethod(
  36406. $core.method({
  36407. selector: "source:",
  36408. protocol: "accessing",
  36409. fn: function (aString){
  36410. var self=this,$self=this;
  36411. $self["@source"]=aString;
  36412. return self;
  36413. },
  36414. args: ["aString"],
  36415. source: "source: aString\x0a\x09source := aString",
  36416. referencedClasses: [],
  36417. messageSends: []
  36418. }),
  36419. $globals.Compiler);
  36420. $core.addMethod(
  36421. $core.method({
  36422. selector: "eval:",
  36423. protocol: "evaluating",
  36424. fn: function (aString){
  36425. var self=this,$self=this;
  36426. return $core.withContext(function($ctx1) {
  36427. return $recv($self._new())._eval_(aString);
  36428. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  36429. },
  36430. args: ["aString"],
  36431. source: "eval: aString\x0a\x09^ self new eval: aString",
  36432. referencedClasses: [],
  36433. messageSends: ["eval:", "new"]
  36434. }),
  36435. $globals.Compiler.a$cls);
  36436. $core.addMethod(
  36437. $core.method({
  36438. selector: "recompile:",
  36439. protocol: "compiling",
  36440. fn: function (aClass){
  36441. var self=this,$self=this;
  36442. return $core.withContext(function($ctx1) {
  36443. $recv($self._new())._recompile_(aClass);
  36444. return self;
  36445. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  36446. },
  36447. args: ["aClass"],
  36448. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  36449. referencedClasses: [],
  36450. messageSends: ["recompile:", "new"]
  36451. }),
  36452. $globals.Compiler.a$cls);
  36453. $core.addMethod(
  36454. $core.method({
  36455. selector: "recompileAll",
  36456. protocol: "compiling",
  36457. fn: function (){
  36458. var self=this,$self=this;
  36459. return $core.withContext(function($ctx1) {
  36460. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  36461. return $core.withContext(function($ctx2) {
  36462. return $self._recompile_(each);
  36463. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36464. }));
  36465. return self;
  36466. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  36467. },
  36468. args: [],
  36469. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  36470. referencedClasses: ["Smalltalk"],
  36471. messageSends: ["do:", "classes", "recompile:"]
  36472. }),
  36473. $globals.Compiler.a$cls);
  36474. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  36475. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  36476. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  36477. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  36478. $core.addMethod(
  36479. $core.method({
  36480. selector: "evaluate:context:",
  36481. protocol: "evaluating",
  36482. fn: function (aString,aContext){
  36483. var self=this,$self=this;
  36484. var compiler,ast;
  36485. return $core.withContext(function($ctx1) {
  36486. var $1;
  36487. var $early={};
  36488. try {
  36489. compiler=$recv($globals.Compiler)._new();
  36490. $recv((function(){
  36491. return $core.withContext(function($ctx2) {
  36492. ast=$recv(compiler)._parseExpression_(aString);
  36493. return ast;
  36494. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36495. }))._on_do_($globals.Error,(function(ex){
  36496. return $core.withContext(function($ctx2) {
  36497. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36498. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36499. }));
  36500. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  36501. $recv($1)._context_(aContext);
  36502. $recv($1)._visit_(ast);
  36503. return $recv(aContext)._evaluateNode_(ast);
  36504. }
  36505. catch(e) {if(e===$early)return e[0]; throw e}
  36506. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  36507. },
  36508. args: ["aString", "aContext"],
  36509. 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",
  36510. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  36511. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  36512. }),
  36513. $globals.Evaluator);
  36514. $core.addMethod(
  36515. $core.method({
  36516. selector: "evaluate:for:",
  36517. protocol: "evaluating",
  36518. fn: function (aString,anObject){
  36519. var self=this,$self=this;
  36520. return $core.withContext(function($ctx1) {
  36521. return $recv(anObject)._evaluate_on_(aString,self);
  36522. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  36523. },
  36524. args: ["aString", "anObject"],
  36525. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  36526. referencedClasses: [],
  36527. messageSends: ["evaluate:on:"]
  36528. }),
  36529. $globals.Evaluator);
  36530. $core.addMethod(
  36531. $core.method({
  36532. selector: "evaluate:receiver:",
  36533. protocol: "evaluating",
  36534. fn: function (aString,anObject){
  36535. var self=this,$self=this;
  36536. var compiler;
  36537. return $core.withContext(function($ctx1) {
  36538. var $early={};
  36539. try {
  36540. compiler=$recv($globals.Compiler)._new();
  36541. $recv((function(){
  36542. return $core.withContext(function($ctx2) {
  36543. return $recv(compiler)._parseExpression_(aString);
  36544. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36545. }))._on_do_($globals.Error,(function(ex){
  36546. return $core.withContext(function($ctx2) {
  36547. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36548. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36549. }));
  36550. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  36551. }
  36552. catch(e) {if(e===$early)return e[0]; throw e}
  36553. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  36554. },
  36555. args: ["aString", "anObject"],
  36556. 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",
  36557. referencedClasses: ["Compiler", "Error", "Terminal"],
  36558. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  36559. }),
  36560. $globals.Evaluator);
  36561. $core.addMethod(
  36562. $core.method({
  36563. selector: "evaluate:for:",
  36564. protocol: "instance creation",
  36565. fn: function (aString,anObject){
  36566. var self=this,$self=this;
  36567. return $core.withContext(function($ctx1) {
  36568. return $recv($self._new())._evaluate_for_(aString,anObject);
  36569. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  36570. },
  36571. args: ["aString", "anObject"],
  36572. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  36573. referencedClasses: [],
  36574. messageSends: ["evaluate:for:", "new"]
  36575. }),
  36576. $globals.Evaluator.a$cls);
  36577. $core.addClass("Pragmator", $globals.NodeVisitor, ["methodNode", "sequenceNode"], "Compiler-Core");
  36578. $globals.Pragmator.comment="I am abstract superclass for pragma-processing transformer.\x0a\x0aMy subclasses should implement messages for each pragma\x0athey process. Pragma processing checks if a message is known\x0ato a class but not to its superclass. IOW, each and only those\x0apragmas are processed which are defined as methods in the subclass.\x0a\x0aThese messages can access sequence node in which\x0aa pragma occurred and its containing method node\x0aas `self sequenceNode` and `self methodNode`.\x0a\x0aSee `EarlyPragmator` for an example.";
  36579. $core.addMethod(
  36580. $core.method({
  36581. selector: "canProcessPragma:",
  36582. protocol: "pragma processing",
  36583. fn: function (aMessage){
  36584. var self=this,$self=this;
  36585. var selector;
  36586. return $core.withContext(function($ctx1) {
  36587. selector=$recv(aMessage)._selector();
  36588. return $recv($self._respondsTo_(selector))._and_((function(){
  36589. return $core.withContext(function($ctx2) {
  36590. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  36591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36592. }));
  36593. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector},$globals.Pragmator)});
  36594. },
  36595. args: ["aMessage"],
  36596. source: "canProcessPragma: aMessage\x0a\x09| selector |\x0a\x09selector := aMessage selector.\x0a\x09^ (self respondsTo: selector) and: [\x0a\x09\x09(self class superclass canUnderstand: selector) not]",
  36597. referencedClasses: [],
  36598. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  36599. }),
  36600. $globals.Pragmator);
  36601. $core.addMethod(
  36602. $core.method({
  36603. selector: "methodNode",
  36604. protocol: "accessing",
  36605. fn: function (){
  36606. var self=this,$self=this;
  36607. return $self["@methodNode"];
  36608. },
  36609. args: [],
  36610. source: "methodNode\x0a\x09^ methodNode",
  36611. referencedClasses: [],
  36612. messageSends: []
  36613. }),
  36614. $globals.Pragmator);
  36615. $core.addMethod(
  36616. $core.method({
  36617. selector: "methodNode:",
  36618. protocol: "accessing",
  36619. fn: function (anObject){
  36620. var self=this,$self=this;
  36621. $self["@methodNode"]=anObject;
  36622. return self;
  36623. },
  36624. args: ["anObject"],
  36625. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  36626. referencedClasses: [],
  36627. messageSends: []
  36628. }),
  36629. $globals.Pragmator);
  36630. $core.addMethod(
  36631. $core.method({
  36632. selector: "processPragma:",
  36633. protocol: "pragma processing",
  36634. fn: function (aMessage){
  36635. var self=this,$self=this;
  36636. return $core.withContext(function($ctx1) {
  36637. var $1;
  36638. $1=$self._canProcessPragma_(aMessage);
  36639. if($core.assert($1)){
  36640. return $recv(aMessage)._sendTo_(self);
  36641. }
  36642. return self;
  36643. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage},$globals.Pragmator)});
  36644. },
  36645. args: ["aMessage"],
  36646. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  36647. referencedClasses: [],
  36648. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  36649. }),
  36650. $globals.Pragmator);
  36651. $core.addMethod(
  36652. $core.method({
  36653. selector: "sequenceNode",
  36654. protocol: "accessing",
  36655. fn: function (){
  36656. var self=this,$self=this;
  36657. return $self["@sequenceNode"];
  36658. },
  36659. args: [],
  36660. source: "sequenceNode\x0a\x09^ sequenceNode",
  36661. referencedClasses: [],
  36662. messageSends: []
  36663. }),
  36664. $globals.Pragmator);
  36665. $core.addMethod(
  36666. $core.method({
  36667. selector: "sequenceNode:",
  36668. protocol: "accessing",
  36669. fn: function (anObject){
  36670. var self=this,$self=this;
  36671. $self["@sequenceNode"]=anObject;
  36672. return self;
  36673. },
  36674. args: ["anObject"],
  36675. source: "sequenceNode: anObject\x0a\x09sequenceNode := anObject",
  36676. referencedClasses: [],
  36677. messageSends: []
  36678. }),
  36679. $globals.Pragmator);
  36680. $core.addMethod(
  36681. $core.method({
  36682. selector: "visitMethodNode:",
  36683. protocol: "pragma processing",
  36684. fn: function (aNode){
  36685. var self=this,$self=this;
  36686. return $core.withContext(function($ctx1) {
  36687. var $1;
  36688. $self._methodNode_(aNode);
  36689. $1=(
  36690. $ctx1.supercall = true,
  36691. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  36692. $ctx1.supercall = false;
  36693. return $1;
  36694. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.Pragmator)});
  36695. },
  36696. args: ["aNode"],
  36697. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09^ super visitMethodNode: aNode",
  36698. referencedClasses: [],
  36699. messageSends: ["methodNode:", "visitMethodNode:"]
  36700. }),
  36701. $globals.Pragmator);
  36702. $core.addMethod(
  36703. $core.method({
  36704. selector: "visitSequenceNode:",
  36705. protocol: "pragma processing",
  36706. fn: function (aNode){
  36707. var self=this,$self=this;
  36708. return $core.withContext(function($ctx1) {
  36709. var $1;
  36710. $self._sequenceNode_(aNode);
  36711. $recv($recv(aNode)._pragmas())._do_((function(each){
  36712. return $core.withContext(function($ctx2) {
  36713. return $self._processPragma_(each);
  36714. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36715. }));
  36716. $1=(
  36717. $ctx1.supercall = true,
  36718. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  36719. $ctx1.supercall = false;
  36720. return $1;
  36721. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.Pragmator)});
  36722. },
  36723. args: ["aNode"],
  36724. source: "visitSequenceNode: aNode\x0a\x09self sequenceNode: aNode.\x0a\x09aNode pragmas do: [ :each | self processPragma: each ].\x0a\x09^ super visitSequenceNode: aNode",
  36725. referencedClasses: [],
  36726. messageSends: ["sequenceNode:", "do:", "pragmas", "processPragma:", "visitSequenceNode:"]
  36727. }),
  36728. $globals.Pragmator);
  36729. $core.addClass("EarlyPragmator", $globals.Pragmator, [], "Compiler-Core");
  36730. $core.addMethod(
  36731. $core.method({
  36732. selector: "asVariableName",
  36733. protocol: "*Compiler-Core",
  36734. fn: function (){
  36735. var self=this,$self=this;
  36736. return $core.withContext(function($ctx1) {
  36737. var $1;
  36738. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  36739. if($core.assert($1)){
  36740. return $self.__comma("_");
  36741. } else {
  36742. return self;
  36743. }
  36744. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  36745. },
  36746. args: [],
  36747. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  36748. referencedClasses: ["Smalltalk"],
  36749. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  36750. }),
  36751. $globals.String);
  36752. });
  36753. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36754. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36755. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36756. $core.addPackage("Compiler-Semantic");
  36757. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  36758. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36759. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36760. $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.";
  36761. $core.addMethod(
  36762. $core.method({
  36763. selector: "addArg:",
  36764. protocol: "adding",
  36765. fn: function (aString){
  36766. var self=this,$self=this;
  36767. return $core.withContext(function($ctx1) {
  36768. var $1;
  36769. $1=$self._args();
  36770. $ctx1.sendIdx["args"]=1;
  36771. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36772. $recv($recv($self._args())._at_(aString))._scope_(self);
  36773. return self;
  36774. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36775. },
  36776. args: ["aString"],
  36777. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36778. referencedClasses: ["ArgVar"],
  36779. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36780. }),
  36781. $globals.LexicalScope);
  36782. $core.addMethod(
  36783. $core.method({
  36784. selector: "addTemp:",
  36785. protocol: "adding",
  36786. fn: function (aString){
  36787. var self=this,$self=this;
  36788. return $core.withContext(function($ctx1) {
  36789. var $1;
  36790. $1=$self._temps();
  36791. $ctx1.sendIdx["temps"]=1;
  36792. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36793. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36794. return self;
  36795. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36796. },
  36797. args: ["aString"],
  36798. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36799. referencedClasses: ["TempVar"],
  36800. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36801. }),
  36802. $globals.LexicalScope);
  36803. $core.addMethod(
  36804. $core.method({
  36805. selector: "alias",
  36806. protocol: "accessing",
  36807. fn: function (){
  36808. var self=this,$self=this;
  36809. return $core.withContext(function($ctx1) {
  36810. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36811. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36812. },
  36813. args: [],
  36814. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36815. referencedClasses: [],
  36816. messageSends: [",", "asString", "scopeLevel"]
  36817. }),
  36818. $globals.LexicalScope);
  36819. $core.addMethod(
  36820. $core.method({
  36821. selector: "allVariableNames",
  36822. protocol: "accessing",
  36823. fn: function (){
  36824. var self=this,$self=this;
  36825. return $core.withContext(function($ctx1) {
  36826. var $1;
  36827. $1=$recv($self._args())._keys();
  36828. $ctx1.sendIdx["keys"]=1;
  36829. return $recv($1).__comma($recv($self._temps())._keys());
  36830. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36831. },
  36832. args: [],
  36833. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36834. referencedClasses: [],
  36835. messageSends: [",", "keys", "args", "temps"]
  36836. }),
  36837. $globals.LexicalScope);
  36838. $core.addMethod(
  36839. $core.method({
  36840. selector: "args",
  36841. protocol: "accessing",
  36842. fn: function (){
  36843. var self=this,$self=this;
  36844. return $core.withContext(function($ctx1) {
  36845. var $1,$receiver;
  36846. $1=$self["@args"];
  36847. if(($receiver = $1) == null || $receiver.a$nil){
  36848. $self["@args"]=$recv($globals.Dictionary)._new();
  36849. return $self["@args"];
  36850. } else {
  36851. return $1;
  36852. }
  36853. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36854. },
  36855. args: [],
  36856. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36857. referencedClasses: ["Dictionary"],
  36858. messageSends: ["ifNil:", "new"]
  36859. }),
  36860. $globals.LexicalScope);
  36861. $core.addMethod(
  36862. $core.method({
  36863. selector: "bindingFor:",
  36864. protocol: "accessing",
  36865. fn: function (aStringOrNode){
  36866. var self=this,$self=this;
  36867. return $core.withContext(function($ctx1) {
  36868. var $2,$3,$4,$5,$1;
  36869. $2=$self._pseudoVars();
  36870. $3=$recv(aStringOrNode)._value();
  36871. $ctx1.sendIdx["value"]=1;
  36872. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36873. return $core.withContext(function($ctx2) {
  36874. $4=$self._args();
  36875. $5=$recv(aStringOrNode)._value();
  36876. $ctx2.sendIdx["value"]=2;
  36877. return $recv($4)._at_ifAbsent_($5,(function(){
  36878. return $core.withContext(function($ctx3) {
  36879. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36880. return nil;
  36881. }));
  36882. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36883. }));
  36884. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36885. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36886. }));
  36887. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36888. return $1;
  36889. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36890. },
  36891. args: ["aStringOrNode"],
  36892. 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 ]]]",
  36893. referencedClasses: [],
  36894. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36895. }),
  36896. $globals.LexicalScope);
  36897. $core.addMethod(
  36898. $core.method({
  36899. selector: "blockIndex",
  36900. protocol: "accessing",
  36901. fn: function (){
  36902. var self=this,$self=this;
  36903. return $core.withContext(function($ctx1) {
  36904. var $1,$receiver;
  36905. $1=$self["@blockIndex"];
  36906. if(($receiver = $1) == null || $receiver.a$nil){
  36907. return (0);
  36908. } else {
  36909. return $1;
  36910. }
  36911. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36912. },
  36913. args: [],
  36914. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36915. referencedClasses: [],
  36916. messageSends: ["ifNil:"]
  36917. }),
  36918. $globals.LexicalScope);
  36919. $core.addMethod(
  36920. $core.method({
  36921. selector: "blockIndex:",
  36922. protocol: "accessing",
  36923. fn: function (anInteger){
  36924. var self=this,$self=this;
  36925. $self["@blockIndex"]=anInteger;
  36926. return self;
  36927. },
  36928. args: ["anInteger"],
  36929. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36930. referencedClasses: [],
  36931. messageSends: []
  36932. }),
  36933. $globals.LexicalScope);
  36934. $core.addMethod(
  36935. $core.method({
  36936. selector: "canInlineNonLocalReturns",
  36937. protocol: "testing",
  36938. fn: function (){
  36939. var self=this,$self=this;
  36940. return $core.withContext(function($ctx1) {
  36941. return $recv($self._isInlined())._and_((function(){
  36942. return $core.withContext(function($ctx2) {
  36943. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36944. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36945. }));
  36946. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36947. },
  36948. args: [],
  36949. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36950. referencedClasses: [],
  36951. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36952. }),
  36953. $globals.LexicalScope);
  36954. $core.addMethod(
  36955. $core.method({
  36956. selector: "instruction",
  36957. protocol: "accessing",
  36958. fn: function (){
  36959. var self=this,$self=this;
  36960. return $self["@instruction"];
  36961. },
  36962. args: [],
  36963. source: "instruction\x0a\x09^ instruction",
  36964. referencedClasses: [],
  36965. messageSends: []
  36966. }),
  36967. $globals.LexicalScope);
  36968. $core.addMethod(
  36969. $core.method({
  36970. selector: "instruction:",
  36971. protocol: "accessing",
  36972. fn: function (anIRInstruction){
  36973. var self=this,$self=this;
  36974. $self["@instruction"]=anIRInstruction;
  36975. return self;
  36976. },
  36977. args: ["anIRInstruction"],
  36978. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  36979. referencedClasses: [],
  36980. messageSends: []
  36981. }),
  36982. $globals.LexicalScope);
  36983. $core.addMethod(
  36984. $core.method({
  36985. selector: "isBlockScope",
  36986. protocol: "testing",
  36987. fn: function (){
  36988. var self=this,$self=this;
  36989. return $core.withContext(function($ctx1) {
  36990. return $recv($self._isMethodScope())._not();
  36991. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  36992. },
  36993. args: [],
  36994. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  36995. referencedClasses: [],
  36996. messageSends: ["not", "isMethodScope"]
  36997. }),
  36998. $globals.LexicalScope);
  36999. $core.addMethod(
  37000. $core.method({
  37001. selector: "isInlined",
  37002. protocol: "testing",
  37003. fn: function (){
  37004. var self=this,$self=this;
  37005. return $core.withContext(function($ctx1) {
  37006. var $2,$1;
  37007. $2=$self._instruction();
  37008. $ctx1.sendIdx["instruction"]=1;
  37009. $1=$recv($2)._notNil();
  37010. return $recv($1)._and_((function(){
  37011. return $core.withContext(function($ctx2) {
  37012. return $recv($self._instruction())._isInlined();
  37013. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37014. }));
  37015. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  37016. },
  37017. args: [],
  37018. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  37019. referencedClasses: [],
  37020. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  37021. }),
  37022. $globals.LexicalScope);
  37023. $core.addMethod(
  37024. $core.method({
  37025. selector: "isMethodScope",
  37026. protocol: "testing",
  37027. fn: function (){
  37028. var self=this,$self=this;
  37029. return false;
  37030. },
  37031. args: [],
  37032. source: "isMethodScope\x0a\x09^ false",
  37033. referencedClasses: [],
  37034. messageSends: []
  37035. }),
  37036. $globals.LexicalScope);
  37037. $core.addMethod(
  37038. $core.method({
  37039. selector: "lookupVariable:",
  37040. protocol: "accessing",
  37041. fn: function (aNode){
  37042. var self=this,$self=this;
  37043. var lookup;
  37044. return $core.withContext(function($ctx1) {
  37045. var $1,$2,$receiver;
  37046. lookup=$self._bindingFor_(aNode);
  37047. $1=lookup;
  37048. if(($receiver = $1) == null || $receiver.a$nil){
  37049. $2=$self._outerScope();
  37050. $ctx1.sendIdx["outerScope"]=1;
  37051. if(($receiver = $2) == null || $receiver.a$nil){
  37052. lookup=$2;
  37053. } else {
  37054. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  37055. }
  37056. lookup;
  37057. } else {
  37058. $1;
  37059. }
  37060. return lookup;
  37061. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  37062. },
  37063. args: ["aNode"],
  37064. 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",
  37065. referencedClasses: [],
  37066. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  37067. }),
  37068. $globals.LexicalScope);
  37069. $core.addMethod(
  37070. $core.method({
  37071. selector: "methodScope",
  37072. protocol: "accessing",
  37073. fn: function (){
  37074. var self=this,$self=this;
  37075. return $core.withContext(function($ctx1) {
  37076. var $1,$receiver;
  37077. $1=$self._outerScope();
  37078. $ctx1.sendIdx["outerScope"]=1;
  37079. if(($receiver = $1) == null || $receiver.a$nil){
  37080. return $1;
  37081. } else {
  37082. return $recv($self._outerScope())._methodScope();
  37083. }
  37084. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  37085. },
  37086. args: [],
  37087. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  37088. referencedClasses: [],
  37089. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  37090. }),
  37091. $globals.LexicalScope);
  37092. $core.addMethod(
  37093. $core.method({
  37094. selector: "node",
  37095. protocol: "accessing",
  37096. fn: function (){
  37097. var self=this,$self=this;
  37098. return $self["@node"];
  37099. },
  37100. args: [],
  37101. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  37102. referencedClasses: [],
  37103. messageSends: []
  37104. }),
  37105. $globals.LexicalScope);
  37106. $core.addMethod(
  37107. $core.method({
  37108. selector: "node:",
  37109. protocol: "accessing",
  37110. fn: function (aNode){
  37111. var self=this,$self=this;
  37112. $self["@node"]=aNode;
  37113. return self;
  37114. },
  37115. args: ["aNode"],
  37116. source: "node: aNode\x0a\x09node := aNode",
  37117. referencedClasses: [],
  37118. messageSends: []
  37119. }),
  37120. $globals.LexicalScope);
  37121. $core.addMethod(
  37122. $core.method({
  37123. selector: "outerScope",
  37124. protocol: "accessing",
  37125. fn: function (){
  37126. var self=this,$self=this;
  37127. return $self["@outerScope"];
  37128. },
  37129. args: [],
  37130. source: "outerScope\x0a\x09^ outerScope",
  37131. referencedClasses: [],
  37132. messageSends: []
  37133. }),
  37134. $globals.LexicalScope);
  37135. $core.addMethod(
  37136. $core.method({
  37137. selector: "outerScope:",
  37138. protocol: "accessing",
  37139. fn: function (aLexicalScope){
  37140. var self=this,$self=this;
  37141. $self["@outerScope"]=aLexicalScope;
  37142. return self;
  37143. },
  37144. args: ["aLexicalScope"],
  37145. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  37146. referencedClasses: [],
  37147. messageSends: []
  37148. }),
  37149. $globals.LexicalScope);
  37150. $core.addMethod(
  37151. $core.method({
  37152. selector: "pseudoVars",
  37153. protocol: "accessing",
  37154. fn: function (){
  37155. var self=this,$self=this;
  37156. return $core.withContext(function($ctx1) {
  37157. return $recv($self._methodScope())._pseudoVars();
  37158. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  37159. },
  37160. args: [],
  37161. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  37162. referencedClasses: [],
  37163. messageSends: ["pseudoVars", "methodScope"]
  37164. }),
  37165. $globals.LexicalScope);
  37166. $core.addMethod(
  37167. $core.method({
  37168. selector: "scopeLevel",
  37169. protocol: "accessing",
  37170. fn: function (){
  37171. var self=this,$self=this;
  37172. return $core.withContext(function($ctx1) {
  37173. var $1,$2,$4,$3,$receiver;
  37174. $1=$self._outerScope();
  37175. $ctx1.sendIdx["outerScope"]=1;
  37176. if(($receiver = $1) == null || $receiver.a$nil){
  37177. return (1);
  37178. } else {
  37179. $1;
  37180. }
  37181. $2=$self._isInlined();
  37182. if($core.assert($2)){
  37183. $4=$self._outerScope();
  37184. $ctx1.sendIdx["outerScope"]=2;
  37185. $3=$recv($4)._scopeLevel();
  37186. $ctx1.sendIdx["scopeLevel"]=1;
  37187. return $3;
  37188. }
  37189. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  37190. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  37191. },
  37192. args: [],
  37193. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  37194. referencedClasses: [],
  37195. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  37196. }),
  37197. $globals.LexicalScope);
  37198. $core.addMethod(
  37199. $core.method({
  37200. selector: "temps",
  37201. protocol: "accessing",
  37202. fn: function (){
  37203. var self=this,$self=this;
  37204. return $core.withContext(function($ctx1) {
  37205. var $1,$receiver;
  37206. $1=$self["@temps"];
  37207. if(($receiver = $1) == null || $receiver.a$nil){
  37208. $self["@temps"]=$recv($globals.Dictionary)._new();
  37209. return $self["@temps"];
  37210. } else {
  37211. return $1;
  37212. }
  37213. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  37214. },
  37215. args: [],
  37216. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  37217. referencedClasses: ["Dictionary"],
  37218. messageSends: ["ifNil:", "new"]
  37219. }),
  37220. $globals.LexicalScope);
  37221. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  37222. $globals.MethodLexicalScope.comment="I represent a method scope.";
  37223. $core.addMethod(
  37224. $core.method({
  37225. selector: "addIVar:",
  37226. protocol: "adding",
  37227. fn: function (aString){
  37228. var self=this,$self=this;
  37229. return $core.withContext(function($ctx1) {
  37230. var $1;
  37231. $1=$self._iVars();
  37232. $ctx1.sendIdx["iVars"]=1;
  37233. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  37234. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  37235. return self;
  37236. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  37237. },
  37238. args: ["aString"],
  37239. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  37240. referencedClasses: ["InstanceVar"],
  37241. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  37242. }),
  37243. $globals.MethodLexicalScope);
  37244. $core.addMethod(
  37245. $core.method({
  37246. selector: "addNonLocalReturn:",
  37247. protocol: "adding",
  37248. fn: function (aScope){
  37249. var self=this,$self=this;
  37250. return $core.withContext(function($ctx1) {
  37251. $recv($self._nonLocalReturns())._add_(aScope);
  37252. return self;
  37253. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37254. },
  37255. args: ["aScope"],
  37256. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  37257. referencedClasses: [],
  37258. messageSends: ["add:", "nonLocalReturns"]
  37259. }),
  37260. $globals.MethodLexicalScope);
  37261. $core.addMethod(
  37262. $core.method({
  37263. selector: "allVariableNames",
  37264. protocol: "accessing",
  37265. fn: function (){
  37266. var self=this,$self=this;
  37267. return $core.withContext(function($ctx1) {
  37268. var $1;
  37269. $1=(
  37270. $ctx1.supercall = true,
  37271. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  37272. $ctx1.supercall = false;
  37273. return $recv($1).__comma($recv($self._iVars())._keys());
  37274. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  37275. },
  37276. args: [],
  37277. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  37278. referencedClasses: [],
  37279. messageSends: [",", "allVariableNames", "keys", "iVars"]
  37280. }),
  37281. $globals.MethodLexicalScope);
  37282. $core.addMethod(
  37283. $core.method({
  37284. selector: "bindingFor:",
  37285. protocol: "accessing",
  37286. fn: function (aNode){
  37287. var self=this,$self=this;
  37288. return $core.withContext(function($ctx1) {
  37289. var $1,$receiver;
  37290. $1=(
  37291. $ctx1.supercall = true,
  37292. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  37293. $ctx1.supercall = false;
  37294. if(($receiver = $1) == null || $receiver.a$nil){
  37295. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  37296. return nil;
  37297. }));
  37298. } else {
  37299. return $1;
  37300. }
  37301. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  37302. },
  37303. args: ["aNode"],
  37304. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  37305. referencedClasses: [],
  37306. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  37307. }),
  37308. $globals.MethodLexicalScope);
  37309. $core.addMethod(
  37310. $core.method({
  37311. selector: "canInlineNonLocalReturns",
  37312. protocol: "testing",
  37313. fn: function (){
  37314. var self=this,$self=this;
  37315. return true;
  37316. },
  37317. args: [],
  37318. source: "canInlineNonLocalReturns\x0a\x09^ true",
  37319. referencedClasses: [],
  37320. messageSends: []
  37321. }),
  37322. $globals.MethodLexicalScope);
  37323. $core.addMethod(
  37324. $core.method({
  37325. selector: "hasLocalReturn",
  37326. protocol: "testing",
  37327. fn: function (){
  37328. var self=this,$self=this;
  37329. return $core.withContext(function($ctx1) {
  37330. return $self._localReturn();
  37331. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  37332. },
  37333. args: [],
  37334. source: "hasLocalReturn\x0a\x09^ self localReturn",
  37335. referencedClasses: [],
  37336. messageSends: ["localReturn"]
  37337. }),
  37338. $globals.MethodLexicalScope);
  37339. $core.addMethod(
  37340. $core.method({
  37341. selector: "hasNonLocalReturn",
  37342. protocol: "testing",
  37343. fn: function (){
  37344. var self=this,$self=this;
  37345. return $core.withContext(function($ctx1) {
  37346. return $recv($self._nonLocalReturns())._notEmpty();
  37347. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  37348. },
  37349. args: [],
  37350. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  37351. referencedClasses: [],
  37352. messageSends: ["notEmpty", "nonLocalReturns"]
  37353. }),
  37354. $globals.MethodLexicalScope);
  37355. $core.addMethod(
  37356. $core.method({
  37357. selector: "iVars",
  37358. protocol: "accessing",
  37359. fn: function (){
  37360. var self=this,$self=this;
  37361. return $core.withContext(function($ctx1) {
  37362. var $1,$receiver;
  37363. $1=$self["@iVars"];
  37364. if(($receiver = $1) == null || $receiver.a$nil){
  37365. $self["@iVars"]=$recv($globals.Dictionary)._new();
  37366. return $self["@iVars"];
  37367. } else {
  37368. return $1;
  37369. }
  37370. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  37371. },
  37372. args: [],
  37373. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  37374. referencedClasses: ["Dictionary"],
  37375. messageSends: ["ifNil:", "new"]
  37376. }),
  37377. $globals.MethodLexicalScope);
  37378. $core.addMethod(
  37379. $core.method({
  37380. selector: "isMethodScope",
  37381. protocol: "testing",
  37382. fn: function (){
  37383. var self=this,$self=this;
  37384. return true;
  37385. },
  37386. args: [],
  37387. source: "isMethodScope\x0a\x09^ true",
  37388. referencedClasses: [],
  37389. messageSends: []
  37390. }),
  37391. $globals.MethodLexicalScope);
  37392. $core.addMethod(
  37393. $core.method({
  37394. selector: "localReturn",
  37395. protocol: "accessing",
  37396. fn: function (){
  37397. var self=this,$self=this;
  37398. return $core.withContext(function($ctx1) {
  37399. var $1,$receiver;
  37400. $1=$self["@localReturn"];
  37401. if(($receiver = $1) == null || $receiver.a$nil){
  37402. return false;
  37403. } else {
  37404. return $1;
  37405. }
  37406. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  37407. },
  37408. args: [],
  37409. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  37410. referencedClasses: [],
  37411. messageSends: ["ifNil:"]
  37412. }),
  37413. $globals.MethodLexicalScope);
  37414. $core.addMethod(
  37415. $core.method({
  37416. selector: "localReturn:",
  37417. protocol: "accessing",
  37418. fn: function (aBoolean){
  37419. var self=this,$self=this;
  37420. $self["@localReturn"]=aBoolean;
  37421. return self;
  37422. },
  37423. args: ["aBoolean"],
  37424. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  37425. referencedClasses: [],
  37426. messageSends: []
  37427. }),
  37428. $globals.MethodLexicalScope);
  37429. $core.addMethod(
  37430. $core.method({
  37431. selector: "methodScope",
  37432. protocol: "accessing",
  37433. fn: function (){
  37434. var self=this,$self=this;
  37435. return self;
  37436. },
  37437. args: [],
  37438. source: "methodScope\x0a\x09^ self",
  37439. referencedClasses: [],
  37440. messageSends: []
  37441. }),
  37442. $globals.MethodLexicalScope);
  37443. $core.addMethod(
  37444. $core.method({
  37445. selector: "nonLocalReturns",
  37446. protocol: "accessing",
  37447. fn: function (){
  37448. var self=this,$self=this;
  37449. return $core.withContext(function($ctx1) {
  37450. var $1,$receiver;
  37451. $1=$self["@nonLocalReturns"];
  37452. if(($receiver = $1) == null || $receiver.a$nil){
  37453. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  37454. return $self["@nonLocalReturns"];
  37455. } else {
  37456. return $1;
  37457. }
  37458. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37459. },
  37460. args: [],
  37461. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37462. referencedClasses: ["OrderedCollection"],
  37463. messageSends: ["ifNil:", "new"]
  37464. }),
  37465. $globals.MethodLexicalScope);
  37466. $core.addMethod(
  37467. $core.method({
  37468. selector: "pseudoVars",
  37469. protocol: "accessing",
  37470. fn: function (){
  37471. var self=this,$self=this;
  37472. return $core.withContext(function($ctx1) {
  37473. var $1,$2,$4,$3,$receiver;
  37474. $1=$self["@pseudoVars"];
  37475. if(($receiver = $1) == null || $receiver.a$nil){
  37476. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  37477. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37478. return $core.withContext(function($ctx2) {
  37479. $2=$self["@pseudoVars"];
  37480. $4=$recv($globals.PseudoVar)._on_(each);
  37481. $recv($4)._scope_($self._methodScope());
  37482. $3=$recv($4)._yourself();
  37483. return $recv($2)._at_put_(each,$3);
  37484. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37485. }));
  37486. } else {
  37487. $1;
  37488. }
  37489. return $self["@pseudoVars"];
  37490. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37491. },
  37492. args: [],
  37493. 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",
  37494. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37495. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37496. }),
  37497. $globals.MethodLexicalScope);
  37498. $core.addMethod(
  37499. $core.method({
  37500. selector: "removeNonLocalReturn:",
  37501. protocol: "adding",
  37502. fn: function (aScope){
  37503. var self=this,$self=this;
  37504. return $core.withContext(function($ctx1) {
  37505. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37506. }));
  37507. return self;
  37508. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37509. },
  37510. args: ["aScope"],
  37511. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37512. referencedClasses: [],
  37513. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37514. }),
  37515. $globals.MethodLexicalScope);
  37516. $core.addMethod(
  37517. $core.method({
  37518. selector: "unknownVariables",
  37519. protocol: "accessing",
  37520. fn: function (){
  37521. var self=this,$self=this;
  37522. return $core.withContext(function($ctx1) {
  37523. var $1,$receiver;
  37524. $1=$self["@unknownVariables"];
  37525. if(($receiver = $1) == null || $receiver.a$nil){
  37526. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  37527. return $self["@unknownVariables"];
  37528. } else {
  37529. return $1;
  37530. }
  37531. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37532. },
  37533. args: [],
  37534. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37535. referencedClasses: ["OrderedCollection"],
  37536. messageSends: ["ifNil:", "new"]
  37537. }),
  37538. $globals.MethodLexicalScope);
  37539. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37540. $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.";
  37541. $core.addMethod(
  37542. $core.method({
  37543. selector: "alias",
  37544. protocol: "accessing",
  37545. fn: function (){
  37546. var self=this,$self=this;
  37547. return $core.withContext(function($ctx1) {
  37548. return $recv($self._name())._asVariableName();
  37549. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37550. },
  37551. args: [],
  37552. source: "alias\x0a\x09^ self name asVariableName",
  37553. referencedClasses: [],
  37554. messageSends: ["asVariableName", "name"]
  37555. }),
  37556. $globals.ScopeVar);
  37557. $core.addMethod(
  37558. $core.method({
  37559. selector: "isArgVar",
  37560. protocol: "testing",
  37561. fn: function (){
  37562. var self=this,$self=this;
  37563. return false;
  37564. },
  37565. args: [],
  37566. source: "isArgVar\x0a\x09^ false",
  37567. referencedClasses: [],
  37568. messageSends: []
  37569. }),
  37570. $globals.ScopeVar);
  37571. $core.addMethod(
  37572. $core.method({
  37573. selector: "isClassRefVar",
  37574. protocol: "testing",
  37575. fn: function (){
  37576. var self=this,$self=this;
  37577. return false;
  37578. },
  37579. args: [],
  37580. source: "isClassRefVar\x0a\x09^ false",
  37581. referencedClasses: [],
  37582. messageSends: []
  37583. }),
  37584. $globals.ScopeVar);
  37585. $core.addMethod(
  37586. $core.method({
  37587. selector: "isImmutable",
  37588. protocol: "testing",
  37589. fn: function (){
  37590. var self=this,$self=this;
  37591. return false;
  37592. },
  37593. args: [],
  37594. source: "isImmutable\x0a\x09^ false",
  37595. referencedClasses: [],
  37596. messageSends: []
  37597. }),
  37598. $globals.ScopeVar);
  37599. $core.addMethod(
  37600. $core.method({
  37601. selector: "isInstanceVar",
  37602. protocol: "testing",
  37603. fn: function (){
  37604. var self=this,$self=this;
  37605. return false;
  37606. },
  37607. args: [],
  37608. source: "isInstanceVar\x0a\x09^ false",
  37609. referencedClasses: [],
  37610. messageSends: []
  37611. }),
  37612. $globals.ScopeVar);
  37613. $core.addMethod(
  37614. $core.method({
  37615. selector: "isPseudoVar",
  37616. protocol: "testing",
  37617. fn: function (){
  37618. var self=this,$self=this;
  37619. return false;
  37620. },
  37621. args: [],
  37622. source: "isPseudoVar\x0a\x09^ false",
  37623. referencedClasses: [],
  37624. messageSends: []
  37625. }),
  37626. $globals.ScopeVar);
  37627. $core.addMethod(
  37628. $core.method({
  37629. selector: "isSelf",
  37630. protocol: "testing",
  37631. fn: function (){
  37632. var self=this,$self=this;
  37633. return false;
  37634. },
  37635. args: [],
  37636. source: "isSelf\x0a\x09^ false",
  37637. referencedClasses: [],
  37638. messageSends: []
  37639. }),
  37640. $globals.ScopeVar);
  37641. $core.addMethod(
  37642. $core.method({
  37643. selector: "isSuper",
  37644. protocol: "testing",
  37645. fn: function (){
  37646. var self=this,$self=this;
  37647. return false;
  37648. },
  37649. args: [],
  37650. source: "isSuper\x0a\x09^ false",
  37651. referencedClasses: [],
  37652. messageSends: []
  37653. }),
  37654. $globals.ScopeVar);
  37655. $core.addMethod(
  37656. $core.method({
  37657. selector: "isTempVar",
  37658. protocol: "testing",
  37659. fn: function (){
  37660. var self=this,$self=this;
  37661. return false;
  37662. },
  37663. args: [],
  37664. source: "isTempVar\x0a\x09^ false",
  37665. referencedClasses: [],
  37666. messageSends: []
  37667. }),
  37668. $globals.ScopeVar);
  37669. $core.addMethod(
  37670. $core.method({
  37671. selector: "isUnknownVar",
  37672. protocol: "testing",
  37673. fn: function (){
  37674. var self=this,$self=this;
  37675. return false;
  37676. },
  37677. args: [],
  37678. source: "isUnknownVar\x0a\x09^ false",
  37679. referencedClasses: [],
  37680. messageSends: []
  37681. }),
  37682. $globals.ScopeVar);
  37683. $core.addMethod(
  37684. $core.method({
  37685. selector: "name",
  37686. protocol: "accessing",
  37687. fn: function (){
  37688. var self=this,$self=this;
  37689. return $self["@name"];
  37690. },
  37691. args: [],
  37692. source: "name\x0a\x09^ name",
  37693. referencedClasses: [],
  37694. messageSends: []
  37695. }),
  37696. $globals.ScopeVar);
  37697. $core.addMethod(
  37698. $core.method({
  37699. selector: "name:",
  37700. protocol: "accessing",
  37701. fn: function (aString){
  37702. var self=this,$self=this;
  37703. $self["@name"]=aString;
  37704. return self;
  37705. },
  37706. args: ["aString"],
  37707. source: "name: aString\x0a\x09name := aString",
  37708. referencedClasses: [],
  37709. messageSends: []
  37710. }),
  37711. $globals.ScopeVar);
  37712. $core.addMethod(
  37713. $core.method({
  37714. selector: "scope",
  37715. protocol: "accessing",
  37716. fn: function (){
  37717. var self=this,$self=this;
  37718. return $self["@scope"];
  37719. },
  37720. args: [],
  37721. source: "scope\x0a\x09^ scope",
  37722. referencedClasses: [],
  37723. messageSends: []
  37724. }),
  37725. $globals.ScopeVar);
  37726. $core.addMethod(
  37727. $core.method({
  37728. selector: "scope:",
  37729. protocol: "accessing",
  37730. fn: function (aScope){
  37731. var self=this,$self=this;
  37732. $self["@scope"]=aScope;
  37733. return self;
  37734. },
  37735. args: ["aScope"],
  37736. source: "scope: aScope\x0a\x09scope := aScope",
  37737. referencedClasses: [],
  37738. messageSends: []
  37739. }),
  37740. $globals.ScopeVar);
  37741. $core.addMethod(
  37742. $core.method({
  37743. selector: "validateAssignment",
  37744. protocol: "testing",
  37745. fn: function (){
  37746. var self=this,$self=this;
  37747. return $core.withContext(function($ctx1) {
  37748. var $1,$2;
  37749. $1=$recv($self._isArgVar())._or_((function(){
  37750. return $core.withContext(function($ctx2) {
  37751. return $self._isPseudoVar();
  37752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37753. }));
  37754. if($core.assert($1)){
  37755. $2=$recv($globals.InvalidAssignmentError)._new();
  37756. $recv($2)._variableName_($self._name());
  37757. $recv($2)._signal();
  37758. }
  37759. return self;
  37760. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37761. },
  37762. args: [],
  37763. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37764. referencedClasses: ["InvalidAssignmentError"],
  37765. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37766. }),
  37767. $globals.ScopeVar);
  37768. $core.addMethod(
  37769. $core.method({
  37770. selector: "on:",
  37771. protocol: "instance creation",
  37772. fn: function (aString){
  37773. var self=this,$self=this;
  37774. return $core.withContext(function($ctx1) {
  37775. var $1;
  37776. $1=$self._new();
  37777. $recv($1)._name_(aString);
  37778. return $recv($1)._yourself();
  37779. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37780. },
  37781. args: ["aString"],
  37782. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37783. referencedClasses: [],
  37784. messageSends: ["name:", "new", "yourself"]
  37785. }),
  37786. $globals.ScopeVar.a$cls);
  37787. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37788. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37789. $core.addMethod(
  37790. $core.method({
  37791. selector: "isImmutable",
  37792. protocol: "testing",
  37793. fn: function (){
  37794. var self=this,$self=this;
  37795. return true;
  37796. },
  37797. args: [],
  37798. source: "isImmutable\x0a\x09^ true",
  37799. referencedClasses: [],
  37800. messageSends: []
  37801. }),
  37802. $globals.AliasVar);
  37803. $core.addMethod(
  37804. $core.method({
  37805. selector: "node",
  37806. protocol: "accessing",
  37807. fn: function (){
  37808. var self=this,$self=this;
  37809. return $self["@node"];
  37810. },
  37811. args: [],
  37812. source: "node\x0a\x09^ node",
  37813. referencedClasses: [],
  37814. messageSends: []
  37815. }),
  37816. $globals.AliasVar);
  37817. $core.addMethod(
  37818. $core.method({
  37819. selector: "node:",
  37820. protocol: "accessing",
  37821. fn: function (aNode){
  37822. var self=this,$self=this;
  37823. $self["@node"]=aNode;
  37824. return self;
  37825. },
  37826. args: ["aNode"],
  37827. source: "node: aNode\x0a\x09node := aNode",
  37828. referencedClasses: [],
  37829. messageSends: []
  37830. }),
  37831. $globals.AliasVar);
  37832. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37833. $globals.ArgVar.comment="I am an argument of a method or block.";
  37834. $core.addMethod(
  37835. $core.method({
  37836. selector: "isArgVar",
  37837. protocol: "testing",
  37838. fn: function (){
  37839. var self=this,$self=this;
  37840. return true;
  37841. },
  37842. args: [],
  37843. source: "isArgVar\x0a\x09^ true",
  37844. referencedClasses: [],
  37845. messageSends: []
  37846. }),
  37847. $globals.ArgVar);
  37848. $core.addMethod(
  37849. $core.method({
  37850. selector: "isImmutable",
  37851. protocol: "testing",
  37852. fn: function (){
  37853. var self=this,$self=this;
  37854. return true;
  37855. },
  37856. args: [],
  37857. source: "isImmutable\x0a\x09^ true",
  37858. referencedClasses: [],
  37859. messageSends: []
  37860. }),
  37861. $globals.ArgVar);
  37862. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37863. $globals.ClassRefVar.comment="I am an class reference variable";
  37864. $core.addMethod(
  37865. $core.method({
  37866. selector: "alias",
  37867. protocol: "accessing",
  37868. fn: function (){
  37869. var self=this,$self=this;
  37870. return $core.withContext(function($ctx1) {
  37871. return "$globals.".__comma($self._name());
  37872. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37873. },
  37874. args: [],
  37875. 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",
  37876. referencedClasses: [],
  37877. messageSends: [",", "name"]
  37878. }),
  37879. $globals.ClassRefVar);
  37880. $core.addMethod(
  37881. $core.method({
  37882. selector: "isClassRefVar",
  37883. protocol: "testing",
  37884. fn: function (){
  37885. var self=this,$self=this;
  37886. return true;
  37887. },
  37888. args: [],
  37889. source: "isClassRefVar\x0a\x09^ true",
  37890. referencedClasses: [],
  37891. messageSends: []
  37892. }),
  37893. $globals.ClassRefVar);
  37894. $core.addMethod(
  37895. $core.method({
  37896. selector: "isImmutable",
  37897. protocol: "testing",
  37898. fn: function (){
  37899. var self=this,$self=this;
  37900. return true;
  37901. },
  37902. args: [],
  37903. source: "isImmutable\x0a\x09^ true",
  37904. referencedClasses: [],
  37905. messageSends: []
  37906. }),
  37907. $globals.ClassRefVar);
  37908. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37909. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37910. $core.addMethod(
  37911. $core.method({
  37912. selector: "alias",
  37913. protocol: "testing",
  37914. fn: function (){
  37915. var self=this,$self=this;
  37916. return $core.withContext(function($ctx1) {
  37917. var $1;
  37918. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37919. $ctx1.sendIdx[","]=1;
  37920. return $1;
  37921. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37922. },
  37923. args: [],
  37924. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37925. referencedClasses: [],
  37926. messageSends: [",", "name"]
  37927. }),
  37928. $globals.InstanceVar);
  37929. $core.addMethod(
  37930. $core.method({
  37931. selector: "isInstanceVar",
  37932. protocol: "testing",
  37933. fn: function (){
  37934. var self=this,$self=this;
  37935. return true;
  37936. },
  37937. args: [],
  37938. source: "isInstanceVar\x0a\x09^ true",
  37939. referencedClasses: [],
  37940. messageSends: []
  37941. }),
  37942. $globals.InstanceVar);
  37943. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37944. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37945. $core.addMethod(
  37946. $core.method({
  37947. selector: "alias",
  37948. protocol: "accessing",
  37949. fn: function (){
  37950. var self=this,$self=this;
  37951. return $core.withContext(function($ctx1) {
  37952. return $self._name();
  37953. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37954. },
  37955. args: [],
  37956. source: "alias\x0a\x09^ self name",
  37957. referencedClasses: [],
  37958. messageSends: ["name"]
  37959. }),
  37960. $globals.PseudoVar);
  37961. $core.addMethod(
  37962. $core.method({
  37963. selector: "isImmutable",
  37964. protocol: "testing",
  37965. fn: function (){
  37966. var self=this,$self=this;
  37967. return true;
  37968. },
  37969. args: [],
  37970. source: "isImmutable\x0a\x09^ true",
  37971. referencedClasses: [],
  37972. messageSends: []
  37973. }),
  37974. $globals.PseudoVar);
  37975. $core.addMethod(
  37976. $core.method({
  37977. selector: "isPseudoVar",
  37978. protocol: "testing",
  37979. fn: function (){
  37980. var self=this,$self=this;
  37981. return true;
  37982. },
  37983. args: [],
  37984. source: "isPseudoVar\x0a\x09^ true",
  37985. referencedClasses: [],
  37986. messageSends: []
  37987. }),
  37988. $globals.PseudoVar);
  37989. $core.addMethod(
  37990. $core.method({
  37991. selector: "isSelf",
  37992. protocol: "testing",
  37993. fn: function (){
  37994. var self=this,$self=this;
  37995. return $core.withContext(function($ctx1) {
  37996. return $recv($self["@name"]).__eq("self");
  37997. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  37998. },
  37999. args: [],
  38000. source: "isSelf\x0a\x09^ name = 'self'",
  38001. referencedClasses: [],
  38002. messageSends: ["="]
  38003. }),
  38004. $globals.PseudoVar);
  38005. $core.addMethod(
  38006. $core.method({
  38007. selector: "isSuper",
  38008. protocol: "testing",
  38009. fn: function (){
  38010. var self=this,$self=this;
  38011. return $core.withContext(function($ctx1) {
  38012. return $recv($self["@name"]).__eq("super");
  38013. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  38014. },
  38015. args: [],
  38016. source: "isSuper\x0a\x09^ name = 'super'",
  38017. referencedClasses: [],
  38018. messageSends: ["="]
  38019. }),
  38020. $globals.PseudoVar);
  38021. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38022. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  38023. $core.addMethod(
  38024. $core.method({
  38025. selector: "isTempVar",
  38026. protocol: "testing",
  38027. fn: function (){
  38028. var self=this,$self=this;
  38029. return true;
  38030. },
  38031. args: [],
  38032. source: "isTempVar\x0a\x09^ true",
  38033. referencedClasses: [],
  38034. messageSends: []
  38035. }),
  38036. $globals.TempVar);
  38037. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38038. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  38039. $core.addMethod(
  38040. $core.method({
  38041. selector: "isUnknownVar",
  38042. protocol: "testing",
  38043. fn: function (){
  38044. var self=this,$self=this;
  38045. return true;
  38046. },
  38047. args: [],
  38048. source: "isUnknownVar\x0a\x09^ true",
  38049. referencedClasses: [],
  38050. messageSends: []
  38051. }),
  38052. $globals.UnknownVar);
  38053. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  38054. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  38055. $core.addMethod(
  38056. $core.method({
  38057. selector: "classReferences",
  38058. protocol: "accessing",
  38059. fn: function (){
  38060. var self=this,$self=this;
  38061. return $core.withContext(function($ctx1) {
  38062. var $1,$receiver;
  38063. $1=$self["@classReferences"];
  38064. if(($receiver = $1) == null || $receiver.a$nil){
  38065. $self["@classReferences"]=$recv($globals.Set)._new();
  38066. return $self["@classReferences"];
  38067. } else {
  38068. return $1;
  38069. }
  38070. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  38071. },
  38072. args: [],
  38073. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  38074. referencedClasses: ["Set"],
  38075. messageSends: ["ifNil:", "new"]
  38076. }),
  38077. $globals.SemanticAnalyzer);
  38078. $core.addMethod(
  38079. $core.method({
  38080. selector: "errorShadowingVariable:",
  38081. protocol: "error handling",
  38082. fn: function (aString){
  38083. var self=this,$self=this;
  38084. return $core.withContext(function($ctx1) {
  38085. var $1;
  38086. $1=$recv($globals.ShadowingVariableError)._new();
  38087. $recv($1)._variableName_(aString);
  38088. $recv($1)._signal();
  38089. return self;
  38090. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  38091. },
  38092. args: ["aString"],
  38093. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  38094. referencedClasses: ["ShadowingVariableError"],
  38095. messageSends: ["variableName:", "new", "signal"]
  38096. }),
  38097. $globals.SemanticAnalyzer);
  38098. $core.addMethod(
  38099. $core.method({
  38100. selector: "errorUnknownVariable:",
  38101. protocol: "error handling",
  38102. fn: function (aNode){
  38103. var self=this,$self=this;
  38104. var identifier;
  38105. return $core.withContext(function($ctx1) {
  38106. var $1,$2,$3;
  38107. identifier=$recv(aNode)._value();
  38108. $ctx1.sendIdx["value"]=1;
  38109. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  38110. return $core.withContext(function($ctx2) {
  38111. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  38112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38113. }));
  38114. if($core.assert($1)){
  38115. $2=$recv($globals.UnknownVariableError)._new();
  38116. $3=$recv(aNode)._value();
  38117. $ctx1.sendIdx["value"]=2;
  38118. $recv($2)._variableName_($3);
  38119. $recv($2)._signal();
  38120. } else {
  38121. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  38122. }
  38123. return self;
  38124. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  38125. },
  38126. args: ["aNode"],
  38127. 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 ]",
  38128. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  38129. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  38130. }),
  38131. $globals.SemanticAnalyzer);
  38132. $core.addMethod(
  38133. $core.method({
  38134. selector: "isVariableUndefined:inPackage:",
  38135. protocol: "testing",
  38136. fn: function (aString,aPackage){
  38137. var self=this,$self=this;
  38138. return $core.withContext(function($ctx1) {
  38139. var $1,$2,$receiver;
  38140. if(($receiver = aPackage) == null || $receiver.a$nil){
  38141. aPackage;
  38142. } else {
  38143. var packageKnownVars;
  38144. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  38145. $1=$recv(packageKnownVars)._includes_(aString);
  38146. if($core.assert($1)){
  38147. return false;
  38148. }
  38149. }
  38150. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  38151. $ctx1.sendIdx[","]=1;
  38152. return $recv($globals.Compiler)._eval_($2);
  38153. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  38154. },
  38155. args: ["aString", "aPackage"],
  38156. 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 eval: 'typeof ', aString, ' === \x22undefined\x22'",
  38157. referencedClasses: ["Compiler"],
  38158. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  38159. }),
  38160. $globals.SemanticAnalyzer);
  38161. $core.addMethod(
  38162. $core.method({
  38163. selector: "messageSends",
  38164. protocol: "accessing",
  38165. fn: function (){
  38166. var self=this,$self=this;
  38167. return $core.withContext(function($ctx1) {
  38168. var $1,$receiver;
  38169. $1=$self["@messageSends"];
  38170. if(($receiver = $1) == null || $receiver.a$nil){
  38171. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  38172. return $self["@messageSends"];
  38173. } else {
  38174. return $1;
  38175. }
  38176. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  38177. },
  38178. args: [],
  38179. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  38180. referencedClasses: ["Dictionary"],
  38181. messageSends: ["ifNil:", "new"]
  38182. }),
  38183. $globals.SemanticAnalyzer);
  38184. $core.addMethod(
  38185. $core.method({
  38186. selector: "newBlockScope",
  38187. protocol: "factory",
  38188. fn: function (){
  38189. var self=this,$self=this;
  38190. return $core.withContext(function($ctx1) {
  38191. return $self._newScopeOfClass_($globals.LexicalScope);
  38192. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  38193. },
  38194. args: [],
  38195. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  38196. referencedClasses: ["LexicalScope"],
  38197. messageSends: ["newScopeOfClass:"]
  38198. }),
  38199. $globals.SemanticAnalyzer);
  38200. $core.addMethod(
  38201. $core.method({
  38202. selector: "newMethodScope",
  38203. protocol: "factory",
  38204. fn: function (){
  38205. var self=this,$self=this;
  38206. return $core.withContext(function($ctx1) {
  38207. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  38208. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  38209. },
  38210. args: [],
  38211. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  38212. referencedClasses: ["MethodLexicalScope"],
  38213. messageSends: ["newScopeOfClass:"]
  38214. }),
  38215. $globals.SemanticAnalyzer);
  38216. $core.addMethod(
  38217. $core.method({
  38218. selector: "newScopeOfClass:",
  38219. protocol: "factory",
  38220. fn: function (aLexicalScopeClass){
  38221. var self=this,$self=this;
  38222. return $core.withContext(function($ctx1) {
  38223. var $1;
  38224. $1=$recv(aLexicalScopeClass)._new();
  38225. $recv($1)._outerScope_($self["@currentScope"]);
  38226. return $recv($1)._yourself();
  38227. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  38228. },
  38229. args: ["aLexicalScopeClass"],
  38230. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  38231. referencedClasses: [],
  38232. messageSends: ["outerScope:", "new", "yourself"]
  38233. }),
  38234. $globals.SemanticAnalyzer);
  38235. $core.addMethod(
  38236. $core.method({
  38237. selector: "nextBlockIndex",
  38238. protocol: "private",
  38239. fn: function (){
  38240. var self=this,$self=this;
  38241. return $core.withContext(function($ctx1) {
  38242. var $1,$receiver;
  38243. $1=$self["@blockIndex"];
  38244. if(($receiver = $1) == null || $receiver.a$nil){
  38245. $self["@blockIndex"]=(0);
  38246. $self["@blockIndex"];
  38247. } else {
  38248. $1;
  38249. }
  38250. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  38251. return $self["@blockIndex"];
  38252. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  38253. },
  38254. args: [],
  38255. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  38256. referencedClasses: [],
  38257. messageSends: ["ifNil:", "+"]
  38258. }),
  38259. $globals.SemanticAnalyzer);
  38260. $core.addMethod(
  38261. $core.method({
  38262. selector: "popScope",
  38263. protocol: "scope",
  38264. fn: function (){
  38265. var self=this,$self=this;
  38266. return $core.withContext(function($ctx1) {
  38267. var $1,$receiver;
  38268. $1=$self["@currentScope"];
  38269. if(($receiver = $1) == null || $receiver.a$nil){
  38270. $1;
  38271. } else {
  38272. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  38273. $self["@currentScope"];
  38274. }
  38275. return self;
  38276. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  38277. },
  38278. args: [],
  38279. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  38280. referencedClasses: [],
  38281. messageSends: ["ifNotNil:", "outerScope"]
  38282. }),
  38283. $globals.SemanticAnalyzer);
  38284. $core.addMethod(
  38285. $core.method({
  38286. selector: "pushScope:",
  38287. protocol: "scope",
  38288. fn: function (aScope){
  38289. var self=this,$self=this;
  38290. return $core.withContext(function($ctx1) {
  38291. $recv(aScope)._outerScope_($self["@currentScope"]);
  38292. $self["@currentScope"]=aScope;
  38293. return self;
  38294. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  38295. },
  38296. args: ["aScope"],
  38297. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  38298. referencedClasses: [],
  38299. messageSends: ["outerScope:"]
  38300. }),
  38301. $globals.SemanticAnalyzer);
  38302. $core.addMethod(
  38303. $core.method({
  38304. selector: "theClass",
  38305. protocol: "accessing",
  38306. fn: function (){
  38307. var self=this,$self=this;
  38308. return $self["@theClass"];
  38309. },
  38310. args: [],
  38311. source: "theClass\x0a\x09^ theClass",
  38312. referencedClasses: [],
  38313. messageSends: []
  38314. }),
  38315. $globals.SemanticAnalyzer);
  38316. $core.addMethod(
  38317. $core.method({
  38318. selector: "theClass:",
  38319. protocol: "accessing",
  38320. fn: function (aClass){
  38321. var self=this,$self=this;
  38322. $self["@theClass"]=aClass;
  38323. return self;
  38324. },
  38325. args: ["aClass"],
  38326. source: "theClass: aClass\x0a\x09theClass := aClass",
  38327. referencedClasses: [],
  38328. messageSends: []
  38329. }),
  38330. $globals.SemanticAnalyzer);
  38331. $core.addMethod(
  38332. $core.method({
  38333. selector: "thePackage",
  38334. protocol: "accessing",
  38335. fn: function (){
  38336. var self=this,$self=this;
  38337. return $self["@thePackage"];
  38338. },
  38339. args: [],
  38340. source: "thePackage\x0a\x09^ thePackage",
  38341. referencedClasses: [],
  38342. messageSends: []
  38343. }),
  38344. $globals.SemanticAnalyzer);
  38345. $core.addMethod(
  38346. $core.method({
  38347. selector: "thePackage:",
  38348. protocol: "accessing",
  38349. fn: function (aPackage){
  38350. var self=this,$self=this;
  38351. $self["@thePackage"]=aPackage;
  38352. return self;
  38353. },
  38354. args: ["aPackage"],
  38355. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  38356. referencedClasses: [],
  38357. messageSends: []
  38358. }),
  38359. $globals.SemanticAnalyzer);
  38360. $core.addMethod(
  38361. $core.method({
  38362. selector: "validateVariableScope:",
  38363. protocol: "scope",
  38364. fn: function (aString){
  38365. var self=this,$self=this;
  38366. return $core.withContext(function($ctx1) {
  38367. var $1,$receiver;
  38368. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  38369. if(($receiver = $1) == null || $receiver.a$nil){
  38370. $1;
  38371. } else {
  38372. $self._errorShadowingVariable_(aString);
  38373. }
  38374. return self;
  38375. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  38376. },
  38377. args: ["aString"],
  38378. 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 ]",
  38379. referencedClasses: [],
  38380. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  38381. }),
  38382. $globals.SemanticAnalyzer);
  38383. $core.addMethod(
  38384. $core.method({
  38385. selector: "visitAssignmentNode:",
  38386. protocol: "visiting",
  38387. fn: function (aNode){
  38388. var self=this,$self=this;
  38389. return $core.withContext(function($ctx1) {
  38390. (
  38391. $ctx1.supercall = true,
  38392. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  38393. $ctx1.supercall = false;
  38394. $recv($recv(aNode)._left())._beAssigned();
  38395. return self;
  38396. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38397. },
  38398. args: ["aNode"],
  38399. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  38400. referencedClasses: [],
  38401. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  38402. }),
  38403. $globals.SemanticAnalyzer);
  38404. $core.addMethod(
  38405. $core.method({
  38406. selector: "visitBlockNode:",
  38407. protocol: "visiting",
  38408. fn: function (aNode){
  38409. var self=this,$self=this;
  38410. return $core.withContext(function($ctx1) {
  38411. $self._pushScope_($self._newBlockScope());
  38412. $recv(aNode)._scope_($self["@currentScope"]);
  38413. $recv($self["@currentScope"])._node_(aNode);
  38414. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  38415. $recv($recv(aNode)._parameters())._do_((function(each){
  38416. return $core.withContext(function($ctx2) {
  38417. $self._validateVariableScope_(each);
  38418. return $recv($self["@currentScope"])._addArg_(each);
  38419. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38420. }));
  38421. (
  38422. $ctx1.supercall = true,
  38423. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  38424. $ctx1.supercall = false;
  38425. $self._popScope();
  38426. return self;
  38427. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38428. },
  38429. args: ["aNode"],
  38430. 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",
  38431. referencedClasses: [],
  38432. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38433. }),
  38434. $globals.SemanticAnalyzer);
  38435. $core.addMethod(
  38436. $core.method({
  38437. selector: "visitCascadeNode:",
  38438. protocol: "visiting",
  38439. fn: function (aNode){
  38440. var self=this,$self=this;
  38441. return $core.withContext(function($ctx1) {
  38442. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  38443. (
  38444. $ctx1.supercall = true,
  38445. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38446. $ctx1.supercall = false;
  38447. return self;
  38448. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38449. },
  38450. args: ["aNode"],
  38451. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38452. referencedClasses: [],
  38453. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38454. }),
  38455. $globals.SemanticAnalyzer);
  38456. $core.addMethod(
  38457. $core.method({
  38458. selector: "visitMethodNode:",
  38459. protocol: "visiting",
  38460. fn: function (aNode){
  38461. var self=this,$self=this;
  38462. return $core.withContext(function($ctx1) {
  38463. $self._pushScope_($self._newMethodScope());
  38464. $recv(aNode)._scope_($self["@currentScope"]);
  38465. $recv($self["@currentScope"])._node_(aNode);
  38466. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38467. return $core.withContext(function($ctx2) {
  38468. return $recv($self["@currentScope"])._addIVar_(each);
  38469. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38470. }));
  38471. $ctx1.sendIdx["do:"]=1;
  38472. $recv($recv(aNode)._arguments())._do_((function(each){
  38473. return $core.withContext(function($ctx2) {
  38474. $self._validateVariableScope_(each);
  38475. return $recv($self["@currentScope"])._addArg_(each);
  38476. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38477. }));
  38478. (
  38479. $ctx1.supercall = true,
  38480. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38481. $ctx1.supercall = false;
  38482. $recv(aNode)._classReferences_($self._classReferences());
  38483. $recv(aNode)._sendIndexes_($self._messageSends());
  38484. $self._popScope();
  38485. return aNode;
  38486. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38487. },
  38488. args: ["aNode"],
  38489. 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",
  38490. referencedClasses: [],
  38491. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38492. }),
  38493. $globals.SemanticAnalyzer);
  38494. $core.addMethod(
  38495. $core.method({
  38496. selector: "visitReturnNode:",
  38497. protocol: "visiting",
  38498. fn: function (aNode){
  38499. var self=this,$self=this;
  38500. return $core.withContext(function($ctx1) {
  38501. var $1;
  38502. $recv(aNode)._scope_($self["@currentScope"]);
  38503. $1=$recv($self["@currentScope"])._isMethodScope();
  38504. if($core.assert($1)){
  38505. $recv($self["@currentScope"])._localReturn_(true);
  38506. } else {
  38507. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  38508. }
  38509. (
  38510. $ctx1.supercall = true,
  38511. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38512. $ctx1.supercall = false;
  38513. return self;
  38514. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38515. },
  38516. args: ["aNode"],
  38517. 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",
  38518. referencedClasses: [],
  38519. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38520. }),
  38521. $globals.SemanticAnalyzer);
  38522. $core.addMethod(
  38523. $core.method({
  38524. selector: "visitSendNode:",
  38525. protocol: "visiting",
  38526. fn: function (aNode){
  38527. var self=this,$self=this;
  38528. var sends;
  38529. return $core.withContext(function($ctx1) {
  38530. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38531. return $core.withContext(function($ctx2) {
  38532. return $recv($globals.OrderedCollection)._new();
  38533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38534. }));
  38535. $recv(sends)._add_(aNode);
  38536. $recv(aNode)._index_($recv(sends)._size());
  38537. (
  38538. $ctx1.supercall = true,
  38539. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38540. $ctx1.supercall = false;
  38541. return self;
  38542. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38543. },
  38544. args: ["aNode"],
  38545. 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",
  38546. referencedClasses: ["OrderedCollection"],
  38547. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38548. }),
  38549. $globals.SemanticAnalyzer);
  38550. $core.addMethod(
  38551. $core.method({
  38552. selector: "visitSequenceNode:",
  38553. protocol: "visiting",
  38554. fn: function (aNode){
  38555. var self=this,$self=this;
  38556. return $core.withContext(function($ctx1) {
  38557. $recv($recv(aNode)._temps())._do_((function(each){
  38558. return $core.withContext(function($ctx2) {
  38559. $self._validateVariableScope_(each);
  38560. return $recv($self["@currentScope"])._addTemp_(each);
  38561. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38562. }));
  38563. (
  38564. $ctx1.supercall = true,
  38565. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38566. $ctx1.supercall = false;
  38567. return self;
  38568. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38569. },
  38570. args: ["aNode"],
  38571. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38572. referencedClasses: [],
  38573. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38574. }),
  38575. $globals.SemanticAnalyzer);
  38576. $core.addMethod(
  38577. $core.method({
  38578. selector: "visitVariableNode:",
  38579. protocol: "visiting",
  38580. fn: function (aNode){
  38581. var self=this,$self=this;
  38582. var binding;
  38583. return $core.withContext(function($ctx1) {
  38584. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38585. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38586. $1=binding;
  38587. if(($receiver = $1) == null || $receiver.a$nil){
  38588. $3=$recv(aNode)._value();
  38589. $ctx1.sendIdx["value"]=1;
  38590. $2=$recv($3)._isCapitalized();
  38591. if($core.assert($2)){
  38592. $4=$recv($globals.ClassRefVar)._new();
  38593. $ctx1.sendIdx["new"]=1;
  38594. $5=$recv(aNode)._value();
  38595. $ctx1.sendIdx["value"]=2;
  38596. $recv($4)._name_($5);
  38597. $ctx1.sendIdx["name:"]=1;
  38598. $6=$recv($4)._yourself();
  38599. $ctx1.sendIdx["yourself"]=1;
  38600. binding=$6;
  38601. $7=$self._classReferences();
  38602. $8=$recv(aNode)._value();
  38603. $ctx1.sendIdx["value"]=3;
  38604. $recv($7)._add_($8);
  38605. } else {
  38606. $self._errorUnknownVariable_(aNode);
  38607. $9=$recv($globals.UnknownVar)._new();
  38608. $recv($9)._name_($recv(aNode)._value());
  38609. binding=$recv($9)._yourself();
  38610. binding;
  38611. }
  38612. } else {
  38613. $1;
  38614. }
  38615. $recv(aNode)._binding_(binding);
  38616. return self;
  38617. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38618. },
  38619. args: ["aNode"],
  38620. 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.",
  38621. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38622. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38623. }),
  38624. $globals.SemanticAnalyzer);
  38625. $core.addMethod(
  38626. $core.method({
  38627. selector: "on:",
  38628. protocol: "instance creation",
  38629. fn: function (aClass){
  38630. var self=this,$self=this;
  38631. return $core.withContext(function($ctx1) {
  38632. var $1;
  38633. $1=$self._new();
  38634. $recv($1)._theClass_(aClass);
  38635. return $recv($1)._yourself();
  38636. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38637. },
  38638. args: ["aClass"],
  38639. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38640. referencedClasses: [],
  38641. messageSends: ["theClass:", "new", "yourself"]
  38642. }),
  38643. $globals.SemanticAnalyzer.a$cls);
  38644. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38645. $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";
  38646. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38647. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38648. $core.addMethod(
  38649. $core.method({
  38650. selector: "messageText",
  38651. protocol: "accessing",
  38652. fn: function (){
  38653. var self=this,$self=this;
  38654. return $core.withContext(function($ctx1) {
  38655. return " Invalid assignment to variable: ".__comma($self._variableName());
  38656. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38657. },
  38658. args: [],
  38659. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38660. referencedClasses: [],
  38661. messageSends: [",", "variableName"]
  38662. }),
  38663. $globals.InvalidAssignmentError);
  38664. $core.addMethod(
  38665. $core.method({
  38666. selector: "variableName",
  38667. protocol: "accessing",
  38668. fn: function (){
  38669. var self=this,$self=this;
  38670. return $self["@variableName"];
  38671. },
  38672. args: [],
  38673. source: "variableName\x0a\x09^ variableName",
  38674. referencedClasses: [],
  38675. messageSends: []
  38676. }),
  38677. $globals.InvalidAssignmentError);
  38678. $core.addMethod(
  38679. $core.method({
  38680. selector: "variableName:",
  38681. protocol: "accessing",
  38682. fn: function (aString){
  38683. var self=this,$self=this;
  38684. $self["@variableName"]=aString;
  38685. return self;
  38686. },
  38687. args: ["aString"],
  38688. source: "variableName: aString\x0a\x09variableName := aString",
  38689. referencedClasses: [],
  38690. messageSends: []
  38691. }),
  38692. $globals.InvalidAssignmentError);
  38693. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38694. $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.";
  38695. $core.addMethod(
  38696. $core.method({
  38697. selector: "messageText",
  38698. protocol: "accessing",
  38699. fn: function (){
  38700. var self=this,$self=this;
  38701. return $core.withContext(function($ctx1) {
  38702. var $1;
  38703. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38704. $ctx1.sendIdx[","]=1;
  38705. return $1;
  38706. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38707. },
  38708. args: [],
  38709. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38710. referencedClasses: [],
  38711. messageSends: [",", "variableName"]
  38712. }),
  38713. $globals.ShadowingVariableError);
  38714. $core.addMethod(
  38715. $core.method({
  38716. selector: "variableName",
  38717. protocol: "accessing",
  38718. fn: function (){
  38719. var self=this,$self=this;
  38720. return $self["@variableName"];
  38721. },
  38722. args: [],
  38723. source: "variableName\x0a\x09^ variableName",
  38724. referencedClasses: [],
  38725. messageSends: []
  38726. }),
  38727. $globals.ShadowingVariableError);
  38728. $core.addMethod(
  38729. $core.method({
  38730. selector: "variableName:",
  38731. protocol: "accessing",
  38732. fn: function (aString){
  38733. var self=this,$self=this;
  38734. $self["@variableName"]=aString;
  38735. return self;
  38736. },
  38737. args: ["aString"],
  38738. source: "variableName: aString\x0a\x09variableName := aString",
  38739. referencedClasses: [],
  38740. messageSends: []
  38741. }),
  38742. $globals.ShadowingVariableError);
  38743. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38744. $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.";
  38745. $core.addMethod(
  38746. $core.method({
  38747. selector: "messageText",
  38748. protocol: "accessing",
  38749. fn: function (){
  38750. var self=this,$self=this;
  38751. return $core.withContext(function($ctx1) {
  38752. var $1;
  38753. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38754. $ctx1.sendIdx[","]=1;
  38755. return $1;
  38756. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38757. },
  38758. args: [],
  38759. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38760. referencedClasses: [],
  38761. messageSends: [",", "variableName"]
  38762. }),
  38763. $globals.UnknownVariableError);
  38764. $core.addMethod(
  38765. $core.method({
  38766. selector: "variableName",
  38767. protocol: "accessing",
  38768. fn: function (){
  38769. var self=this,$self=this;
  38770. return $self["@variableName"];
  38771. },
  38772. args: [],
  38773. source: "variableName\x0a\x09^ variableName",
  38774. referencedClasses: [],
  38775. messageSends: []
  38776. }),
  38777. $globals.UnknownVariableError);
  38778. $core.addMethod(
  38779. $core.method({
  38780. selector: "variableName:",
  38781. protocol: "accessing",
  38782. fn: function (aString){
  38783. var self=this,$self=this;
  38784. $self["@variableName"]=aString;
  38785. return self;
  38786. },
  38787. args: ["aString"],
  38788. source: "variableName: aString\x0a\x09variableName := aString",
  38789. referencedClasses: [],
  38790. messageSends: []
  38791. }),
  38792. $globals.UnknownVariableError);
  38793. $core.addMethod(
  38794. $core.method({
  38795. selector: "inlineJS:",
  38796. protocol: "*Compiler-Semantic",
  38797. fn: function (aString){
  38798. var self=this,$self=this;
  38799. return $core.withContext(function($ctx1) {
  38800. var $2,$1,$3,$5,$4;
  38801. $2=$self._sequenceNode();
  38802. $ctx1.sendIdx["sequenceNode"]=1;
  38803. $1=$recv($2)._dagChildren();
  38804. $recv($1)._ifNotEmpty_((function(){
  38805. return $core.withContext(function($ctx2) {
  38806. return $recv($globals.CompilerError)._signal_("inlineJS: does not allow smalltalk statements");
  38807. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38808. }));
  38809. $3=$self._sequenceNode();
  38810. $5=$recv($globals.JSStatementNode)._new();
  38811. $recv($5)._source_(aString);
  38812. $4=$recv($5)._yourself();
  38813. $recv($3)._addDagChild_($4);
  38814. return self;
  38815. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString},$globals.EarlyPragmator)});
  38816. },
  38817. args: ["aString"],
  38818. source: "inlineJS: aString\x0a\x09self sequenceNode dagChildren ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'inlineJS: does not allow smalltalk statements' ].\x0a\x09self sequenceNode addDagChild: (\x0a\x09\x09JSStatementNode new\x0a\x09\x09\x09source: aString;\x0a\x09\x09\x09yourself)",
  38819. referencedClasses: ["CompilerError", "JSStatementNode"],
  38820. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  38821. }),
  38822. $globals.EarlyPragmator);
  38823. });
  38824. 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";
  38825. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38826. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38827. $core.addPackage("Compiler-IR");
  38828. ($core.packageDescriptors||$core.packages)["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  38829. ($core.packageDescriptors||$core.packages)["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38830. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38831. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38832. $core.addMethod(
  38833. $core.method({
  38834. selector: "addToSequence:",
  38835. protocol: "visiting",
  38836. fn: function (anInstruction){
  38837. var self=this,$self=this;
  38838. return $core.withContext(function($ctx1) {
  38839. var $1,$receiver;
  38840. if(($receiver = anInstruction) == null || $receiver.a$nil){
  38841. anInstruction;
  38842. } else {
  38843. $1=$recv(anInstruction)._isVariable();
  38844. if(!$core.assert($1)){
  38845. $recv($self._sequence())._add_(anInstruction);
  38846. }
  38847. }
  38848. return anInstruction;
  38849. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction},$globals.IRASTTranslator)});
  38850. },
  38851. args: ["anInstruction"],
  38852. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  38853. referencedClasses: [],
  38854. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  38855. }),
  38856. $globals.IRASTTranslator);
  38857. $core.addMethod(
  38858. $core.method({
  38859. selector: "alias:",
  38860. protocol: "visiting",
  38861. fn: function (aNode){
  38862. var self=this,$self=this;
  38863. var variable;
  38864. return $core.withContext(function($ctx1) {
  38865. var $1,$2,$3,$5,$4,$6,$8,$7;
  38866. $1=$recv(aNode)._isImmutable();
  38867. if($core.assert($1)){
  38868. $2=$self._visit_(aNode);
  38869. $ctx1.sendIdx["visit:"]=1;
  38870. return $2;
  38871. }
  38872. $3=$recv($globals.IRVariable)._new();
  38873. $ctx1.sendIdx["new"]=1;
  38874. $5=$recv($globals.AliasVar)._new();
  38875. $ctx1.sendIdx["new"]=2;
  38876. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38877. $recv($3)._variable_($4);
  38878. $6=$recv($3)._yourself();
  38879. $ctx1.sendIdx["yourself"]=1;
  38880. variable=$6;
  38881. $8=$recv($globals.IRAssignment)._new();
  38882. $recv($8)._add_(variable);
  38883. $ctx1.sendIdx["add:"]=1;
  38884. $recv($8)._add_($self._visit_(aNode));
  38885. $ctx1.sendIdx["add:"]=2;
  38886. $7=$recv($8)._yourself();
  38887. $self._addToSequence_($7);
  38888. $recv($recv($self._method())._internalVariables())._add_(variable);
  38889. return variable;
  38890. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38891. },
  38892. args: ["aNode"],
  38893. 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 addToSequence: (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",
  38894. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38895. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  38896. }),
  38897. $globals.IRASTTranslator);
  38898. $core.addMethod(
  38899. $core.method({
  38900. selector: "aliasTemporally:",
  38901. protocol: "visiting",
  38902. fn: function (aCollection){
  38903. var self=this,$self=this;
  38904. var threshold,result;
  38905. return $core.withContext(function($ctx1) {
  38906. var $1,$2,$4,$3;
  38907. threshold=(0);
  38908. $recv(aCollection)._withIndexDo_((function(each,i){
  38909. return $core.withContext(function($ctx2) {
  38910. $1=$recv(each)._subtreeNeedsAliasing();
  38911. if($core.assert($1)){
  38912. threshold=i;
  38913. return threshold;
  38914. }
  38915. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38916. }));
  38917. $ctx1.sendIdx["withIndexDo:"]=1;
  38918. result=$recv($globals.OrderedCollection)._new();
  38919. $recv(aCollection)._withIndexDo_((function(each,i){
  38920. return $core.withContext(function($ctx2) {
  38921. $2=result;
  38922. $4=$recv(i).__lt_eq(threshold);
  38923. if($core.assert($4)){
  38924. $3=$self._alias_(each);
  38925. } else {
  38926. $3=$self._visit_(each);
  38927. }
  38928. return $recv($2)._add_($3);
  38929. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38930. }));
  38931. return result;
  38932. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38933. },
  38934. args: ["aCollection"],
  38935. 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",
  38936. referencedClasses: ["OrderedCollection"],
  38937. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38938. }),
  38939. $globals.IRASTTranslator);
  38940. $core.addMethod(
  38941. $core.method({
  38942. selector: "method",
  38943. protocol: "accessing",
  38944. fn: function (){
  38945. var self=this,$self=this;
  38946. return $self["@method"];
  38947. },
  38948. args: [],
  38949. source: "method\x0a\x09^ method",
  38950. referencedClasses: [],
  38951. messageSends: []
  38952. }),
  38953. $globals.IRASTTranslator);
  38954. $core.addMethod(
  38955. $core.method({
  38956. selector: "method:",
  38957. protocol: "accessing",
  38958. fn: function (anIRMethod){
  38959. var self=this,$self=this;
  38960. $self["@method"]=anIRMethod;
  38961. return self;
  38962. },
  38963. args: ["anIRMethod"],
  38964. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38965. referencedClasses: [],
  38966. messageSends: []
  38967. }),
  38968. $globals.IRASTTranslator);
  38969. $core.addMethod(
  38970. $core.method({
  38971. selector: "nextAlias",
  38972. protocol: "accessing",
  38973. fn: function (){
  38974. var self=this,$self=this;
  38975. return $core.withContext(function($ctx1) {
  38976. var $1,$receiver;
  38977. $1=$self["@nextAlias"];
  38978. if(($receiver = $1) == null || $receiver.a$nil){
  38979. $self["@nextAlias"]=(0);
  38980. $self["@nextAlias"];
  38981. } else {
  38982. $1;
  38983. }
  38984. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  38985. return $recv($self["@nextAlias"])._asString();
  38986. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  38987. },
  38988. args: [],
  38989. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  38990. referencedClasses: [],
  38991. messageSends: ["ifNil:", "+", "asString"]
  38992. }),
  38993. $globals.IRASTTranslator);
  38994. $core.addMethod(
  38995. $core.method({
  38996. selector: "sequence",
  38997. protocol: "accessing",
  38998. fn: function (){
  38999. var self=this,$self=this;
  39000. return $self["@sequence"];
  39001. },
  39002. args: [],
  39003. source: "sequence\x0a\x09^ sequence",
  39004. referencedClasses: [],
  39005. messageSends: []
  39006. }),
  39007. $globals.IRASTTranslator);
  39008. $core.addMethod(
  39009. $core.method({
  39010. selector: "sequence:",
  39011. protocol: "accessing",
  39012. fn: function (anIRSequence){
  39013. var self=this,$self=this;
  39014. $self["@sequence"]=anIRSequence;
  39015. return self;
  39016. },
  39017. args: ["anIRSequence"],
  39018. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  39019. referencedClasses: [],
  39020. messageSends: []
  39021. }),
  39022. $globals.IRASTTranslator);
  39023. $core.addMethod(
  39024. $core.method({
  39025. selector: "source",
  39026. protocol: "accessing",
  39027. fn: function (){
  39028. var self=this,$self=this;
  39029. return $self["@source"];
  39030. },
  39031. args: [],
  39032. source: "source\x0a\x09^ source",
  39033. referencedClasses: [],
  39034. messageSends: []
  39035. }),
  39036. $globals.IRASTTranslator);
  39037. $core.addMethod(
  39038. $core.method({
  39039. selector: "source:",
  39040. protocol: "accessing",
  39041. fn: function (aString){
  39042. var self=this,$self=this;
  39043. $self["@source"]=aString;
  39044. return self;
  39045. },
  39046. args: ["aString"],
  39047. source: "source: aString\x0a\x09source := aString",
  39048. referencedClasses: [],
  39049. messageSends: []
  39050. }),
  39051. $globals.IRASTTranslator);
  39052. $core.addMethod(
  39053. $core.method({
  39054. selector: "theClass",
  39055. protocol: "accessing",
  39056. fn: function (){
  39057. var self=this,$self=this;
  39058. return $self["@theClass"];
  39059. },
  39060. args: [],
  39061. source: "theClass\x0a\x09^ theClass",
  39062. referencedClasses: [],
  39063. messageSends: []
  39064. }),
  39065. $globals.IRASTTranslator);
  39066. $core.addMethod(
  39067. $core.method({
  39068. selector: "theClass:",
  39069. protocol: "accessing",
  39070. fn: function (aClass){
  39071. var self=this,$self=this;
  39072. $self["@theClass"]=aClass;
  39073. return self;
  39074. },
  39075. args: ["aClass"],
  39076. source: "theClass: aClass\x0a\x09theClass := aClass",
  39077. referencedClasses: [],
  39078. messageSends: []
  39079. }),
  39080. $globals.IRASTTranslator);
  39081. $core.addMethod(
  39082. $core.method({
  39083. selector: "visitAssignmentNode:",
  39084. protocol: "visiting",
  39085. fn: function (aNode){
  39086. var self=this,$self=this;
  39087. var left,right,assignment;
  39088. return $core.withContext(function($ctx1) {
  39089. var $2,$1;
  39090. right=$self._visit_($recv(aNode)._right());
  39091. $ctx1.sendIdx["visit:"]=1;
  39092. left=$self._visit_($recv(aNode)._left());
  39093. $2=$recv($globals.IRAssignment)._new();
  39094. $recv($2)._add_(left);
  39095. $ctx1.sendIdx["add:"]=1;
  39096. $recv($2)._add_(right);
  39097. $1=$recv($2)._yourself();
  39098. $self._addToSequence_($1);
  39099. return left;
  39100. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  39101. },
  39102. args: ["aNode"],
  39103. source: "visitAssignmentNode: aNode\x0a\x09| left right assignment |\x0a\x09right := self visit: aNode right.\x0a\x09left := self visit: aNode left.\x0a\x09self addToSequence: (IRAssignment new\x0a\x09\x09add: left;\x0a\x09\x09add: right;\x0a\x09\x09yourself).\x0a\x09^ left",
  39104. referencedClasses: ["IRAssignment"],
  39105. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  39106. }),
  39107. $globals.IRASTTranslator);
  39108. $core.addMethod(
  39109. $core.method({
  39110. selector: "visitBlockNode:",
  39111. protocol: "visiting",
  39112. fn: function (aNode){
  39113. var self=this,$self=this;
  39114. var closure;
  39115. return $core.withContext(function($ctx1) {
  39116. var $1,$2,$3,$5,$4,$6,$8,$7;
  39117. $1=$recv($globals.IRClosure)._new();
  39118. $ctx1.sendIdx["new"]=1;
  39119. $recv($1)._arguments_($recv(aNode)._parameters());
  39120. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39121. $2=$recv(aNode)._scope();
  39122. $ctx1.sendIdx["scope"]=1;
  39123. $recv($1)._scope_($2);
  39124. $ctx1.sendIdx["scope:"]=1;
  39125. $3=$recv($1)._yourself();
  39126. $ctx1.sendIdx["yourself"]=1;
  39127. closure=$3;
  39128. $5=$recv(aNode)._scope();
  39129. $ctx1.sendIdx["scope"]=2;
  39130. $4=$recv($5)._temps();
  39131. $recv($4)._do_((function(each){
  39132. return $core.withContext(function($ctx2) {
  39133. $6=closure;
  39134. $8=$recv($globals.IRTempDeclaration)._new();
  39135. $recv($8)._name_($recv(each)._name());
  39136. $recv($8)._scope_($recv(aNode)._scope());
  39137. $7=$recv($8)._yourself();
  39138. return $recv($6)._add_($7);
  39139. $ctx2.sendIdx["add:"]=1;
  39140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39141. }));
  39142. $ctx1.sendIdx["do:"]=1;
  39143. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39144. return $core.withContext(function($ctx2) {
  39145. return $recv(closure)._add_($self._visit_(each));
  39146. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39147. }));
  39148. return closure;
  39149. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  39150. },
  39151. args: ["aNode"],
  39152. 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",
  39153. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  39154. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  39155. }),
  39156. $globals.IRASTTranslator);
  39157. $core.addMethod(
  39158. $core.method({
  39159. selector: "visitBlockSequenceNode:",
  39160. protocol: "visiting",
  39161. fn: function (aNode){
  39162. var self=this,$self=this;
  39163. return $core.withContext(function($ctx1) {
  39164. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  39165. $1=$recv($globals.IRBlockSequence)._new();
  39166. $ctx1.sendIdx["new"]=1;
  39167. return $self._withSequence_do_($1,(function(){
  39168. return $core.withContext(function($ctx2) {
  39169. $2=$recv(aNode)._dagChildren();
  39170. $ctx2.sendIdx["dagChildren"]=1;
  39171. return $recv($2)._ifNotEmpty_((function(){
  39172. return $core.withContext(function($ctx3) {
  39173. $4=$recv(aNode)._dagChildren();
  39174. $ctx3.sendIdx["dagChildren"]=2;
  39175. $3=$recv($4)._allButLast();
  39176. $recv($3)._do_((function(each){
  39177. return $core.withContext(function($ctx4) {
  39178. $5=$self._visitOrAlias_(each);
  39179. $ctx4.sendIdx["visitOrAlias:"]=1;
  39180. return $self._addToSequence_($5);
  39181. $ctx4.sendIdx["addToSequence:"]=1;
  39182. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39183. }));
  39184. $8=$recv(aNode)._dagChildren();
  39185. $ctx3.sendIdx["dagChildren"]=3;
  39186. $7=$recv($8)._last();
  39187. $ctx3.sendIdx["last"]=1;
  39188. $6=$recv($7)._isReturnNode();
  39189. if($core.assert($6)){
  39190. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  39191. } else {
  39192. $10=$recv($globals.IRBlockReturn)._new();
  39193. $13=$recv(aNode)._dagChildren();
  39194. $ctx3.sendIdx["dagChildren"]=4;
  39195. $12=$recv($13)._last();
  39196. $ctx3.sendIdx["last"]=2;
  39197. $11=$self._visitOrAlias_($12);
  39198. $ctx3.sendIdx["visitOrAlias:"]=2;
  39199. $recv($10)._add_($11);
  39200. $9=$recv($10)._yourself();
  39201. return $self._addToSequence_($9);
  39202. $ctx3.sendIdx["addToSequence:"]=2;
  39203. }
  39204. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39205. }));
  39206. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39207. }));
  39208. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39209. },
  39210. args: ["aNode"],
  39211. 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 addToSequence: (self visitOrAlias: each) ].\x0a\x09\x09\x09\x09aNode dagChildren last isReturnNode\x0a\x09\x09\x09\x09\x09ifFalse: [ self addToSequence: (IRBlockReturn new add: (self visitOrAlias: aNode dagChildren last); yourself) ]\x0a\x09\x09\x09\x09\x09ifTrue: [ self addToSequence: (self visitOrAlias: aNode dagChildren last) ] ]]",
  39212. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  39213. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  39214. }),
  39215. $globals.IRASTTranslator);
  39216. $core.addMethod(
  39217. $core.method({
  39218. selector: "visitCascadeNode:",
  39219. protocol: "visiting",
  39220. fn: function (aNode){
  39221. var self=this,$self=this;
  39222. var receiver;
  39223. return $core.withContext(function($ctx1) {
  39224. var $1,$2,$4,$3;
  39225. receiver=$recv(aNode)._receiver();
  39226. $1=$recv(receiver)._isImmutable();
  39227. if(!$core.assert($1)){
  39228. var alias;
  39229. alias=$self._alias_(receiver);
  39230. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  39231. receiver;
  39232. }
  39233. $2=$recv(aNode)._dagChildren();
  39234. $ctx1.sendIdx["dagChildren"]=1;
  39235. $recv($2)._do_((function(each){
  39236. return $core.withContext(function($ctx2) {
  39237. return $recv(each)._receiver_(receiver);
  39238. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39239. }));
  39240. $ctx1.sendIdx["do:"]=1;
  39241. $4=$recv(aNode)._dagChildren();
  39242. $ctx1.sendIdx["dagChildren"]=2;
  39243. $3=$recv($4)._allButLast();
  39244. $recv($3)._do_((function(each){
  39245. return $core.withContext(function($ctx2) {
  39246. return $self._addToSequence_($self._visit_(each));
  39247. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39248. }));
  39249. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  39250. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  39251. },
  39252. args: ["aNode"],
  39253. 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 addToSequence: (self visit: each) ].\x0a\x0a\x09^ self visitOrAlias: aNode dagChildren last",
  39254. referencedClasses: ["VariableNode"],
  39255. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  39256. }),
  39257. $globals.IRASTTranslator);
  39258. $core.addMethod(
  39259. $core.method({
  39260. selector: "visitDynamicArrayNode:",
  39261. protocol: "visiting",
  39262. fn: function (aNode){
  39263. var self=this,$self=this;
  39264. var array;
  39265. return $core.withContext(function($ctx1) {
  39266. array=$recv($globals.IRDynamicArray)._new();
  39267. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39268. return $core.withContext(function($ctx2) {
  39269. return $recv(array)._add_(each);
  39270. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39271. }));
  39272. return array;
  39273. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  39274. },
  39275. args: ["aNode"],
  39276. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  39277. referencedClasses: ["IRDynamicArray"],
  39278. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39279. }),
  39280. $globals.IRASTTranslator);
  39281. $core.addMethod(
  39282. $core.method({
  39283. selector: "visitDynamicDictionaryNode:",
  39284. protocol: "visiting",
  39285. fn: function (aNode){
  39286. var self=this,$self=this;
  39287. var dictionary;
  39288. return $core.withContext(function($ctx1) {
  39289. dictionary=$recv($globals.IRDynamicDictionary)._new();
  39290. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39291. return $core.withContext(function($ctx2) {
  39292. return $recv(dictionary)._add_(each);
  39293. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39294. }));
  39295. return dictionary;
  39296. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  39297. },
  39298. args: ["aNode"],
  39299. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  39300. referencedClasses: ["IRDynamicDictionary"],
  39301. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39302. }),
  39303. $globals.IRASTTranslator);
  39304. $core.addMethod(
  39305. $core.method({
  39306. selector: "visitJSStatementNode:",
  39307. protocol: "visiting",
  39308. fn: function (aNode){
  39309. var self=this,$self=this;
  39310. return $core.withContext(function($ctx1) {
  39311. var $1;
  39312. $1=$recv($globals.IRVerbatim)._new();
  39313. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  39314. return $recv($1)._yourself();
  39315. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39316. },
  39317. args: ["aNode"],
  39318. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  39319. referencedClasses: ["IRVerbatim"],
  39320. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  39321. }),
  39322. $globals.IRASTTranslator);
  39323. $core.addMethod(
  39324. $core.method({
  39325. selector: "visitMethodNode:",
  39326. protocol: "visiting",
  39327. fn: function (aNode){
  39328. var self=this,$self=this;
  39329. return $core.withContext(function($ctx1) {
  39330. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  39331. $2=$recv($globals.IRMethod)._new();
  39332. $ctx1.sendIdx["new"]=1;
  39333. $recv($2)._source_($recv($self._source())._crlfSanitized());
  39334. $ctx1.sendIdx["source:"]=1;
  39335. $recv($2)._theClass_($self._theClass());
  39336. $recv($2)._arguments_($recv(aNode)._arguments());
  39337. $recv($2)._selector_($recv(aNode)._selector());
  39338. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  39339. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39340. $recv($2)._classReferences_($recv(aNode)._classReferences());
  39341. $3=$recv(aNode)._scope();
  39342. $ctx1.sendIdx["scope"]=1;
  39343. $recv($2)._scope_($3);
  39344. $ctx1.sendIdx["scope:"]=1;
  39345. $4=$recv($2)._yourself();
  39346. $ctx1.sendIdx["yourself"]=1;
  39347. $1=$4;
  39348. $self._method_($1);
  39349. $6=$recv(aNode)._scope();
  39350. $ctx1.sendIdx["scope"]=2;
  39351. $5=$recv($6)._temps();
  39352. $recv($5)._do_((function(each){
  39353. return $core.withContext(function($ctx2) {
  39354. $7=$self._method();
  39355. $ctx2.sendIdx["method"]=1;
  39356. $9=$recv($globals.IRTempDeclaration)._new();
  39357. $ctx2.sendIdx["new"]=2;
  39358. $recv($9)._name_($recv(each)._name());
  39359. $10=$recv(aNode)._scope();
  39360. $ctx2.sendIdx["scope"]=3;
  39361. $recv($9)._scope_($10);
  39362. $11=$recv($9)._yourself();
  39363. $ctx2.sendIdx["yourself"]=2;
  39364. $8=$11;
  39365. return $recv($7)._add_($8);
  39366. $ctx2.sendIdx["add:"]=1;
  39367. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39368. }));
  39369. $ctx1.sendIdx["do:"]=1;
  39370. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39371. return $core.withContext(function($ctx2) {
  39372. $12=$self._method();
  39373. $ctx2.sendIdx["method"]=2;
  39374. return $recv($12)._add_($self._visit_(each));
  39375. $ctx2.sendIdx["add:"]=2;
  39376. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39377. }));
  39378. $14=$recv(aNode)._scope();
  39379. $ctx1.sendIdx["scope"]=4;
  39380. $13=$recv($14)._hasLocalReturn();
  39381. if(!$core.assert($13)){
  39382. $15=$self._method();
  39383. $ctx1.sendIdx["method"]=3;
  39384. $17=$recv($globals.IRReturn)._new();
  39385. $ctx1.sendIdx["new"]=3;
  39386. $19=$recv($globals.IRVariable)._new();
  39387. $ctx1.sendIdx["new"]=4;
  39388. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  39389. $20=$recv($19)._yourself();
  39390. $ctx1.sendIdx["yourself"]=3;
  39391. $18=$20;
  39392. $recv($17)._add_($18);
  39393. $ctx1.sendIdx["add:"]=4;
  39394. $21=$recv($17)._yourself();
  39395. $ctx1.sendIdx["yourself"]=4;
  39396. $16=$21;
  39397. $recv($15)._add_($16);
  39398. $ctx1.sendIdx["add:"]=3;
  39399. $23=$recv($globals.IRVerbatim)._new();
  39400. $recv($23)._source_(";".__comma($recv($globals.String)._lf()));
  39401. $22=$recv($23)._yourself();
  39402. $recv($15)._add_($22);
  39403. }
  39404. return $self._method();
  39405. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39406. },
  39407. args: ["aNode"],
  39408. 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: ';', String lf; yourself) ].\x0a\x0a\x09^ self method",
  39409. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  39410. 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", ",", "lf"]
  39411. }),
  39412. $globals.IRASTTranslator);
  39413. $core.addMethod(
  39414. $core.method({
  39415. selector: "visitOrAlias:",
  39416. protocol: "visiting",
  39417. fn: function (aNode){
  39418. var self=this,$self=this;
  39419. return $core.withContext(function($ctx1) {
  39420. var $1;
  39421. $1=$recv(aNode)._shouldBeAliased();
  39422. if($core.assert($1)){
  39423. return $self._alias_(aNode);
  39424. } else {
  39425. return $self._visit_(aNode);
  39426. }
  39427. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  39428. },
  39429. args: ["aNode"],
  39430. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  39431. referencedClasses: [],
  39432. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  39433. }),
  39434. $globals.IRASTTranslator);
  39435. $core.addMethod(
  39436. $core.method({
  39437. selector: "visitReturnNode:",
  39438. protocol: "visiting",
  39439. fn: function (aNode){
  39440. var self=this,$self=this;
  39441. var return_;
  39442. return $core.withContext(function($ctx1) {
  39443. var $1;
  39444. $1=$recv(aNode)._nonLocalReturn();
  39445. if($core.assert($1)){
  39446. return_=$recv($globals.IRNonLocalReturn)._new();
  39447. $ctx1.sendIdx["new"]=1;
  39448. } else {
  39449. return_=$recv($globals.IRReturn)._new();
  39450. }
  39451. $recv(return_)._scope_($recv(aNode)._scope());
  39452. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39453. return $core.withContext(function($ctx2) {
  39454. return $recv(return_)._add_($self._visitOrAlias_(each));
  39455. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39456. }));
  39457. return return_;
  39458. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  39459. },
  39460. args: ["aNode"],
  39461. 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",
  39462. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39463. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  39464. }),
  39465. $globals.IRASTTranslator);
  39466. $core.addMethod(
  39467. $core.method({
  39468. selector: "visitSendNode:",
  39469. protocol: "visiting",
  39470. fn: function (aNode){
  39471. var self=this,$self=this;
  39472. var send;
  39473. return $core.withContext(function($ctx1) {
  39474. var $1;
  39475. send=$recv($globals.IRSend)._new();
  39476. $1=send;
  39477. $recv($1)._selector_($recv(aNode)._selector());
  39478. $recv($1)._index_($recv(aNode)._index());
  39479. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39480. return $core.withContext(function($ctx2) {
  39481. return $recv(send)._add_(each);
  39482. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39483. }));
  39484. return send;
  39485. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  39486. },
  39487. args: ["aNode"],
  39488. 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",
  39489. referencedClasses: ["IRSend"],
  39490. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39491. }),
  39492. $globals.IRASTTranslator);
  39493. $core.addMethod(
  39494. $core.method({
  39495. selector: "visitSequenceNode:",
  39496. protocol: "visiting",
  39497. fn: function (aNode){
  39498. var self=this,$self=this;
  39499. return $core.withContext(function($ctx1) {
  39500. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39501. return $core.withContext(function($ctx2) {
  39502. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39503. return $core.withContext(function($ctx3) {
  39504. return $self._addToSequence_($self._visitOrAlias_(each));
  39505. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39506. }));
  39507. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39508. }));
  39509. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39510. },
  39511. args: ["aNode"],
  39512. source: "visitSequenceNode: aNode\x0a\x09^ self\x0a\x09\x09withSequence: IRSequence new\x0a\x09\x09do: [ aNode dagChildren do: [ :each |\x0a\x09\x09\x09self addToSequence: (self visitOrAlias: each) ] ]",
  39513. referencedClasses: ["IRSequence"],
  39514. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  39515. }),
  39516. $globals.IRASTTranslator);
  39517. $core.addMethod(
  39518. $core.method({
  39519. selector: "visitValueNode:",
  39520. protocol: "visiting",
  39521. fn: function (aNode){
  39522. var self=this,$self=this;
  39523. return $core.withContext(function($ctx1) {
  39524. var $1;
  39525. $1=$recv($globals.IRValue)._new();
  39526. $recv($1)._value_($recv(aNode)._value());
  39527. return $recv($1)._yourself();
  39528. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39529. },
  39530. args: ["aNode"],
  39531. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39532. referencedClasses: ["IRValue"],
  39533. messageSends: ["value:", "new", "value", "yourself"]
  39534. }),
  39535. $globals.IRASTTranslator);
  39536. $core.addMethod(
  39537. $core.method({
  39538. selector: "visitVariableNode:",
  39539. protocol: "visiting",
  39540. fn: function (aNode){
  39541. var self=this,$self=this;
  39542. return $core.withContext(function($ctx1) {
  39543. var $1;
  39544. $1=$recv($globals.IRVariable)._new();
  39545. $recv($1)._variable_($recv(aNode)._binding());
  39546. return $recv($1)._yourself();
  39547. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39548. },
  39549. args: ["aNode"],
  39550. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39551. referencedClasses: ["IRVariable"],
  39552. messageSends: ["variable:", "new", "binding", "yourself"]
  39553. }),
  39554. $globals.IRASTTranslator);
  39555. $core.addMethod(
  39556. $core.method({
  39557. selector: "withSequence:do:",
  39558. protocol: "accessing",
  39559. fn: function (aSequence,aBlock){
  39560. var self=this,$self=this;
  39561. var outerSequence;
  39562. return $core.withContext(function($ctx1) {
  39563. outerSequence=$self._sequence();
  39564. $self._sequence_(aSequence);
  39565. $ctx1.sendIdx["sequence:"]=1;
  39566. $recv(aBlock)._value();
  39567. $self._sequence_(outerSequence);
  39568. return aSequence;
  39569. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39570. },
  39571. args: ["aSequence", "aBlock"],
  39572. 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",
  39573. referencedClasses: [],
  39574. messageSends: ["sequence", "sequence:", "value"]
  39575. }),
  39576. $globals.IRASTTranslator);
  39577. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39578. $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.";
  39579. $core.addMethod(
  39580. $core.method({
  39581. selector: "add:",
  39582. protocol: "building",
  39583. fn: function (anObject){
  39584. var self=this,$self=this;
  39585. return $core.withContext(function($ctx1) {
  39586. $recv(anObject)._parent_(self);
  39587. return $recv($self._dagChildren())._add_(anObject);
  39588. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39589. },
  39590. args: ["anObject"],
  39591. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39592. referencedClasses: [],
  39593. messageSends: ["parent:", "add:", "dagChildren"]
  39594. }),
  39595. $globals.IRInstruction);
  39596. $core.addMethod(
  39597. $core.method({
  39598. selector: "isClosure",
  39599. protocol: "testing",
  39600. fn: function (){
  39601. var self=this,$self=this;
  39602. return false;
  39603. },
  39604. args: [],
  39605. source: "isClosure\x0a\x09^ false",
  39606. referencedClasses: [],
  39607. messageSends: []
  39608. }),
  39609. $globals.IRInstruction);
  39610. $core.addMethod(
  39611. $core.method({
  39612. selector: "isInlined",
  39613. protocol: "testing",
  39614. fn: function (){
  39615. var self=this,$self=this;
  39616. return false;
  39617. },
  39618. args: [],
  39619. source: "isInlined\x0a\x09^ false",
  39620. referencedClasses: [],
  39621. messageSends: []
  39622. }),
  39623. $globals.IRInstruction);
  39624. $core.addMethod(
  39625. $core.method({
  39626. selector: "isMethod",
  39627. protocol: "testing",
  39628. fn: function (){
  39629. var self=this,$self=this;
  39630. return false;
  39631. },
  39632. args: [],
  39633. source: "isMethod\x0a\x09^ false",
  39634. referencedClasses: [],
  39635. messageSends: []
  39636. }),
  39637. $globals.IRInstruction);
  39638. $core.addMethod(
  39639. $core.method({
  39640. selector: "isSelf",
  39641. protocol: "testing",
  39642. fn: function (){
  39643. var self=this,$self=this;
  39644. return false;
  39645. },
  39646. args: [],
  39647. source: "isSelf\x0a\x09^ false",
  39648. referencedClasses: [],
  39649. messageSends: []
  39650. }),
  39651. $globals.IRInstruction);
  39652. $core.addMethod(
  39653. $core.method({
  39654. selector: "isSend",
  39655. protocol: "testing",
  39656. fn: function (){
  39657. var self=this,$self=this;
  39658. return false;
  39659. },
  39660. args: [],
  39661. source: "isSend\x0a\x09^ false",
  39662. referencedClasses: [],
  39663. messageSends: []
  39664. }),
  39665. $globals.IRInstruction);
  39666. $core.addMethod(
  39667. $core.method({
  39668. selector: "isSequence",
  39669. protocol: "testing",
  39670. fn: function (){
  39671. var self=this,$self=this;
  39672. return false;
  39673. },
  39674. args: [],
  39675. source: "isSequence\x0a\x09^ false",
  39676. referencedClasses: [],
  39677. messageSends: []
  39678. }),
  39679. $globals.IRInstruction);
  39680. $core.addMethod(
  39681. $core.method({
  39682. selector: "isSuper",
  39683. protocol: "testing",
  39684. fn: function (){
  39685. var self=this,$self=this;
  39686. return false;
  39687. },
  39688. args: [],
  39689. source: "isSuper\x0a\x09^ false",
  39690. referencedClasses: [],
  39691. messageSends: []
  39692. }),
  39693. $globals.IRInstruction);
  39694. $core.addMethod(
  39695. $core.method({
  39696. selector: "isTempDeclaration",
  39697. protocol: "testing",
  39698. fn: function (){
  39699. var self=this,$self=this;
  39700. return false;
  39701. },
  39702. args: [],
  39703. source: "isTempDeclaration\x0a\x09^ false",
  39704. referencedClasses: [],
  39705. messageSends: []
  39706. }),
  39707. $globals.IRInstruction);
  39708. $core.addMethod(
  39709. $core.method({
  39710. selector: "isVariable",
  39711. protocol: "testing",
  39712. fn: function (){
  39713. var self=this,$self=this;
  39714. return false;
  39715. },
  39716. args: [],
  39717. source: "isVariable\x0a\x09^ false",
  39718. referencedClasses: [],
  39719. messageSends: []
  39720. }),
  39721. $globals.IRInstruction);
  39722. $core.addMethod(
  39723. $core.method({
  39724. selector: "method",
  39725. protocol: "accessing",
  39726. fn: function (){
  39727. var self=this,$self=this;
  39728. return $core.withContext(function($ctx1) {
  39729. return $recv($self._parent())._method();
  39730. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39731. },
  39732. args: [],
  39733. source: "method\x0a\x09^ self parent method",
  39734. referencedClasses: [],
  39735. messageSends: ["method", "parent"]
  39736. }),
  39737. $globals.IRInstruction);
  39738. $core.addMethod(
  39739. $core.method({
  39740. selector: "needsBoxingAsReceiver",
  39741. protocol: "testing",
  39742. fn: function (){
  39743. var self=this,$self=this;
  39744. return true;
  39745. },
  39746. args: [],
  39747. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39748. referencedClasses: [],
  39749. messageSends: []
  39750. }),
  39751. $globals.IRInstruction);
  39752. $core.addMethod(
  39753. $core.method({
  39754. selector: "parent",
  39755. protocol: "accessing",
  39756. fn: function (){
  39757. var self=this,$self=this;
  39758. return $self["@parent"];
  39759. },
  39760. args: [],
  39761. source: "parent\x0a\x09^ parent",
  39762. referencedClasses: [],
  39763. messageSends: []
  39764. }),
  39765. $globals.IRInstruction);
  39766. $core.addMethod(
  39767. $core.method({
  39768. selector: "parent:",
  39769. protocol: "accessing",
  39770. fn: function (anIRInstruction){
  39771. var self=this,$self=this;
  39772. $self["@parent"]=anIRInstruction;
  39773. return self;
  39774. },
  39775. args: ["anIRInstruction"],
  39776. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39777. referencedClasses: [],
  39778. messageSends: []
  39779. }),
  39780. $globals.IRInstruction);
  39781. $core.addMethod(
  39782. $core.method({
  39783. selector: "remove:",
  39784. protocol: "building",
  39785. fn: function (anIRInstruction){
  39786. var self=this,$self=this;
  39787. return $core.withContext(function($ctx1) {
  39788. $recv($self._dagChildren())._remove_(anIRInstruction);
  39789. return self;
  39790. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39791. },
  39792. args: ["anIRInstruction"],
  39793. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39794. referencedClasses: [],
  39795. messageSends: ["remove:", "dagChildren"]
  39796. }),
  39797. $globals.IRInstruction);
  39798. $core.addMethod(
  39799. $core.method({
  39800. selector: "replace:with:",
  39801. protocol: "building",
  39802. fn: function (anIRInstruction,anotherIRInstruction){
  39803. var self=this,$self=this;
  39804. return $core.withContext(function($ctx1) {
  39805. var $1;
  39806. $recv(anotherIRInstruction)._parent_(self);
  39807. $1=$self._dagChildren();
  39808. $ctx1.sendIdx["dagChildren"]=1;
  39809. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39810. return self;
  39811. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39812. },
  39813. args: ["anIRInstruction", "anotherIRInstruction"],
  39814. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39815. referencedClasses: [],
  39816. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39817. }),
  39818. $globals.IRInstruction);
  39819. $core.addMethod(
  39820. $core.method({
  39821. selector: "replaceWith:",
  39822. protocol: "building",
  39823. fn: function (anIRInstruction){
  39824. var self=this,$self=this;
  39825. return $core.withContext(function($ctx1) {
  39826. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39827. return self;
  39828. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39829. },
  39830. args: ["anIRInstruction"],
  39831. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39832. referencedClasses: [],
  39833. messageSends: ["replace:with:", "parent"]
  39834. }),
  39835. $globals.IRInstruction);
  39836. $core.addMethod(
  39837. $core.method({
  39838. selector: "scope",
  39839. protocol: "accessing",
  39840. fn: function (){
  39841. var self=this,$self=this;
  39842. return $core.withContext(function($ctx1) {
  39843. var $1,$receiver;
  39844. $1=$self._parent();
  39845. if(($receiver = $1) == null || $receiver.a$nil){
  39846. return $1;
  39847. } else {
  39848. var node;
  39849. node=$receiver;
  39850. return $recv(node)._scope();
  39851. }
  39852. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39853. },
  39854. args: [],
  39855. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39856. referencedClasses: [],
  39857. messageSends: ["ifNotNil:", "parent", "scope"]
  39858. }),
  39859. $globals.IRInstruction);
  39860. $core.addMethod(
  39861. $core.method({
  39862. selector: "yieldsValue",
  39863. protocol: "testing",
  39864. fn: function (){
  39865. var self=this,$self=this;
  39866. return true;
  39867. },
  39868. args: [],
  39869. source: "yieldsValue\x0a\x09^ true",
  39870. referencedClasses: [],
  39871. messageSends: []
  39872. }),
  39873. $globals.IRInstruction);
  39874. $core.addMethod(
  39875. $core.method({
  39876. selector: "on:",
  39877. protocol: "instance creation",
  39878. fn: function (aBuilder){
  39879. var self=this,$self=this;
  39880. return $core.withContext(function($ctx1) {
  39881. var $1;
  39882. $1=$self._new();
  39883. $recv($1)._builder_(aBuilder);
  39884. return $recv($1)._yourself();
  39885. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39886. },
  39887. args: ["aBuilder"],
  39888. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39889. referencedClasses: [],
  39890. messageSends: ["builder:", "new", "yourself"]
  39891. }),
  39892. $globals.IRInstruction.a$cls);
  39893. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39894. $core.addMethod(
  39895. $core.method({
  39896. selector: "acceptDagVisitor:",
  39897. protocol: "visiting",
  39898. fn: function (aVisitor){
  39899. var self=this,$self=this;
  39900. return $core.withContext(function($ctx1) {
  39901. return $recv(aVisitor)._visitIRAssignment_(self);
  39902. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39903. },
  39904. args: ["aVisitor"],
  39905. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39906. referencedClasses: [],
  39907. messageSends: ["visitIRAssignment:"]
  39908. }),
  39909. $globals.IRAssignment);
  39910. $core.addMethod(
  39911. $core.method({
  39912. selector: "left",
  39913. protocol: "accessing",
  39914. fn: function (){
  39915. var self=this,$self=this;
  39916. return $core.withContext(function($ctx1) {
  39917. return $recv($self._dagChildren())._first();
  39918. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39919. },
  39920. args: [],
  39921. source: "left\x0a\x09^ self dagChildren first",
  39922. referencedClasses: [],
  39923. messageSends: ["first", "dagChildren"]
  39924. }),
  39925. $globals.IRAssignment);
  39926. $core.addMethod(
  39927. $core.method({
  39928. selector: "right",
  39929. protocol: "accessing",
  39930. fn: function (){
  39931. var self=this,$self=this;
  39932. return $core.withContext(function($ctx1) {
  39933. return $recv($self._dagChildren())._last();
  39934. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39935. },
  39936. args: [],
  39937. source: "right\x0a\x09^ self dagChildren last",
  39938. referencedClasses: [],
  39939. messageSends: ["last", "dagChildren"]
  39940. }),
  39941. $globals.IRAssignment);
  39942. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39943. $core.addMethod(
  39944. $core.method({
  39945. selector: "acceptDagVisitor:",
  39946. protocol: "visiting",
  39947. fn: function (aVisitor){
  39948. var self=this,$self=this;
  39949. return $core.withContext(function($ctx1) {
  39950. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39951. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39952. },
  39953. args: ["aVisitor"],
  39954. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39955. referencedClasses: [],
  39956. messageSends: ["visitIRDynamicArray:"]
  39957. }),
  39958. $globals.IRDynamicArray);
  39959. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39960. $core.addMethod(
  39961. $core.method({
  39962. selector: "acceptDagVisitor:",
  39963. protocol: "visiting",
  39964. fn: function (aVisitor){
  39965. var self=this,$self=this;
  39966. return $core.withContext(function($ctx1) {
  39967. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  39968. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  39969. },
  39970. args: ["aVisitor"],
  39971. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  39972. referencedClasses: [],
  39973. messageSends: ["visitIRDynamicDictionary:"]
  39974. }),
  39975. $globals.IRDynamicDictionary);
  39976. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  39977. $core.addMethod(
  39978. $core.method({
  39979. selector: "scope",
  39980. protocol: "accessing",
  39981. fn: function (){
  39982. var self=this,$self=this;
  39983. return $self["@scope"];
  39984. },
  39985. args: [],
  39986. source: "scope\x0a\x09^ scope",
  39987. referencedClasses: [],
  39988. messageSends: []
  39989. }),
  39990. $globals.IRScopedInstruction);
  39991. $core.addMethod(
  39992. $core.method({
  39993. selector: "scope:",
  39994. protocol: "accessing",
  39995. fn: function (aScope){
  39996. var self=this,$self=this;
  39997. $self["@scope"]=aScope;
  39998. return self;
  39999. },
  40000. args: ["aScope"],
  40001. source: "scope: aScope\x0a\x09scope := aScope",
  40002. referencedClasses: [],
  40003. messageSends: []
  40004. }),
  40005. $globals.IRScopedInstruction);
  40006. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  40007. $core.addMethod(
  40008. $core.method({
  40009. selector: "arguments",
  40010. protocol: "accessing",
  40011. fn: function (){
  40012. var self=this,$self=this;
  40013. return $core.withContext(function($ctx1) {
  40014. var $1,$receiver;
  40015. $1=$self["@arguments"];
  40016. if(($receiver = $1) == null || $receiver.a$nil){
  40017. return [];
  40018. } else {
  40019. return $1;
  40020. }
  40021. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  40022. },
  40023. args: [],
  40024. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  40025. referencedClasses: [],
  40026. messageSends: ["ifNil:"]
  40027. }),
  40028. $globals.IRClosureInstruction);
  40029. $core.addMethod(
  40030. $core.method({
  40031. selector: "arguments:",
  40032. protocol: "accessing",
  40033. fn: function (aCollection){
  40034. var self=this,$self=this;
  40035. $self["@arguments"]=aCollection;
  40036. return self;
  40037. },
  40038. args: ["aCollection"],
  40039. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  40040. referencedClasses: [],
  40041. messageSends: []
  40042. }),
  40043. $globals.IRClosureInstruction);
  40044. $core.addMethod(
  40045. $core.method({
  40046. selector: "locals",
  40047. protocol: "accessing",
  40048. fn: function (){
  40049. var self=this,$self=this;
  40050. return $core.withContext(function($ctx1) {
  40051. var $1;
  40052. $1=$recv($self._arguments())._copy();
  40053. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  40054. return $core.withContext(function($ctx2) {
  40055. return $recv(each)._name();
  40056. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40057. })));
  40058. return $recv($1)._yourself();
  40059. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  40060. },
  40061. args: [],
  40062. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  40063. referencedClasses: [],
  40064. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  40065. }),
  40066. $globals.IRClosureInstruction);
  40067. $core.addMethod(
  40068. $core.method({
  40069. selector: "requiresSmalltalkContext",
  40070. protocol: "accessing",
  40071. fn: function (){
  40072. var self=this,$self=this;
  40073. return $core.withContext(function($ctx1) {
  40074. var $1,$receiver;
  40075. $1=$self["@requiresSmalltalkContext"];
  40076. if(($receiver = $1) == null || $receiver.a$nil){
  40077. return false;
  40078. } else {
  40079. return $1;
  40080. }
  40081. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  40082. },
  40083. args: [],
  40084. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  40085. referencedClasses: [],
  40086. messageSends: ["ifNil:"]
  40087. }),
  40088. $globals.IRClosureInstruction);
  40089. $core.addMethod(
  40090. $core.method({
  40091. selector: "requiresSmalltalkContext:",
  40092. protocol: "accessing",
  40093. fn: function (anObject){
  40094. var self=this,$self=this;
  40095. $self["@requiresSmalltalkContext"]=anObject;
  40096. return self;
  40097. },
  40098. args: ["anObject"],
  40099. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  40100. referencedClasses: [],
  40101. messageSends: []
  40102. }),
  40103. $globals.IRClosureInstruction);
  40104. $core.addMethod(
  40105. $core.method({
  40106. selector: "scope:",
  40107. protocol: "accessing",
  40108. fn: function (aScope){
  40109. var self=this,$self=this;
  40110. return $core.withContext(function($ctx1) {
  40111. (
  40112. $ctx1.supercall = true,
  40113. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  40114. $ctx1.supercall = false;
  40115. $recv(aScope)._instruction_(self);
  40116. return self;
  40117. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  40118. },
  40119. args: ["aScope"],
  40120. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  40121. referencedClasses: [],
  40122. messageSends: ["scope:", "instruction:"]
  40123. }),
  40124. $globals.IRClosureInstruction);
  40125. $core.addMethod(
  40126. $core.method({
  40127. selector: "tempDeclarations",
  40128. protocol: "accessing",
  40129. fn: function (){
  40130. var self=this,$self=this;
  40131. return $core.withContext(function($ctx1) {
  40132. return $recv($self._dagChildren())._select_((function(each){
  40133. return $core.withContext(function($ctx2) {
  40134. return $recv(each)._isTempDeclaration();
  40135. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40136. }));
  40137. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  40138. },
  40139. args: [],
  40140. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  40141. referencedClasses: [],
  40142. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  40143. }),
  40144. $globals.IRClosureInstruction);
  40145. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  40146. $core.addMethod(
  40147. $core.method({
  40148. selector: "acceptDagVisitor:",
  40149. protocol: "visiting",
  40150. fn: function (aVisitor){
  40151. var self=this,$self=this;
  40152. return $core.withContext(function($ctx1) {
  40153. return $recv(aVisitor)._visitIRClosure_(self);
  40154. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  40155. },
  40156. args: ["aVisitor"],
  40157. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  40158. referencedClasses: [],
  40159. messageSends: ["visitIRClosure:"]
  40160. }),
  40161. $globals.IRClosure);
  40162. $core.addMethod(
  40163. $core.method({
  40164. selector: "isClosure",
  40165. protocol: "testing",
  40166. fn: function (){
  40167. var self=this,$self=this;
  40168. return true;
  40169. },
  40170. args: [],
  40171. source: "isClosure\x0a\x09^ true",
  40172. referencedClasses: [],
  40173. messageSends: []
  40174. }),
  40175. $globals.IRClosure);
  40176. $core.addMethod(
  40177. $core.method({
  40178. selector: "sequence",
  40179. protocol: "accessing",
  40180. fn: function (){
  40181. var self=this,$self=this;
  40182. return $core.withContext(function($ctx1) {
  40183. return $recv($self._dagChildren())._last();
  40184. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  40185. },
  40186. args: [],
  40187. source: "sequence\x0a\x09^ self dagChildren last",
  40188. referencedClasses: [],
  40189. messageSends: ["last", "dagChildren"]
  40190. }),
  40191. $globals.IRClosure);
  40192. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  40193. $globals.IRMethod.comment="I am a method instruction";
  40194. $core.addMethod(
  40195. $core.method({
  40196. selector: "acceptDagVisitor:",
  40197. protocol: "visiting",
  40198. fn: function (aVisitor){
  40199. var self=this,$self=this;
  40200. return $core.withContext(function($ctx1) {
  40201. return $recv(aVisitor)._visitIRMethod_(self);
  40202. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  40203. },
  40204. args: ["aVisitor"],
  40205. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  40206. referencedClasses: [],
  40207. messageSends: ["visitIRMethod:"]
  40208. }),
  40209. $globals.IRMethod);
  40210. $core.addMethod(
  40211. $core.method({
  40212. selector: "classReferences",
  40213. protocol: "accessing",
  40214. fn: function (){
  40215. var self=this,$self=this;
  40216. return $self["@classReferences"];
  40217. },
  40218. args: [],
  40219. source: "classReferences\x0a\x09^ classReferences",
  40220. referencedClasses: [],
  40221. messageSends: []
  40222. }),
  40223. $globals.IRMethod);
  40224. $core.addMethod(
  40225. $core.method({
  40226. selector: "classReferences:",
  40227. protocol: "accessing",
  40228. fn: function (aCollection){
  40229. var self=this,$self=this;
  40230. $self["@classReferences"]=aCollection;
  40231. return self;
  40232. },
  40233. args: ["aCollection"],
  40234. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  40235. referencedClasses: [],
  40236. messageSends: []
  40237. }),
  40238. $globals.IRMethod);
  40239. $core.addMethod(
  40240. $core.method({
  40241. selector: "internalVariables",
  40242. protocol: "accessing",
  40243. fn: function (){
  40244. var self=this,$self=this;
  40245. return $core.withContext(function($ctx1) {
  40246. var $1,$receiver;
  40247. $1=$self["@internalVariables"];
  40248. if(($receiver = $1) == null || $receiver.a$nil){
  40249. $self["@internalVariables"]=$recv($globals.Set)._new();
  40250. return $self["@internalVariables"];
  40251. } else {
  40252. return $1;
  40253. }
  40254. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  40255. },
  40256. args: [],
  40257. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  40258. referencedClasses: ["Set"],
  40259. messageSends: ["ifNil:", "new"]
  40260. }),
  40261. $globals.IRMethod);
  40262. $core.addMethod(
  40263. $core.method({
  40264. selector: "isMethod",
  40265. protocol: "testing",
  40266. fn: function (){
  40267. var self=this,$self=this;
  40268. return true;
  40269. },
  40270. args: [],
  40271. source: "isMethod\x0a\x09^ true",
  40272. referencedClasses: [],
  40273. messageSends: []
  40274. }),
  40275. $globals.IRMethod);
  40276. $core.addMethod(
  40277. $core.method({
  40278. selector: "messageSends",
  40279. protocol: "accessing",
  40280. fn: function (){
  40281. var self=this,$self=this;
  40282. return $core.withContext(function($ctx1) {
  40283. return $recv($self._sendIndexes())._keys();
  40284. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  40285. },
  40286. args: [],
  40287. source: "messageSends\x0a\x09^ self sendIndexes keys",
  40288. referencedClasses: [],
  40289. messageSends: ["keys", "sendIndexes"]
  40290. }),
  40291. $globals.IRMethod);
  40292. $core.addMethod(
  40293. $core.method({
  40294. selector: "method",
  40295. protocol: "accessing",
  40296. fn: function (){
  40297. var self=this,$self=this;
  40298. return self;
  40299. },
  40300. args: [],
  40301. source: "method\x0a\x09^ self",
  40302. referencedClasses: [],
  40303. messageSends: []
  40304. }),
  40305. $globals.IRMethod);
  40306. $core.addMethod(
  40307. $core.method({
  40308. selector: "selector",
  40309. protocol: "accessing",
  40310. fn: function (){
  40311. var self=this,$self=this;
  40312. return $self["@selector"];
  40313. },
  40314. args: [],
  40315. source: "selector\x0a\x09^ selector",
  40316. referencedClasses: [],
  40317. messageSends: []
  40318. }),
  40319. $globals.IRMethod);
  40320. $core.addMethod(
  40321. $core.method({
  40322. selector: "selector:",
  40323. protocol: "accessing",
  40324. fn: function (aString){
  40325. var self=this,$self=this;
  40326. $self["@selector"]=aString;
  40327. return self;
  40328. },
  40329. args: ["aString"],
  40330. source: "selector: aString\x0a\x09selector := aString",
  40331. referencedClasses: [],
  40332. messageSends: []
  40333. }),
  40334. $globals.IRMethod);
  40335. $core.addMethod(
  40336. $core.method({
  40337. selector: "sendIndexes",
  40338. protocol: "accessing",
  40339. fn: function (){
  40340. var self=this,$self=this;
  40341. return $self["@sendIndexes"];
  40342. },
  40343. args: [],
  40344. source: "sendIndexes\x0a\x09^ sendIndexes",
  40345. referencedClasses: [],
  40346. messageSends: []
  40347. }),
  40348. $globals.IRMethod);
  40349. $core.addMethod(
  40350. $core.method({
  40351. selector: "sendIndexes:",
  40352. protocol: "accessing",
  40353. fn: function (aDictionary){
  40354. var self=this,$self=this;
  40355. $self["@sendIndexes"]=aDictionary;
  40356. return self;
  40357. },
  40358. args: ["aDictionary"],
  40359. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  40360. referencedClasses: [],
  40361. messageSends: []
  40362. }),
  40363. $globals.IRMethod);
  40364. $core.addMethod(
  40365. $core.method({
  40366. selector: "source",
  40367. protocol: "accessing",
  40368. fn: function (){
  40369. var self=this,$self=this;
  40370. return $self["@source"];
  40371. },
  40372. args: [],
  40373. source: "source\x0a\x09^ source",
  40374. referencedClasses: [],
  40375. messageSends: []
  40376. }),
  40377. $globals.IRMethod);
  40378. $core.addMethod(
  40379. $core.method({
  40380. selector: "source:",
  40381. protocol: "accessing",
  40382. fn: function (aString){
  40383. var self=this,$self=this;
  40384. $self["@source"]=aString;
  40385. return self;
  40386. },
  40387. args: ["aString"],
  40388. source: "source: aString\x0a\x09source := aString",
  40389. referencedClasses: [],
  40390. messageSends: []
  40391. }),
  40392. $globals.IRMethod);
  40393. $core.addMethod(
  40394. $core.method({
  40395. selector: "theClass",
  40396. protocol: "accessing",
  40397. fn: function (){
  40398. var self=this,$self=this;
  40399. return $self["@theClass"];
  40400. },
  40401. args: [],
  40402. source: "theClass\x0a\x09^ theClass",
  40403. referencedClasses: [],
  40404. messageSends: []
  40405. }),
  40406. $globals.IRMethod);
  40407. $core.addMethod(
  40408. $core.method({
  40409. selector: "theClass:",
  40410. protocol: "accessing",
  40411. fn: function (aClass){
  40412. var self=this,$self=this;
  40413. $self["@theClass"]=aClass;
  40414. return self;
  40415. },
  40416. args: ["aClass"],
  40417. source: "theClass: aClass\x0a\x09theClass := aClass",
  40418. referencedClasses: [],
  40419. messageSends: []
  40420. }),
  40421. $globals.IRMethod);
  40422. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  40423. $globals.IRReturn.comment="I am a local return instruction.";
  40424. $core.addMethod(
  40425. $core.method({
  40426. selector: "acceptDagVisitor:",
  40427. protocol: "visiting",
  40428. fn: function (aVisitor){
  40429. var self=this,$self=this;
  40430. return $core.withContext(function($ctx1) {
  40431. return $recv(aVisitor)._visitIRReturn_(self);
  40432. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  40433. },
  40434. args: ["aVisitor"],
  40435. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  40436. referencedClasses: [],
  40437. messageSends: ["visitIRReturn:"]
  40438. }),
  40439. $globals.IRReturn);
  40440. $core.addMethod(
  40441. $core.method({
  40442. selector: "expression",
  40443. protocol: "accessing",
  40444. fn: function (){
  40445. var self=this,$self=this;
  40446. return $core.withContext(function($ctx1) {
  40447. return $recv($self._dagChildren())._single();
  40448. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  40449. },
  40450. args: [],
  40451. source: "expression\x0a\x09^ self dagChildren single",
  40452. referencedClasses: [],
  40453. messageSends: ["single", "dagChildren"]
  40454. }),
  40455. $globals.IRReturn);
  40456. $core.addMethod(
  40457. $core.method({
  40458. selector: "scope",
  40459. protocol: "accessing",
  40460. fn: function (){
  40461. var self=this,$self=this;
  40462. return $core.withContext(function($ctx1) {
  40463. var $1,$receiver;
  40464. $1=$self["@scope"];
  40465. if(($receiver = $1) == null || $receiver.a$nil){
  40466. return $recv($self._parent())._scope();
  40467. } else {
  40468. return $1;
  40469. }
  40470. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  40471. },
  40472. args: [],
  40473. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  40474. referencedClasses: [],
  40475. messageSends: ["ifNil:", "scope", "parent"]
  40476. }),
  40477. $globals.IRReturn);
  40478. $core.addMethod(
  40479. $core.method({
  40480. selector: "yieldsValue",
  40481. protocol: "testing",
  40482. fn: function (){
  40483. var self=this,$self=this;
  40484. return false;
  40485. },
  40486. args: [],
  40487. source: "yieldsValue\x0a\x09^ false",
  40488. referencedClasses: [],
  40489. messageSends: []
  40490. }),
  40491. $globals.IRReturn);
  40492. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40493. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40494. $core.addMethod(
  40495. $core.method({
  40496. selector: "acceptDagVisitor:",
  40497. protocol: "visiting",
  40498. fn: function (aVisitor){
  40499. var self=this,$self=this;
  40500. return $core.withContext(function($ctx1) {
  40501. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40502. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40503. },
  40504. args: ["aVisitor"],
  40505. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40506. referencedClasses: [],
  40507. messageSends: ["visitIRBlockReturn:"]
  40508. }),
  40509. $globals.IRBlockReturn);
  40510. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40511. $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.";
  40512. $core.addMethod(
  40513. $core.method({
  40514. selector: "acceptDagVisitor:",
  40515. protocol: "visiting",
  40516. fn: function (aVisitor){
  40517. var self=this,$self=this;
  40518. return $core.withContext(function($ctx1) {
  40519. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40520. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40521. },
  40522. args: ["aVisitor"],
  40523. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40524. referencedClasses: [],
  40525. messageSends: ["visitIRNonLocalReturn:"]
  40526. }),
  40527. $globals.IRNonLocalReturn);
  40528. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40529. $core.addMethod(
  40530. $core.method({
  40531. selector: "acceptDagVisitor:",
  40532. protocol: "visiting",
  40533. fn: function (aVisitor){
  40534. var self=this,$self=this;
  40535. return $core.withContext(function($ctx1) {
  40536. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40537. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40538. },
  40539. args: ["aVisitor"],
  40540. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40541. referencedClasses: [],
  40542. messageSends: ["visitIRTempDeclaration:"]
  40543. }),
  40544. $globals.IRTempDeclaration);
  40545. $core.addMethod(
  40546. $core.method({
  40547. selector: "isTempDeclaration",
  40548. protocol: "testing",
  40549. fn: function (){
  40550. var self=this,$self=this;
  40551. return true;
  40552. },
  40553. args: [],
  40554. source: "isTempDeclaration\x0a\x09^ true",
  40555. referencedClasses: [],
  40556. messageSends: []
  40557. }),
  40558. $globals.IRTempDeclaration);
  40559. $core.addMethod(
  40560. $core.method({
  40561. selector: "name",
  40562. protocol: "accessing",
  40563. fn: function (){
  40564. var self=this,$self=this;
  40565. return $self["@name"];
  40566. },
  40567. args: [],
  40568. source: "name\x0a\x09^ name",
  40569. referencedClasses: [],
  40570. messageSends: []
  40571. }),
  40572. $globals.IRTempDeclaration);
  40573. $core.addMethod(
  40574. $core.method({
  40575. selector: "name:",
  40576. protocol: "accessing",
  40577. fn: function (aString){
  40578. var self=this,$self=this;
  40579. $self["@name"]=aString;
  40580. return self;
  40581. },
  40582. args: ["aString"],
  40583. source: "name: aString\x0a\x09name := aString",
  40584. referencedClasses: [],
  40585. messageSends: []
  40586. }),
  40587. $globals.IRTempDeclaration);
  40588. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40589. $globals.IRSend.comment="I am a message send instruction.";
  40590. $core.addMethod(
  40591. $core.method({
  40592. selector: "acceptDagVisitor:",
  40593. protocol: "visiting",
  40594. fn: function (aVisitor){
  40595. var self=this,$self=this;
  40596. return $core.withContext(function($ctx1) {
  40597. return $recv(aVisitor)._visitIRSend_(self);
  40598. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40599. },
  40600. args: ["aVisitor"],
  40601. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40602. referencedClasses: [],
  40603. messageSends: ["visitIRSend:"]
  40604. }),
  40605. $globals.IRSend);
  40606. $core.addMethod(
  40607. $core.method({
  40608. selector: "arguments",
  40609. protocol: "accessing",
  40610. fn: function (){
  40611. var self=this,$self=this;
  40612. return $core.withContext(function($ctx1) {
  40613. return $recv($self._dagChildren())._allButFirst();
  40614. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40615. },
  40616. args: [],
  40617. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40618. referencedClasses: [],
  40619. messageSends: ["allButFirst", "dagChildren"]
  40620. }),
  40621. $globals.IRSend);
  40622. $core.addMethod(
  40623. $core.method({
  40624. selector: "index",
  40625. protocol: "accessing",
  40626. fn: function (){
  40627. var self=this,$self=this;
  40628. return $self["@index"];
  40629. },
  40630. args: [],
  40631. source: "index\x0a\x09^ index",
  40632. referencedClasses: [],
  40633. messageSends: []
  40634. }),
  40635. $globals.IRSend);
  40636. $core.addMethod(
  40637. $core.method({
  40638. selector: "index:",
  40639. protocol: "accessing",
  40640. fn: function (anInteger){
  40641. var self=this,$self=this;
  40642. $self["@index"]=anInteger;
  40643. return self;
  40644. },
  40645. args: ["anInteger"],
  40646. source: "index: anInteger\x0a\x09index := anInteger",
  40647. referencedClasses: [],
  40648. messageSends: []
  40649. }),
  40650. $globals.IRSend);
  40651. $core.addMethod(
  40652. $core.method({
  40653. selector: "isSend",
  40654. protocol: "testing",
  40655. fn: function (){
  40656. var self=this,$self=this;
  40657. return true;
  40658. },
  40659. args: [],
  40660. source: "isSend\x0a\x09^ true",
  40661. referencedClasses: [],
  40662. messageSends: []
  40663. }),
  40664. $globals.IRSend);
  40665. $core.addMethod(
  40666. $core.method({
  40667. selector: "receiver",
  40668. protocol: "accessing",
  40669. fn: function (){
  40670. var self=this,$self=this;
  40671. return $core.withContext(function($ctx1) {
  40672. return $recv($self._dagChildren())._first();
  40673. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40674. },
  40675. args: [],
  40676. source: "receiver\x0a\x09^ self dagChildren first",
  40677. referencedClasses: [],
  40678. messageSends: ["first", "dagChildren"]
  40679. }),
  40680. $globals.IRSend);
  40681. $core.addMethod(
  40682. $core.method({
  40683. selector: "selector",
  40684. protocol: "accessing",
  40685. fn: function (){
  40686. var self=this,$self=this;
  40687. return $self["@selector"];
  40688. },
  40689. args: [],
  40690. source: "selector\x0a\x09^ selector",
  40691. referencedClasses: [],
  40692. messageSends: []
  40693. }),
  40694. $globals.IRSend);
  40695. $core.addMethod(
  40696. $core.method({
  40697. selector: "selector:",
  40698. protocol: "accessing",
  40699. fn: function (aString){
  40700. var self=this,$self=this;
  40701. $self["@selector"]=aString;
  40702. return self;
  40703. },
  40704. args: ["aString"],
  40705. source: "selector: aString\x0a\x09selector := aString",
  40706. referencedClasses: [],
  40707. messageSends: []
  40708. }),
  40709. $globals.IRSend);
  40710. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40711. $core.addMethod(
  40712. $core.method({
  40713. selector: "acceptDagVisitor:",
  40714. protocol: "visiting",
  40715. fn: function (aVisitor){
  40716. var self=this,$self=this;
  40717. return $core.withContext(function($ctx1) {
  40718. return $recv(aVisitor)._visitIRSequence_(self);
  40719. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40720. },
  40721. args: ["aVisitor"],
  40722. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40723. referencedClasses: [],
  40724. messageSends: ["visitIRSequence:"]
  40725. }),
  40726. $globals.IRSequence);
  40727. $core.addMethod(
  40728. $core.method({
  40729. selector: "isSequence",
  40730. protocol: "testing",
  40731. fn: function (){
  40732. var self=this,$self=this;
  40733. return true;
  40734. },
  40735. args: [],
  40736. source: "isSequence\x0a\x09^ true",
  40737. referencedClasses: [],
  40738. messageSends: []
  40739. }),
  40740. $globals.IRSequence);
  40741. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40742. $core.addMethod(
  40743. $core.method({
  40744. selector: "acceptDagVisitor:",
  40745. protocol: "visiting",
  40746. fn: function (aVisitor){
  40747. var self=this,$self=this;
  40748. return $core.withContext(function($ctx1) {
  40749. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40750. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40751. },
  40752. args: ["aVisitor"],
  40753. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40754. referencedClasses: [],
  40755. messageSends: ["visitIRBlockSequence:"]
  40756. }),
  40757. $globals.IRBlockSequence);
  40758. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40759. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40760. $core.addMethod(
  40761. $core.method({
  40762. selector: "acceptDagVisitor:",
  40763. protocol: "visiting",
  40764. fn: function (aVisitor){
  40765. var self=this,$self=this;
  40766. return $core.withContext(function($ctx1) {
  40767. return $recv(aVisitor)._visitIRValue_(self);
  40768. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40769. },
  40770. args: ["aVisitor"],
  40771. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40772. referencedClasses: [],
  40773. messageSends: ["visitIRValue:"]
  40774. }),
  40775. $globals.IRValue);
  40776. $core.addMethod(
  40777. $core.method({
  40778. selector: "needsBoxingAsReceiver",
  40779. protocol: "testing",
  40780. fn: function (){
  40781. var self=this,$self=this;
  40782. return false;
  40783. },
  40784. args: [],
  40785. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40786. referencedClasses: [],
  40787. messageSends: []
  40788. }),
  40789. $globals.IRValue);
  40790. $core.addMethod(
  40791. $core.method({
  40792. selector: "value",
  40793. protocol: "accessing",
  40794. fn: function (){
  40795. var self=this,$self=this;
  40796. return $self["@value"];
  40797. },
  40798. args: [],
  40799. source: "value\x0a\x09^ value",
  40800. referencedClasses: [],
  40801. messageSends: []
  40802. }),
  40803. $globals.IRValue);
  40804. $core.addMethod(
  40805. $core.method({
  40806. selector: "value:",
  40807. protocol: "accessing",
  40808. fn: function (aString){
  40809. var self=this,$self=this;
  40810. $self["@value"]=aString;
  40811. return self;
  40812. },
  40813. args: ["aString"],
  40814. source: "value: aString\x0a\x09value := aString",
  40815. referencedClasses: [],
  40816. messageSends: []
  40817. }),
  40818. $globals.IRValue);
  40819. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40820. $globals.IRVariable.comment="I am a variable instruction.";
  40821. $core.addMethod(
  40822. $core.method({
  40823. selector: "acceptDagVisitor:",
  40824. protocol: "visiting",
  40825. fn: function (aVisitor){
  40826. var self=this,$self=this;
  40827. return $core.withContext(function($ctx1) {
  40828. return $recv(aVisitor)._visitIRVariable_(self);
  40829. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40830. },
  40831. args: ["aVisitor"],
  40832. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40833. referencedClasses: [],
  40834. messageSends: ["visitIRVariable:"]
  40835. }),
  40836. $globals.IRVariable);
  40837. $core.addMethod(
  40838. $core.method({
  40839. selector: "isSelf",
  40840. protocol: "testing",
  40841. fn: function (){
  40842. var self=this,$self=this;
  40843. return $core.withContext(function($ctx1) {
  40844. return $recv($self._variable())._isSelf();
  40845. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40846. },
  40847. args: [],
  40848. source: "isSelf\x0a\x09^ self variable isSelf",
  40849. referencedClasses: [],
  40850. messageSends: ["isSelf", "variable"]
  40851. }),
  40852. $globals.IRVariable);
  40853. $core.addMethod(
  40854. $core.method({
  40855. selector: "isSuper",
  40856. protocol: "testing",
  40857. fn: function (){
  40858. var self=this,$self=this;
  40859. return $core.withContext(function($ctx1) {
  40860. return $recv($self._variable())._isSuper();
  40861. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40862. },
  40863. args: [],
  40864. source: "isSuper\x0a\x09^ self variable isSuper",
  40865. referencedClasses: [],
  40866. messageSends: ["isSuper", "variable"]
  40867. }),
  40868. $globals.IRVariable);
  40869. $core.addMethod(
  40870. $core.method({
  40871. selector: "isVariable",
  40872. protocol: "testing",
  40873. fn: function (){
  40874. var self=this,$self=this;
  40875. return true;
  40876. },
  40877. args: [],
  40878. source: "isVariable\x0a\x09^ true",
  40879. referencedClasses: [],
  40880. messageSends: []
  40881. }),
  40882. $globals.IRVariable);
  40883. $core.addMethod(
  40884. $core.method({
  40885. selector: "needsBoxingAsReceiver",
  40886. protocol: "testing",
  40887. fn: function (){
  40888. var self=this,$self=this;
  40889. return $core.withContext(function($ctx1) {
  40890. return $recv($recv($self._variable())._isPseudoVar())._not();
  40891. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40892. },
  40893. args: [],
  40894. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40895. referencedClasses: [],
  40896. messageSends: ["not", "isPseudoVar", "variable"]
  40897. }),
  40898. $globals.IRVariable);
  40899. $core.addMethod(
  40900. $core.method({
  40901. selector: "variable",
  40902. protocol: "accessing",
  40903. fn: function (){
  40904. var self=this,$self=this;
  40905. return $self["@variable"];
  40906. },
  40907. args: [],
  40908. source: "variable\x0a\x09^ variable",
  40909. referencedClasses: [],
  40910. messageSends: []
  40911. }),
  40912. $globals.IRVariable);
  40913. $core.addMethod(
  40914. $core.method({
  40915. selector: "variable:",
  40916. protocol: "accessing",
  40917. fn: function (aScopeVariable){
  40918. var self=this,$self=this;
  40919. $self["@variable"]=aScopeVariable;
  40920. return self;
  40921. },
  40922. args: ["aScopeVariable"],
  40923. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40924. referencedClasses: [],
  40925. messageSends: []
  40926. }),
  40927. $globals.IRVariable);
  40928. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40929. $core.addMethod(
  40930. $core.method({
  40931. selector: "acceptDagVisitor:",
  40932. protocol: "visiting",
  40933. fn: function (aVisitor){
  40934. var self=this,$self=this;
  40935. return $core.withContext(function($ctx1) {
  40936. return $recv(aVisitor)._visitIRVerbatim_(self);
  40937. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40938. },
  40939. args: ["aVisitor"],
  40940. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40941. referencedClasses: [],
  40942. messageSends: ["visitIRVerbatim:"]
  40943. }),
  40944. $globals.IRVerbatim);
  40945. $core.addMethod(
  40946. $core.method({
  40947. selector: "source",
  40948. protocol: "accessing",
  40949. fn: function (){
  40950. var self=this,$self=this;
  40951. return $self["@source"];
  40952. },
  40953. args: [],
  40954. source: "source\x0a\x09^ source",
  40955. referencedClasses: [],
  40956. messageSends: []
  40957. }),
  40958. $globals.IRVerbatim);
  40959. $core.addMethod(
  40960. $core.method({
  40961. selector: "source:",
  40962. protocol: "accessing",
  40963. fn: function (aString){
  40964. var self=this,$self=this;
  40965. $self["@source"]=aString;
  40966. return self;
  40967. },
  40968. args: ["aString"],
  40969. source: "source: aString\x0a\x09source := aString",
  40970. referencedClasses: [],
  40971. messageSends: []
  40972. }),
  40973. $globals.IRVerbatim);
  40974. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  40975. $core.addMethod(
  40976. $core.method({
  40977. selector: "visitDagNode:",
  40978. protocol: "visiting",
  40979. fn: function (aNode){
  40980. var self=this,$self=this;
  40981. return $core.withContext(function($ctx1) {
  40982. return $self._visitDagNodeVariantSimple_(aNode);
  40983. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  40984. },
  40985. args: ["aNode"],
  40986. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  40987. referencedClasses: [],
  40988. messageSends: ["visitDagNodeVariantSimple:"]
  40989. }),
  40990. $globals.IRVisitor);
  40991. $core.addMethod(
  40992. $core.method({
  40993. selector: "visitIRAssignment:",
  40994. protocol: "visiting",
  40995. fn: function (anIRAssignment){
  40996. var self=this,$self=this;
  40997. return $core.withContext(function($ctx1) {
  40998. return $self._visitDagNode_(anIRAssignment);
  40999. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  41000. },
  41001. args: ["anIRAssignment"],
  41002. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  41003. referencedClasses: [],
  41004. messageSends: ["visitDagNode:"]
  41005. }),
  41006. $globals.IRVisitor);
  41007. $core.addMethod(
  41008. $core.method({
  41009. selector: "visitIRBlockReturn:",
  41010. protocol: "visiting",
  41011. fn: function (anIRBlockReturn){
  41012. var self=this,$self=this;
  41013. return $core.withContext(function($ctx1) {
  41014. return $self._visitIRReturn_(anIRBlockReturn);
  41015. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  41016. },
  41017. args: ["anIRBlockReturn"],
  41018. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  41019. referencedClasses: [],
  41020. messageSends: ["visitIRReturn:"]
  41021. }),
  41022. $globals.IRVisitor);
  41023. $core.addMethod(
  41024. $core.method({
  41025. selector: "visitIRBlockSequence:",
  41026. protocol: "visiting",
  41027. fn: function (anIRBlockSequence){
  41028. var self=this,$self=this;
  41029. return $core.withContext(function($ctx1) {
  41030. return $self._visitIRSequence_(anIRBlockSequence);
  41031. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  41032. },
  41033. args: ["anIRBlockSequence"],
  41034. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  41035. referencedClasses: [],
  41036. messageSends: ["visitIRSequence:"]
  41037. }),
  41038. $globals.IRVisitor);
  41039. $core.addMethod(
  41040. $core.method({
  41041. selector: "visitIRClosure:",
  41042. protocol: "visiting",
  41043. fn: function (anIRClosure){
  41044. var self=this,$self=this;
  41045. return $core.withContext(function($ctx1) {
  41046. return $self._visitDagNode_(anIRClosure);
  41047. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  41048. },
  41049. args: ["anIRClosure"],
  41050. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  41051. referencedClasses: [],
  41052. messageSends: ["visitDagNode:"]
  41053. }),
  41054. $globals.IRVisitor);
  41055. $core.addMethod(
  41056. $core.method({
  41057. selector: "visitIRDynamicArray:",
  41058. protocol: "visiting",
  41059. fn: function (anIRDynamicArray){
  41060. var self=this,$self=this;
  41061. return $core.withContext(function($ctx1) {
  41062. return $self._visitDagNode_(anIRDynamicArray);
  41063. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  41064. },
  41065. args: ["anIRDynamicArray"],
  41066. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  41067. referencedClasses: [],
  41068. messageSends: ["visitDagNode:"]
  41069. }),
  41070. $globals.IRVisitor);
  41071. $core.addMethod(
  41072. $core.method({
  41073. selector: "visitIRDynamicDictionary:",
  41074. protocol: "visiting",
  41075. fn: function (anIRDynamicDictionary){
  41076. var self=this,$self=this;
  41077. return $core.withContext(function($ctx1) {
  41078. return $self._visitDagNode_(anIRDynamicDictionary);
  41079. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  41080. },
  41081. args: ["anIRDynamicDictionary"],
  41082. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  41083. referencedClasses: [],
  41084. messageSends: ["visitDagNode:"]
  41085. }),
  41086. $globals.IRVisitor);
  41087. $core.addMethod(
  41088. $core.method({
  41089. selector: "visitIRInlinedClosure:",
  41090. protocol: "visiting",
  41091. fn: function (anIRInlinedClosure){
  41092. var self=this,$self=this;
  41093. return $core.withContext(function($ctx1) {
  41094. return $self._visitIRClosure_(anIRInlinedClosure);
  41095. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  41096. },
  41097. args: ["anIRInlinedClosure"],
  41098. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  41099. referencedClasses: [],
  41100. messageSends: ["visitIRClosure:"]
  41101. }),
  41102. $globals.IRVisitor);
  41103. $core.addMethod(
  41104. $core.method({
  41105. selector: "visitIRInlinedSequence:",
  41106. protocol: "visiting",
  41107. fn: function (anIRInlinedSequence){
  41108. var self=this,$self=this;
  41109. return $core.withContext(function($ctx1) {
  41110. return $self._visitIRSequence_(anIRInlinedSequence);
  41111. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  41112. },
  41113. args: ["anIRInlinedSequence"],
  41114. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  41115. referencedClasses: [],
  41116. messageSends: ["visitIRSequence:"]
  41117. }),
  41118. $globals.IRVisitor);
  41119. $core.addMethod(
  41120. $core.method({
  41121. selector: "visitIRMethod:",
  41122. protocol: "visiting",
  41123. fn: function (anIRMethod){
  41124. var self=this,$self=this;
  41125. return $core.withContext(function($ctx1) {
  41126. return $self._visitDagNode_(anIRMethod);
  41127. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  41128. },
  41129. args: ["anIRMethod"],
  41130. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  41131. referencedClasses: [],
  41132. messageSends: ["visitDagNode:"]
  41133. }),
  41134. $globals.IRVisitor);
  41135. $core.addMethod(
  41136. $core.method({
  41137. selector: "visitIRNonLocalReturn:",
  41138. protocol: "visiting",
  41139. fn: function (anIRNonLocalReturn){
  41140. var self=this,$self=this;
  41141. return $core.withContext(function($ctx1) {
  41142. return $self._visitDagNode_(anIRNonLocalReturn);
  41143. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  41144. },
  41145. args: ["anIRNonLocalReturn"],
  41146. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  41147. referencedClasses: [],
  41148. messageSends: ["visitDagNode:"]
  41149. }),
  41150. $globals.IRVisitor);
  41151. $core.addMethod(
  41152. $core.method({
  41153. selector: "visitIRNonLocalReturnHandling:",
  41154. protocol: "visiting",
  41155. fn: function (anIRNonLocalReturnHandling){
  41156. var self=this,$self=this;
  41157. return $core.withContext(function($ctx1) {
  41158. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  41159. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  41160. },
  41161. args: ["anIRNonLocalReturnHandling"],
  41162. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  41163. referencedClasses: [],
  41164. messageSends: ["visitDagNode:"]
  41165. }),
  41166. $globals.IRVisitor);
  41167. $core.addMethod(
  41168. $core.method({
  41169. selector: "visitIRReturn:",
  41170. protocol: "visiting",
  41171. fn: function (anIRReturn){
  41172. var self=this,$self=this;
  41173. return $core.withContext(function($ctx1) {
  41174. return $self._visitDagNode_(anIRReturn);
  41175. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  41176. },
  41177. args: ["anIRReturn"],
  41178. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  41179. referencedClasses: [],
  41180. messageSends: ["visitDagNode:"]
  41181. }),
  41182. $globals.IRVisitor);
  41183. $core.addMethod(
  41184. $core.method({
  41185. selector: "visitIRSend:",
  41186. protocol: "visiting",
  41187. fn: function (anIRSend){
  41188. var self=this,$self=this;
  41189. return $core.withContext(function($ctx1) {
  41190. return $self._visitDagNode_(anIRSend);
  41191. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  41192. },
  41193. args: ["anIRSend"],
  41194. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  41195. referencedClasses: [],
  41196. messageSends: ["visitDagNode:"]
  41197. }),
  41198. $globals.IRVisitor);
  41199. $core.addMethod(
  41200. $core.method({
  41201. selector: "visitIRSequence:",
  41202. protocol: "visiting",
  41203. fn: function (anIRSequence){
  41204. var self=this,$self=this;
  41205. return $core.withContext(function($ctx1) {
  41206. return $self._visitDagNode_(anIRSequence);
  41207. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  41208. },
  41209. args: ["anIRSequence"],
  41210. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  41211. referencedClasses: [],
  41212. messageSends: ["visitDagNode:"]
  41213. }),
  41214. $globals.IRVisitor);
  41215. $core.addMethod(
  41216. $core.method({
  41217. selector: "visitIRTempDeclaration:",
  41218. protocol: "visiting",
  41219. fn: function (anIRTempDeclaration){
  41220. var self=this,$self=this;
  41221. return $core.withContext(function($ctx1) {
  41222. return $self._visitDagNode_(anIRTempDeclaration);
  41223. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  41224. },
  41225. args: ["anIRTempDeclaration"],
  41226. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  41227. referencedClasses: [],
  41228. messageSends: ["visitDagNode:"]
  41229. }),
  41230. $globals.IRVisitor);
  41231. $core.addMethod(
  41232. $core.method({
  41233. selector: "visitIRValue:",
  41234. protocol: "visiting",
  41235. fn: function (anIRValue){
  41236. var self=this,$self=this;
  41237. return $core.withContext(function($ctx1) {
  41238. return $self._visitDagNode_(anIRValue);
  41239. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  41240. },
  41241. args: ["anIRValue"],
  41242. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  41243. referencedClasses: [],
  41244. messageSends: ["visitDagNode:"]
  41245. }),
  41246. $globals.IRVisitor);
  41247. $core.addMethod(
  41248. $core.method({
  41249. selector: "visitIRVariable:",
  41250. protocol: "visiting",
  41251. fn: function (anIRVariable){
  41252. var self=this,$self=this;
  41253. return $core.withContext(function($ctx1) {
  41254. return $self._visitDagNode_(anIRVariable);
  41255. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  41256. },
  41257. args: ["anIRVariable"],
  41258. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  41259. referencedClasses: [],
  41260. messageSends: ["visitDagNode:"]
  41261. }),
  41262. $globals.IRVisitor);
  41263. $core.addMethod(
  41264. $core.method({
  41265. selector: "visitIRVerbatim:",
  41266. protocol: "visiting",
  41267. fn: function (anIRVerbatim){
  41268. var self=this,$self=this;
  41269. return $core.withContext(function($ctx1) {
  41270. return $self._visitDagNode_(anIRVerbatim);
  41271. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  41272. },
  41273. args: ["anIRVerbatim"],
  41274. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  41275. referencedClasses: [],
  41276. messageSends: ["visitDagNode:"]
  41277. }),
  41278. $globals.IRVisitor);
  41279. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  41280. $core.addMethod(
  41281. $core.method({
  41282. selector: "contents",
  41283. protocol: "accessing",
  41284. fn: function (){
  41285. var self=this,$self=this;
  41286. return $core.withContext(function($ctx1) {
  41287. return $recv($self._stream())._contents();
  41288. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  41289. },
  41290. args: [],
  41291. source: "contents\x0a\x09^ self stream contents",
  41292. referencedClasses: [],
  41293. messageSends: ["contents", "stream"]
  41294. }),
  41295. $globals.IRJSTranslator);
  41296. $core.addMethod(
  41297. $core.method({
  41298. selector: "currentClass",
  41299. protocol: "accessing",
  41300. fn: function (){
  41301. var self=this,$self=this;
  41302. return $self["@currentClass"];
  41303. },
  41304. args: [],
  41305. source: "currentClass\x0a\x09^ currentClass",
  41306. referencedClasses: [],
  41307. messageSends: []
  41308. }),
  41309. $globals.IRJSTranslator);
  41310. $core.addMethod(
  41311. $core.method({
  41312. selector: "currentClass:",
  41313. protocol: "accessing",
  41314. fn: function (aClass){
  41315. var self=this,$self=this;
  41316. $self["@currentClass"]=aClass;
  41317. return self;
  41318. },
  41319. args: ["aClass"],
  41320. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  41321. referencedClasses: [],
  41322. messageSends: []
  41323. }),
  41324. $globals.IRJSTranslator);
  41325. $core.addMethod(
  41326. $core.method({
  41327. selector: "initialize",
  41328. protocol: "initialization",
  41329. fn: function (){
  41330. var self=this,$self=this;
  41331. return $core.withContext(function($ctx1) {
  41332. (
  41333. $ctx1.supercall = true,
  41334. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41335. $ctx1.supercall = false;
  41336. $self["@stream"]=$recv($globals.JSStream)._new();
  41337. return self;
  41338. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  41339. },
  41340. args: [],
  41341. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  41342. referencedClasses: ["JSStream"],
  41343. messageSends: ["initialize", "new"]
  41344. }),
  41345. $globals.IRJSTranslator);
  41346. $core.addMethod(
  41347. $core.method({
  41348. selector: "stream",
  41349. protocol: "accessing",
  41350. fn: function (){
  41351. var self=this,$self=this;
  41352. return $self["@stream"];
  41353. },
  41354. args: [],
  41355. source: "stream\x0a\x09^ stream",
  41356. referencedClasses: [],
  41357. messageSends: []
  41358. }),
  41359. $globals.IRJSTranslator);
  41360. $core.addMethod(
  41361. $core.method({
  41362. selector: "stream:",
  41363. protocol: "accessing",
  41364. fn: function (aStream){
  41365. var self=this,$self=this;
  41366. $self["@stream"]=aStream;
  41367. return self;
  41368. },
  41369. args: ["aStream"],
  41370. source: "stream: aStream\x0a\x09stream := aStream",
  41371. referencedClasses: [],
  41372. messageSends: []
  41373. }),
  41374. $globals.IRJSTranslator);
  41375. $core.addMethod(
  41376. $core.method({
  41377. selector: "visitIRAssignment:",
  41378. protocol: "visiting",
  41379. fn: function (anIRAssignment){
  41380. var self=this,$self=this;
  41381. return $core.withContext(function($ctx1) {
  41382. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  41383. return $core.withContext(function($ctx2) {
  41384. return $self._visit_($recv(anIRAssignment)._left());
  41385. $ctx2.sendIdx["visit:"]=1;
  41386. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41387. }),(function(){
  41388. return $core.withContext(function($ctx2) {
  41389. return $self._visit_($recv(anIRAssignment)._right());
  41390. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41391. }));
  41392. return self;
  41393. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  41394. },
  41395. args: ["anIRAssignment"],
  41396. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  41397. referencedClasses: [],
  41398. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  41399. }),
  41400. $globals.IRJSTranslator);
  41401. $core.addMethod(
  41402. $core.method({
  41403. selector: "visitIRClosure:",
  41404. protocol: "visiting",
  41405. fn: function (anIRClosure){
  41406. var self=this,$self=this;
  41407. return $core.withContext(function($ctx1) {
  41408. var $1,$2;
  41409. $1=$self._stream();
  41410. $ctx1.sendIdx["stream"]=1;
  41411. $recv($1)._nextPutClosureWith_arguments_((function(){
  41412. return $core.withContext(function($ctx2) {
  41413. $2=$self._stream();
  41414. $ctx2.sendIdx["stream"]=2;
  41415. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  41416. return $core.withContext(function($ctx3) {
  41417. return $recv($recv(each)._name())._asVariableName();
  41418. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41419. })));
  41420. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  41421. return $core.withContext(function($ctx3) {
  41422. return (
  41423. $ctx3.supercall = true,
  41424. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  41425. $ctx3.supercall = false;
  41426. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  41427. }));
  41428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41429. }),$recv(anIRClosure)._arguments());
  41430. return self;
  41431. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  41432. },
  41433. args: ["anIRClosure"],
  41434. 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",
  41435. referencedClasses: [],
  41436. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  41437. }),
  41438. $globals.IRJSTranslator);
  41439. $core.addMethod(
  41440. $core.method({
  41441. selector: "visitIRDynamicArray:",
  41442. protocol: "visiting",
  41443. fn: function (anIRDynamicArray){
  41444. var self=this,$self=this;
  41445. return $core.withContext(function($ctx1) {
  41446. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  41447. return self;
  41448. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  41449. },
  41450. args: ["anIRDynamicArray"],
  41451. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  41452. referencedClasses: [],
  41453. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41454. }),
  41455. $globals.IRJSTranslator);
  41456. $core.addMethod(
  41457. $core.method({
  41458. selector: "visitIRDynamicDictionary:",
  41459. protocol: "visiting",
  41460. fn: function (anIRDynamicDictionary){
  41461. var self=this,$self=this;
  41462. return $core.withContext(function($ctx1) {
  41463. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  41464. return self;
  41465. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  41466. },
  41467. args: ["anIRDynamicDictionary"],
  41468. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  41469. referencedClasses: [],
  41470. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41471. }),
  41472. $globals.IRJSTranslator);
  41473. $core.addMethod(
  41474. $core.method({
  41475. selector: "visitIRMethod:",
  41476. protocol: "visiting",
  41477. fn: function (anIRMethod){
  41478. var self=this,$self=this;
  41479. return $core.withContext(function($ctx1) {
  41480. var $1,$2,$3,$4,$5,$6,$7;
  41481. $1=$self._stream();
  41482. $ctx1.sendIdx["stream"]=1;
  41483. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41484. return $core.withContext(function($ctx2) {
  41485. $2=$self._stream();
  41486. $ctx2.sendIdx["stream"]=2;
  41487. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41488. return $core.withContext(function($ctx3) {
  41489. $3=$self._stream();
  41490. $ctx3.sendIdx["stream"]=3;
  41491. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41492. return $core.withContext(function($ctx4) {
  41493. return $recv($recv(each)._name())._asVariableName();
  41494. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41495. }));
  41496. $ctx3.sendIdx["collect:"]=1;
  41497. $recv($3)._nextPutVars_($4);
  41498. $ctx3.sendIdx["nextPutVars:"]=1;
  41499. $5=$self._stream();
  41500. $ctx3.sendIdx["stream"]=4;
  41501. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41502. return $core.withContext(function($ctx4) {
  41503. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41504. return $core.withContext(function($ctx5) {
  41505. $6=$self._stream();
  41506. $ctx5.sendIdx["stream"]=5;
  41507. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41508. return $core.withContext(function($ctx6) {
  41509. return $recv($recv(each)._variable())._alias();
  41510. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41511. })));
  41512. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41513. }));
  41514. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41515. if($core.assert($7)){
  41516. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41517. return $core.withContext(function($ctx5) {
  41518. return (
  41519. $ctx5.supercall = true,
  41520. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41521. $ctx5.supercall = false;
  41522. $ctx5.sendIdx["visitIRMethod:"]=1;
  41523. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41524. }));
  41525. } else {
  41526. return (
  41527. $ctx4.supercall = true,
  41528. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41529. $ctx4.supercall = false;
  41530. }
  41531. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41532. }));
  41533. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41534. }),$recv(anIRMethod)._arguments());
  41535. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41536. }));
  41537. return $self._contents();
  41538. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41539. },
  41540. args: ["anIRMethod"],
  41541. 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",
  41542. referencedClasses: [],
  41543. 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"]
  41544. }),
  41545. $globals.IRJSTranslator);
  41546. $core.addMethod(
  41547. $core.method({
  41548. selector: "visitIRNonLocalReturn:",
  41549. protocol: "visiting",
  41550. fn: function (anIRNonLocalReturn){
  41551. var self=this,$self=this;
  41552. return $core.withContext(function($ctx1) {
  41553. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41554. return $core.withContext(function($ctx2) {
  41555. return (
  41556. $ctx2.supercall = true,
  41557. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41558. $ctx2.supercall = false;
  41559. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41560. }));
  41561. return self;
  41562. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41563. },
  41564. args: ["anIRNonLocalReturn"],
  41565. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41566. referencedClasses: [],
  41567. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41568. }),
  41569. $globals.IRJSTranslator);
  41570. $core.addMethod(
  41571. $core.method({
  41572. selector: "visitIRReturn:",
  41573. protocol: "visiting",
  41574. fn: function (anIRReturn){
  41575. var self=this,$self=this;
  41576. return $core.withContext(function($ctx1) {
  41577. $recv($self._stream())._nextPutReturnWith_((function(){
  41578. return $core.withContext(function($ctx2) {
  41579. return (
  41580. $ctx2.supercall = true,
  41581. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41582. $ctx2.supercall = false;
  41583. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41584. }));
  41585. return self;
  41586. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41587. },
  41588. args: ["anIRReturn"],
  41589. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41590. referencedClasses: [],
  41591. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41592. }),
  41593. $globals.IRJSTranslator);
  41594. $core.addMethod(
  41595. $core.method({
  41596. selector: "visitIRSend:",
  41597. protocol: "visiting",
  41598. fn: function (anIRSend){
  41599. var self=this,$self=this;
  41600. var sends,superclass;
  41601. return $core.withContext(function($ctx1) {
  41602. var $1,$2;
  41603. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41604. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41605. if($core.assert($1)){
  41606. $self._visitSuperSend_(anIRSend);
  41607. } else {
  41608. $self._visitSend_(anIRSend);
  41609. }
  41610. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41611. if($core.assert($2)){
  41612. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41613. }
  41614. return self;
  41615. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41616. },
  41617. args: ["anIRSend"],
  41618. 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 ]",
  41619. referencedClasses: [],
  41620. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41621. }),
  41622. $globals.IRJSTranslator);
  41623. $core.addMethod(
  41624. $core.method({
  41625. selector: "visitIRSequence:",
  41626. protocol: "visiting",
  41627. fn: function (anIRSequence){
  41628. var self=this,$self=this;
  41629. return $core.withContext(function($ctx1) {
  41630. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41631. return $core.withContext(function($ctx2) {
  41632. return $recv($self._stream())._nextPutStatementWith_((function(){
  41633. return $core.withContext(function($ctx3) {
  41634. return $self._visit_(each);
  41635. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41636. }));
  41637. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41638. }));
  41639. return self;
  41640. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41641. },
  41642. args: ["anIRSequence"],
  41643. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41644. referencedClasses: [],
  41645. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41646. }),
  41647. $globals.IRJSTranslator);
  41648. $core.addMethod(
  41649. $core.method({
  41650. selector: "visitIRTempDeclaration:",
  41651. protocol: "visiting",
  41652. fn: function (anIRTempDeclaration){
  41653. var self=this,$self=this;
  41654. return self;
  41655. },
  41656. args: ["anIRTempDeclaration"],
  41657. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41658. referencedClasses: [],
  41659. messageSends: []
  41660. }),
  41661. $globals.IRJSTranslator);
  41662. $core.addMethod(
  41663. $core.method({
  41664. selector: "visitIRValue:",
  41665. protocol: "visiting",
  41666. fn: function (anIRValue){
  41667. var self=this,$self=this;
  41668. return $core.withContext(function($ctx1) {
  41669. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41670. return self;
  41671. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41672. },
  41673. args: ["anIRValue"],
  41674. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41675. referencedClasses: [],
  41676. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41677. }),
  41678. $globals.IRJSTranslator);
  41679. $core.addMethod(
  41680. $core.method({
  41681. selector: "visitIRVariable:",
  41682. protocol: "visiting",
  41683. fn: function (anIRVariable){
  41684. var self=this,$self=this;
  41685. return $core.withContext(function($ctx1) {
  41686. var $3,$2,$1,$4;
  41687. $3=$recv(anIRVariable)._variable();
  41688. $ctx1.sendIdx["variable"]=1;
  41689. $2=$recv($3)._name();
  41690. $1=$recv($2).__eq("thisContext");
  41691. if($core.assert($1)){
  41692. $4=$self._stream();
  41693. $ctx1.sendIdx["stream"]=1;
  41694. $recv($4)._nextPutAll_("$core.getThisContext()");
  41695. $ctx1.sendIdx["nextPutAll:"]=1;
  41696. } else {
  41697. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41698. }
  41699. return self;
  41700. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41701. },
  41702. args: ["anIRVariable"],
  41703. 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 ]",
  41704. referencedClasses: [],
  41705. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41706. }),
  41707. $globals.IRJSTranslator);
  41708. $core.addMethod(
  41709. $core.method({
  41710. selector: "visitIRVerbatim:",
  41711. protocol: "visiting",
  41712. fn: function (anIRVerbatim){
  41713. var self=this,$self=this;
  41714. return $core.withContext(function($ctx1) {
  41715. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41716. return self;
  41717. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41718. },
  41719. args: ["anIRVerbatim"],
  41720. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  41721. referencedClasses: [],
  41722. messageSends: ["nextPutAll:", "stream", "source"]
  41723. }),
  41724. $globals.IRJSTranslator);
  41725. $core.addMethod(
  41726. $core.method({
  41727. selector: "visitInstructionList:enclosedBetween:and:",
  41728. protocol: "visiting",
  41729. fn: function (anArray,aString,anotherString){
  41730. var self=this,$self=this;
  41731. return $core.withContext(function($ctx1) {
  41732. var $1;
  41733. $1=$self._stream();
  41734. $ctx1.sendIdx["stream"]=1;
  41735. $recv($1)._nextPutAll_(aString);
  41736. $ctx1.sendIdx["nextPutAll:"]=1;
  41737. $recv(anArray)._do_separatedBy_((function(each){
  41738. return $core.withContext(function($ctx2) {
  41739. return $self._visit_(each);
  41740. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41741. }),(function(){
  41742. return $core.withContext(function($ctx2) {
  41743. return $recv($self._stream())._nextPutAll_(",");
  41744. $ctx2.sendIdx["nextPutAll:"]=2;
  41745. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41746. }));
  41747. $recv($self["@stream"])._nextPutAll_(anotherString);
  41748. return self;
  41749. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41750. },
  41751. args: ["anArray", "aString", "anotherString"],
  41752. 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",
  41753. referencedClasses: [],
  41754. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41755. }),
  41756. $globals.IRJSTranslator);
  41757. $core.addMethod(
  41758. $core.method({
  41759. selector: "visitReceiver:",
  41760. protocol: "visiting",
  41761. fn: function (anIRInstruction){
  41762. var self=this,$self=this;
  41763. var instr;
  41764. return $core.withContext(function($ctx1) {
  41765. var $1,$2,$4,$5,$3,$6,$7,$8;
  41766. $1=$recv(anIRInstruction)._isSelf();
  41767. if($core.assert($1)){
  41768. $2=$recv(anIRInstruction)._copy();
  41769. $ctx1.sendIdx["copy"]=1;
  41770. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41771. $recv($4)._name_("$self");
  41772. $5=$recv($4)._yourself();
  41773. $ctx1.sendIdx["yourself"]=1;
  41774. $3=$5;
  41775. $recv($2)._variable_($3);
  41776. instr=$recv($2)._yourself();
  41777. instr;
  41778. } else {
  41779. instr=anIRInstruction;
  41780. instr;
  41781. }
  41782. $6=$recv(instr)._needsBoxingAsReceiver();
  41783. if(!$core.assert($6)){
  41784. $7=$self._visit_(instr);
  41785. $ctx1.sendIdx["visit:"]=1;
  41786. return $7;
  41787. }
  41788. $8=$self._stream();
  41789. $ctx1.sendIdx["stream"]=1;
  41790. $recv($8)._nextPutAll_("$recv(");
  41791. $ctx1.sendIdx["nextPutAll:"]=1;
  41792. $self._visit_(instr);
  41793. $recv($self._stream())._nextPutAll_(")");
  41794. return self;
  41795. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41796. },
  41797. args: ["anIRInstruction"],
  41798. 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: ')'",
  41799. referencedClasses: [],
  41800. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41801. }),
  41802. $globals.IRJSTranslator);
  41803. $core.addMethod(
  41804. $core.method({
  41805. selector: "visitSend:",
  41806. protocol: "visiting",
  41807. fn: function (anIRSend){
  41808. var self=this,$self=this;
  41809. return $core.withContext(function($ctx1) {
  41810. $self._visitReceiver_($recv(anIRSend)._receiver());
  41811. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41812. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41813. return self;
  41814. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41815. },
  41816. args: ["anIRSend"],
  41817. 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: ')'",
  41818. referencedClasses: [],
  41819. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41820. }),
  41821. $globals.IRJSTranslator);
  41822. $core.addMethod(
  41823. $core.method({
  41824. selector: "visitSuperSend:",
  41825. protocol: "visiting",
  41826. fn: function (anIRSend){
  41827. var self=this,$self=this;
  41828. return $core.withContext(function($ctx1) {
  41829. var $1,$4,$3,$2,$5,$6,$7,$8;
  41830. $1=$self._stream();
  41831. $ctx1.sendIdx["stream"]=1;
  41832. $recv($1)._nextPutAll_("(");
  41833. $ctx1.sendIdx["nextPutAll:"]=1;
  41834. $recv($1)._lf();
  41835. $ctx1.sendIdx["lf"]=1;
  41836. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41837. $ctx1.sendIdx["nextPutAll:"]=2;
  41838. $recv($1)._lf();
  41839. $ctx1.sendIdx["lf"]=2;
  41840. $4=$recv(anIRSend)._scope();
  41841. $ctx1.sendIdx["scope"]=1;
  41842. $3=$recv($4)._alias();
  41843. $ctx1.sendIdx["alias"]=1;
  41844. $2=$recv($3).__comma(".supercall = true,");
  41845. $ctx1.sendIdx[","]=1;
  41846. $recv($1)._nextPutAll_($2);
  41847. $ctx1.sendIdx["nextPutAll:"]=3;
  41848. $recv($1)._lf();
  41849. $ctx1.sendIdx["lf"]=3;
  41850. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41851. $ctx1.sendIdx["nextPutAll:"]=4;
  41852. $recv($1)._lf();
  41853. $ctx1.sendIdx["lf"]=4;
  41854. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41855. $ctx1.sendIdx[","]=2;
  41856. $recv($1)._nextPutAll_($5);
  41857. $ctx1.sendIdx["nextPutAll:"]=5;
  41858. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41859. $ctx1.sendIdx["nextPutAll:"]=6;
  41860. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41861. $ctx1.sendIdx[","]=3;
  41862. $recv($1)._nextPutAll_($6);
  41863. $ctx1.sendIdx["nextPutAll:"]=7;
  41864. $7=$recv($1)._nextPutAll_("$self, ");
  41865. $ctx1.sendIdx["nextPutAll:"]=8;
  41866. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41867. $8=$self._stream();
  41868. $recv($8)._nextPutAll_("));");
  41869. $ctx1.sendIdx["nextPutAll:"]=9;
  41870. $recv($8)._lf();
  41871. $ctx1.sendIdx["lf"]=5;
  41872. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41873. $ctx1.sendIdx["nextPutAll:"]=10;
  41874. $recv($8)._lf();
  41875. $ctx1.sendIdx["lf"]=6;
  41876. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41877. $ctx1.sendIdx["nextPutAll:"]=11;
  41878. $recv($8)._lf();
  41879. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41880. return self;
  41881. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41882. },
  41883. args: ["anIRSend"],
  41884. 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);'",
  41885. referencedClasses: [],
  41886. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41887. }),
  41888. $globals.IRJSTranslator);
  41889. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41890. $core.addMethod(
  41891. $core.method({
  41892. selector: "contents",
  41893. protocol: "accessing",
  41894. fn: function (){
  41895. var self=this,$self=this;
  41896. return $core.withContext(function($ctx1) {
  41897. return $recv($self["@stream"])._contents();
  41898. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41899. },
  41900. args: [],
  41901. source: "contents\x0a\x09^ stream contents",
  41902. referencedClasses: [],
  41903. messageSends: ["contents"]
  41904. }),
  41905. $globals.JSStream);
  41906. $core.addMethod(
  41907. $core.method({
  41908. selector: "initialize",
  41909. protocol: "initialization",
  41910. fn: function (){
  41911. var self=this,$self=this;
  41912. return $core.withContext(function($ctx1) {
  41913. (
  41914. $ctx1.supercall = true,
  41915. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41916. $ctx1.supercall = false;
  41917. $self["@stream"]=""._writeStream();
  41918. return self;
  41919. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41920. },
  41921. args: [],
  41922. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41923. referencedClasses: [],
  41924. messageSends: ["initialize", "writeStream"]
  41925. }),
  41926. $globals.JSStream);
  41927. $core.addMethod(
  41928. $core.method({
  41929. selector: "lf",
  41930. protocol: "streaming",
  41931. fn: function (){
  41932. var self=this,$self=this;
  41933. return $core.withContext(function($ctx1) {
  41934. $recv($self["@stream"])._lf();
  41935. return self;
  41936. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41937. },
  41938. args: [],
  41939. source: "lf\x0a\x09stream lf",
  41940. referencedClasses: [],
  41941. messageSends: ["lf"]
  41942. }),
  41943. $globals.JSStream);
  41944. $core.addMethod(
  41945. $core.method({
  41946. selector: "nextPut:",
  41947. protocol: "streaming",
  41948. fn: function (aString){
  41949. var self=this,$self=this;
  41950. return $core.withContext(function($ctx1) {
  41951. $recv($self["@stream"])._nextPut_(aString);
  41952. return self;
  41953. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41954. },
  41955. args: ["aString"],
  41956. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41957. referencedClasses: [],
  41958. messageSends: ["nextPut:"]
  41959. }),
  41960. $globals.JSStream);
  41961. $core.addMethod(
  41962. $core.method({
  41963. selector: "nextPutAll:",
  41964. protocol: "streaming",
  41965. fn: function (aString){
  41966. var self=this,$self=this;
  41967. return $core.withContext(function($ctx1) {
  41968. $recv($self["@stream"])._nextPutAll_(aString);
  41969. return self;
  41970. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  41971. },
  41972. args: ["aString"],
  41973. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  41974. referencedClasses: [],
  41975. messageSends: ["nextPutAll:"]
  41976. }),
  41977. $globals.JSStream);
  41978. $core.addMethod(
  41979. $core.method({
  41980. selector: "nextPutAssignLhs:rhs:",
  41981. protocol: "streaming",
  41982. fn: function (aBlock,anotherBlock){
  41983. var self=this,$self=this;
  41984. return $core.withContext(function($ctx1) {
  41985. $recv(aBlock)._value();
  41986. $ctx1.sendIdx["value"]=1;
  41987. $recv($self["@stream"])._nextPutAll_("=");
  41988. $recv(anotherBlock)._value();
  41989. return self;
  41990. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  41991. },
  41992. args: ["aBlock", "anotherBlock"],
  41993. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  41994. referencedClasses: [],
  41995. messageSends: ["value", "nextPutAll:"]
  41996. }),
  41997. $globals.JSStream);
  41998. $core.addMethod(
  41999. $core.method({
  42000. selector: "nextPutBlockContextFor:during:",
  42001. protocol: "streaming",
  42002. fn: function (anIRClosure,aBlock){
  42003. var self=this,$self=this;
  42004. return $core.withContext(function($ctx1) {
  42005. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  42006. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  42007. if(!$core.assert($1)){
  42008. $2=$recv(aBlock)._value();
  42009. $ctx1.sendIdx["value"]=1;
  42010. return $2;
  42011. }
  42012. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42013. $ctx1.sendIdx["nextPutAll:"]=1;
  42014. $self._lf();
  42015. $ctx1.sendIdx["lf"]=1;
  42016. $6=$recv(anIRClosure)._scope();
  42017. $ctx1.sendIdx["scope"]=1;
  42018. $5=$recv($6)._alias();
  42019. $ctx1.sendIdx["alias"]=1;
  42020. $4="return $core.withContext(function(".__comma($5);
  42021. $ctx1.sendIdx[","]=2;
  42022. $3=$recv($4).__comma(") {");
  42023. $ctx1.sendIdx[","]=1;
  42024. $self._nextPutAll_($3);
  42025. $ctx1.sendIdx["nextPutAll:"]=2;
  42026. $self._lf();
  42027. $ctx1.sendIdx["lf"]=2;
  42028. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42029. $ctx1.sendIdx["nextPutAll:"]=3;
  42030. $7=$self._lf();
  42031. $ctx1.sendIdx["lf"]=3;
  42032. $recv(aBlock)._value();
  42033. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42034. $ctx1.sendIdx["nextPutAll:"]=4;
  42035. $self._lf();
  42036. $ctx1.sendIdx["lf"]=4;
  42037. $11=$recv(anIRClosure)._scope();
  42038. $ctx1.sendIdx["scope"]=2;
  42039. $10=$recv($11)._alias();
  42040. $ctx1.sendIdx["alias"]=2;
  42041. $9="}, function(".__comma($10);
  42042. $ctx1.sendIdx[","]=4;
  42043. $8=$recv($9).__comma(") {");
  42044. $ctx1.sendIdx[","]=3;
  42045. $self._nextPutAll_($8);
  42046. $ctx1.sendIdx["nextPutAll:"]=5;
  42047. $15=$recv(anIRClosure)._scope();
  42048. $ctx1.sendIdx["scope"]=3;
  42049. $14=$recv($15)._alias();
  42050. $ctx1.sendIdx["alias"]=3;
  42051. $13=$recv($14).__comma(".fillBlock({");
  42052. $ctx1.sendIdx[","]=5;
  42053. $12=$self._nextPutAll_($13);
  42054. $ctx1.sendIdx["nextPutAll:"]=6;
  42055. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  42056. return $core.withContext(function($ctx2) {
  42057. $16=$recv(each)._asVariableName();
  42058. $ctx2.sendIdx["asVariableName"]=1;
  42059. $self._nextPutAll_($16);
  42060. $ctx2.sendIdx["nextPutAll:"]=7;
  42061. $self._nextPutAll_(":");
  42062. $ctx2.sendIdx["nextPutAll:"]=8;
  42063. $17=$self._nextPutAll_($recv(each)._asVariableName());
  42064. $ctx2.sendIdx["nextPutAll:"]=9;
  42065. return $17;
  42066. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42067. }),(function(){
  42068. return $core.withContext(function($ctx2) {
  42069. return $self._nextPutAll_(",");
  42070. $ctx2.sendIdx["nextPutAll:"]=10;
  42071. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42072. }));
  42073. $self._nextPutAll_("},");
  42074. $ctx1.sendIdx["nextPutAll:"]=11;
  42075. $23=$recv(anIRClosure)._scope();
  42076. $ctx1.sendIdx["scope"]=4;
  42077. $22=$recv($23)._outerScope();
  42078. $21=$recv($22)._alias();
  42079. $20=$recv($21).__comma(",");
  42080. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  42081. $ctx1.sendIdx[","]=7;
  42082. $18=$recv($19).__comma(")});");
  42083. $ctx1.sendIdx[","]=6;
  42084. $self._nextPutAll_($18);
  42085. $ctx1.sendIdx["nextPutAll:"]=12;
  42086. $self._lf();
  42087. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42088. return self;
  42089. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  42090. },
  42091. args: ["anIRClosure", "aBlock"],
  42092. 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);'",
  42093. referencedClasses: [],
  42094. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  42095. }),
  42096. $globals.JSStream);
  42097. $core.addMethod(
  42098. $core.method({
  42099. selector: "nextPutClosureWith:arguments:",
  42100. protocol: "streaming",
  42101. fn: function (aBlock,anArray){
  42102. var self=this,$self=this;
  42103. return $core.withContext(function($ctx1) {
  42104. var $1,$2,$3;
  42105. $recv($self["@stream"])._nextPutAll_("(function(");
  42106. $ctx1.sendIdx["nextPutAll:"]=1;
  42107. $recv(anArray)._do_separatedBy_((function(each){
  42108. return $core.withContext(function($ctx2) {
  42109. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42110. $ctx2.sendIdx["nextPutAll:"]=2;
  42111. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42112. }),(function(){
  42113. return $core.withContext(function($ctx2) {
  42114. return $recv($self["@stream"])._nextPut_(",");
  42115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42116. }));
  42117. $1=$self["@stream"];
  42118. $recv($1)._nextPutAll_("){");
  42119. $ctx1.sendIdx["nextPutAll:"]=3;
  42120. $2=$recv($1)._lf();
  42121. $ctx1.sendIdx["lf"]=1;
  42122. $recv(aBlock)._value();
  42123. $3=$self["@stream"];
  42124. $recv($3)._lf();
  42125. $recv($3)._nextPutAll_("})");
  42126. return self;
  42127. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42128. },
  42129. args: ["aBlock", "anArray"],
  42130. 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: '})'",
  42131. referencedClasses: [],
  42132. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42133. }),
  42134. $globals.JSStream);
  42135. $core.addMethod(
  42136. $core.method({
  42137. selector: "nextPutContextFor:during:",
  42138. protocol: "streaming",
  42139. fn: function (aMethod,aBlock){
  42140. var self=this,$self=this;
  42141. return $core.withContext(function($ctx1) {
  42142. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  42143. $1=$recv(aMethod)._requiresSmalltalkContext();
  42144. if(!$core.assert($1)){
  42145. $2=$recv(aBlock)._value();
  42146. $ctx1.sendIdx["value"]=1;
  42147. return $2;
  42148. }
  42149. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42150. $ctx1.sendIdx["nextPutAll:"]=1;
  42151. $self._lf();
  42152. $ctx1.sendIdx["lf"]=1;
  42153. $6=$recv(aMethod)._scope();
  42154. $ctx1.sendIdx["scope"]=1;
  42155. $5=$recv($6)._alias();
  42156. $ctx1.sendIdx["alias"]=1;
  42157. $4="return $core.withContext(function(".__comma($5);
  42158. $ctx1.sendIdx[","]=2;
  42159. $3=$recv($4).__comma(") {");
  42160. $ctx1.sendIdx[","]=1;
  42161. $self._nextPutAll_($3);
  42162. $ctx1.sendIdx["nextPutAll:"]=2;
  42163. $self._lf();
  42164. $ctx1.sendIdx["lf"]=2;
  42165. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42166. $ctx1.sendIdx["nextPutAll:"]=3;
  42167. $7=$self._lf();
  42168. $ctx1.sendIdx["lf"]=3;
  42169. $recv(aBlock)._value();
  42170. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42171. $ctx1.sendIdx["nextPutAll:"]=4;
  42172. $self._lf();
  42173. $ctx1.sendIdx["lf"]=4;
  42174. $12=$recv(aMethod)._scope();
  42175. $ctx1.sendIdx["scope"]=2;
  42176. $11=$recv($12)._alias();
  42177. $ctx1.sendIdx["alias"]=2;
  42178. $10="}, function(".__comma($11);
  42179. $ctx1.sendIdx[","]=5;
  42180. $9=$recv($10).__comma(") {");
  42181. $ctx1.sendIdx[","]=4;
  42182. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  42183. $ctx1.sendIdx[","]=3;
  42184. $self._nextPutAll_($8);
  42185. $ctx1.sendIdx["nextPutAll:"]=5;
  42186. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42187. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42188. $15=".fill(self,".__comma($16);
  42189. $14=$recv($15).__comma(",{");
  42190. $ctx1.sendIdx[","]=6;
  42191. $13=$self._nextPutAll_($14);
  42192. $ctx1.sendIdx["nextPutAll:"]=6;
  42193. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  42194. return $core.withContext(function($ctx2) {
  42195. $17=$recv(each)._asVariableName();
  42196. $ctx2.sendIdx["asVariableName"]=1;
  42197. $self._nextPutAll_($17);
  42198. $ctx2.sendIdx["nextPutAll:"]=7;
  42199. $self._nextPutAll_(":");
  42200. $ctx2.sendIdx["nextPutAll:"]=8;
  42201. $18=$self._nextPutAll_($recv(each)._asVariableName());
  42202. $ctx2.sendIdx["nextPutAll:"]=9;
  42203. return $18;
  42204. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42205. }),(function(){
  42206. return $core.withContext(function($ctx2) {
  42207. return $self._nextPutAll_(",");
  42208. $ctx2.sendIdx["nextPutAll:"]=10;
  42209. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42210. }));
  42211. $self._nextPutAll_("},");
  42212. $ctx1.sendIdx["nextPutAll:"]=11;
  42213. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  42214. $ctx1.sendIdx["nextPutAll:"]=12;
  42215. $self._nextPutAll_(")});");
  42216. $ctx1.sendIdx["nextPutAll:"]=13;
  42217. $self._lf();
  42218. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42219. return self;
  42220. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42221. },
  42222. args: ["aMethod", "aBlock"],
  42223. 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);'",
  42224. referencedClasses: [],
  42225. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  42226. }),
  42227. $globals.JSStream);
  42228. $core.addMethod(
  42229. $core.method({
  42230. selector: "nextPutFunctionWith:arguments:",
  42231. protocol: "streaming",
  42232. fn: function (aBlock,anArray){
  42233. var self=this,$self=this;
  42234. return $core.withContext(function($ctx1) {
  42235. var $1,$2,$3,$4,$5;
  42236. $recv($self["@stream"])._nextPutAll_("fn: function (");
  42237. $ctx1.sendIdx["nextPutAll:"]=1;
  42238. $recv(anArray)._do_separatedBy_((function(each){
  42239. return $core.withContext(function($ctx2) {
  42240. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42241. $ctx2.sendIdx["nextPutAll:"]=2;
  42242. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42243. }),(function(){
  42244. return $core.withContext(function($ctx2) {
  42245. return $recv($self["@stream"])._nextPut_(",");
  42246. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42247. }));
  42248. $1=$self["@stream"];
  42249. $recv($1)._nextPutAll_("){");
  42250. $ctx1.sendIdx["nextPutAll:"]=3;
  42251. $2=$recv($1)._lf();
  42252. $ctx1.sendIdx["lf"]=1;
  42253. $3=$self["@stream"];
  42254. $recv($3)._nextPutAll_("var self=this,$self=this;");
  42255. $ctx1.sendIdx["nextPutAll:"]=4;
  42256. $4=$recv($3)._lf();
  42257. $ctx1.sendIdx["lf"]=2;
  42258. $recv(aBlock)._value();
  42259. $5=$self["@stream"];
  42260. $recv($5)._lf();
  42261. $recv($5)._nextPutAll_("}");
  42262. return self;
  42263. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42264. },
  42265. args: ["aBlock", "anArray"],
  42266. 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: '}'",
  42267. referencedClasses: [],
  42268. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42269. }),
  42270. $globals.JSStream);
  42271. $core.addMethod(
  42272. $core.method({
  42273. selector: "nextPutIf:then:",
  42274. protocol: "streaming",
  42275. fn: function (aBlock,anotherBlock){
  42276. var self=this,$self=this;
  42277. return $core.withContext(function($ctx1) {
  42278. var $1;
  42279. $recv($self["@stream"])._nextPutAll_("if(");
  42280. $ctx1.sendIdx["nextPutAll:"]=1;
  42281. $recv(aBlock)._value();
  42282. $ctx1.sendIdx["value"]=1;
  42283. $1=$self["@stream"];
  42284. $recv($1)._nextPutAll_("){");
  42285. $ctx1.sendIdx["nextPutAll:"]=2;
  42286. $recv($1)._lf();
  42287. $recv(anotherBlock)._value();
  42288. $recv($self["@stream"])._nextPutAll_("}");
  42289. $self._omitSemicolon_(true);
  42290. return self;
  42291. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42292. },
  42293. args: ["aBlock", "anotherBlock"],
  42294. 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",
  42295. referencedClasses: [],
  42296. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42297. }),
  42298. $globals.JSStream);
  42299. $core.addMethod(
  42300. $core.method({
  42301. selector: "nextPutIf:then:else:",
  42302. protocol: "streaming",
  42303. fn: function (aBlock,ifBlock,elseBlock){
  42304. var self=this,$self=this;
  42305. return $core.withContext(function($ctx1) {
  42306. var $1,$2,$3;
  42307. $recv($self["@stream"])._nextPutAll_("if(");
  42308. $ctx1.sendIdx["nextPutAll:"]=1;
  42309. $recv(aBlock)._value();
  42310. $ctx1.sendIdx["value"]=1;
  42311. $1=$self["@stream"];
  42312. $recv($1)._nextPutAll_("){");
  42313. $ctx1.sendIdx["nextPutAll:"]=2;
  42314. $2=$recv($1)._lf();
  42315. $ctx1.sendIdx["lf"]=1;
  42316. $recv(ifBlock)._value();
  42317. $ctx1.sendIdx["value"]=2;
  42318. $3=$self["@stream"];
  42319. $recv($3)._nextPutAll_("} else {");
  42320. $ctx1.sendIdx["nextPutAll:"]=3;
  42321. $recv($3)._lf();
  42322. $recv(elseBlock)._value();
  42323. $recv($self["@stream"])._nextPutAll_("}");
  42324. $self._omitSemicolon_(true);
  42325. return self;
  42326. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  42327. },
  42328. args: ["aBlock", "ifBlock", "elseBlock"],
  42329. 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",
  42330. referencedClasses: [],
  42331. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42332. }),
  42333. $globals.JSStream);
  42334. $core.addMethod(
  42335. $core.method({
  42336. selector: "nextPutMethodDeclaration:with:",
  42337. protocol: "streaming",
  42338. fn: function (aMethod,aBlock){
  42339. var self=this,$self=this;
  42340. return $core.withContext(function($ctx1) {
  42341. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  42342. $1=$self["@stream"];
  42343. $recv($1)._nextPutAll_("$core.method({");
  42344. $ctx1.sendIdx["nextPutAll:"]=1;
  42345. $recv($1)._lf();
  42346. $ctx1.sendIdx["lf"]=1;
  42347. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42348. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42349. $3="selector: ".__comma($4);
  42350. $ctx1.sendIdx[","]=2;
  42351. $2=$recv($3).__comma(",");
  42352. $ctx1.sendIdx[","]=1;
  42353. $recv($1)._nextPutAll_($2);
  42354. $ctx1.sendIdx["nextPutAll:"]=2;
  42355. $recv($1)._lf();
  42356. $ctx1.sendIdx["lf"]=2;
  42357. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  42358. $ctx1.sendIdx["asJavaScriptSource"]=2;
  42359. $6="source: ".__comma($7);
  42360. $ctx1.sendIdx[","]=4;
  42361. $5=$recv($6).__comma(",");
  42362. $ctx1.sendIdx[","]=3;
  42363. $recv($1)._nextPutAll_($5);
  42364. $ctx1.sendIdx["nextPutAll:"]=3;
  42365. $8=$recv($1)._lf();
  42366. $ctx1.sendIdx["lf"]=3;
  42367. $recv(aBlock)._value();
  42368. $ctx1.sendIdx["value"]=1;
  42369. $9=$self["@stream"];
  42370. $12=$recv($globals.String)._lf();
  42371. $ctx1.sendIdx["lf"]=4;
  42372. $11=",".__comma($12);
  42373. $ctx1.sendIdx[","]=6;
  42374. $10=$recv($11).__comma("messageSends: ");
  42375. $ctx1.sendIdx[","]=5;
  42376. $recv($9)._nextPutAll_($10);
  42377. $ctx1.sendIdx["nextPutAll:"]=4;
  42378. $15=$recv($recv(aMethod)._messageSends())._asArray();
  42379. $ctx1.sendIdx["asArray"]=1;
  42380. $14=$recv($15)._asJavaScriptSource();
  42381. $ctx1.sendIdx["asJavaScriptSource"]=3;
  42382. $13=$recv($14).__comma(",");
  42383. $ctx1.sendIdx[","]=7;
  42384. $recv($9)._nextPutAll_($13);
  42385. $ctx1.sendIdx["nextPutAll:"]=5;
  42386. $recv($9)._lf();
  42387. $ctx1.sendIdx["lf"]=5;
  42388. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  42389. return $core.withContext(function($ctx2) {
  42390. return $recv(each)._value();
  42391. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42392. })))._asArray())._asJavaScriptSource();
  42393. $ctx1.sendIdx["asJavaScriptSource"]=4;
  42394. $17="args: ".__comma($18);
  42395. $16=$recv($17).__comma(",");
  42396. $ctx1.sendIdx[","]=8;
  42397. $recv($9)._nextPutAll_($16);
  42398. $ctx1.sendIdx["nextPutAll:"]=6;
  42399. $recv($9)._lf();
  42400. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  42401. $ctx1.sendIdx["nextPutAll:"]=7;
  42402. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  42403. return $core.withContext(function($ctx2) {
  42404. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  42405. $ctx2.sendIdx["nextPutAll:"]=8;
  42406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42407. }),(function(){
  42408. return $core.withContext(function($ctx2) {
  42409. return $recv($self["@stream"])._nextPutAll_(",");
  42410. $ctx2.sendIdx["nextPutAll:"]=9;
  42411. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42412. }));
  42413. $20=$self["@stream"];
  42414. $recv($20)._nextPutAll_("]");
  42415. $ctx1.sendIdx["nextPutAll:"]=10;
  42416. $recv($20)._nextPutAll_("})");
  42417. return self;
  42418. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42419. },
  42420. args: ["aMethod", "aBlock"],
  42421. 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: '})'",
  42422. referencedClasses: ["String"],
  42423. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  42424. }),
  42425. $globals.JSStream);
  42426. $core.addMethod(
  42427. $core.method({
  42428. selector: "nextPutNonLocalReturnHandlingWith:",
  42429. protocol: "streaming",
  42430. fn: function (aBlock){
  42431. var self=this,$self=this;
  42432. return $core.withContext(function($ctx1) {
  42433. var $1,$2,$3;
  42434. $1=$self["@stream"];
  42435. $recv($1)._nextPutAll_("var $early={};");
  42436. $ctx1.sendIdx["nextPutAll:"]=1;
  42437. $recv($1)._lf();
  42438. $ctx1.sendIdx["lf"]=1;
  42439. $recv($1)._nextPutAll_("try {");
  42440. $ctx1.sendIdx["nextPutAll:"]=2;
  42441. $2=$recv($1)._lf();
  42442. $ctx1.sendIdx["lf"]=2;
  42443. $recv(aBlock)._value();
  42444. $3=$self["@stream"];
  42445. $recv($3)._nextPutAll_("}");
  42446. $ctx1.sendIdx["nextPutAll:"]=3;
  42447. $recv($3)._lf();
  42448. $ctx1.sendIdx["lf"]=3;
  42449. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  42450. $recv($3)._lf();
  42451. return self;
  42452. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  42453. },
  42454. args: ["aBlock"],
  42455. 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",
  42456. referencedClasses: [],
  42457. messageSends: ["nextPutAll:", "lf", "value"]
  42458. }),
  42459. $globals.JSStream);
  42460. $core.addMethod(
  42461. $core.method({
  42462. selector: "nextPutNonLocalReturnWith:",
  42463. protocol: "streaming",
  42464. fn: function (aBlock){
  42465. var self=this,$self=this;
  42466. return $core.withContext(function($ctx1) {
  42467. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  42468. $ctx1.sendIdx["nextPutAll:"]=1;
  42469. $recv(aBlock)._value();
  42470. $recv($self["@stream"])._nextPutAll_("]");
  42471. return self;
  42472. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42473. },
  42474. args: ["aBlock"],
  42475. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42476. referencedClasses: [],
  42477. messageSends: ["nextPutAll:", "value"]
  42478. }),
  42479. $globals.JSStream);
  42480. $core.addMethod(
  42481. $core.method({
  42482. selector: "nextPutReturnWith:",
  42483. protocol: "streaming",
  42484. fn: function (aBlock){
  42485. var self=this,$self=this;
  42486. return $core.withContext(function($ctx1) {
  42487. $recv($self["@stream"])._nextPutAll_("return ");
  42488. $recv(aBlock)._value();
  42489. return self;
  42490. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42491. },
  42492. args: ["aBlock"],
  42493. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42494. referencedClasses: [],
  42495. messageSends: ["nextPutAll:", "value"]
  42496. }),
  42497. $globals.JSStream);
  42498. $core.addMethod(
  42499. $core.method({
  42500. selector: "nextPutSendIndexFor:",
  42501. protocol: "streaming",
  42502. fn: function (anIRSend){
  42503. var self=this,$self=this;
  42504. return $core.withContext(function($ctx1) {
  42505. $self._nextPutAll_(";");
  42506. $ctx1.sendIdx["nextPutAll:"]=1;
  42507. $self._lf();
  42508. $ctx1.sendIdx["lf"]=1;
  42509. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42510. $ctx1.sendIdx["nextPutAll:"]=2;
  42511. $self._lf();
  42512. $ctx1.sendIdx["lf"]=2;
  42513. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42514. $ctx1.sendIdx["nextPutAll:"]=3;
  42515. $self._nextPutAll_(".sendIdx[");
  42516. $ctx1.sendIdx["nextPutAll:"]=4;
  42517. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42518. $ctx1.sendIdx["nextPutAll:"]=5;
  42519. $self._nextPutAll_("]=");
  42520. $ctx1.sendIdx["nextPutAll:"]=6;
  42521. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42522. $ctx1.sendIdx["nextPutAll:"]=7;
  42523. $self._nextPutAll_(";");
  42524. $ctx1.sendIdx["nextPutAll:"]=8;
  42525. $self._lf();
  42526. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42527. return self;
  42528. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42529. },
  42530. args: ["anIRSend"],
  42531. 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)'",
  42532. referencedClasses: [],
  42533. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42534. }),
  42535. $globals.JSStream);
  42536. $core.addMethod(
  42537. $core.method({
  42538. selector: "nextPutStatementWith:",
  42539. protocol: "streaming",
  42540. fn: function (aBlock){
  42541. var self=this,$self=this;
  42542. return $core.withContext(function($ctx1) {
  42543. var $1;
  42544. $self._omitSemicolon_(false);
  42545. $ctx1.sendIdx["omitSemicolon:"]=1;
  42546. $recv(aBlock)._value();
  42547. $1=$self._omitSemicolon();
  42548. if(!$core.assert($1)){
  42549. $recv($self["@stream"])._nextPutAll_(";");
  42550. }
  42551. $self._omitSemicolon_(false);
  42552. $recv($self["@stream"])._lf();
  42553. return self;
  42554. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42555. },
  42556. args: ["aBlock"],
  42557. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42558. referencedClasses: [],
  42559. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42560. }),
  42561. $globals.JSStream);
  42562. $core.addMethod(
  42563. $core.method({
  42564. selector: "nextPutVars:",
  42565. protocol: "streaming",
  42566. fn: function (aCollection){
  42567. var self=this,$self=this;
  42568. return $core.withContext(function($ctx1) {
  42569. var $1;
  42570. $recv(aCollection)._ifNotEmpty_((function(){
  42571. return $core.withContext(function($ctx2) {
  42572. $recv($self["@stream"])._nextPutAll_("var ");
  42573. $ctx2.sendIdx["nextPutAll:"]=1;
  42574. $recv(aCollection)._do_separatedBy_((function(each){
  42575. return $core.withContext(function($ctx3) {
  42576. return $recv($self["@stream"])._nextPutAll_(each);
  42577. $ctx3.sendIdx["nextPutAll:"]=2;
  42578. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42579. }),(function(){
  42580. return $core.withContext(function($ctx3) {
  42581. return $recv($self["@stream"])._nextPutAll_(",");
  42582. $ctx3.sendIdx["nextPutAll:"]=3;
  42583. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42584. }));
  42585. $1=$self["@stream"];
  42586. $recv($1)._nextPutAll_(";");
  42587. return $recv($1)._lf();
  42588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42589. }));
  42590. return self;
  42591. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42592. },
  42593. args: ["aCollection"],
  42594. 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 ]",
  42595. referencedClasses: [],
  42596. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42597. }),
  42598. $globals.JSStream);
  42599. $core.addMethod(
  42600. $core.method({
  42601. selector: "omitSemicolon",
  42602. protocol: "accessing",
  42603. fn: function (){
  42604. var self=this,$self=this;
  42605. return $self["@omitSemicolon"];
  42606. },
  42607. args: [],
  42608. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42609. referencedClasses: [],
  42610. messageSends: []
  42611. }),
  42612. $globals.JSStream);
  42613. $core.addMethod(
  42614. $core.method({
  42615. selector: "omitSemicolon:",
  42616. protocol: "accessing",
  42617. fn: function (aBoolean){
  42618. var self=this,$self=this;
  42619. $self["@omitSemicolon"]=aBoolean;
  42620. return self;
  42621. },
  42622. args: ["aBoolean"],
  42623. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42624. referencedClasses: [],
  42625. messageSends: []
  42626. }),
  42627. $globals.JSStream);
  42628. $core.addMethod(
  42629. $core.method({
  42630. selector: "isReferenced",
  42631. protocol: "*Compiler-IR",
  42632. fn: function (){
  42633. var self=this,$self=this;
  42634. return $core.withContext(function($ctx1) {
  42635. var $3,$2,$1;
  42636. $3=$self._parent();
  42637. $ctx1.sendIdx["parent"]=1;
  42638. $2=$recv($3)._isSequenceNode();
  42639. $1=$recv($2)._or_((function(){
  42640. return $core.withContext(function($ctx2) {
  42641. return $recv($self._parent())._isAssignmentNode();
  42642. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42643. }));
  42644. return $recv($1)._not();
  42645. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42646. },
  42647. args: [],
  42648. 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",
  42649. referencedClasses: [],
  42650. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42651. }),
  42652. $globals.ASTNode);
  42653. $core.addMethod(
  42654. $core.method({
  42655. selector: "subtreeNeedsAliasing",
  42656. protocol: "*Compiler-IR",
  42657. fn: function (){
  42658. var self=this,$self=this;
  42659. return $core.withContext(function($ctx1) {
  42660. return $recv($self._shouldBeAliased())._or_((function(){
  42661. return $core.withContext(function($ctx2) {
  42662. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42663. return $core.withContext(function($ctx3) {
  42664. return $recv(each)._subtreeNeedsAliasing();
  42665. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42666. }));
  42667. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42668. }));
  42669. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42670. },
  42671. args: [],
  42672. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42673. referencedClasses: [],
  42674. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42675. }),
  42676. $globals.ASTNode);
  42677. $core.addMethod(
  42678. $core.method({
  42679. selector: "shouldBeAliased",
  42680. protocol: "*Compiler-IR",
  42681. fn: function (){
  42682. var self=this,$self=this;
  42683. return $core.withContext(function($ctx1) {
  42684. var $1;
  42685. $1=(
  42686. $ctx1.supercall = true,
  42687. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42688. $ctx1.supercall = false;
  42689. return $recv($1)._or_((function(){
  42690. return $core.withContext(function($ctx2) {
  42691. return $self._isReferenced();
  42692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42693. }));
  42694. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42695. },
  42696. args: [],
  42697. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42698. referencedClasses: [],
  42699. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42700. }),
  42701. $globals.AssignmentNode);
  42702. $core.addMethod(
  42703. $core.method({
  42704. selector: "appendToInstruction:",
  42705. protocol: "*Compiler-IR",
  42706. fn: function (anIRInstruction){
  42707. var self=this,$self=this;
  42708. return $core.withContext(function($ctx1) {
  42709. $recv(anIRInstruction)._appendBlock_(self);
  42710. return self;
  42711. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42712. },
  42713. args: ["anIRInstruction"],
  42714. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42715. referencedClasses: [],
  42716. messageSends: ["appendBlock:"]
  42717. }),
  42718. $globals.BlockClosure);
  42719. $core.addMethod(
  42720. $core.method({
  42721. selector: "subtreeNeedsAliasing",
  42722. protocol: "*Compiler-IR",
  42723. fn: function (){
  42724. var self=this,$self=this;
  42725. return $core.withContext(function($ctx1) {
  42726. return $self._shouldBeAliased();
  42727. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42728. },
  42729. args: [],
  42730. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42731. referencedClasses: [],
  42732. messageSends: ["shouldBeAliased"]
  42733. }),
  42734. $globals.BlockNode);
  42735. $core.addMethod(
  42736. $core.method({
  42737. selector: "subtreeNeedsAliasing",
  42738. protocol: "*Compiler-IR",
  42739. fn: function (){
  42740. var self=this,$self=this;
  42741. return $core.withContext(function($ctx1) {
  42742. return $recv($recv($self._parent())._isSequenceNode())._not();
  42743. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42744. },
  42745. args: [],
  42746. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42747. referencedClasses: [],
  42748. messageSends: ["not", "isSequenceNode", "parent"]
  42749. }),
  42750. $globals.CascadeNode);
  42751. $core.addMethod(
  42752. $core.method({
  42753. selector: "shouldBeAliased",
  42754. protocol: "*Compiler-IR",
  42755. fn: function (){
  42756. var self=this,$self=this;
  42757. var sends;
  42758. return $core.withContext(function($ctx1) {
  42759. var $2,$1;
  42760. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42761. $2=(
  42762. $ctx1.supercall = true,
  42763. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42764. $ctx1.supercall = false;
  42765. $1=$recv($2)._or_((function(){
  42766. return $core.withContext(function($ctx2) {
  42767. return $recv($self._isReferenced())._and_((function(){
  42768. return $core.withContext(function($ctx3) {
  42769. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42770. return $core.withContext(function($ctx4) {
  42771. return $self._superSend();
  42772. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42773. }));
  42774. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42775. }));
  42776. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42777. }));
  42778. $ctx1.sendIdx["or:"]=1;
  42779. return $1;
  42780. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42781. },
  42782. args: [],
  42783. 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 ] ] ])",
  42784. referencedClasses: [],
  42785. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42786. }),
  42787. $globals.SendNode);
  42788. $core.addMethod(
  42789. $core.method({
  42790. selector: "subtreeNeedsAliasing",
  42791. protocol: "*Compiler-IR",
  42792. fn: function (){
  42793. var self=this,$self=this;
  42794. return $core.withContext(function($ctx1) {
  42795. return $recv($self._shouldBeInlined())._or_((function(){
  42796. return $core.withContext(function($ctx2) {
  42797. return (
  42798. $ctx2.supercall = true,
  42799. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42800. $ctx2.supercall = false;
  42801. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42802. }));
  42803. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42804. },
  42805. args: [],
  42806. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42807. referencedClasses: [],
  42808. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42809. }),
  42810. $globals.SendNode);
  42811. });
  42812. 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";
  42813. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42814. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42815. $core.addPackage("Compiler-Inlining");
  42816. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  42817. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42818. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42819. $core.addMethod(
  42820. $core.method({
  42821. selector: "visitSendNode:",
  42822. protocol: "visiting",
  42823. fn: function (aNode){
  42824. var self=this,$self=this;
  42825. return $core.withContext(function($ctx1) {
  42826. var $1,$2,$3,$4,$receiver;
  42827. $1=$recv(aNode)._superSend();
  42828. if(!$core.assert($1)){
  42829. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42830. if($core.assert($2)){
  42831. $recv(aNode)._shouldBeInlined_(true);
  42832. $3=$recv(aNode)._receiver();
  42833. if(($receiver = $3) == null || $receiver.a$nil){
  42834. $3;
  42835. } else {
  42836. var receiver;
  42837. receiver=$receiver;
  42838. $recv(receiver)._shouldBeAliased_(true);
  42839. }
  42840. }
  42841. }
  42842. $4=(
  42843. $ctx1.supercall = true,
  42844. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42845. $ctx1.supercall = false;
  42846. return $4;
  42847. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42848. },
  42849. args: ["aNode"],
  42850. 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",
  42851. referencedClasses: ["IRSendInliner"],
  42852. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42853. }),
  42854. $globals.ASTPreInliner);
  42855. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42856. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42857. $core.addMethod(
  42858. $core.method({
  42859. selector: "acceptDagVisitor:",
  42860. protocol: "visiting",
  42861. fn: function (aVisitor){
  42862. var self=this,$self=this;
  42863. return $core.withContext(function($ctx1) {
  42864. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42865. return self;
  42866. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42867. },
  42868. args: ["aVisitor"],
  42869. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42870. referencedClasses: [],
  42871. messageSends: ["visitIRInlinedClosure:"]
  42872. }),
  42873. $globals.IRInlinedClosure);
  42874. $core.addMethod(
  42875. $core.method({
  42876. selector: "isInlined",
  42877. protocol: "testing",
  42878. fn: function (){
  42879. var self=this,$self=this;
  42880. return true;
  42881. },
  42882. args: [],
  42883. source: "isInlined\x0a\x09^ true",
  42884. referencedClasses: [],
  42885. messageSends: []
  42886. }),
  42887. $globals.IRInlinedClosure);
  42888. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42889. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42890. $core.addMethod(
  42891. $core.method({
  42892. selector: "acceptDagVisitor:",
  42893. protocol: "visiting",
  42894. fn: function (aVisitor){
  42895. var self=this,$self=this;
  42896. return $core.withContext(function($ctx1) {
  42897. $recv(aVisitor)._visitInlinedSend_(self);
  42898. return self;
  42899. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42900. },
  42901. args: ["aVisitor"],
  42902. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42903. referencedClasses: [],
  42904. messageSends: ["visitInlinedSend:"]
  42905. }),
  42906. $globals.IRInlinedSend);
  42907. $core.addMethod(
  42908. $core.method({
  42909. selector: "internalVariables",
  42910. protocol: "accessing",
  42911. fn: function (){
  42912. var self=this,$self=this;
  42913. return [];
  42914. },
  42915. args: [],
  42916. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42917. referencedClasses: [],
  42918. messageSends: []
  42919. }),
  42920. $globals.IRInlinedSend);
  42921. $core.addMethod(
  42922. $core.method({
  42923. selector: "isInlined",
  42924. protocol: "testing",
  42925. fn: function (){
  42926. var self=this,$self=this;
  42927. return true;
  42928. },
  42929. args: [],
  42930. source: "isInlined\x0a\x09^ true",
  42931. referencedClasses: [],
  42932. messageSends: []
  42933. }),
  42934. $globals.IRInlinedSend);
  42935. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42936. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42937. $core.addMethod(
  42938. $core.method({
  42939. selector: "acceptDagVisitor:",
  42940. protocol: "visiting",
  42941. fn: function (aVisitor){
  42942. var self=this,$self=this;
  42943. return $core.withContext(function($ctx1) {
  42944. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42945. return self;
  42946. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42947. },
  42948. args: ["aVisitor"],
  42949. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42950. referencedClasses: [],
  42951. messageSends: ["visitIRInlinedIfFalse:"]
  42952. }),
  42953. $globals.IRInlinedIfFalse);
  42954. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42955. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42956. $core.addMethod(
  42957. $core.method({
  42958. selector: "acceptDagVisitor:",
  42959. protocol: "visiting",
  42960. fn: function (aVisitor){
  42961. var self=this,$self=this;
  42962. return $core.withContext(function($ctx1) {
  42963. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42964. return self;
  42965. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42966. },
  42967. args: ["aVisitor"],
  42968. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  42969. referencedClasses: [],
  42970. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  42971. }),
  42972. $globals.IRInlinedIfNilIfNotNil);
  42973. $core.addMethod(
  42974. $core.method({
  42975. selector: "internalVariables",
  42976. protocol: "accessing",
  42977. fn: function (){
  42978. var self=this,$self=this;
  42979. return $core.withContext(function($ctx1) {
  42980. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  42981. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  42982. },
  42983. args: [],
  42984. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  42985. referencedClasses: ["Array"],
  42986. messageSends: ["with:", "receiverInternalVariable"]
  42987. }),
  42988. $globals.IRInlinedIfNilIfNotNil);
  42989. $core.addMethod(
  42990. $core.method({
  42991. selector: "receiverInternalVariable",
  42992. protocol: "accessing",
  42993. fn: function (){
  42994. var self=this,$self=this;
  42995. return $core.withContext(function($ctx1) {
  42996. var $1;
  42997. $1=$recv($globals.IRVariable)._new();
  42998. $ctx1.sendIdx["new"]=1;
  42999. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  43000. return $recv($1)._yourself();
  43001. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  43002. },
  43003. args: [],
  43004. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  43005. referencedClasses: ["IRVariable", "AliasVar"],
  43006. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  43007. }),
  43008. $globals.IRInlinedIfNilIfNotNil);
  43009. $core.addMethod(
  43010. $core.method({
  43011. selector: "receiverInternalVariableName",
  43012. protocol: "accessing",
  43013. fn: function (){
  43014. var self=this,$self=this;
  43015. return "$receiver";
  43016. },
  43017. args: [],
  43018. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  43019. referencedClasses: [],
  43020. messageSends: []
  43021. }),
  43022. $globals.IRInlinedIfNilIfNotNil);
  43023. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43024. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  43025. $core.addMethod(
  43026. $core.method({
  43027. selector: "acceptDagVisitor:",
  43028. protocol: "visiting",
  43029. fn: function (aVisitor){
  43030. var self=this,$self=this;
  43031. return $core.withContext(function($ctx1) {
  43032. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  43033. return self;
  43034. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  43035. },
  43036. args: ["aVisitor"],
  43037. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  43038. referencedClasses: [],
  43039. messageSends: ["visitIRInlinedIfTrue:"]
  43040. }),
  43041. $globals.IRInlinedIfTrue);
  43042. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43043. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  43044. $core.addMethod(
  43045. $core.method({
  43046. selector: "acceptDagVisitor:",
  43047. protocol: "visiting",
  43048. fn: function (aVisitor){
  43049. var self=this,$self=this;
  43050. return $core.withContext(function($ctx1) {
  43051. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  43052. return self;
  43053. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  43054. },
  43055. args: ["aVisitor"],
  43056. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  43057. referencedClasses: [],
  43058. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  43059. }),
  43060. $globals.IRInlinedIfTrueIfFalse);
  43061. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  43062. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  43063. $core.addMethod(
  43064. $core.method({
  43065. selector: "acceptDagVisitor:",
  43066. protocol: "visiting",
  43067. fn: function (aVisitor){
  43068. var self=this,$self=this;
  43069. return $core.withContext(function($ctx1) {
  43070. $recv(aVisitor)._visitIRInlinedSequence_(self);
  43071. return self;
  43072. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  43073. },
  43074. args: ["aVisitor"],
  43075. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  43076. referencedClasses: [],
  43077. messageSends: ["visitIRInlinedSequence:"]
  43078. }),
  43079. $globals.IRInlinedSequence);
  43080. $core.addMethod(
  43081. $core.method({
  43082. selector: "isInlined",
  43083. protocol: "testing",
  43084. fn: function (){
  43085. var self=this,$self=this;
  43086. return true;
  43087. },
  43088. args: [],
  43089. source: "isInlined\x0a\x09^ true",
  43090. referencedClasses: [],
  43091. messageSends: []
  43092. }),
  43093. $globals.IRInlinedSequence);
  43094. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  43095. $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`";
  43096. $core.addMethod(
  43097. $core.method({
  43098. selector: "assignmentInliner",
  43099. protocol: "factory",
  43100. fn: function (){
  43101. var self=this,$self=this;
  43102. return $core.withContext(function($ctx1) {
  43103. var $1;
  43104. $1=$recv($globals.IRAssignmentInliner)._new();
  43105. $recv($1)._translator_(self);
  43106. return $recv($1)._yourself();
  43107. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  43108. },
  43109. args: [],
  43110. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43111. referencedClasses: ["IRAssignmentInliner"],
  43112. messageSends: ["translator:", "new", "yourself"]
  43113. }),
  43114. $globals.IRInliner);
  43115. $core.addMethod(
  43116. $core.method({
  43117. selector: "returnInliner",
  43118. protocol: "factory",
  43119. fn: function (){
  43120. var self=this,$self=this;
  43121. return $core.withContext(function($ctx1) {
  43122. var $1;
  43123. $1=$recv($globals.IRReturnInliner)._new();
  43124. $recv($1)._translator_(self);
  43125. return $recv($1)._yourself();
  43126. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  43127. },
  43128. args: [],
  43129. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43130. referencedClasses: ["IRReturnInliner"],
  43131. messageSends: ["translator:", "new", "yourself"]
  43132. }),
  43133. $globals.IRInliner);
  43134. $core.addMethod(
  43135. $core.method({
  43136. selector: "sendInliner",
  43137. protocol: "factory",
  43138. fn: function (){
  43139. var self=this,$self=this;
  43140. return $core.withContext(function($ctx1) {
  43141. var $1;
  43142. $1=$recv($globals.IRSendInliner)._new();
  43143. $recv($1)._translator_(self);
  43144. return $recv($1)._yourself();
  43145. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  43146. },
  43147. args: [],
  43148. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43149. referencedClasses: ["IRSendInliner"],
  43150. messageSends: ["translator:", "new", "yourself"]
  43151. }),
  43152. $globals.IRInliner);
  43153. $core.addMethod(
  43154. $core.method({
  43155. selector: "shouldInlineAssignment:",
  43156. protocol: "testing",
  43157. fn: function (anIRAssignment){
  43158. var self=this,$self=this;
  43159. return $core.withContext(function($ctx1) {
  43160. var $3,$2,$1;
  43161. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  43162. return $core.withContext(function($ctx2) {
  43163. $3=$recv(anIRAssignment)._right();
  43164. $ctx2.sendIdx["right"]=1;
  43165. $2=$recv($3)._isSend();
  43166. return $recv($2)._and_((function(){
  43167. return $core.withContext(function($ctx3) {
  43168. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  43169. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43170. }));
  43171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43172. }));
  43173. $ctx1.sendIdx["and:"]=1;
  43174. return $1;
  43175. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43176. },
  43177. args: ["anIRAssignment"],
  43178. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  43179. referencedClasses: [],
  43180. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  43181. }),
  43182. $globals.IRInliner);
  43183. $core.addMethod(
  43184. $core.method({
  43185. selector: "shouldInlineReturn:",
  43186. protocol: "testing",
  43187. fn: function (anIRReturn){
  43188. var self=this,$self=this;
  43189. return $core.withContext(function($ctx1) {
  43190. var $3,$2,$1;
  43191. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  43192. return $core.withContext(function($ctx2) {
  43193. $3=$recv(anIRReturn)._expression();
  43194. $ctx2.sendIdx["expression"]=1;
  43195. $2=$recv($3)._isSend();
  43196. return $recv($2)._and_((function(){
  43197. return $core.withContext(function($ctx3) {
  43198. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  43199. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43200. }));
  43201. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43202. }));
  43203. $ctx1.sendIdx["and:"]=1;
  43204. return $1;
  43205. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43206. },
  43207. args: ["anIRReturn"],
  43208. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  43209. referencedClasses: [],
  43210. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  43211. }),
  43212. $globals.IRInliner);
  43213. $core.addMethod(
  43214. $core.method({
  43215. selector: "shouldInlineSend:",
  43216. protocol: "testing",
  43217. fn: function (anIRSend){
  43218. var self=this,$self=this;
  43219. return $core.withContext(function($ctx1) {
  43220. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  43221. return $core.withContext(function($ctx2) {
  43222. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  43223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43224. }));
  43225. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43226. },
  43227. args: ["anIRSend"],
  43228. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  43229. referencedClasses: ["IRSendInliner"],
  43230. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  43231. }),
  43232. $globals.IRInliner);
  43233. $core.addMethod(
  43234. $core.method({
  43235. selector: "visitIRAssignment:",
  43236. protocol: "visiting",
  43237. fn: function (anIRAssignment){
  43238. var self=this,$self=this;
  43239. return $core.withContext(function($ctx1) {
  43240. var $1;
  43241. $1=$self._shouldInlineAssignment_(anIRAssignment);
  43242. if($core.assert($1)){
  43243. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  43244. } else {
  43245. return (
  43246. $ctx1.supercall = true,
  43247. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  43248. $ctx1.supercall = false;
  43249. }
  43250. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43251. },
  43252. args: ["anIRAssignment"],
  43253. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  43254. referencedClasses: [],
  43255. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  43256. }),
  43257. $globals.IRInliner);
  43258. $core.addMethod(
  43259. $core.method({
  43260. selector: "visitIRNonLocalReturn:",
  43261. protocol: "visiting",
  43262. fn: function (anIRNonLocalReturn){
  43263. var self=this,$self=this;
  43264. var localReturn;
  43265. return $core.withContext(function($ctx1) {
  43266. var $2,$1,$4,$3,$5,$6,$7;
  43267. $2=$recv(anIRNonLocalReturn)._scope();
  43268. $ctx1.sendIdx["scope"]=1;
  43269. $1=$recv($2)._canInlineNonLocalReturns();
  43270. if($core.assert($1)){
  43271. $4=$recv(anIRNonLocalReturn)._scope();
  43272. $ctx1.sendIdx["scope"]=2;
  43273. $3=$recv($4)._methodScope();
  43274. $5=$recv(anIRNonLocalReturn)._scope();
  43275. $ctx1.sendIdx["scope"]=3;
  43276. $recv($3)._removeNonLocalReturn_($5);
  43277. $6=$recv($globals.IRReturn)._new();
  43278. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  43279. localReturn=$recv($6)._yourself();
  43280. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  43281. return $core.withContext(function($ctx2) {
  43282. return $recv(localReturn)._add_(each);
  43283. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43284. }));
  43285. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  43286. return $self._visitIRReturn_(localReturn);
  43287. }
  43288. $7=(
  43289. $ctx1.supercall = true,
  43290. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43291. $ctx1.supercall = false;
  43292. return $7;
  43293. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  43294. },
  43295. args: ["anIRNonLocalReturn"],
  43296. 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",
  43297. referencedClasses: ["IRReturn"],
  43298. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  43299. }),
  43300. $globals.IRInliner);
  43301. $core.addMethod(
  43302. $core.method({
  43303. selector: "visitIRReturn:",
  43304. protocol: "visiting",
  43305. fn: function (anIRReturn){
  43306. var self=this,$self=this;
  43307. return $core.withContext(function($ctx1) {
  43308. var $1;
  43309. $1=$self._shouldInlineReturn_(anIRReturn);
  43310. if($core.assert($1)){
  43311. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  43312. } else {
  43313. return (
  43314. $ctx1.supercall = true,
  43315. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43316. $ctx1.supercall = false;
  43317. }
  43318. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43319. },
  43320. args: ["anIRReturn"],
  43321. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  43322. referencedClasses: [],
  43323. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  43324. }),
  43325. $globals.IRInliner);
  43326. $core.addMethod(
  43327. $core.method({
  43328. selector: "visitIRSend:",
  43329. protocol: "visiting",
  43330. fn: function (anIRSend){
  43331. var self=this,$self=this;
  43332. return $core.withContext(function($ctx1) {
  43333. var $1;
  43334. $1=$self._shouldInlineSend_(anIRSend);
  43335. if($core.assert($1)){
  43336. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  43337. } else {
  43338. return (
  43339. $ctx1.supercall = true,
  43340. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  43341. $ctx1.supercall = false;
  43342. }
  43343. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43344. },
  43345. args: ["anIRSend"],
  43346. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  43347. referencedClasses: [],
  43348. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  43349. }),
  43350. $globals.IRInliner);
  43351. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  43352. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  43353. $core.addMethod(
  43354. $core.method({
  43355. selector: "visitIRInlinedClosure:",
  43356. protocol: "visiting",
  43357. fn: function (anIRInlinedClosure){
  43358. var self=this,$self=this;
  43359. return $core.withContext(function($ctx1) {
  43360. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  43361. return $core.withContext(function($ctx2) {
  43362. return $recv($recv(each)._name())._asVariableName();
  43363. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43364. })));
  43365. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  43366. return self;
  43367. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  43368. },
  43369. args: ["anIRInlinedClosure"],
  43370. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  43371. referencedClasses: [],
  43372. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  43373. }),
  43374. $globals.IRInliningJSTranslator);
  43375. $core.addMethod(
  43376. $core.method({
  43377. selector: "visitIRInlinedIfFalse:",
  43378. protocol: "visiting",
  43379. fn: function (anIRInlinedIfFalse){
  43380. var self=this,$self=this;
  43381. return $core.withContext(function($ctx1) {
  43382. var $1,$2,$4,$3;
  43383. $1=$self._stream();
  43384. $ctx1.sendIdx["stream"]=1;
  43385. $recv($1)._nextPutIf_then_((function(){
  43386. return $core.withContext(function($ctx2) {
  43387. $2=$self._stream();
  43388. $ctx2.sendIdx["stream"]=2;
  43389. $recv($2)._nextPutAll_("!$core.assert(");
  43390. $ctx2.sendIdx["nextPutAll:"]=1;
  43391. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  43392. $ctx2.sendIdx["dagChildren"]=1;
  43393. $3=$recv($4)._first();
  43394. $self._visit_($3);
  43395. $ctx2.sendIdx["visit:"]=1;
  43396. return $recv($self._stream())._nextPutAll_(")");
  43397. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43398. }),(function(){
  43399. return $core.withContext(function($ctx2) {
  43400. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  43401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43402. }));
  43403. return self;
  43404. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  43405. },
  43406. args: ["anIRInlinedIfFalse"],
  43407. 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 ]",
  43408. referencedClasses: [],
  43409. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43410. }),
  43411. $globals.IRInliningJSTranslator);
  43412. $core.addMethod(
  43413. $core.method({
  43414. selector: "visitIRInlinedIfNilIfNotNil:",
  43415. protocol: "visiting",
  43416. fn: function (anIRInlinedIfNilIfNotNil){
  43417. var self=this,$self=this;
  43418. return $core.withContext(function($ctx1) {
  43419. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  43420. $1=$self._stream();
  43421. $ctx1.sendIdx["stream"]=1;
  43422. $recv($1)._nextPutIf_then_else_((function(){
  43423. var recvVarName;
  43424. return $core.withContext(function($ctx2) {
  43425. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  43426. $2=$self._stream();
  43427. $ctx2.sendIdx["stream"]=2;
  43428. $4="(".__comma(recvVarName);
  43429. $ctx2.sendIdx[","]=2;
  43430. $3=$recv($4).__comma(" = ");
  43431. $ctx2.sendIdx[","]=1;
  43432. $recv($2)._nextPutAll_($3);
  43433. $ctx2.sendIdx["nextPutAll:"]=1;
  43434. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43435. $ctx2.sendIdx["dagChildren"]=1;
  43436. $5=$recv($6)._first();
  43437. $self._visit_($5);
  43438. $ctx2.sendIdx["visit:"]=1;
  43439. $7=$self._stream();
  43440. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  43441. $ctx2.sendIdx[","]=3;
  43442. return $recv($7)._nextPutAll_($8);
  43443. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  43444. }),(function(){
  43445. return $core.withContext(function($ctx2) {
  43446. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43447. $ctx2.sendIdx["dagChildren"]=2;
  43448. $9=$recv($10)._second();
  43449. return $self._visit_($9);
  43450. $ctx2.sendIdx["visit:"]=2;
  43451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43452. }),(function(){
  43453. return $core.withContext(function($ctx2) {
  43454. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  43455. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43456. }));
  43457. return self;
  43458. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  43459. },
  43460. args: ["anIRInlinedIfNilIfNotNil"],
  43461. 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 ]",
  43462. referencedClasses: [],
  43463. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  43464. }),
  43465. $globals.IRInliningJSTranslator);
  43466. $core.addMethod(
  43467. $core.method({
  43468. selector: "visitIRInlinedIfTrue:",
  43469. protocol: "visiting",
  43470. fn: function (anIRInlinedIfTrue){
  43471. var self=this,$self=this;
  43472. return $core.withContext(function($ctx1) {
  43473. var $1,$2,$4,$3;
  43474. $1=$self._stream();
  43475. $ctx1.sendIdx["stream"]=1;
  43476. $recv($1)._nextPutIf_then_((function(){
  43477. return $core.withContext(function($ctx2) {
  43478. $2=$self._stream();
  43479. $ctx2.sendIdx["stream"]=2;
  43480. $recv($2)._nextPutAll_("$core.assert(");
  43481. $ctx2.sendIdx["nextPutAll:"]=1;
  43482. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43483. $ctx2.sendIdx["dagChildren"]=1;
  43484. $3=$recv($4)._first();
  43485. $self._visit_($3);
  43486. $ctx2.sendIdx["visit:"]=1;
  43487. return $recv($self._stream())._nextPutAll_(")");
  43488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43489. }),(function(){
  43490. return $core.withContext(function($ctx2) {
  43491. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43492. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43493. }));
  43494. return self;
  43495. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43496. },
  43497. args: ["anIRInlinedIfTrue"],
  43498. 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 ]",
  43499. referencedClasses: [],
  43500. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43501. }),
  43502. $globals.IRInliningJSTranslator);
  43503. $core.addMethod(
  43504. $core.method({
  43505. selector: "visitIRInlinedIfTrueIfFalse:",
  43506. protocol: "visiting",
  43507. fn: function (anIRInlinedIfTrueIfFalse){
  43508. var self=this,$self=this;
  43509. return $core.withContext(function($ctx1) {
  43510. var $1,$2,$4,$3,$6,$5;
  43511. $1=$self._stream();
  43512. $ctx1.sendIdx["stream"]=1;
  43513. $recv($1)._nextPutIf_then_else_((function(){
  43514. return $core.withContext(function($ctx2) {
  43515. $2=$self._stream();
  43516. $ctx2.sendIdx["stream"]=2;
  43517. $recv($2)._nextPutAll_("$core.assert(");
  43518. $ctx2.sendIdx["nextPutAll:"]=1;
  43519. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43520. $ctx2.sendIdx["dagChildren"]=1;
  43521. $3=$recv($4)._first();
  43522. $self._visit_($3);
  43523. $ctx2.sendIdx["visit:"]=1;
  43524. return $recv($self._stream())._nextPutAll_(")");
  43525. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43526. }),(function(){
  43527. return $core.withContext(function($ctx2) {
  43528. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43529. $ctx2.sendIdx["dagChildren"]=2;
  43530. $5=$recv($6)._second();
  43531. return $self._visit_($5);
  43532. $ctx2.sendIdx["visit:"]=2;
  43533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43534. }),(function(){
  43535. return $core.withContext(function($ctx2) {
  43536. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43538. }));
  43539. return self;
  43540. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43541. },
  43542. args: ["anIRInlinedIfTrueIfFalse"],
  43543. 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 ]",
  43544. referencedClasses: [],
  43545. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43546. }),
  43547. $globals.IRInliningJSTranslator);
  43548. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43549. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43550. $core.addMethod(
  43551. $core.method({
  43552. selector: "ifFalse:",
  43553. protocol: "inlining",
  43554. fn: function (anIRInstruction){
  43555. var self=this,$self=this;
  43556. return $core.withContext(function($ctx1) {
  43557. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43558. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43559. },
  43560. args: ["anIRInstruction"],
  43561. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43562. referencedClasses: ["IRInlinedIfFalse"],
  43563. messageSends: ["inlinedSend:withBlock:", "new"]
  43564. }),
  43565. $globals.IRSendInliner);
  43566. $core.addMethod(
  43567. $core.method({
  43568. selector: "ifFalse:ifTrue:",
  43569. protocol: "inlining",
  43570. fn: function (anIRInstruction,anotherIRInstruction){
  43571. var self=this,$self=this;
  43572. return $core.withContext(function($ctx1) {
  43573. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43574. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43575. },
  43576. args: ["anIRInstruction", "anotherIRInstruction"],
  43577. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43578. referencedClasses: [],
  43579. messageSends: ["perform:withArguments:"]
  43580. }),
  43581. $globals.IRSendInliner);
  43582. $core.addMethod(
  43583. $core.method({
  43584. selector: "ifNil:",
  43585. protocol: "inlining",
  43586. fn: function (anIRInstruction){
  43587. var self=this,$self=this;
  43588. return $core.withContext(function($ctx1) {
  43589. var $1,$3,$5,$6,$4,$2;
  43590. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43591. $ctx1.sendIdx["new"]=1;
  43592. $3=$recv($globals.IRClosure)._new();
  43593. $ctx1.sendIdx["new"]=2;
  43594. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43595. $5=$recv($globals.IRBlockSequence)._new();
  43596. $recv($5)._add_($recv($self._send())._receiver());
  43597. $6=$recv($5)._yourself();
  43598. $ctx1.sendIdx["yourself"]=1;
  43599. $4=$6;
  43600. $recv($3)._add_($4);
  43601. $ctx1.sendIdx["add:"]=1;
  43602. $2=$recv($3)._yourself();
  43603. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43604. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43605. },
  43606. args: ["anIRInstruction"],
  43607. 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)",
  43608. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43609. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43610. }),
  43611. $globals.IRSendInliner);
  43612. $core.addMethod(
  43613. $core.method({
  43614. selector: "ifNil:ifNotNil:",
  43615. protocol: "inlining",
  43616. fn: function (anIRInstruction,anotherIRInstruction){
  43617. var self=this,$self=this;
  43618. return $core.withContext(function($ctx1) {
  43619. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43620. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43621. },
  43622. args: ["anIRInstruction", "anotherIRInstruction"],
  43623. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43624. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43625. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43626. }),
  43627. $globals.IRSendInliner);
  43628. $core.addMethod(
  43629. $core.method({
  43630. selector: "ifNotNil:",
  43631. protocol: "inlining",
  43632. fn: function (anIRInstruction){
  43633. var self=this,$self=this;
  43634. return $core.withContext(function($ctx1) {
  43635. var $1,$3,$5,$6,$4,$2;
  43636. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43637. $ctx1.sendIdx["new"]=1;
  43638. $3=$recv($globals.IRClosure)._new();
  43639. $ctx1.sendIdx["new"]=2;
  43640. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43641. $5=$recv($globals.IRBlockSequence)._new();
  43642. $recv($5)._add_($recv($self._send())._receiver());
  43643. $6=$recv($5)._yourself();
  43644. $ctx1.sendIdx["yourself"]=1;
  43645. $4=$6;
  43646. $recv($3)._add_($4);
  43647. $ctx1.sendIdx["add:"]=1;
  43648. $2=$recv($3)._yourself();
  43649. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43650. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43651. },
  43652. args: ["anIRInstruction"],
  43653. 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",
  43654. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43655. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43656. }),
  43657. $globals.IRSendInliner);
  43658. $core.addMethod(
  43659. $core.method({
  43660. selector: "ifNotNil:ifNil:",
  43661. protocol: "inlining",
  43662. fn: function (anIRInstruction,anotherIRInstruction){
  43663. var self=this,$self=this;
  43664. return $core.withContext(function($ctx1) {
  43665. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43666. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43667. },
  43668. args: ["anIRInstruction", "anotherIRInstruction"],
  43669. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43670. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43671. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43672. }),
  43673. $globals.IRSendInliner);
  43674. $core.addMethod(
  43675. $core.method({
  43676. selector: "ifTrue:",
  43677. protocol: "inlining",
  43678. fn: function (anIRInstruction){
  43679. var self=this,$self=this;
  43680. return $core.withContext(function($ctx1) {
  43681. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43682. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43683. },
  43684. args: ["anIRInstruction"],
  43685. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43686. referencedClasses: ["IRInlinedIfTrue"],
  43687. messageSends: ["inlinedSend:withBlock:", "new"]
  43688. }),
  43689. $globals.IRSendInliner);
  43690. $core.addMethod(
  43691. $core.method({
  43692. selector: "ifTrue:ifFalse:",
  43693. protocol: "inlining",
  43694. fn: function (anIRInstruction,anotherIRInstruction){
  43695. var self=this,$self=this;
  43696. return $core.withContext(function($ctx1) {
  43697. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43698. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43699. },
  43700. args: ["anIRInstruction", "anotherIRInstruction"],
  43701. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43702. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43703. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43704. }),
  43705. $globals.IRSendInliner);
  43706. $core.addMethod(
  43707. $core.method({
  43708. selector: "inlineClosure:",
  43709. protocol: "inlining",
  43710. fn: function (anIRClosure){
  43711. var self=this,$self=this;
  43712. var inlinedClosure,sequence,statements;
  43713. return $core.withContext(function($ctx1) {
  43714. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43715. inlinedClosure=$self._inlinedClosure();
  43716. $1=inlinedClosure;
  43717. $2=$recv(anIRClosure)._scope();
  43718. $ctx1.sendIdx["scope"]=1;
  43719. $recv($1)._scope_($2);
  43720. $ctx1.sendIdx["scope:"]=1;
  43721. $recv($1)._parent_($recv(anIRClosure)._parent());
  43722. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43723. return $core.withContext(function($ctx2) {
  43724. return $recv(inlinedClosure)._add_(each);
  43725. $ctx2.sendIdx["add:"]=1;
  43726. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43727. }));
  43728. $ctx1.sendIdx["do:"]=1;
  43729. sequence=$self._inlinedSequence();
  43730. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43731. return $core.withContext(function($ctx2) {
  43732. $3=inlinedClosure;
  43733. $5=$recv($globals.IRTempDeclaration)._new();
  43734. $ctx2.sendIdx["new"]=1;
  43735. $recv($5)._name_(each);
  43736. $ctx2.sendIdx["name:"]=1;
  43737. $6=$recv($5)._yourself();
  43738. $ctx2.sendIdx["yourself"]=1;
  43739. $4=$6;
  43740. $recv($3)._add_($4);
  43741. $ctx2.sendIdx["add:"]=2;
  43742. $7=sequence;
  43743. $9=$recv($globals.IRAssignment)._new();
  43744. $ctx2.sendIdx["new"]=2;
  43745. $11=$recv($globals.IRVariable)._new();
  43746. $ctx2.sendIdx["new"]=3;
  43747. $13=$recv($globals.AliasVar)._new();
  43748. $ctx2.sendIdx["new"]=4;
  43749. $14=$recv(inlinedClosure)._scope();
  43750. $ctx2.sendIdx["scope"]=2;
  43751. $recv($13)._scope_($14);
  43752. $ctx2.sendIdx["scope:"]=2;
  43753. $recv($13)._name_(each);
  43754. $ctx2.sendIdx["name:"]=2;
  43755. $15=$recv($13)._yourself();
  43756. $ctx2.sendIdx["yourself"]=2;
  43757. $12=$15;
  43758. $10=$recv($11)._variable_($12);
  43759. $ctx2.sendIdx["variable:"]=1;
  43760. $recv($9)._add_($10);
  43761. $ctx2.sendIdx["add:"]=4;
  43762. $17=$recv($globals.IRVariable)._new();
  43763. $ctx2.sendIdx["new"]=5;
  43764. $19=$recv($globals.AliasVar)._new();
  43765. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43766. $recv($19)._name_("$receiver");
  43767. $20=$recv($19)._yourself();
  43768. $ctx2.sendIdx["yourself"]=3;
  43769. $18=$20;
  43770. $16=$recv($17)._variable_($18);
  43771. $recv($9)._add_($16);
  43772. $ctx2.sendIdx["add:"]=5;
  43773. $8=$recv($9)._yourself();
  43774. return $recv($7)._add_($8);
  43775. $ctx2.sendIdx["add:"]=3;
  43776. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43777. }));
  43778. $ctx1.sendIdx["do:"]=2;
  43779. $recv(inlinedClosure)._add_(sequence);
  43780. $ctx1.sendIdx["add:"]=6;
  43781. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43782. $recv(statements)._ifNotEmpty_((function(){
  43783. return $core.withContext(function($ctx2) {
  43784. $recv($recv(statements)._allButLast())._do_((function(each){
  43785. return $core.withContext(function($ctx3) {
  43786. return $recv(sequence)._add_(each);
  43787. $ctx3.sendIdx["add:"]=7;
  43788. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43789. }));
  43790. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43791. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43792. }));
  43793. return inlinedClosure;
  43794. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43795. },
  43796. args: ["anIRClosure"],
  43797. 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",
  43798. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43799. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43800. }),
  43801. $globals.IRSendInliner);
  43802. $core.addMethod(
  43803. $core.method({
  43804. selector: "inlineSend:",
  43805. protocol: "inlining",
  43806. fn: function (anIRSend){
  43807. var self=this,$self=this;
  43808. return $core.withContext(function($ctx1) {
  43809. var $2,$1;
  43810. $self._send_(anIRSend);
  43811. $2=$self._send();
  43812. $ctx1.sendIdx["send"]=1;
  43813. $1=$recv($2)._selector();
  43814. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43815. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43816. },
  43817. args: ["anIRSend"],
  43818. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43819. referencedClasses: [],
  43820. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43821. }),
  43822. $globals.IRSendInliner);
  43823. $core.addMethod(
  43824. $core.method({
  43825. selector: "inlineSend:andReplace:",
  43826. protocol: "private",
  43827. fn: function (anIRSend,anIRInstruction){
  43828. var self=this,$self=this;
  43829. return $core.withContext(function($ctx1) {
  43830. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43831. return $self._inlineSend_(anIRSend);
  43832. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43833. },
  43834. args: ["anIRSend", "anIRInstruction"],
  43835. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43836. referencedClasses: [],
  43837. messageSends: ["replaceWith:", "inlineSend:"]
  43838. }),
  43839. $globals.IRSendInliner);
  43840. $core.addMethod(
  43841. $core.method({
  43842. selector: "inlinedClosure",
  43843. protocol: "factory",
  43844. fn: function (){
  43845. var self=this,$self=this;
  43846. return $core.withContext(function($ctx1) {
  43847. return $recv($globals.IRInlinedClosure)._new();
  43848. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43849. },
  43850. args: [],
  43851. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43852. referencedClasses: ["IRInlinedClosure"],
  43853. messageSends: ["new"]
  43854. }),
  43855. $globals.IRSendInliner);
  43856. $core.addMethod(
  43857. $core.method({
  43858. selector: "inlinedSend:withBlock:",
  43859. protocol: "private",
  43860. fn: function (inlinedSend,anIRInstruction){
  43861. var self=this,$self=this;
  43862. var inlinedClosure;
  43863. return $core.withContext(function($ctx1) {
  43864. var $1,$2,$4,$3,$5;
  43865. $1=$recv(anIRInstruction)._isClosure();
  43866. if(!$core.assert($1)){
  43867. $self._inliningError_("Message argument should be a block");
  43868. $ctx1.sendIdx["inliningError:"]=1;
  43869. }
  43870. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43871. if(!$core.assert($2)){
  43872. $self._inliningError_("Inlined block should have zero argument");
  43873. }
  43874. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43875. $4=$self._send();
  43876. $ctx1.sendIdx["send"]=1;
  43877. $3=$recv($4)._receiver();
  43878. $recv(inlinedSend)._add_($3);
  43879. $ctx1.sendIdx["add:"]=1;
  43880. $recv(inlinedSend)._add_(inlinedClosure);
  43881. $recv($self._send())._replaceWith_(inlinedSend);
  43882. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43883. $ctx1.sendIdx["internalVariables"]=1;
  43884. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43885. return inlinedSend;
  43886. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43887. },
  43888. args: ["inlinedSend", "anIRInstruction"],
  43889. 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",
  43890. referencedClasses: [],
  43891. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43892. }),
  43893. $globals.IRSendInliner);
  43894. $core.addMethod(
  43895. $core.method({
  43896. selector: "inlinedSend:withBlock:withBlock:",
  43897. protocol: "private",
  43898. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43899. var self=this,$self=this;
  43900. var inlinedClosure1,inlinedClosure2;
  43901. return $core.withContext(function($ctx1) {
  43902. var $1,$2,$3,$4,$6,$5,$7;
  43903. $1=$recv(anIRInstruction)._isClosure();
  43904. $ctx1.sendIdx["isClosure"]=1;
  43905. if(!$core.assert($1)){
  43906. $self._inliningError_("Message argument should be a block");
  43907. $ctx1.sendIdx["inliningError:"]=1;
  43908. }
  43909. $2=$recv(anotherIRInstruction)._isClosure();
  43910. if(!$core.assert($2)){
  43911. $self._inliningError_("Message argument should be a block");
  43912. }
  43913. $3=$self._translator();
  43914. $ctx1.sendIdx["translator"]=1;
  43915. $4=$self._inlineClosure_(anIRInstruction);
  43916. $ctx1.sendIdx["inlineClosure:"]=1;
  43917. inlinedClosure1=$recv($3)._visit_($4);
  43918. $ctx1.sendIdx["visit:"]=1;
  43919. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43920. $6=$self._send();
  43921. $ctx1.sendIdx["send"]=1;
  43922. $5=$recv($6)._receiver();
  43923. $recv(inlinedSend)._add_($5);
  43924. $ctx1.sendIdx["add:"]=1;
  43925. $recv(inlinedSend)._add_(inlinedClosure1);
  43926. $ctx1.sendIdx["add:"]=2;
  43927. $recv(inlinedSend)._add_(inlinedClosure2);
  43928. $recv($self._send())._replaceWith_(inlinedSend);
  43929. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43930. $ctx1.sendIdx["internalVariables"]=1;
  43931. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43932. return inlinedSend;
  43933. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43934. },
  43935. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43936. 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",
  43937. referencedClasses: [],
  43938. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43939. }),
  43940. $globals.IRSendInliner);
  43941. $core.addMethod(
  43942. $core.method({
  43943. selector: "inlinedSequence",
  43944. protocol: "factory",
  43945. fn: function (){
  43946. var self=this,$self=this;
  43947. return $core.withContext(function($ctx1) {
  43948. return $recv($globals.IRInlinedSequence)._new();
  43949. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43950. },
  43951. args: [],
  43952. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43953. referencedClasses: ["IRInlinedSequence"],
  43954. messageSends: ["new"]
  43955. }),
  43956. $globals.IRSendInliner);
  43957. $core.addMethod(
  43958. $core.method({
  43959. selector: "inliningError:",
  43960. protocol: "error handling",
  43961. fn: function (aString){
  43962. var self=this,$self=this;
  43963. return $core.withContext(function($ctx1) {
  43964. $recv($globals.InliningError)._signal_(aString);
  43965. return self;
  43966. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43967. },
  43968. args: ["aString"],
  43969. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  43970. referencedClasses: ["InliningError"],
  43971. messageSends: ["signal:"]
  43972. }),
  43973. $globals.IRSendInliner);
  43974. $core.addMethod(
  43975. $core.method({
  43976. selector: "send",
  43977. protocol: "accessing",
  43978. fn: function (){
  43979. var self=this,$self=this;
  43980. return $self["@send"];
  43981. },
  43982. args: [],
  43983. source: "send\x0a\x09^ send",
  43984. referencedClasses: [],
  43985. messageSends: []
  43986. }),
  43987. $globals.IRSendInliner);
  43988. $core.addMethod(
  43989. $core.method({
  43990. selector: "send:",
  43991. protocol: "accessing",
  43992. fn: function (anIRSend){
  43993. var self=this,$self=this;
  43994. $self["@send"]=anIRSend;
  43995. return self;
  43996. },
  43997. args: ["anIRSend"],
  43998. source: "send: anIRSend\x0a\x09send := anIRSend",
  43999. referencedClasses: [],
  44000. messageSends: []
  44001. }),
  44002. $globals.IRSendInliner);
  44003. $core.addMethod(
  44004. $core.method({
  44005. selector: "translator",
  44006. protocol: "accessing",
  44007. fn: function (){
  44008. var self=this,$self=this;
  44009. return $self["@translator"];
  44010. },
  44011. args: [],
  44012. source: "translator\x0a\x09^ translator",
  44013. referencedClasses: [],
  44014. messageSends: []
  44015. }),
  44016. $globals.IRSendInliner);
  44017. $core.addMethod(
  44018. $core.method({
  44019. selector: "translator:",
  44020. protocol: "accessing",
  44021. fn: function (anASTTranslator){
  44022. var self=this,$self=this;
  44023. $self["@translator"]=anASTTranslator;
  44024. return self;
  44025. },
  44026. args: ["anASTTranslator"],
  44027. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  44028. referencedClasses: [],
  44029. messageSends: []
  44030. }),
  44031. $globals.IRSendInliner);
  44032. $core.addMethod(
  44033. $core.method({
  44034. selector: "inlinedSelectors",
  44035. protocol: "accessing",
  44036. fn: function (){
  44037. var self=this,$self=this;
  44038. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  44039. },
  44040. args: [],
  44041. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  44042. referencedClasses: [],
  44043. messageSends: []
  44044. }),
  44045. $globals.IRSendInliner.a$cls);
  44046. $core.addMethod(
  44047. $core.method({
  44048. selector: "shouldInline:",
  44049. protocol: "accessing",
  44050. fn: function (anIRSend){
  44051. var self=this,$self=this;
  44052. return $core.withContext(function($ctx1) {
  44053. var $1;
  44054. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  44055. if(!$core.assert($1)){
  44056. return false;
  44057. }
  44058. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  44059. return $core.withContext(function($ctx2) {
  44060. return $recv(each)._isClosure();
  44061. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44062. }));
  44063. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  44064. },
  44065. args: ["anIRSend"],
  44066. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  44067. referencedClasses: [],
  44068. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  44069. }),
  44070. $globals.IRSendInliner.a$cls);
  44071. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  44072. $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};";
  44073. $core.addMethod(
  44074. $core.method({
  44075. selector: "inlineAssignment:",
  44076. protocol: "inlining",
  44077. fn: function (anIRAssignment){
  44078. var self=this,$self=this;
  44079. return $core.withContext(function($ctx1) {
  44080. $self._target_($recv(anIRAssignment)._left());
  44081. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  44082. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  44083. },
  44084. args: ["anIRAssignment"],
  44085. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  44086. referencedClasses: [],
  44087. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  44088. }),
  44089. $globals.IRAssignmentInliner);
  44090. $core.addMethod(
  44091. $core.method({
  44092. selector: "inlineClosure:",
  44093. protocol: "inlining",
  44094. fn: function (anIRClosure){
  44095. var self=this,$self=this;
  44096. var closure,sequence,statements;
  44097. return $core.withContext(function($ctx1) {
  44098. var $1,$2,$3,$5,$4;
  44099. closure=(
  44100. $ctx1.supercall = true,
  44101. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44102. $ctx1.supercall = false;
  44103. sequence=$recv(closure)._sequence();
  44104. statements=$recv(sequence)._dagChildren();
  44105. $recv(statements)._ifNotEmpty_((function(){
  44106. var final;
  44107. return $core.withContext(function($ctx2) {
  44108. final=$recv(statements)._last();
  44109. $1=$recv(final)._yieldsValue();
  44110. if($core.assert($1)){
  44111. $2=sequence;
  44112. $3=final;
  44113. $5=$recv($globals.IRAssignment)._new();
  44114. $recv($5)._add_($self._target());
  44115. $ctx2.sendIdx["add:"]=1;
  44116. $recv($5)._add_($recv(final)._copy());
  44117. $4=$recv($5)._yourself();
  44118. return $recv($2)._replace_with_($3,$4);
  44119. }
  44120. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44121. }));
  44122. return closure;
  44123. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  44124. },
  44125. args: ["anIRClosure"],
  44126. 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",
  44127. referencedClasses: ["IRAssignment"],
  44128. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  44129. }),
  44130. $globals.IRAssignmentInliner);
  44131. $core.addMethod(
  44132. $core.method({
  44133. selector: "target",
  44134. protocol: "accessing",
  44135. fn: function (){
  44136. var self=this,$self=this;
  44137. return $self["@target"];
  44138. },
  44139. args: [],
  44140. source: "target\x0a\x09^ target",
  44141. referencedClasses: [],
  44142. messageSends: []
  44143. }),
  44144. $globals.IRAssignmentInliner);
  44145. $core.addMethod(
  44146. $core.method({
  44147. selector: "target:",
  44148. protocol: "accessing",
  44149. fn: function (anObject){
  44150. var self=this,$self=this;
  44151. $self["@target"]=anObject;
  44152. return self;
  44153. },
  44154. args: ["anObject"],
  44155. source: "target: anObject\x0a\x09target := anObject",
  44156. referencedClasses: [],
  44157. messageSends: []
  44158. }),
  44159. $globals.IRAssignmentInliner);
  44160. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  44161. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  44162. $core.addMethod(
  44163. $core.method({
  44164. selector: "inlineClosure:",
  44165. protocol: "inlining",
  44166. fn: function (anIRClosure){
  44167. var self=this,$self=this;
  44168. var closure,sequence,statements;
  44169. return $core.withContext(function($ctx1) {
  44170. var $1,$2,$3,$5,$4;
  44171. closure=(
  44172. $ctx1.supercall = true,
  44173. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44174. $ctx1.supercall = false;
  44175. sequence=$recv(closure)._sequence();
  44176. statements=$recv(sequence)._dagChildren();
  44177. $recv(statements)._ifNotEmpty_((function(){
  44178. var final;
  44179. return $core.withContext(function($ctx2) {
  44180. final=$recv(statements)._last();
  44181. $1=$recv(final)._yieldsValue();
  44182. if($core.assert($1)){
  44183. $2=sequence;
  44184. $3=final;
  44185. $5=$recv($globals.IRReturn)._new();
  44186. $recv($5)._add_($recv(final)._copy());
  44187. $4=$recv($5)._yourself();
  44188. return $recv($2)._replace_with_($3,$4);
  44189. }
  44190. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44191. }));
  44192. return closure;
  44193. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  44194. },
  44195. args: ["anIRClosure"],
  44196. 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",
  44197. referencedClasses: ["IRReturn"],
  44198. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  44199. }),
  44200. $globals.IRReturnInliner);
  44201. $core.addMethod(
  44202. $core.method({
  44203. selector: "inlineReturn:",
  44204. protocol: "inlining",
  44205. fn: function (anIRReturn){
  44206. var self=this,$self=this;
  44207. return $core.withContext(function($ctx1) {
  44208. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  44209. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  44210. },
  44211. args: ["anIRReturn"],
  44212. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  44213. referencedClasses: [],
  44214. messageSends: ["inlineSend:andReplace:", "expression"]
  44215. }),
  44216. $globals.IRReturnInliner);
  44217. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  44218. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  44219. $core.addMethod(
  44220. $core.method({
  44221. selector: "inliner",
  44222. protocol: "compiling",
  44223. fn: function (){
  44224. var self=this,$self=this;
  44225. return $core.withContext(function($ctx1) {
  44226. return $recv($globals.IRInliner)._new();
  44227. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  44228. },
  44229. args: [],
  44230. source: "inliner\x0a\x09^ IRInliner new",
  44231. referencedClasses: ["IRInliner"],
  44232. messageSends: ["new"]
  44233. }),
  44234. $globals.InliningCodeGenerator);
  44235. $core.addMethod(
  44236. $core.method({
  44237. selector: "irTranslatorClass",
  44238. protocol: "compiling",
  44239. fn: function (){
  44240. var self=this,$self=this;
  44241. return $globals.IRInliningJSTranslator;
  44242. },
  44243. args: [],
  44244. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  44245. referencedClasses: ["IRInliningJSTranslator"],
  44246. messageSends: []
  44247. }),
  44248. $globals.InliningCodeGenerator);
  44249. $core.addMethod(
  44250. $core.method({
  44251. selector: "preInliner",
  44252. protocol: "compiling",
  44253. fn: function (){
  44254. var self=this,$self=this;
  44255. return $core.withContext(function($ctx1) {
  44256. return $recv($globals.ASTPreInliner)._new();
  44257. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  44258. },
  44259. args: [],
  44260. source: "preInliner\x0a\x09^ ASTPreInliner new",
  44261. referencedClasses: ["ASTPreInliner"],
  44262. messageSends: ["new"]
  44263. }),
  44264. $globals.InliningCodeGenerator);
  44265. $core.addMethod(
  44266. $core.method({
  44267. selector: "transformersDictionary",
  44268. protocol: "compiling",
  44269. fn: function (){
  44270. var self=this,$self=this;
  44271. return $core.withContext(function($ctx1) {
  44272. var $1,$2,$receiver;
  44273. $1=$self["@transformersDictionary"];
  44274. if(($receiver = $1) == null || $receiver.a$nil){
  44275. $2=(
  44276. $ctx1.supercall = true,
  44277. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  44278. $ctx1.supercall = false;
  44279. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  44280. $ctx1.sendIdx["at:put:"]=1;
  44281. $recv($2)._at_put_("6000-inliner",$self._inliner());
  44282. $ctx1.sendIdx["at:put:"]=2;
  44283. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  44284. $self["@transformersDictionary"]=$recv($2)._yourself();
  44285. return $self["@transformersDictionary"];
  44286. } else {
  44287. return $1;
  44288. }
  44289. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  44290. },
  44291. args: [],
  44292. 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 ]",
  44293. referencedClasses: [],
  44294. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  44295. }),
  44296. $globals.InliningCodeGenerator);
  44297. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  44298. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  44299. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  44300. $core.addMethod(
  44301. $core.method({
  44302. selector: "visitSendNode:",
  44303. protocol: "visiting",
  44304. fn: function (aNode){
  44305. var self=this,$self=this;
  44306. return $core.withContext(function($ctx1) {
  44307. var $1,$2,$3,$receiver;
  44308. $1=$recv(aNode)._superSend();
  44309. if(!$core.assert($1)){
  44310. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  44311. if($core.assert($2)){
  44312. $recv(aNode)._shouldBeInlined_(true);
  44313. $3=$recv(aNode)._receiver();
  44314. if(($receiver = $3) == null || $receiver.a$nil){
  44315. $3;
  44316. } else {
  44317. var receiver;
  44318. receiver=$receiver;
  44319. $recv(receiver)._shouldBeAliased_(true);
  44320. }
  44321. }
  44322. }
  44323. (
  44324. $ctx1.supercall = true,
  44325. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  44326. $ctx1.supercall = false;
  44327. return self;
  44328. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  44329. },
  44330. args: ["aNode"],
  44331. 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",
  44332. referencedClasses: ["IRSendInliner"],
  44333. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  44334. }),
  44335. $globals.InliningSemanticAnalyzer);
  44336. $core.addMethod(
  44337. $core.method({
  44338. selector: "asInlinedBlockResult",
  44339. protocol: "*Compiler-Inlining",
  44340. fn: function (){
  44341. var self=this,$self=this;
  44342. return $core.withContext(function($ctx1) {
  44343. return $self._expression();
  44344. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  44345. },
  44346. args: [],
  44347. source: "asInlinedBlockResult\x0a\x09^ self expression",
  44348. referencedClasses: [],
  44349. messageSends: ["expression"]
  44350. }),
  44351. $globals.IRBlockReturn);
  44352. $core.addMethod(
  44353. $core.method({
  44354. selector: "asInlinedBlockResult",
  44355. protocol: "*Compiler-Inlining",
  44356. fn: function (){
  44357. var self=this,$self=this;
  44358. return self;
  44359. },
  44360. args: [],
  44361. source: "asInlinedBlockResult\x0a\x09^ self",
  44362. referencedClasses: [],
  44363. messageSends: []
  44364. }),
  44365. $globals.IRInstruction);
  44366. });
  44367. 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";
  44368. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  44369. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44370. $core.addPackage("Compiler-Interpreter");
  44371. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  44372. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44373. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  44374. $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`).";
  44375. $core.addMethod(
  44376. $core.method({
  44377. selector: "applyTo:arguments:",
  44378. protocol: "evaluating",
  44379. fn: function (anObject,aCollection){
  44380. var self=this,$self=this;
  44381. return $core.withContext(function($ctx1) {
  44382. $self._interpreterError();
  44383. return self;
  44384. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  44385. },
  44386. args: ["anObject", "aCollection"],
  44387. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  44388. referencedClasses: [],
  44389. messageSends: ["interpreterError"]
  44390. }),
  44391. $globals.AIBlockClosure);
  44392. $core.addMethod(
  44393. $core.method({
  44394. selector: "compiledSource",
  44395. protocol: "accessing",
  44396. fn: function (){
  44397. var self=this,$self=this;
  44398. return "[ AST Block closure ]";
  44399. },
  44400. args: [],
  44401. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  44402. referencedClasses: [],
  44403. messageSends: []
  44404. }),
  44405. $globals.AIBlockClosure);
  44406. $core.addMethod(
  44407. $core.method({
  44408. selector: "currySelf",
  44409. protocol: "converting",
  44410. fn: function (){
  44411. var self=this,$self=this;
  44412. return $core.withContext(function($ctx1) {
  44413. $self._interpreterError();
  44414. return self;
  44415. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  44416. },
  44417. args: [],
  44418. source: "currySelf\x0a\x09self interpreterError",
  44419. referencedClasses: [],
  44420. messageSends: ["interpreterError"]
  44421. }),
  44422. $globals.AIBlockClosure);
  44423. $core.addMethod(
  44424. $core.method({
  44425. selector: "initializeWithContext:node:",
  44426. protocol: "initialization",
  44427. fn: function (aContext,aNode){
  44428. var self=this,$self=this;
  44429. $self["@node"]=aNode;
  44430. $self["@outerContext"]=aContext;
  44431. return self;
  44432. },
  44433. args: ["aContext", "aNode"],
  44434. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  44435. referencedClasses: [],
  44436. messageSends: []
  44437. }),
  44438. $globals.AIBlockClosure);
  44439. $core.addMethod(
  44440. $core.method({
  44441. selector: "interpreterError",
  44442. protocol: "error handling",
  44443. fn: function (){
  44444. var self=this,$self=this;
  44445. return $core.withContext(function($ctx1) {
  44446. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  44447. return self;
  44448. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  44449. },
  44450. args: [],
  44451. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  44452. referencedClasses: ["ASTInterpreterError"],
  44453. messageSends: ["signal:"]
  44454. }),
  44455. $globals.AIBlockClosure);
  44456. $core.addMethod(
  44457. $core.method({
  44458. selector: "numArgs",
  44459. protocol: "accessing",
  44460. fn: function (){
  44461. var self=this,$self=this;
  44462. return $core.withContext(function($ctx1) {
  44463. return $recv($recv($self["@node"])._temps())._size();
  44464. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  44465. },
  44466. args: [],
  44467. source: "numArgs\x0a\x09^ node temps size",
  44468. referencedClasses: [],
  44469. messageSends: ["size", "temps"]
  44470. }),
  44471. $globals.AIBlockClosure);
  44472. $core.addMethod(
  44473. $core.method({
  44474. selector: "value",
  44475. protocol: "evaluating",
  44476. fn: function (){
  44477. var self=this,$self=this;
  44478. return $core.withContext(function($ctx1) {
  44479. return $self._valueWithPossibleArguments_([]);
  44480. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44481. },
  44482. args: [],
  44483. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44484. referencedClasses: [],
  44485. messageSends: ["valueWithPossibleArguments:"]
  44486. }),
  44487. $globals.AIBlockClosure);
  44488. $core.addMethod(
  44489. $core.method({
  44490. selector: "value:",
  44491. protocol: "evaluating",
  44492. fn: function (anArgument){
  44493. var self=this,$self=this;
  44494. return $core.withContext(function($ctx1) {
  44495. return $self._valueWithPossibleArguments_([anArgument]);
  44496. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44497. },
  44498. args: ["anArgument"],
  44499. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44500. referencedClasses: [],
  44501. messageSends: ["valueWithPossibleArguments:"]
  44502. }),
  44503. $globals.AIBlockClosure);
  44504. $core.addMethod(
  44505. $core.method({
  44506. selector: "value:value:",
  44507. protocol: "evaluating",
  44508. fn: function (firstArgument,secondArgument){
  44509. var self=this,$self=this;
  44510. return $core.withContext(function($ctx1) {
  44511. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44512. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44513. },
  44514. args: ["firstArgument", "secondArgument"],
  44515. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44516. referencedClasses: [],
  44517. messageSends: ["valueWithPossibleArguments:"]
  44518. }),
  44519. $globals.AIBlockClosure);
  44520. $core.addMethod(
  44521. $core.method({
  44522. selector: "value:value:value:",
  44523. protocol: "evaluating",
  44524. fn: function (firstArgument,secondArgument,thirdArgument){
  44525. var self=this,$self=this;
  44526. return $core.withContext(function($ctx1) {
  44527. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44528. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44529. },
  44530. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44531. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44532. referencedClasses: [],
  44533. messageSends: ["valueWithPossibleArguments:"]
  44534. }),
  44535. $globals.AIBlockClosure);
  44536. $core.addMethod(
  44537. $core.method({
  44538. selector: "valueWithPossibleArguments:",
  44539. protocol: "evaluating",
  44540. fn: function (aCollection){
  44541. var self=this,$self=this;
  44542. var context,sequenceNode;
  44543. return $core.withContext(function($ctx1) {
  44544. var $1,$2,$3;
  44545. context=$recv($self["@outerContext"])._newInnerContext();
  44546. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  44547. $recv($1)._parent_(nil);
  44548. sequenceNode=$recv($1)._yourself();
  44549. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44550. return $core.withContext(function($ctx2) {
  44551. return $recv(context)._defineLocal_(each);
  44552. $ctx2.sendIdx["defineLocal:"]=1;
  44553. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44554. }));
  44555. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  44556. return $core.withContext(function($ctx2) {
  44557. $recv(context)._defineLocal_(each);
  44558. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44559. return nil;
  44560. })));
  44561. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44562. }));
  44563. $2=$recv(context)._interpreter();
  44564. $ctx1.sendIdx["interpreter"]=1;
  44565. $recv($2)._node_(sequenceNode);
  44566. $recv($2)._enterNode();
  44567. $recv($2)._proceed();
  44568. $3=$recv($self["@outerContext"])._interpreter();
  44569. $ctx1.sendIdx["interpreter"]=2;
  44570. $recv($3)._setNonLocalReturnFromContext_(context);
  44571. return $recv($recv(context)._interpreter())._pop();
  44572. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44573. },
  44574. args: ["aCollection"],
  44575. 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",
  44576. referencedClasses: [],
  44577. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44578. }),
  44579. $globals.AIBlockClosure);
  44580. $core.addMethod(
  44581. $core.method({
  44582. selector: "forContext:node:",
  44583. protocol: "instance creation",
  44584. fn: function (aContext,aNode){
  44585. var self=this,$self=this;
  44586. return $core.withContext(function($ctx1) {
  44587. var $1;
  44588. $1=$self._new();
  44589. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44590. return $recv($1)._yourself();
  44591. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44592. },
  44593. args: ["aContext", "aNode"],
  44594. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44595. referencedClasses: [],
  44596. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44597. }),
  44598. $globals.AIBlockClosure.a$cls);
  44599. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44600. $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)";
  44601. $core.addMethod(
  44602. $core.method({
  44603. selector: "arguments",
  44604. protocol: "interpreting",
  44605. fn: function (){
  44606. var self=this,$self=this;
  44607. return $core.withContext(function($ctx1) {
  44608. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44609. return $core.withContext(function($ctx2) {
  44610. return $self._localAt_ifAbsent_(each,(function(){
  44611. return $core.withContext(function($ctx3) {
  44612. return $self._error_("Argument not in context");
  44613. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44614. }));
  44615. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44616. }));
  44617. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44618. },
  44619. args: [],
  44620. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44621. referencedClasses: [],
  44622. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44623. }),
  44624. $globals.AIContext);
  44625. $core.addMethod(
  44626. $core.method({
  44627. selector: "ast",
  44628. protocol: "interpreting",
  44629. fn: function (){
  44630. var self=this,$self=this;
  44631. return $core.withContext(function($ctx1) {
  44632. var $1,$2,$3,$receiver;
  44633. $1=$self._isBlockContext();
  44634. if($core.assert($1)){
  44635. $2=$self._outerContext();
  44636. if(($receiver = $2) == null || $receiver.a$nil){
  44637. return $2;
  44638. } else {
  44639. var context;
  44640. context=$receiver;
  44641. return $recv(context)._ast();
  44642. }
  44643. }
  44644. $3=$self["@ast"];
  44645. if(($receiver = $3) == null || $receiver.a$nil){
  44646. $self._initializeAST();
  44647. } else {
  44648. $3;
  44649. }
  44650. return $self["@ast"];
  44651. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44652. },
  44653. args: [],
  44654. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44655. referencedClasses: [],
  44656. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44657. }),
  44658. $globals.AIContext);
  44659. $core.addMethod(
  44660. $core.method({
  44661. selector: "basicLocalAt:",
  44662. protocol: "private",
  44663. fn: function (aString){
  44664. var self=this,$self=this;
  44665. return $core.withContext(function($ctx1) {
  44666. return $recv($self._locals())._at_(aString);
  44667. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44668. },
  44669. args: ["aString"],
  44670. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44671. referencedClasses: [],
  44672. messageSends: ["at:", "locals"]
  44673. }),
  44674. $globals.AIContext);
  44675. $core.addMethod(
  44676. $core.method({
  44677. selector: "basicLocalAt:put:",
  44678. protocol: "private",
  44679. fn: function (aString,anObject){
  44680. var self=this,$self=this;
  44681. return $core.withContext(function($ctx1) {
  44682. $recv($self._locals())._at_put_(aString,anObject);
  44683. return self;
  44684. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44685. },
  44686. args: ["aString", "anObject"],
  44687. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44688. referencedClasses: [],
  44689. messageSends: ["at:put:", "locals"]
  44690. }),
  44691. $globals.AIContext);
  44692. $core.addMethod(
  44693. $core.method({
  44694. selector: "basicReceiver",
  44695. protocol: "interpreting",
  44696. fn: function (){
  44697. var self=this,$self=this;
  44698. return $core.withContext(function($ctx1) {
  44699. return $self._localAt_("self");
  44700. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44701. },
  44702. args: [],
  44703. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44704. referencedClasses: [],
  44705. messageSends: ["localAt:"]
  44706. }),
  44707. $globals.AIContext);
  44708. $core.addMethod(
  44709. $core.method({
  44710. selector: "defineLocal:",
  44711. protocol: "accessing",
  44712. fn: function (aString){
  44713. var self=this,$self=this;
  44714. return $core.withContext(function($ctx1) {
  44715. $recv($self._locals())._at_put_(aString,nil);
  44716. return self;
  44717. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44718. },
  44719. args: ["aString"],
  44720. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44721. referencedClasses: [],
  44722. messageSends: ["at:put:", "locals"]
  44723. }),
  44724. $globals.AIContext);
  44725. $core.addMethod(
  44726. $core.method({
  44727. selector: "evaluate:on:",
  44728. protocol: "evaluating",
  44729. fn: function (aString,anEvaluator){
  44730. var self=this,$self=this;
  44731. return $core.withContext(function($ctx1) {
  44732. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44733. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44734. },
  44735. args: ["aString", "anEvaluator"],
  44736. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44737. referencedClasses: [],
  44738. messageSends: ["evaluate:context:"]
  44739. }),
  44740. $globals.AIContext);
  44741. $core.addMethod(
  44742. $core.method({
  44743. selector: "evaluateNode:",
  44744. protocol: "evaluating",
  44745. fn: function (aNode){
  44746. var self=this,$self=this;
  44747. return $core.withContext(function($ctx1) {
  44748. var $1;
  44749. $1=$recv($globals.ASTInterpreter)._new();
  44750. $recv($1)._context_(self);
  44751. $recv($1)._node_(aNode);
  44752. $recv($1)._enterNode();
  44753. $recv($1)._proceed();
  44754. return $recv($1)._result();
  44755. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44756. },
  44757. args: ["aNode"],
  44758. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44759. referencedClasses: ["ASTInterpreter"],
  44760. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44761. }),
  44762. $globals.AIContext);
  44763. $core.addMethod(
  44764. $core.method({
  44765. selector: "evaluatedSelector",
  44766. protocol: "accessing",
  44767. fn: function (){
  44768. var self=this,$self=this;
  44769. return $self["@evaluatedSelector"];
  44770. },
  44771. args: [],
  44772. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44773. referencedClasses: [],
  44774. messageSends: []
  44775. }),
  44776. $globals.AIContext);
  44777. $core.addMethod(
  44778. $core.method({
  44779. selector: "evaluatedSelector:",
  44780. protocol: "accessing",
  44781. fn: function (aString){
  44782. var self=this,$self=this;
  44783. $self["@evaluatedSelector"]=aString;
  44784. return self;
  44785. },
  44786. args: ["aString"],
  44787. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44788. referencedClasses: [],
  44789. messageSends: []
  44790. }),
  44791. $globals.AIContext);
  44792. $core.addMethod(
  44793. $core.method({
  44794. selector: "index",
  44795. protocol: "accessing",
  44796. fn: function (){
  44797. var self=this,$self=this;
  44798. return $core.withContext(function($ctx1) {
  44799. var $1,$receiver;
  44800. $1=$self["@index"];
  44801. if(($receiver = $1) == null || $receiver.a$nil){
  44802. return (0);
  44803. } else {
  44804. return $1;
  44805. }
  44806. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44807. },
  44808. args: [],
  44809. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44810. referencedClasses: [],
  44811. messageSends: ["ifNil:"]
  44812. }),
  44813. $globals.AIContext);
  44814. $core.addMethod(
  44815. $core.method({
  44816. selector: "index:",
  44817. protocol: "accessing",
  44818. fn: function (anInteger){
  44819. var self=this,$self=this;
  44820. $self["@index"]=anInteger;
  44821. return self;
  44822. },
  44823. args: ["anInteger"],
  44824. source: "index: anInteger\x0a\x09index := anInteger",
  44825. referencedClasses: [],
  44826. messageSends: []
  44827. }),
  44828. $globals.AIContext);
  44829. $core.addMethod(
  44830. $core.method({
  44831. selector: "initializeAST",
  44832. protocol: "initialization",
  44833. fn: function (){
  44834. var self=this,$self=this;
  44835. return $core.withContext(function($ctx1) {
  44836. var $1;
  44837. $1=$self._method();
  44838. $ctx1.sendIdx["method"]=1;
  44839. $self["@ast"]=$recv($1)._ast();
  44840. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44841. return self;
  44842. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44843. },
  44844. args: [],
  44845. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44846. referencedClasses: ["SemanticAnalyzer"],
  44847. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44848. }),
  44849. $globals.AIContext);
  44850. $core.addMethod(
  44851. $core.method({
  44852. selector: "initializeFromMethodContext:",
  44853. protocol: "initialization",
  44854. fn: function (aMethodContext){
  44855. var self=this,$self=this;
  44856. return $core.withContext(function($ctx1) {
  44857. var $1,$2,$3,$receiver;
  44858. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44859. $self._index_($recv(aMethodContext)._index());
  44860. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44861. $self._receiver_($recv(aMethodContext)._receiver());
  44862. $self._supercall_($recv(aMethodContext)._supercall());
  44863. $self._selector_($recv(aMethodContext)._selector());
  44864. $1=$recv(aMethodContext)._outerContext();
  44865. $ctx1.sendIdx["outerContext"]=1;
  44866. if(($receiver = $1) == null || $receiver.a$nil){
  44867. $1;
  44868. } else {
  44869. var outer;
  44870. outer=$receiver;
  44871. $2=$recv(outer)._methodContext();
  44872. if(($receiver = $2) == null || $receiver.a$nil){
  44873. $2;
  44874. } else {
  44875. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44876. }
  44877. $3=$recv(aMethodContext)._locals();
  44878. $ctx1.sendIdx["locals"]=1;
  44879. $recv($3)._keysAndValuesDo_((function(key,value){
  44880. return $core.withContext(function($ctx2) {
  44881. return $recv($self._locals())._at_put_(key,value);
  44882. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44883. }));
  44884. }
  44885. return self;
  44886. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44887. },
  44888. args: ["aMethodContext"],
  44889. 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 ] ]",
  44890. referencedClasses: [],
  44891. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44892. }),
  44893. $globals.AIContext);
  44894. $core.addMethod(
  44895. $core.method({
  44896. selector: "initializeInterpreter",
  44897. protocol: "initialization",
  44898. fn: function (){
  44899. var self=this,$self=this;
  44900. return $core.withContext(function($ctx1) {
  44901. var $1,$2,$receiver;
  44902. $1=$recv($globals.ASTInterpreter)._new();
  44903. $recv($1)._context_(self);
  44904. $self["@interpreter"]=$recv($1)._yourself();
  44905. $2=$self._innerContext();
  44906. if(($receiver = $2) == null || $receiver.a$nil){
  44907. $2;
  44908. } else {
  44909. $self._setupInterpreter_($self["@interpreter"]);
  44910. }
  44911. return self;
  44912. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44913. },
  44914. args: [],
  44915. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44916. referencedClasses: ["ASTInterpreter"],
  44917. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44918. }),
  44919. $globals.AIContext);
  44920. $core.addMethod(
  44921. $core.method({
  44922. selector: "initializeLocals",
  44923. protocol: "initialization",
  44924. fn: function (){
  44925. var self=this,$self=this;
  44926. return $core.withContext(function($ctx1) {
  44927. $self["@locals"]=$recv($globals.Dictionary)._new();
  44928. $recv($self["@locals"])._at_put_("thisContext",self);
  44929. return self;
  44930. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44931. },
  44932. args: [],
  44933. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44934. referencedClasses: ["Dictionary"],
  44935. messageSends: ["new", "at:put:"]
  44936. }),
  44937. $globals.AIContext);
  44938. $core.addMethod(
  44939. $core.method({
  44940. selector: "innerContext",
  44941. protocol: "accessing",
  44942. fn: function (){
  44943. var self=this,$self=this;
  44944. return $self["@innerContext"];
  44945. },
  44946. args: [],
  44947. source: "innerContext\x0a\x09^ innerContext",
  44948. referencedClasses: [],
  44949. messageSends: []
  44950. }),
  44951. $globals.AIContext);
  44952. $core.addMethod(
  44953. $core.method({
  44954. selector: "innerContext:",
  44955. protocol: "accessing",
  44956. fn: function (anAIContext){
  44957. var self=this,$self=this;
  44958. $self["@innerContext"]=anAIContext;
  44959. return self;
  44960. },
  44961. args: ["anAIContext"],
  44962. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44963. referencedClasses: [],
  44964. messageSends: []
  44965. }),
  44966. $globals.AIContext);
  44967. $core.addMethod(
  44968. $core.method({
  44969. selector: "interpreter",
  44970. protocol: "interpreting",
  44971. fn: function (){
  44972. var self=this,$self=this;
  44973. return $core.withContext(function($ctx1) {
  44974. var $1,$receiver;
  44975. $1=$self["@interpreter"];
  44976. if(($receiver = $1) == null || $receiver.a$nil){
  44977. $self._initializeInterpreter();
  44978. } else {
  44979. $1;
  44980. }
  44981. return $self["@interpreter"];
  44982. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  44983. },
  44984. args: [],
  44985. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  44986. referencedClasses: [],
  44987. messageSends: ["ifNil:", "initializeInterpreter"]
  44988. }),
  44989. $globals.AIContext);
  44990. $core.addMethod(
  44991. $core.method({
  44992. selector: "interpreter:",
  44993. protocol: "interpreting",
  44994. fn: function (anInterpreter){
  44995. var self=this,$self=this;
  44996. $self["@interpreter"]=anInterpreter;
  44997. return self;
  44998. },
  44999. args: ["anInterpreter"],
  45000. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  45001. referencedClasses: [],
  45002. messageSends: []
  45003. }),
  45004. $globals.AIContext);
  45005. $core.addMethod(
  45006. $core.method({
  45007. selector: "isTopContext",
  45008. protocol: "testing",
  45009. fn: function (){
  45010. var self=this,$self=this;
  45011. return $core.withContext(function($ctx1) {
  45012. return $recv($self._innerContext())._isNil();
  45013. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  45014. },
  45015. args: [],
  45016. source: "isTopContext\x0a\x09^ self innerContext isNil",
  45017. referencedClasses: [],
  45018. messageSends: ["isNil", "innerContext"]
  45019. }),
  45020. $globals.AIContext);
  45021. $core.addMethod(
  45022. $core.method({
  45023. selector: "localAt:",
  45024. protocol: "accessing",
  45025. fn: function (aString){
  45026. var self=this,$self=this;
  45027. var context;
  45028. return $core.withContext(function($ctx1) {
  45029. context=$self._lookupContextForLocal_(aString);
  45030. return $recv(context)._basicLocalAt_(aString);
  45031. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  45032. },
  45033. args: ["aString"],
  45034. 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",
  45035. referencedClasses: [],
  45036. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  45037. }),
  45038. $globals.AIContext);
  45039. $core.addMethod(
  45040. $core.method({
  45041. selector: "localAt:ifAbsent:",
  45042. protocol: "accessing",
  45043. fn: function (aString,aBlock){
  45044. var self=this,$self=this;
  45045. var context;
  45046. return $core.withContext(function($ctx1) {
  45047. var $early={};
  45048. try {
  45049. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  45050. return $core.withContext(function($ctx2) {
  45051. throw $early=[$recv(aBlock)._value()];
  45052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45053. }));
  45054. return $recv(context)._basicLocalAt_(aString);
  45055. }
  45056. catch(e) {if(e===$early)return e[0]; throw e}
  45057. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  45058. },
  45059. args: ["aString", "aBlock"],
  45060. 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",
  45061. referencedClasses: [],
  45062. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  45063. }),
  45064. $globals.AIContext);
  45065. $core.addMethod(
  45066. $core.method({
  45067. selector: "localAt:put:",
  45068. protocol: "accessing",
  45069. fn: function (aString,anObject){
  45070. var self=this,$self=this;
  45071. var context;
  45072. return $core.withContext(function($ctx1) {
  45073. context=$self._lookupContextForLocal_(aString);
  45074. $recv(context)._basicLocalAt_put_(aString,anObject);
  45075. return self;
  45076. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  45077. },
  45078. args: ["aString", "anObject"],
  45079. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  45080. referencedClasses: [],
  45081. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  45082. }),
  45083. $globals.AIContext);
  45084. $core.addMethod(
  45085. $core.method({
  45086. selector: "locals",
  45087. protocol: "accessing",
  45088. fn: function (){
  45089. var self=this,$self=this;
  45090. return $core.withContext(function($ctx1) {
  45091. var $1,$receiver;
  45092. $1=$self["@locals"];
  45093. if(($receiver = $1) == null || $receiver.a$nil){
  45094. $self._initializeLocals();
  45095. } else {
  45096. $1;
  45097. }
  45098. return $self["@locals"];
  45099. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  45100. },
  45101. args: [],
  45102. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  45103. referencedClasses: [],
  45104. messageSends: ["ifNil:", "initializeLocals"]
  45105. }),
  45106. $globals.AIContext);
  45107. $core.addMethod(
  45108. $core.method({
  45109. selector: "lookupContextForLocal:",
  45110. protocol: "private",
  45111. fn: function (aString){
  45112. var self=this,$self=this;
  45113. return $core.withContext(function($ctx1) {
  45114. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  45115. return $core.withContext(function($ctx2) {
  45116. return $self._variableNotFound();
  45117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45118. }));
  45119. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  45120. },
  45121. args: ["aString"],
  45122. 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 ]",
  45123. referencedClasses: [],
  45124. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  45125. }),
  45126. $globals.AIContext);
  45127. $core.addMethod(
  45128. $core.method({
  45129. selector: "lookupContextForLocal:ifNone:",
  45130. protocol: "private",
  45131. fn: function (aString,aBlock){
  45132. var self=this,$self=this;
  45133. return $core.withContext(function($ctx1) {
  45134. var $1;
  45135. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  45136. return self;
  45137. }),(function(){
  45138. return $core.withContext(function($ctx2) {
  45139. $1=$self._outerContext();
  45140. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  45141. return $core.withContext(function($ctx3) {
  45142. return $recv(context)._lookupContextForLocal_(aString);
  45143. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  45144. }));
  45145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45146. }));
  45147. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  45148. },
  45149. args: ["aString", "aBlock"],
  45150. 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 ] ]",
  45151. referencedClasses: [],
  45152. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  45153. }),
  45154. $globals.AIContext);
  45155. $core.addMethod(
  45156. $core.method({
  45157. selector: "newInnerContext",
  45158. protocol: "factory",
  45159. fn: function (){
  45160. var self=this,$self=this;
  45161. return $core.withContext(function($ctx1) {
  45162. var $1;
  45163. $1=$recv($self._class())._new();
  45164. $recv($1)._outerContext_(self);
  45165. return $recv($1)._yourself();
  45166. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  45167. },
  45168. args: [],
  45169. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  45170. referencedClasses: [],
  45171. messageSends: ["outerContext:", "new", "class", "yourself"]
  45172. }),
  45173. $globals.AIContext);
  45174. $core.addMethod(
  45175. $core.method({
  45176. selector: "outerContext",
  45177. protocol: "accessing",
  45178. fn: function (){
  45179. var self=this,$self=this;
  45180. return $self["@outerContext"];
  45181. },
  45182. args: [],
  45183. source: "outerContext\x0a\x09^ outerContext",
  45184. referencedClasses: [],
  45185. messageSends: []
  45186. }),
  45187. $globals.AIContext);
  45188. $core.addMethod(
  45189. $core.method({
  45190. selector: "outerContext:",
  45191. protocol: "accessing",
  45192. fn: function (anAIContext){
  45193. var self=this,$self=this;
  45194. return $core.withContext(function($ctx1) {
  45195. var $1,$receiver;
  45196. $self["@outerContext"]=anAIContext;
  45197. $1=$self["@outerContext"];
  45198. if(($receiver = $1) == null || $receiver.a$nil){
  45199. $1;
  45200. } else {
  45201. var context;
  45202. context=$receiver;
  45203. $recv(context)._innerContext_(self);
  45204. }
  45205. return self;
  45206. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  45207. },
  45208. args: ["anAIContext"],
  45209. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  45210. referencedClasses: [],
  45211. messageSends: ["ifNotNil:", "innerContext:"]
  45212. }),
  45213. $globals.AIContext);
  45214. $core.addMethod(
  45215. $core.method({
  45216. selector: "receiver:",
  45217. protocol: "interpreting",
  45218. fn: function (anObject){
  45219. var self=this,$self=this;
  45220. return $core.withContext(function($ctx1) {
  45221. $recv($self._locals())._at_put_("self",anObject);
  45222. return self;
  45223. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  45224. },
  45225. args: ["anObject"],
  45226. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  45227. referencedClasses: [],
  45228. messageSends: ["at:put:", "locals"]
  45229. }),
  45230. $globals.AIContext);
  45231. $core.addMethod(
  45232. $core.method({
  45233. selector: "selector",
  45234. protocol: "accessing",
  45235. fn: function (){
  45236. var self=this,$self=this;
  45237. return $self["@selector"];
  45238. },
  45239. args: [],
  45240. source: "selector\x0a\x09^ selector",
  45241. referencedClasses: [],
  45242. messageSends: []
  45243. }),
  45244. $globals.AIContext);
  45245. $core.addMethod(
  45246. $core.method({
  45247. selector: "selector:",
  45248. protocol: "accessing",
  45249. fn: function (aString){
  45250. var self=this,$self=this;
  45251. $self["@selector"]=aString;
  45252. return self;
  45253. },
  45254. args: ["aString"],
  45255. source: "selector: aString\x0a\x09selector := aString",
  45256. referencedClasses: [],
  45257. messageSends: []
  45258. }),
  45259. $globals.AIContext);
  45260. $core.addMethod(
  45261. $core.method({
  45262. selector: "sendIndexAt:",
  45263. protocol: "accessing",
  45264. fn: function (aString){
  45265. var self=this,$self=this;
  45266. return $core.withContext(function($ctx1) {
  45267. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  45268. return (0);
  45269. }));
  45270. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  45271. },
  45272. args: ["aString"],
  45273. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  45274. referencedClasses: [],
  45275. messageSends: ["at:ifAbsent:", "sendIndexes"]
  45276. }),
  45277. $globals.AIContext);
  45278. $core.addMethod(
  45279. $core.method({
  45280. selector: "sendIndexes",
  45281. protocol: "accessing",
  45282. fn: function (){
  45283. var self=this,$self=this;
  45284. return $core.withContext(function($ctx1) {
  45285. var $1,$receiver;
  45286. $1=$self["@sendIndexes"];
  45287. if(($receiver = $1) == null || $receiver.a$nil){
  45288. return $recv($globals.Dictionary)._new();
  45289. } else {
  45290. return $1;
  45291. }
  45292. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  45293. },
  45294. args: [],
  45295. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  45296. referencedClasses: ["Dictionary"],
  45297. messageSends: ["ifNil:", "new"]
  45298. }),
  45299. $globals.AIContext);
  45300. $core.addMethod(
  45301. $core.method({
  45302. selector: "sendIndexes:",
  45303. protocol: "accessing",
  45304. fn: function (aDictionary){
  45305. var self=this,$self=this;
  45306. $self["@sendIndexes"]=aDictionary;
  45307. return self;
  45308. },
  45309. args: ["aDictionary"],
  45310. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  45311. referencedClasses: [],
  45312. messageSends: []
  45313. }),
  45314. $globals.AIContext);
  45315. $core.addMethod(
  45316. $core.method({
  45317. selector: "setupInterpreter:",
  45318. protocol: "interpreting",
  45319. fn: function (anInterpreter){
  45320. var self=this,$self=this;
  45321. var currentNode;
  45322. return $core.withContext(function($ctx1) {
  45323. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  45324. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45325. $2=$self._evaluatedSelector();
  45326. $ctx1.sendIdx["evaluatedSelector"]=1;
  45327. $recv($1)._selector_($2);
  45328. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  45329. $3=$self._ast();
  45330. $ctx1.sendIdx["ast"]=1;
  45331. $recv($1)._visit_($3);
  45332. currentNode=$recv($1)._currentNode();
  45333. $4=$recv($self._ast())._sequenceNode();
  45334. if(($receiver = $4) == null || $receiver.a$nil){
  45335. $4;
  45336. } else {
  45337. var sequence;
  45338. sequence=$receiver;
  45339. $recv($recv(sequence)._temps())._do_((function(each){
  45340. return $core.withContext(function($ctx2) {
  45341. return $self._defineLocal_(each);
  45342. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45343. }));
  45344. $ctx1.sendIdx["do:"]=1;
  45345. }
  45346. $recv(anInterpreter)._node_(currentNode);
  45347. $7=$self._innerContext();
  45348. $ctx1.sendIdx["innerContext"]=1;
  45349. $6=$recv($7)._arguments();
  45350. $5=$recv($6)._reversed();
  45351. $recv($5)._do_((function(each){
  45352. return $core.withContext(function($ctx2) {
  45353. return $recv(anInterpreter)._push_(each);
  45354. $ctx2.sendIdx["push:"]=1;
  45355. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  45356. }));
  45357. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  45358. return self;
  45359. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  45360. },
  45361. args: ["anInterpreter"],
  45362. 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)",
  45363. referencedClasses: ["ASTPCNodeVisitor"],
  45364. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  45365. }),
  45366. $globals.AIContext);
  45367. $core.addMethod(
  45368. $core.method({
  45369. selector: "supercall",
  45370. protocol: "interpreting",
  45371. fn: function (){
  45372. var self=this,$self=this;
  45373. return $core.withContext(function($ctx1) {
  45374. var $1,$receiver;
  45375. $1=$self["@supercall"];
  45376. if(($receiver = $1) == null || $receiver.a$nil){
  45377. return false;
  45378. } else {
  45379. return $1;
  45380. }
  45381. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  45382. },
  45383. args: [],
  45384. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  45385. referencedClasses: [],
  45386. messageSends: ["ifNil:"]
  45387. }),
  45388. $globals.AIContext);
  45389. $core.addMethod(
  45390. $core.method({
  45391. selector: "supercall:",
  45392. protocol: "interpreting",
  45393. fn: function (aBoolean){
  45394. var self=this,$self=this;
  45395. $self["@supercall"]=aBoolean;
  45396. return self;
  45397. },
  45398. args: ["aBoolean"],
  45399. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  45400. referencedClasses: [],
  45401. messageSends: []
  45402. }),
  45403. $globals.AIContext);
  45404. $core.addMethod(
  45405. $core.method({
  45406. selector: "variableNotFound",
  45407. protocol: "error handling",
  45408. fn: function (){
  45409. var self=this,$self=this;
  45410. return $core.withContext(function($ctx1) {
  45411. $self._error_("Variable missing");
  45412. return self;
  45413. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  45414. },
  45415. args: [],
  45416. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  45417. referencedClasses: [],
  45418. messageSends: ["error:"]
  45419. }),
  45420. $globals.AIContext);
  45421. $core.addMethod(
  45422. $core.method({
  45423. selector: "fromMethodContext:",
  45424. protocol: "instance creation",
  45425. fn: function (aMethodContext){
  45426. var self=this,$self=this;
  45427. return $core.withContext(function($ctx1) {
  45428. var $1;
  45429. $1=$self._new();
  45430. $recv($1)._initializeFromMethodContext_(aMethodContext);
  45431. return $recv($1)._yourself();
  45432. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  45433. },
  45434. args: ["aMethodContext"],
  45435. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  45436. referencedClasses: [],
  45437. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  45438. }),
  45439. $globals.AIContext.a$cls);
  45440. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  45441. $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.";
  45442. $core.addMethod(
  45443. $core.method({
  45444. selector: "context",
  45445. protocol: "accessing",
  45446. fn: function (){
  45447. var self=this,$self=this;
  45448. return $self["@context"];
  45449. },
  45450. args: [],
  45451. source: "context\x0a\x09^ context",
  45452. referencedClasses: [],
  45453. messageSends: []
  45454. }),
  45455. $globals.AISemanticAnalyzer);
  45456. $core.addMethod(
  45457. $core.method({
  45458. selector: "context:",
  45459. protocol: "accessing",
  45460. fn: function (anAIContext){
  45461. var self=this,$self=this;
  45462. $self["@context"]=anAIContext;
  45463. return self;
  45464. },
  45465. args: ["anAIContext"],
  45466. source: "context: anAIContext\x0a\x09context := anAIContext",
  45467. referencedClasses: [],
  45468. messageSends: []
  45469. }),
  45470. $globals.AISemanticAnalyzer);
  45471. $core.addMethod(
  45472. $core.method({
  45473. selector: "visitVariableNode:",
  45474. protocol: "visiting",
  45475. fn: function (aNode){
  45476. var self=this,$self=this;
  45477. return $core.withContext(function($ctx1) {
  45478. var $1;
  45479. var $early={};
  45480. try {
  45481. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45482. return $core.withContext(function($ctx2) {
  45483. $1=(
  45484. $ctx2.supercall = true,
  45485. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45486. $ctx2.supercall = false;
  45487. throw $early=[$1];
  45488. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45489. }));
  45490. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45491. return self;
  45492. }
  45493. catch(e) {if(e===$early)return e[0]; throw e}
  45494. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45495. },
  45496. args: ["aNode"],
  45497. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45498. referencedClasses: ["ASTContextVar"],
  45499. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45500. }),
  45501. $globals.AISemanticAnalyzer);
  45502. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45503. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45504. $core.addMethod(
  45505. $core.method({
  45506. selector: "context",
  45507. protocol: "accessing",
  45508. fn: function (){
  45509. var self=this,$self=this;
  45510. return $self["@context"];
  45511. },
  45512. args: [],
  45513. source: "context\x0a\x09^ context",
  45514. referencedClasses: [],
  45515. messageSends: []
  45516. }),
  45517. $globals.ASTContextVar);
  45518. $core.addMethod(
  45519. $core.method({
  45520. selector: "context:",
  45521. protocol: "accessing",
  45522. fn: function (anObject){
  45523. var self=this,$self=this;
  45524. $self["@context"]=anObject;
  45525. return self;
  45526. },
  45527. args: ["anObject"],
  45528. source: "context: anObject\x0a\x09context := anObject",
  45529. referencedClasses: [],
  45530. messageSends: []
  45531. }),
  45532. $globals.ASTContextVar);
  45533. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45534. $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.";
  45535. $core.addMethod(
  45536. $core.method({
  45537. selector: "atEnd",
  45538. protocol: "testing",
  45539. fn: function (){
  45540. var self=this,$self=this;
  45541. return $core.withContext(function($ctx1) {
  45542. var $1,$receiver;
  45543. $1=$self._context();
  45544. $ctx1.sendIdx["context"]=1;
  45545. if(($receiver = $1) == null || $receiver.a$nil){
  45546. return true;
  45547. } else {
  45548. $1;
  45549. }
  45550. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45551. return $core.withContext(function($ctx2) {
  45552. return $recv($self._context())._isTopContext();
  45553. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45554. }));
  45555. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45556. },
  45557. args: [],
  45558. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45559. referencedClasses: [],
  45560. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45561. }),
  45562. $globals.ASTDebugger);
  45563. $core.addMethod(
  45564. $core.method({
  45565. selector: "context",
  45566. protocol: "accessing",
  45567. fn: function (){
  45568. var self=this,$self=this;
  45569. return $self["@context"];
  45570. },
  45571. args: [],
  45572. source: "context\x0a\x09^ context",
  45573. referencedClasses: [],
  45574. messageSends: []
  45575. }),
  45576. $globals.ASTDebugger);
  45577. $core.addMethod(
  45578. $core.method({
  45579. selector: "context:",
  45580. protocol: "accessing",
  45581. fn: function (aContext){
  45582. var self=this,$self=this;
  45583. $self["@context"]=aContext;
  45584. return self;
  45585. },
  45586. args: ["aContext"],
  45587. source: "context: aContext\x0a\x09context := aContext",
  45588. referencedClasses: [],
  45589. messageSends: []
  45590. }),
  45591. $globals.ASTDebugger);
  45592. $core.addMethod(
  45593. $core.method({
  45594. selector: "flushInnerContexts",
  45595. protocol: "actions",
  45596. fn: function (){
  45597. var self=this,$self=this;
  45598. return $core.withContext(function($ctx1) {
  45599. var $1,$receiver;
  45600. $1=$self._context();
  45601. if(($receiver = $1) == null || $receiver.a$nil){
  45602. $1;
  45603. } else {
  45604. var cxt;
  45605. cxt=$receiver;
  45606. $recv(cxt)._innerContext_(nil);
  45607. }
  45608. return self;
  45609. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45610. },
  45611. args: [],
  45612. 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 ]",
  45613. referencedClasses: [],
  45614. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45615. }),
  45616. $globals.ASTDebugger);
  45617. $core.addMethod(
  45618. $core.method({
  45619. selector: "interpreter",
  45620. protocol: "accessing",
  45621. fn: function (){
  45622. var self=this,$self=this;
  45623. return $core.withContext(function($ctx1) {
  45624. var $1,$receiver;
  45625. $1=$self._context();
  45626. if(($receiver = $1) == null || $receiver.a$nil){
  45627. return $1;
  45628. } else {
  45629. var ctx;
  45630. ctx=$receiver;
  45631. return $recv(ctx)._interpreter();
  45632. }
  45633. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45634. },
  45635. args: [],
  45636. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45637. referencedClasses: [],
  45638. messageSends: ["ifNotNil:", "context", "interpreter"]
  45639. }),
  45640. $globals.ASTDebugger);
  45641. $core.addMethod(
  45642. $core.method({
  45643. selector: "method",
  45644. protocol: "accessing",
  45645. fn: function (){
  45646. var self=this,$self=this;
  45647. return $core.withContext(function($ctx1) {
  45648. return $recv($self._context())._method();
  45649. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45650. },
  45651. args: [],
  45652. source: "method\x0a\x09^ self context method",
  45653. referencedClasses: [],
  45654. messageSends: ["method", "context"]
  45655. }),
  45656. $globals.ASTDebugger);
  45657. $core.addMethod(
  45658. $core.method({
  45659. selector: "node",
  45660. protocol: "accessing",
  45661. fn: function (){
  45662. var self=this,$self=this;
  45663. return $core.withContext(function($ctx1) {
  45664. var $1,$receiver;
  45665. $1=$self._interpreter();
  45666. $ctx1.sendIdx["interpreter"]=1;
  45667. if(($receiver = $1) == null || $receiver.a$nil){
  45668. return $1;
  45669. } else {
  45670. return $recv($self._interpreter())._node();
  45671. }
  45672. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45673. },
  45674. args: [],
  45675. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45676. referencedClasses: [],
  45677. messageSends: ["ifNotNil:", "interpreter", "node"]
  45678. }),
  45679. $globals.ASTDebugger);
  45680. $core.addMethod(
  45681. $core.method({
  45682. selector: "onStep",
  45683. protocol: "private",
  45684. fn: function (){
  45685. var self=this,$self=this;
  45686. return $core.withContext(function($ctx1) {
  45687. var $1,$3,$2,$4,$6,$5,$receiver;
  45688. $1=$self._interpreter();
  45689. $ctx1.sendIdx["interpreter"]=1;
  45690. $self["@result"]=$recv($1)._result();
  45691. $3=$self._interpreter();
  45692. $ctx1.sendIdx["interpreter"]=2;
  45693. $2=$recv($3)._atEnd();
  45694. $ctx1.sendIdx["atEnd"]=1;
  45695. if($core.assert($2)){
  45696. $4=$recv($self._context())._outerContext();
  45697. if(($receiver = $4) == null || $receiver.a$nil){
  45698. $4;
  45699. } else {
  45700. var outerContext;
  45701. outerContext=$receiver;
  45702. $self._context_(outerContext);
  45703. }
  45704. $6=$self._interpreter();
  45705. $ctx1.sendIdx["interpreter"]=3;
  45706. $5=$recv($6)._atEnd();
  45707. if(!$core.assert($5)){
  45708. $recv($self._interpreter())._skip();
  45709. }
  45710. }
  45711. $self._flushInnerContexts();
  45712. return self;
  45713. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45714. },
  45715. args: [],
  45716. 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",
  45717. referencedClasses: [],
  45718. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45719. }),
  45720. $globals.ASTDebugger);
  45721. $core.addMethod(
  45722. $core.method({
  45723. selector: "proceed",
  45724. protocol: "stepping",
  45725. fn: function (){
  45726. var self=this,$self=this;
  45727. return $core.withContext(function($ctx1) {
  45728. $recv((function(){
  45729. return $core.withContext(function($ctx2) {
  45730. return $self._atEnd();
  45731. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45732. }))._whileFalse_((function(){
  45733. return $core.withContext(function($ctx2) {
  45734. return $self._stepOver();
  45735. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45736. }));
  45737. return self;
  45738. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45739. },
  45740. args: [],
  45741. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45742. referencedClasses: [],
  45743. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45744. }),
  45745. $globals.ASTDebugger);
  45746. $core.addMethod(
  45747. $core.method({
  45748. selector: "restart",
  45749. protocol: "stepping",
  45750. fn: function (){
  45751. var self=this,$self=this;
  45752. return $core.withContext(function($ctx1) {
  45753. $recv($self._interpreter())._restart();
  45754. $self._flushInnerContexts();
  45755. return self;
  45756. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45757. },
  45758. args: [],
  45759. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45760. referencedClasses: [],
  45761. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45762. }),
  45763. $globals.ASTDebugger);
  45764. $core.addMethod(
  45765. $core.method({
  45766. selector: "result",
  45767. protocol: "accessing",
  45768. fn: function (){
  45769. var self=this,$self=this;
  45770. return $self["@result"];
  45771. },
  45772. args: [],
  45773. source: "result\x0a\x09^ result",
  45774. referencedClasses: [],
  45775. messageSends: []
  45776. }),
  45777. $globals.ASTDebugger);
  45778. $core.addMethod(
  45779. $core.method({
  45780. selector: "stepInto",
  45781. protocol: "stepping",
  45782. fn: function (){
  45783. var self=this,$self=this;
  45784. return $core.withContext(function($ctx1) {
  45785. $self._shouldBeImplemented();
  45786. return self;
  45787. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45788. },
  45789. args: [],
  45790. source: "stepInto\x0a\x09self shouldBeImplemented",
  45791. referencedClasses: [],
  45792. messageSends: ["shouldBeImplemented"]
  45793. }),
  45794. $globals.ASTDebugger);
  45795. $core.addMethod(
  45796. $core.method({
  45797. selector: "stepOver",
  45798. protocol: "stepping",
  45799. fn: function (){
  45800. var self=this,$self=this;
  45801. return $core.withContext(function($ctx1) {
  45802. var $1,$2;
  45803. $1=$recv($self._context())._isTopContext();
  45804. if($core.assert($1)){
  45805. $recv($self._interpreter())._stepOver();
  45806. } else {
  45807. $2=$self._interpreter();
  45808. $ctx1.sendIdx["interpreter"]=1;
  45809. $recv($2)._skip();
  45810. }
  45811. $self._onStep();
  45812. return self;
  45813. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45814. },
  45815. args: [],
  45816. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45817. referencedClasses: [],
  45818. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45819. }),
  45820. $globals.ASTDebugger);
  45821. $core.addMethod(
  45822. $core.method({
  45823. selector: "context:",
  45824. protocol: "instance creation",
  45825. fn: function (aContext){
  45826. var self=this,$self=this;
  45827. return $core.withContext(function($ctx1) {
  45828. var $1;
  45829. $1=$self._new();
  45830. $recv($1)._context_(aContext);
  45831. return $recv($1)._yourself();
  45832. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45833. },
  45834. args: ["aContext"],
  45835. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45836. referencedClasses: [],
  45837. messageSends: ["context:", "new", "yourself"]
  45838. }),
  45839. $globals.ASTDebugger.a$cls);
  45840. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45841. $core.addMethod(
  45842. $core.method({
  45843. selector: "interpreter",
  45844. protocol: "accessing",
  45845. fn: function (){
  45846. var self=this,$self=this;
  45847. return $self["@interpreter"];
  45848. },
  45849. args: [],
  45850. source: "interpreter\x0a\x09^ interpreter",
  45851. referencedClasses: [],
  45852. messageSends: []
  45853. }),
  45854. $globals.ASTEnterNode);
  45855. $core.addMethod(
  45856. $core.method({
  45857. selector: "interpreter:",
  45858. protocol: "accessing",
  45859. fn: function (anObject){
  45860. var self=this,$self=this;
  45861. $self["@interpreter"]=anObject;
  45862. return self;
  45863. },
  45864. args: ["anObject"],
  45865. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45866. referencedClasses: [],
  45867. messageSends: []
  45868. }),
  45869. $globals.ASTEnterNode);
  45870. $core.addMethod(
  45871. $core.method({
  45872. selector: "visitBlockNode:",
  45873. protocol: "visiting",
  45874. fn: function (aNode){
  45875. var self=this,$self=this;
  45876. return aNode;
  45877. },
  45878. args: ["aNode"],
  45879. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45880. referencedClasses: [],
  45881. messageSends: []
  45882. }),
  45883. $globals.ASTEnterNode);
  45884. $core.addMethod(
  45885. $core.method({
  45886. selector: "visitDagNode:",
  45887. protocol: "visiting",
  45888. fn: function (aNode){
  45889. var self=this,$self=this;
  45890. return $core.withContext(function($ctx1) {
  45891. var $early={};
  45892. try {
  45893. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45894. throw $early=[aNode];
  45895. }),(function(nodes){
  45896. return $core.withContext(function($ctx2) {
  45897. throw $early=[$self._visit_($recv(nodes)._first())];
  45898. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45899. }));
  45900. return self;
  45901. }
  45902. catch(e) {if(e===$early)return e[0]; throw e}
  45903. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45904. },
  45905. args: ["aNode"],
  45906. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45907. referencedClasses: [],
  45908. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45909. }),
  45910. $globals.ASTEnterNode);
  45911. $core.addMethod(
  45912. $core.method({
  45913. selector: "visitSequenceNode:",
  45914. protocol: "visiting",
  45915. fn: function (aNode){
  45916. var self=this,$self=this;
  45917. return $core.withContext(function($ctx1) {
  45918. var $1;
  45919. $recv($recv(aNode)._temps())._do_((function(each){
  45920. return $core.withContext(function($ctx2) {
  45921. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45922. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45923. }));
  45924. $1=(
  45925. $ctx1.supercall = true,
  45926. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45927. $ctx1.supercall = false;
  45928. return $1;
  45929. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45930. },
  45931. args: ["aNode"],
  45932. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45933. referencedClasses: [],
  45934. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45935. }),
  45936. $globals.ASTEnterNode);
  45937. $core.addMethod(
  45938. $core.method({
  45939. selector: "on:",
  45940. protocol: "instance creation",
  45941. fn: function (anInterpreter){
  45942. var self=this,$self=this;
  45943. return $core.withContext(function($ctx1) {
  45944. var $1;
  45945. $1=$self._new();
  45946. $recv($1)._interpreter_(anInterpreter);
  45947. return $recv($1)._yourself();
  45948. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45949. },
  45950. args: ["anInterpreter"],
  45951. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45952. referencedClasses: [],
  45953. messageSends: ["interpreter:", "new", "yourself"]
  45954. }),
  45955. $globals.ASTEnterNode.a$cls);
  45956. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45957. $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";
  45958. $core.addMethod(
  45959. $core.method({
  45960. selector: "assign:to:",
  45961. protocol: "private",
  45962. fn: function (aNode,anObject){
  45963. var self=this,$self=this;
  45964. return $core.withContext(function($ctx1) {
  45965. var $1,$3,$2,$4;
  45966. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45967. if($core.assert($1)){
  45968. $3=$self._context();
  45969. $ctx1.sendIdx["context"]=1;
  45970. $2=$recv($3)._receiver();
  45971. $4=$recv(aNode)._value();
  45972. $ctx1.sendIdx["value"]=1;
  45973. $recv($2)._instVarAt_put_($4,anObject);
  45974. } else {
  45975. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  45976. }
  45977. return self;
  45978. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  45979. },
  45980. args: ["aNode", "anObject"],
  45981. 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 ]",
  45982. referencedClasses: [],
  45983. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  45984. }),
  45985. $globals.ASTInterpreter);
  45986. $core.addMethod(
  45987. $core.method({
  45988. selector: "atEnd",
  45989. protocol: "testing",
  45990. fn: function (){
  45991. var self=this,$self=this;
  45992. return $core.withContext(function($ctx1) {
  45993. var $1;
  45994. $1=$self["@forceAtEnd"];
  45995. if($core.assert($1)){
  45996. return true;
  45997. }
  45998. return $recv($self._hasReturned())._or_((function(){
  45999. return $core.withContext(function($ctx2) {
  46000. return $recv($self._node())._isNil();
  46001. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46002. }));
  46003. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  46004. },
  46005. args: [],
  46006. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  46007. referencedClasses: [],
  46008. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  46009. }),
  46010. $globals.ASTInterpreter);
  46011. $core.addMethod(
  46012. $core.method({
  46013. selector: "context",
  46014. protocol: "accessing",
  46015. fn: function (){
  46016. var self=this,$self=this;
  46017. return $self["@context"];
  46018. },
  46019. args: [],
  46020. source: "context\x0a\x09^ context",
  46021. referencedClasses: [],
  46022. messageSends: []
  46023. }),
  46024. $globals.ASTInterpreter);
  46025. $core.addMethod(
  46026. $core.method({
  46027. selector: "context:",
  46028. protocol: "accessing",
  46029. fn: function (aContext){
  46030. var self=this,$self=this;
  46031. $self["@context"]=aContext;
  46032. return self;
  46033. },
  46034. args: ["aContext"],
  46035. source: "context: aContext\x0a\x09context := aContext",
  46036. referencedClasses: [],
  46037. messageSends: []
  46038. }),
  46039. $globals.ASTInterpreter);
  46040. $core.addMethod(
  46041. $core.method({
  46042. selector: "enterNode",
  46043. protocol: "interpreting",
  46044. fn: function (){
  46045. var self=this,$self=this;
  46046. return $core.withContext(function($ctx1) {
  46047. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  46048. return self;
  46049. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  46050. },
  46051. args: [],
  46052. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  46053. referencedClasses: ["ASTEnterNode"],
  46054. messageSends: ["node:", "visit:", "on:", "node"]
  46055. }),
  46056. $globals.ASTInterpreter);
  46057. $core.addMethod(
  46058. $core.method({
  46059. selector: "eval:",
  46060. protocol: "private",
  46061. fn: function (aString){
  46062. var self=this,$self=this;
  46063. var source,function_;
  46064. return $core.withContext(function($ctx1) {
  46065. var $3,$2,$1;
  46066. source=$recv($globals.String)._streamContents_((function(str){
  46067. return $core.withContext(function($ctx2) {
  46068. $recv(str)._nextPutAll_("0,(function(");
  46069. $ctx2.sendIdx["nextPutAll:"]=1;
  46070. $3=$self._context();
  46071. $ctx2.sendIdx["context"]=1;
  46072. $2=$recv($3)._locals();
  46073. $ctx2.sendIdx["locals"]=1;
  46074. $1=$recv($2)._keys();
  46075. $recv($1)._do_separatedBy_((function(each){
  46076. return $core.withContext(function($ctx3) {
  46077. return $recv(str)._nextPutAll_(each);
  46078. $ctx3.sendIdx["nextPutAll:"]=2;
  46079. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  46080. }),(function(){
  46081. return $core.withContext(function($ctx3) {
  46082. return $recv(str)._nextPutAll_(",");
  46083. $ctx3.sendIdx["nextPutAll:"]=3;
  46084. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  46085. }));
  46086. $recv(str)._nextPutAll_("){ return (function() {");
  46087. $ctx2.sendIdx["nextPutAll:"]=4;
  46088. $recv(str)._nextPutAll_(aString);
  46089. $ctx2.sendIdx["nextPutAll:"]=5;
  46090. return $recv(str)._nextPutAll_("})()})");
  46091. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  46092. }));
  46093. function_=$recv($globals.Compiler)._eval_(source);
  46094. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  46095. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  46096. },
  46097. args: ["aString"],
  46098. 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 eval: source.\x0a\x09\x0a\x09^ function valueWithPossibleArguments: self context locals values",
  46099. referencedClasses: ["String", "Compiler"],
  46100. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  46101. }),
  46102. $globals.ASTInterpreter);
  46103. $core.addMethod(
  46104. $core.method({
  46105. selector: "hasReturned",
  46106. protocol: "testing",
  46107. fn: function (){
  46108. var self=this,$self=this;
  46109. return $core.withContext(function($ctx1) {
  46110. var $1,$receiver;
  46111. $1=$self["@returned"];
  46112. if(($receiver = $1) == null || $receiver.a$nil){
  46113. return false;
  46114. } else {
  46115. return $1;
  46116. }
  46117. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  46118. },
  46119. args: [],
  46120. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  46121. referencedClasses: [],
  46122. messageSends: ["ifNil:"]
  46123. }),
  46124. $globals.ASTInterpreter);
  46125. $core.addMethod(
  46126. $core.method({
  46127. selector: "initialize",
  46128. protocol: "initialization",
  46129. fn: function (){
  46130. var self=this,$self=this;
  46131. return $core.withContext(function($ctx1) {
  46132. (
  46133. $ctx1.supercall = true,
  46134. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46135. $ctx1.supercall = false;
  46136. $self["@forceAtEnd"]=false;
  46137. return self;
  46138. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  46139. },
  46140. args: [],
  46141. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  46142. referencedClasses: [],
  46143. messageSends: ["initialize"]
  46144. }),
  46145. $globals.ASTInterpreter);
  46146. $core.addMethod(
  46147. $core.method({
  46148. selector: "interpret",
  46149. protocol: "interpreting",
  46150. fn: function (){
  46151. var self=this,$self=this;
  46152. return $core.withContext(function($ctx1) {
  46153. $self._visit_($self._node());
  46154. return self;
  46155. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  46156. },
  46157. args: [],
  46158. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  46159. referencedClasses: [],
  46160. messageSends: ["visit:", "node"]
  46161. }),
  46162. $globals.ASTInterpreter);
  46163. $core.addMethod(
  46164. $core.method({
  46165. selector: "messageFromSendNode:arguments:",
  46166. protocol: "private",
  46167. fn: function (aSendNode,aCollection){
  46168. var self=this,$self=this;
  46169. return $core.withContext(function($ctx1) {
  46170. var $1;
  46171. $1=$recv($globals.Message)._new();
  46172. $recv($1)._selector_($recv(aSendNode)._selector());
  46173. $recv($1)._arguments_(aCollection);
  46174. return $recv($1)._yourself();
  46175. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  46176. },
  46177. args: ["aSendNode", "aCollection"],
  46178. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  46179. referencedClasses: ["Message"],
  46180. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  46181. }),
  46182. $globals.ASTInterpreter);
  46183. $core.addMethod(
  46184. $core.method({
  46185. selector: "messageNotUnderstood:receiver:",
  46186. protocol: "private",
  46187. fn: function (aMessage,anObject){
  46188. var self=this,$self=this;
  46189. return $core.withContext(function($ctx1) {
  46190. var $1;
  46191. $1=$recv($globals.MessageNotUnderstood)._new();
  46192. $recv($1)._message_(aMessage);
  46193. $recv($1)._receiver_(anObject);
  46194. $recv($1)._signal();
  46195. return self;
  46196. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  46197. },
  46198. args: ["aMessage", "anObject"],
  46199. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  46200. referencedClasses: ["MessageNotUnderstood"],
  46201. messageSends: ["message:", "new", "receiver:", "signal"]
  46202. }),
  46203. $globals.ASTInterpreter);
  46204. $core.addMethod(
  46205. $core.method({
  46206. selector: "next",
  46207. protocol: "interpreting",
  46208. fn: function (){
  46209. var self=this,$self=this;
  46210. var nd,nextNode;
  46211. return $core.withContext(function($ctx1) {
  46212. var $1,$2,$receiver;
  46213. nd=$self._node();
  46214. $1=$recv(nd)._parent();
  46215. if(($receiver = $1) == null || $receiver.a$nil){
  46216. nextNode=$1;
  46217. } else {
  46218. var parent;
  46219. parent=$receiver;
  46220. $2=$recv(parent)._nextSiblingNode_(nd);
  46221. if(($receiver = $2) == null || $receiver.a$nil){
  46222. nextNode=parent;
  46223. } else {
  46224. var sibling;
  46225. sibling=$receiver;
  46226. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  46227. }
  46228. }
  46229. $self._node_(nextNode);
  46230. return self;
  46231. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  46232. },
  46233. args: [],
  46234. 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",
  46235. referencedClasses: ["ASTEnterNode"],
  46236. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  46237. }),
  46238. $globals.ASTInterpreter);
  46239. $core.addMethod(
  46240. $core.method({
  46241. selector: "node",
  46242. protocol: "accessing",
  46243. fn: function (){
  46244. var self=this,$self=this;
  46245. return $self["@node"];
  46246. },
  46247. args: [],
  46248. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  46249. referencedClasses: [],
  46250. messageSends: []
  46251. }),
  46252. $globals.ASTInterpreter);
  46253. $core.addMethod(
  46254. $core.method({
  46255. selector: "node:",
  46256. protocol: "accessing",
  46257. fn: function (aNode){
  46258. var self=this,$self=this;
  46259. $self["@node"]=aNode;
  46260. return self;
  46261. },
  46262. args: ["aNode"],
  46263. source: "node: aNode\x0a\x09node := aNode",
  46264. referencedClasses: [],
  46265. messageSends: []
  46266. }),
  46267. $globals.ASTInterpreter);
  46268. $core.addMethod(
  46269. $core.method({
  46270. selector: "peek",
  46271. protocol: "stack",
  46272. fn: function (){
  46273. var self=this,$self=this;
  46274. return $core.withContext(function($ctx1) {
  46275. var $1;
  46276. var $early={};
  46277. try {
  46278. $1=$self._stack();
  46279. $ctx1.sendIdx["stack"]=1;
  46280. $recv($1)._ifEmpty_((function(){
  46281. throw $early=[nil];
  46282. }));
  46283. return $recv($self._stack())._last();
  46284. }
  46285. catch(e) {if(e===$early)return e[0]; throw e}
  46286. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  46287. },
  46288. args: [],
  46289. 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",
  46290. referencedClasses: [],
  46291. messageSends: ["ifEmpty:", "stack", "last"]
  46292. }),
  46293. $globals.ASTInterpreter);
  46294. $core.addMethod(
  46295. $core.method({
  46296. selector: "pop",
  46297. protocol: "stack",
  46298. fn: function (){
  46299. var self=this,$self=this;
  46300. var peekedValue;
  46301. return $core.withContext(function($ctx1) {
  46302. peekedValue=$self._peek();
  46303. $recv($self._stack())._removeLast();
  46304. return peekedValue;
  46305. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  46306. },
  46307. args: [],
  46308. 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",
  46309. referencedClasses: [],
  46310. messageSends: ["peek", "removeLast", "stack"]
  46311. }),
  46312. $globals.ASTInterpreter);
  46313. $core.addMethod(
  46314. $core.method({
  46315. selector: "proceed",
  46316. protocol: "interpreting",
  46317. fn: function (){
  46318. var self=this,$self=this;
  46319. return $core.withContext(function($ctx1) {
  46320. $recv((function(){
  46321. return $core.withContext(function($ctx2) {
  46322. return $self._atEnd();
  46323. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46324. }))._whileFalse_((function(){
  46325. return $core.withContext(function($ctx2) {
  46326. return $self._step();
  46327. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46328. }));
  46329. return self;
  46330. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  46331. },
  46332. args: [],
  46333. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  46334. referencedClasses: [],
  46335. messageSends: ["whileFalse:", "atEnd", "step"]
  46336. }),
  46337. $globals.ASTInterpreter);
  46338. $core.addMethod(
  46339. $core.method({
  46340. selector: "push:",
  46341. protocol: "stack",
  46342. fn: function (anObject){
  46343. var self=this,$self=this;
  46344. return $core.withContext(function($ctx1) {
  46345. return $recv($self._stack())._add_(anObject);
  46346. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  46347. },
  46348. args: ["anObject"],
  46349. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  46350. referencedClasses: [],
  46351. messageSends: ["add:", "stack"]
  46352. }),
  46353. $globals.ASTInterpreter);
  46354. $core.addMethod(
  46355. $core.method({
  46356. selector: "restart",
  46357. protocol: "interpreting",
  46358. fn: function (){
  46359. var self=this,$self=this;
  46360. return $core.withContext(function($ctx1) {
  46361. $self._node_($recv($self._context())._ast());
  46362. $self._enterNode();
  46363. return self;
  46364. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  46365. },
  46366. args: [],
  46367. source: "restart\x0a\x09self node: self context ast; enterNode",
  46368. referencedClasses: [],
  46369. messageSends: ["node:", "ast", "context", "enterNode"]
  46370. }),
  46371. $globals.ASTInterpreter);
  46372. $core.addMethod(
  46373. $core.method({
  46374. selector: "result",
  46375. protocol: "accessing",
  46376. fn: function (){
  46377. var self=this,$self=this;
  46378. return $core.withContext(function($ctx1) {
  46379. var $1;
  46380. $1=$self._hasReturned();
  46381. if($core.assert($1)){
  46382. return $self._returnValue();
  46383. } else {
  46384. return $recv($self._context())._receiver();
  46385. }
  46386. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  46387. },
  46388. args: [],
  46389. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  46390. referencedClasses: [],
  46391. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  46392. }),
  46393. $globals.ASTInterpreter);
  46394. $core.addMethod(
  46395. $core.method({
  46396. selector: "returnValue",
  46397. protocol: "accessing",
  46398. fn: function (){
  46399. var self=this,$self=this;
  46400. return $self["@returnValue"];
  46401. },
  46402. args: [],
  46403. source: "returnValue\x0a\x09^ returnValue",
  46404. referencedClasses: [],
  46405. messageSends: []
  46406. }),
  46407. $globals.ASTInterpreter);
  46408. $core.addMethod(
  46409. $core.method({
  46410. selector: "returnValue:",
  46411. protocol: "accessing",
  46412. fn: function (anObject){
  46413. var self=this,$self=this;
  46414. $self["@returnValue"]=anObject;
  46415. return self;
  46416. },
  46417. args: ["anObject"],
  46418. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  46419. referencedClasses: [],
  46420. messageSends: []
  46421. }),
  46422. $globals.ASTInterpreter);
  46423. $core.addMethod(
  46424. $core.method({
  46425. selector: "sendMessage:to:superSend:",
  46426. protocol: "private",
  46427. fn: function (aMessage,anObject,aBoolean){
  46428. var self=this,$self=this;
  46429. var method;
  46430. return $core.withContext(function($ctx1) {
  46431. var $2,$1,$3,$receiver;
  46432. var $early={};
  46433. try {
  46434. if(!$core.assert(aBoolean)){
  46435. return $recv(aMessage)._sendTo_(anObject);
  46436. }
  46437. $2=$recv(anObject)._class();
  46438. $ctx1.sendIdx["class"]=1;
  46439. $1=$recv($2)._superclass();
  46440. $ctx1.sendIdx["superclass"]=1;
  46441. if(($receiver = $1) == null || $receiver.a$nil){
  46442. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  46443. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  46444. return $3;
  46445. } else {
  46446. $1;
  46447. }
  46448. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  46449. return $core.withContext(function($ctx2) {
  46450. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  46451. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46452. }));
  46453. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  46454. }
  46455. catch(e) {if(e===$early)return e[0]; throw e}
  46456. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  46457. },
  46458. args: ["aMessage", "anObject", "aBoolean"],
  46459. 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",
  46460. referencedClasses: [],
  46461. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  46462. }),
  46463. $globals.ASTInterpreter);
  46464. $core.addMethod(
  46465. $core.method({
  46466. selector: "setNonLocalReturnFromContext:",
  46467. protocol: "interpreting",
  46468. fn: function (aContext){
  46469. var self=this,$self=this;
  46470. return $core.withContext(function($ctx1) {
  46471. var $2,$1;
  46472. $2=$recv(aContext)._interpreter();
  46473. $ctx1.sendIdx["interpreter"]=1;
  46474. $1=$recv($2)._hasReturned();
  46475. if($core.assert($1)){
  46476. $self["@returned"]=true;
  46477. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46478. }
  46479. return self;
  46480. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46481. },
  46482. args: ["aContext"],
  46483. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46484. referencedClasses: [],
  46485. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46486. }),
  46487. $globals.ASTInterpreter);
  46488. $core.addMethod(
  46489. $core.method({
  46490. selector: "skip",
  46491. protocol: "interpreting",
  46492. fn: function (){
  46493. var self=this,$self=this;
  46494. return $core.withContext(function($ctx1) {
  46495. $self._next();
  46496. return self;
  46497. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46498. },
  46499. args: [],
  46500. source: "skip\x0a\x09self next",
  46501. referencedClasses: [],
  46502. messageSends: ["next"]
  46503. }),
  46504. $globals.ASTInterpreter);
  46505. $core.addMethod(
  46506. $core.method({
  46507. selector: "stack",
  46508. protocol: "accessing",
  46509. fn: function (){
  46510. var self=this,$self=this;
  46511. return $core.withContext(function($ctx1) {
  46512. var $1,$receiver;
  46513. $1=$self["@stack"];
  46514. if(($receiver = $1) == null || $receiver.a$nil){
  46515. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  46516. return $self["@stack"];
  46517. } else {
  46518. return $1;
  46519. }
  46520. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46521. },
  46522. args: [],
  46523. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46524. referencedClasses: ["OrderedCollection"],
  46525. messageSends: ["ifNil:", "new"]
  46526. }),
  46527. $globals.ASTInterpreter);
  46528. $core.addMethod(
  46529. $core.method({
  46530. selector: "step",
  46531. protocol: "interpreting",
  46532. fn: function (){
  46533. var self=this,$self=this;
  46534. return $core.withContext(function($ctx1) {
  46535. $self._interpret();
  46536. $self._next();
  46537. return self;
  46538. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46539. },
  46540. args: [],
  46541. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46542. referencedClasses: [],
  46543. messageSends: ["interpret", "next"]
  46544. }),
  46545. $globals.ASTInterpreter);
  46546. $core.addMethod(
  46547. $core.method({
  46548. selector: "stepOver",
  46549. protocol: "interpreting",
  46550. fn: function (){
  46551. var self=this,$self=this;
  46552. return $core.withContext(function($ctx1) {
  46553. var $2,$1;
  46554. $self._step();
  46555. $ctx1.sendIdx["step"]=1;
  46556. $recv((function(){
  46557. return $core.withContext(function($ctx2) {
  46558. $2=$self._node();
  46559. $ctx2.sendIdx["node"]=1;
  46560. $1=$recv($2)._isNil();
  46561. return $recv($1)._or_((function(){
  46562. return $core.withContext(function($ctx3) {
  46563. return $recv($self._node())._isSteppingNode();
  46564. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46565. }));
  46566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46567. }))._whileFalse_((function(){
  46568. return $core.withContext(function($ctx2) {
  46569. return $self._step();
  46570. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46571. }));
  46572. return self;
  46573. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46574. },
  46575. args: [],
  46576. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46577. referencedClasses: [],
  46578. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46579. }),
  46580. $globals.ASTInterpreter);
  46581. $core.addMethod(
  46582. $core.method({
  46583. selector: "visit:",
  46584. protocol: "visiting",
  46585. fn: function (aNode){
  46586. var self=this,$self=this;
  46587. return $core.withContext(function($ctx1) {
  46588. var $1;
  46589. $1=$self._hasReturned();
  46590. if(!$core.assert($1)){
  46591. (
  46592. $ctx1.supercall = true,
  46593. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46594. $ctx1.supercall = false;
  46595. }
  46596. return self;
  46597. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46598. },
  46599. args: ["aNode"],
  46600. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46601. referencedClasses: [],
  46602. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46603. }),
  46604. $globals.ASTInterpreter);
  46605. $core.addMethod(
  46606. $core.method({
  46607. selector: "visitAssignmentNode:",
  46608. protocol: "visiting",
  46609. fn: function (aNode){
  46610. var self=this,$self=this;
  46611. var poppedValue;
  46612. return $core.withContext(function($ctx1) {
  46613. poppedValue=$self._pop();
  46614. $ctx1.sendIdx["pop"]=1;
  46615. $self._pop();
  46616. $self._push_(poppedValue);
  46617. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46618. return self;
  46619. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46620. },
  46621. args: ["aNode"],
  46622. 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",
  46623. referencedClasses: [],
  46624. messageSends: ["pop", "push:", "assign:to:", "left"]
  46625. }),
  46626. $globals.ASTInterpreter);
  46627. $core.addMethod(
  46628. $core.method({
  46629. selector: "visitBlockNode:",
  46630. protocol: "visiting",
  46631. fn: function (aNode){
  46632. var self=this,$self=this;
  46633. var block;
  46634. return $core.withContext(function($ctx1) {
  46635. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46636. $self._push_(block);
  46637. return self;
  46638. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46639. },
  46640. args: ["aNode"],
  46641. 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",
  46642. referencedClasses: ["AIBlockClosure"],
  46643. messageSends: ["forContext:node:", "context", "push:"]
  46644. }),
  46645. $globals.ASTInterpreter);
  46646. $core.addMethod(
  46647. $core.method({
  46648. selector: "visitBlockSequenceNode:",
  46649. protocol: "visiting",
  46650. fn: function (aNode){
  46651. var self=this,$self=this;
  46652. return $core.withContext(function($ctx1) {
  46653. (
  46654. $ctx1.supercall = true,
  46655. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46656. $ctx1.supercall = false;
  46657. $self["@forceAtEnd"]=true;
  46658. return self;
  46659. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46660. },
  46661. args: ["aNode"],
  46662. 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",
  46663. referencedClasses: [],
  46664. messageSends: ["visitBlockSequenceNode:"]
  46665. }),
  46666. $globals.ASTInterpreter);
  46667. $core.addMethod(
  46668. $core.method({
  46669. selector: "visitDagNode:",
  46670. protocol: "visiting",
  46671. fn: function (aNode){
  46672. var self=this,$self=this;
  46673. return self;
  46674. },
  46675. args: ["aNode"],
  46676. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46677. referencedClasses: [],
  46678. messageSends: []
  46679. }),
  46680. $globals.ASTInterpreter);
  46681. $core.addMethod(
  46682. $core.method({
  46683. selector: "visitDynamicArrayNode:",
  46684. protocol: "visiting",
  46685. fn: function (aNode){
  46686. var self=this,$self=this;
  46687. var array;
  46688. return $core.withContext(function($ctx1) {
  46689. array=[];
  46690. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46691. return $core.withContext(function($ctx2) {
  46692. return $recv(array)._addFirst_($self._pop());
  46693. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46694. }));
  46695. $self._push_(array);
  46696. return self;
  46697. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46698. },
  46699. args: ["aNode"],
  46700. 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",
  46701. referencedClasses: [],
  46702. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46703. }),
  46704. $globals.ASTInterpreter);
  46705. $core.addMethod(
  46706. $core.method({
  46707. selector: "visitDynamicDictionaryNode:",
  46708. protocol: "visiting",
  46709. fn: function (aNode){
  46710. var self=this,$self=this;
  46711. var keyValueList;
  46712. return $core.withContext(function($ctx1) {
  46713. keyValueList=$recv($globals.OrderedCollection)._new();
  46714. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46715. return $core.withContext(function($ctx2) {
  46716. return $recv(keyValueList)._add_($self._pop());
  46717. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46718. }));
  46719. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46720. return self;
  46721. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46722. },
  46723. args: ["aNode"],
  46724. 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)",
  46725. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46726. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46727. }),
  46728. $globals.ASTInterpreter);
  46729. $core.addMethod(
  46730. $core.method({
  46731. selector: "visitJSStatementNode:",
  46732. protocol: "visiting",
  46733. fn: function (aNode){
  46734. var self=this,$self=this;
  46735. return $core.withContext(function($ctx1) {
  46736. $self["@returned"]=true;
  46737. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46738. return self;
  46739. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46740. },
  46741. args: ["aNode"],
  46742. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46743. referencedClasses: [],
  46744. messageSends: ["returnValue:", "eval:", "source"]
  46745. }),
  46746. $globals.ASTInterpreter);
  46747. $core.addMethod(
  46748. $core.method({
  46749. selector: "visitReturnNode:",
  46750. protocol: "visiting",
  46751. fn: function (aNode){
  46752. var self=this,$self=this;
  46753. return $core.withContext(function($ctx1) {
  46754. $self["@returned"]=true;
  46755. $self._returnValue_($self._pop());
  46756. return self;
  46757. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46758. },
  46759. args: ["aNode"],
  46760. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46761. referencedClasses: [],
  46762. messageSends: ["returnValue:", "pop"]
  46763. }),
  46764. $globals.ASTInterpreter);
  46765. $core.addMethod(
  46766. $core.method({
  46767. selector: "visitSendNode:",
  46768. protocol: "visiting",
  46769. fn: function (aNode){
  46770. var self=this,$self=this;
  46771. var receiver,args,message,result;
  46772. return $core.withContext(function($ctx1) {
  46773. var $1;
  46774. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46775. return $core.withContext(function($ctx2) {
  46776. return $self._pop();
  46777. $ctx2.sendIdx["pop"]=1;
  46778. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46779. }));
  46780. receiver=$self._peek();
  46781. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46782. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46783. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46784. return $core.withContext(function($ctx2) {
  46785. return $recv($recv(aNode)._isLastChild())._not();
  46786. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46787. }));
  46788. if(!$core.assert($1)){
  46789. $self._pop();
  46790. $self._push_(result);
  46791. }
  46792. return self;
  46793. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46794. },
  46795. args: ["aNode"],
  46796. 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 ]",
  46797. referencedClasses: [],
  46798. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46799. }),
  46800. $globals.ASTInterpreter);
  46801. $core.addMethod(
  46802. $core.method({
  46803. selector: "visitValueNode:",
  46804. protocol: "visiting",
  46805. fn: function (aNode){
  46806. var self=this,$self=this;
  46807. return $core.withContext(function($ctx1) {
  46808. $self._push_($recv(aNode)._value());
  46809. return self;
  46810. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46811. },
  46812. args: ["aNode"],
  46813. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46814. referencedClasses: [],
  46815. messageSends: ["push:", "value"]
  46816. }),
  46817. $globals.ASTInterpreter);
  46818. $core.addMethod(
  46819. $core.method({
  46820. selector: "visitVariableNode:",
  46821. protocol: "visiting",
  46822. fn: function (aNode){
  46823. var self=this,$self=this;
  46824. return $core.withContext(function($ctx1) {
  46825. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46826. $2=$recv(aNode)._binding();
  46827. $ctx1.sendIdx["binding"]=1;
  46828. $1=$recv($2)._isUnknownVar();
  46829. if($core.assert($1)){
  46830. $5=$recv($globals.Platform)._globals();
  46831. $ctx1.sendIdx["globals"]=1;
  46832. $6=$recv(aNode)._value();
  46833. $ctx1.sendIdx["value"]=1;
  46834. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46835. return $core.withContext(function($ctx2) {
  46836. return $self._error_("Unknown variable");
  46837. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46838. }));
  46839. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46840. $3=$self._push_($4);
  46841. $ctx1.sendIdx["push:"]=1;
  46842. return $3;
  46843. }
  46844. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46845. if($core.assert($8)){
  46846. $10=$self._context();
  46847. $ctx1.sendIdx["context"]=1;
  46848. $9=$recv($10)._receiver();
  46849. $11=$recv(aNode)._value();
  46850. $ctx1.sendIdx["value"]=2;
  46851. $7=$recv($9)._instVarAt_($11);
  46852. } else {
  46853. $12=$self._context();
  46854. $13=$recv(aNode)._value();
  46855. $ctx1.sendIdx["value"]=3;
  46856. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46857. return $core.withContext(function($ctx2) {
  46858. $15=$recv(aNode)._value();
  46859. $ctx2.sendIdx["value"]=4;
  46860. $14=$recv($15)._isCapitalized();
  46861. if($core.assert($14)){
  46862. $16=$recv($globals.Smalltalk)._globals();
  46863. $ctx2.sendIdx["globals"]=2;
  46864. $17=$recv(aNode)._value();
  46865. $ctx2.sendIdx["value"]=5;
  46866. return $recv($16)._at_ifAbsent_($17,(function(){
  46867. return $core.withContext(function($ctx3) {
  46868. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46869. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46870. }));
  46871. }
  46872. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46873. }));
  46874. }
  46875. $self._push_($7);
  46876. return self;
  46877. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46878. },
  46879. args: ["aNode"],
  46880. 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 ] ] ] ])",
  46881. referencedClasses: ["Platform", "Smalltalk"],
  46882. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46883. }),
  46884. $globals.ASTInterpreter);
  46885. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46886. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46887. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46888. $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`";
  46889. $core.addMethod(
  46890. $core.method({
  46891. selector: "currentNode",
  46892. protocol: "accessing",
  46893. fn: function (){
  46894. var self=this,$self=this;
  46895. return $self["@currentNode"];
  46896. },
  46897. args: [],
  46898. source: "currentNode\x0a\x09^ currentNode",
  46899. referencedClasses: [],
  46900. messageSends: []
  46901. }),
  46902. $globals.ASTPCNodeVisitor);
  46903. $core.addMethod(
  46904. $core.method({
  46905. selector: "increaseTrackedIndex",
  46906. protocol: "accessing",
  46907. fn: function (){
  46908. var self=this,$self=this;
  46909. return $core.withContext(function($ctx1) {
  46910. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46911. return self;
  46912. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46913. },
  46914. args: [],
  46915. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46916. referencedClasses: [],
  46917. messageSends: ["+", "trackedIndex"]
  46918. }),
  46919. $globals.ASTPCNodeVisitor);
  46920. $core.addMethod(
  46921. $core.method({
  46922. selector: "index",
  46923. protocol: "accessing",
  46924. fn: function (){
  46925. var self=this,$self=this;
  46926. return $self["@index"];
  46927. },
  46928. args: [],
  46929. source: "index\x0a\x09^ index",
  46930. referencedClasses: [],
  46931. messageSends: []
  46932. }),
  46933. $globals.ASTPCNodeVisitor);
  46934. $core.addMethod(
  46935. $core.method({
  46936. selector: "index:",
  46937. protocol: "accessing",
  46938. fn: function (aNumber){
  46939. var self=this,$self=this;
  46940. $self["@index"]=aNumber;
  46941. return self;
  46942. },
  46943. args: ["aNumber"],
  46944. source: "index: aNumber\x0a\x09index := aNumber",
  46945. referencedClasses: [],
  46946. messageSends: []
  46947. }),
  46948. $globals.ASTPCNodeVisitor);
  46949. $core.addMethod(
  46950. $core.method({
  46951. selector: "selector",
  46952. protocol: "accessing",
  46953. fn: function (){
  46954. var self=this,$self=this;
  46955. return $self["@selector"];
  46956. },
  46957. args: [],
  46958. source: "selector\x0a\x09^ selector",
  46959. referencedClasses: [],
  46960. messageSends: []
  46961. }),
  46962. $globals.ASTPCNodeVisitor);
  46963. $core.addMethod(
  46964. $core.method({
  46965. selector: "selector:",
  46966. protocol: "accessing",
  46967. fn: function (aString){
  46968. var self=this,$self=this;
  46969. $self["@selector"]=aString;
  46970. return self;
  46971. },
  46972. args: ["aString"],
  46973. source: "selector: aString\x0a\x09selector := aString",
  46974. referencedClasses: [],
  46975. messageSends: []
  46976. }),
  46977. $globals.ASTPCNodeVisitor);
  46978. $core.addMethod(
  46979. $core.method({
  46980. selector: "trackedIndex",
  46981. protocol: "accessing",
  46982. fn: function (){
  46983. var self=this,$self=this;
  46984. return $core.withContext(function($ctx1) {
  46985. var $1,$receiver;
  46986. $1=$self["@trackedIndex"];
  46987. if(($receiver = $1) == null || $receiver.a$nil){
  46988. $self["@trackedIndex"]=(0);
  46989. return $self["@trackedIndex"];
  46990. } else {
  46991. return $1;
  46992. }
  46993. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  46994. },
  46995. args: [],
  46996. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  46997. referencedClasses: [],
  46998. messageSends: ["ifNil:"]
  46999. }),
  47000. $globals.ASTPCNodeVisitor);
  47001. $core.addMethod(
  47002. $core.method({
  47003. selector: "visitJSStatementNode:",
  47004. protocol: "visiting",
  47005. fn: function (aNode){
  47006. var self=this,$self=this;
  47007. $self["@currentNode"]=aNode;
  47008. return self;
  47009. },
  47010. args: ["aNode"],
  47011. 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",
  47012. referencedClasses: [],
  47013. messageSends: []
  47014. }),
  47015. $globals.ASTPCNodeVisitor);
  47016. $core.addMethod(
  47017. $core.method({
  47018. selector: "visitSendNode:",
  47019. protocol: "visiting",
  47020. fn: function (aNode){
  47021. var self=this,$self=this;
  47022. return $core.withContext(function($ctx1) {
  47023. var $2,$1,$3;
  47024. (
  47025. $ctx1.supercall = true,
  47026. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  47027. $ctx1.supercall = false;
  47028. $2=$self._selector();
  47029. $ctx1.sendIdx["selector"]=1;
  47030. $1=$recv($2).__eq($recv(aNode)._selector());
  47031. $ctx1.sendIdx["="]=1;
  47032. if($core.assert($1)){
  47033. $3=$recv($self._trackedIndex()).__eq($self._index());
  47034. if($core.assert($3)){
  47035. $self["@currentNode"]=aNode;
  47036. $self["@currentNode"];
  47037. }
  47038. $self._increaseTrackedIndex();
  47039. }
  47040. return self;
  47041. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  47042. },
  47043. args: ["aNode"],
  47044. 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 ]",
  47045. referencedClasses: [],
  47046. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  47047. }),
  47048. $globals.ASTPCNodeVisitor);
  47049. $core.addMethod(
  47050. $core.method({
  47051. selector: "isLastChild",
  47052. protocol: "*Compiler-Interpreter",
  47053. fn: function (){
  47054. var self=this,$self=this;
  47055. return $core.withContext(function($ctx1) {
  47056. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  47057. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  47058. },
  47059. args: [],
  47060. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  47061. referencedClasses: [],
  47062. messageSends: ["=", "last", "dagChildren", "parent"]
  47063. }),
  47064. $globals.ASTNode);
  47065. $core.addMethod(
  47066. $core.method({
  47067. selector: "isSteppingNode",
  47068. protocol: "*Compiler-Interpreter",
  47069. fn: function (){
  47070. var self=this,$self=this;
  47071. return false;
  47072. },
  47073. args: [],
  47074. source: "isSteppingNode\x0a\x09^ false",
  47075. referencedClasses: [],
  47076. messageSends: []
  47077. }),
  47078. $globals.ASTNode);
  47079. $core.addMethod(
  47080. $core.method({
  47081. selector: "nextSiblingNode:",
  47082. protocol: "*Compiler-Interpreter",
  47083. fn: function (aNode){
  47084. var self=this,$self=this;
  47085. return $core.withContext(function($ctx1) {
  47086. var $1;
  47087. var $early={};
  47088. try {
  47089. $1=$self._dagChildren();
  47090. $ctx1.sendIdx["dagChildren"]=1;
  47091. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  47092. throw $early=[nil];
  47093. }));
  47094. }
  47095. catch(e) {if(e===$early)return e[0]; throw e}
  47096. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  47097. },
  47098. args: ["aNode"],
  47099. 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 ]",
  47100. referencedClasses: [],
  47101. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  47102. }),
  47103. $globals.ASTNode);
  47104. $core.addMethod(
  47105. $core.method({
  47106. selector: "isSteppingNode",
  47107. protocol: "*Compiler-Interpreter",
  47108. fn: function (){
  47109. var self=this,$self=this;
  47110. return true;
  47111. },
  47112. args: [],
  47113. source: "isSteppingNode\x0a\x09^ true",
  47114. referencedClasses: [],
  47115. messageSends: []
  47116. }),
  47117. $globals.AssignmentNode);
  47118. $core.addMethod(
  47119. $core.method({
  47120. selector: "isSteppingNode",
  47121. protocol: "*Compiler-Interpreter",
  47122. fn: function (){
  47123. var self=this,$self=this;
  47124. return true;
  47125. },
  47126. args: [],
  47127. source: "isSteppingNode\x0a\x09^ true",
  47128. referencedClasses: [],
  47129. messageSends: []
  47130. }),
  47131. $globals.BlockNode);
  47132. $core.addMethod(
  47133. $core.method({
  47134. selector: "nextSiblingNode:",
  47135. protocol: "*Compiler-Interpreter",
  47136. fn: function (aNode){
  47137. var self=this,$self=this;
  47138. return nil;
  47139. },
  47140. args: ["aNode"],
  47141. 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",
  47142. referencedClasses: [],
  47143. messageSends: []
  47144. }),
  47145. $globals.BlockNode);
  47146. $core.addMethod(
  47147. $core.method({
  47148. selector: "isSteppingNode",
  47149. protocol: "*Compiler-Interpreter",
  47150. fn: function (){
  47151. var self=this,$self=this;
  47152. return true;
  47153. },
  47154. args: [],
  47155. source: "isSteppingNode\x0a\x09^ true",
  47156. referencedClasses: [],
  47157. messageSends: []
  47158. }),
  47159. $globals.DynamicArrayNode);
  47160. $core.addMethod(
  47161. $core.method({
  47162. selector: "isSteppingNode",
  47163. protocol: "*Compiler-Interpreter",
  47164. fn: function (){
  47165. var self=this,$self=this;
  47166. return true;
  47167. },
  47168. args: [],
  47169. source: "isSteppingNode\x0a\x09^ true",
  47170. referencedClasses: [],
  47171. messageSends: []
  47172. }),
  47173. $globals.DynamicDictionaryNode);
  47174. $core.addMethod(
  47175. $core.method({
  47176. selector: "isSteppingNode",
  47177. protocol: "*Compiler-Interpreter",
  47178. fn: function (){
  47179. var self=this,$self=this;
  47180. return true;
  47181. },
  47182. args: [],
  47183. source: "isSteppingNode\x0a\x09^ true",
  47184. referencedClasses: [],
  47185. messageSends: []
  47186. }),
  47187. $globals.JSStatementNode);
  47188. $core.addMethod(
  47189. $core.method({
  47190. selector: "isCascadeSendNode",
  47191. protocol: "*Compiler-Interpreter",
  47192. fn: function (){
  47193. var self=this,$self=this;
  47194. return $core.withContext(function($ctx1) {
  47195. return $recv($self._parent())._isCascadeNode();
  47196. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  47197. },
  47198. args: [],
  47199. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  47200. referencedClasses: [],
  47201. messageSends: ["isCascadeNode", "parent"]
  47202. }),
  47203. $globals.SendNode);
  47204. $core.addMethod(
  47205. $core.method({
  47206. selector: "isSteppingNode",
  47207. protocol: "*Compiler-Interpreter",
  47208. fn: function (){
  47209. var self=this,$self=this;
  47210. return true;
  47211. },
  47212. args: [],
  47213. source: "isSteppingNode\x0a\x09^ true",
  47214. referencedClasses: [],
  47215. messageSends: []
  47216. }),
  47217. $globals.SendNode);
  47218. });
  47219. define('amber/lang',[
  47220. './deploy',
  47221. './boot', // pre-fetch, dep of ./helpers
  47222. './helpers', // pre-fetch, dep of ./deploy
  47223. './parser',
  47224. // --- packages for the Amber reflection begin here ---
  47225. 'amber_core/Platform-ImportExport',
  47226. 'amber_core/Compiler-Core',
  47227. 'amber_core/Compiler-AST',
  47228. 'amber_core/Compiler-Semantic',
  47229. 'amber_core/Compiler-IR',
  47230. 'amber_core/Compiler-Inlining',
  47231. 'amber_core/Compiler-Interpreter'
  47232. // --- packages for the Amber reflection end here ---
  47233. ], function (amber) {
  47234. return amber;
  47235. });
  47236. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47237. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47238. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47239. $core.addPackage("Platform-DOM");
  47240. ($core.packageDescriptors||$core.packages)["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  47241. ($core.packageDescriptors||$core.packages)["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47242. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  47243. $core.addMethod(
  47244. $core.method({
  47245. selector: "isDomNode:",
  47246. protocol: "testing",
  47247. fn: function (anObject){
  47248. var self=this,$self=this;
  47249. return $core.withContext(function($ctx1) {
  47250. return anObject.nodeType > 0 &&
  47251. Object.prototype.toString.call(anObject) !== "[object Object]";
  47252. return self;
  47253. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  47254. },
  47255. args: ["anObject"],
  47256. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  47257. referencedClasses: [],
  47258. messageSends: []
  47259. }),
  47260. $globals.PlatformDom.a$cls);
  47261. $core.addMethod(
  47262. $core.method({
  47263. selector: "isFeasible",
  47264. protocol: "testing",
  47265. fn: function (){
  47266. var self=this,$self=this;
  47267. return $core.withContext(function($ctx1) {
  47268. if (typeof document === "undefined") return false;
  47269. try {
  47270. var d = document.createElement("div"),
  47271. f = document.createDocumentFragment(),
  47272. t = document.createTextNode("Hello, Amber!");
  47273. f.appendChild(t);
  47274. d.insertBefore(f, null);
  47275. return d.innerHTML === "Hello, Amber!";
  47276. } catch (e) {
  47277. return false;
  47278. };
  47279. return self;
  47280. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  47281. },
  47282. args: [],
  47283. 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'>",
  47284. referencedClasses: [],
  47285. messageSends: []
  47286. }),
  47287. $globals.PlatformDom.a$cls);
  47288. $core.addMethod(
  47289. $core.method({
  47290. selector: "newCustomEvent:detail:",
  47291. protocol: "creation",
  47292. fn: function (aString,anObject){
  47293. var self=this,$self=this;
  47294. return $core.withContext(function($ctx1) {
  47295. return new CustomEvent(aString, {detail: anObject});
  47296. return self;
  47297. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  47298. },
  47299. args: ["aString", "anObject"],
  47300. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  47301. referencedClasses: [],
  47302. messageSends: []
  47303. }),
  47304. $globals.PlatformDom.a$cls);
  47305. $core.addMethod(
  47306. $core.method({
  47307. selector: "toArray:",
  47308. protocol: "converting",
  47309. fn: function (aDomList){
  47310. var self=this,$self=this;
  47311. return $core.withContext(function($ctx1) {
  47312. return Array.prototype.slice.call(aDomList);
  47313. return self;
  47314. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  47315. },
  47316. args: ["aDomList"],
  47317. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  47318. referencedClasses: [],
  47319. messageSends: []
  47320. }),
  47321. $globals.PlatformDom.a$cls);
  47322. $core.addMethod(
  47323. $core.method({
  47324. selector: "asDomNode",
  47325. protocol: "*Platform-DOM",
  47326. fn: function (){
  47327. var self=this,$self=this;
  47328. return $core.withContext(function($ctx1) {
  47329. return $recv(document)._createTextNode_($self._asString());
  47330. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  47331. },
  47332. args: [],
  47333. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  47334. referencedClasses: [],
  47335. messageSends: ["createTextNode:", "asString"]
  47336. }),
  47337. $globals.CharacterArray);
  47338. $core.addMethod(
  47339. $core.method({
  47340. selector: "asDomNode",
  47341. protocol: "*Platform-DOM",
  47342. fn: function (){
  47343. var self=this,$self=this;
  47344. var fragment;
  47345. return $core.withContext(function($ctx1) {
  47346. fragment=$recv(document)._createDocumentFragment();
  47347. $self._do_((function(each){
  47348. return $core.withContext(function($ctx2) {
  47349. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  47350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47351. }));
  47352. return fragment;
  47353. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  47354. },
  47355. args: [],
  47356. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  47357. referencedClasses: [],
  47358. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  47359. }),
  47360. $globals.Collection);
  47361. $core.addMethod(
  47362. $core.method({
  47363. selector: "asDomNode",
  47364. protocol: "*Platform-DOM",
  47365. fn: function (){
  47366. var self=this,$self=this;
  47367. return $core.withContext(function($ctx1) {
  47368. var $1,$2;
  47369. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  47370. if($core.assert($1)){
  47371. return $self["@jsObject"];
  47372. } else {
  47373. $2=(
  47374. $ctx1.supercall = true,
  47375. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  47376. $ctx1.supercall = false;
  47377. return $2;
  47378. }
  47379. return self;
  47380. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  47381. },
  47382. args: [],
  47383. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  47384. referencedClasses: ["PlatformDom"],
  47385. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  47386. }),
  47387. $globals.JSObjectProxy);
  47388. $core.addMethod(
  47389. $core.method({
  47390. selector: "htmlTextContent",
  47391. protocol: "*Platform-DOM",
  47392. fn: function (){
  47393. var self=this,$self=this;
  47394. return $core.withContext(function($ctx1) {
  47395. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  47396. return self;
  47397. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  47398. },
  47399. args: [],
  47400. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  47401. referencedClasses: [],
  47402. messageSends: []
  47403. }),
  47404. $globals.String);
  47405. });
  47406. 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";
  47407. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47408. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47409. $core.addPackage("SUnit");
  47410. ($core.packageDescriptors||$core.packages)["SUnit"].innerEval = function (expr) { return eval(expr); };
  47411. ($core.packageDescriptors||$core.packages)["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47412. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  47413. $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.";
  47414. $core.addMethod(
  47415. $core.method({
  47416. selector: "result",
  47417. protocol: "accessing",
  47418. fn: function (){
  47419. var self=this,$self=this;
  47420. return $self["@result"];
  47421. },
  47422. args: [],
  47423. source: "result\x0a\x09^ result",
  47424. referencedClasses: [],
  47425. messageSends: []
  47426. }),
  47427. $globals.ResultAnnouncement);
  47428. $core.addMethod(
  47429. $core.method({
  47430. selector: "result:",
  47431. protocol: "accessing",
  47432. fn: function (aTestResult){
  47433. var self=this,$self=this;
  47434. $self["@result"]=aTestResult;
  47435. return self;
  47436. },
  47437. args: ["aTestResult"],
  47438. source: "result: aTestResult\x0a\x09result := aTestResult",
  47439. referencedClasses: [],
  47440. messageSends: []
  47441. }),
  47442. $globals.ResultAnnouncement);
  47443. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  47444. $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.";
  47445. $core.addMethod(
  47446. $core.method({
  47447. selector: "assert:",
  47448. protocol: "testing",
  47449. fn: function (aBoolean){
  47450. var self=this,$self=this;
  47451. return $core.withContext(function($ctx1) {
  47452. $self._assert_description_(aBoolean,"Assertion failed");
  47453. return self;
  47454. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  47455. },
  47456. args: ["aBoolean"],
  47457. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  47458. referencedClasses: [],
  47459. messageSends: ["assert:description:"]
  47460. }),
  47461. $globals.TestCase);
  47462. $core.addMethod(
  47463. $core.method({
  47464. selector: "assert:description:",
  47465. protocol: "testing",
  47466. fn: function (aBoolean,aString){
  47467. var self=this,$self=this;
  47468. return $core.withContext(function($ctx1) {
  47469. if(!$core.assert(aBoolean)){
  47470. $self._signalFailure_(aString);
  47471. }
  47472. return self;
  47473. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47474. },
  47475. args: ["aBoolean", "aString"],
  47476. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47477. referencedClasses: [],
  47478. messageSends: ["ifFalse:", "signalFailure:"]
  47479. }),
  47480. $globals.TestCase);
  47481. $core.addMethod(
  47482. $core.method({
  47483. selector: "assert:equals:",
  47484. protocol: "testing",
  47485. fn: function (actual,expected){
  47486. var self=this,$self=this;
  47487. return $core.withContext(function($ctx1) {
  47488. var $1,$5,$4,$3,$2;
  47489. $1=$recv(actual).__eq(expected);
  47490. $5=$recv(expected)._printString();
  47491. $ctx1.sendIdx["printString"]=1;
  47492. $4="Expected: ".__comma($5);
  47493. $3=$recv($4).__comma(" but was: ");
  47494. $ctx1.sendIdx[","]=2;
  47495. $2=$recv($3).__comma($recv(actual)._printString());
  47496. $ctx1.sendIdx[","]=1;
  47497. return $self._assert_description_($1,$2);
  47498. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47499. },
  47500. args: ["actual", "expected"],
  47501. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47502. referencedClasses: [],
  47503. messageSends: ["assert:description:", "=", ",", "printString"]
  47504. }),
  47505. $globals.TestCase);
  47506. $core.addMethod(
  47507. $core.method({
  47508. selector: "async:",
  47509. protocol: "async",
  47510. fn: function (aBlock){
  47511. var self=this,$self=this;
  47512. var c;
  47513. return $core.withContext(function($ctx1) {
  47514. var $1;
  47515. $self._errorIfNotAsync_("#async");
  47516. c=$self["@context"];
  47517. return (function(){
  47518. return $core.withContext(function($ctx2) {
  47519. $1=$self._isAsync();
  47520. if($core.assert($1)){
  47521. return $recv(c)._execute_(aBlock);
  47522. }
  47523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47524. });
  47525. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47526. },
  47527. args: ["aBlock"],
  47528. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47529. referencedClasses: [],
  47530. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47531. }),
  47532. $globals.TestCase);
  47533. $core.addMethod(
  47534. $core.method({
  47535. selector: "context:",
  47536. protocol: "accessing",
  47537. fn: function (aRunningTestContext){
  47538. var self=this,$self=this;
  47539. $self["@context"]=aRunningTestContext;
  47540. return self;
  47541. },
  47542. args: ["aRunningTestContext"],
  47543. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47544. referencedClasses: [],
  47545. messageSends: []
  47546. }),
  47547. $globals.TestCase);
  47548. $core.addMethod(
  47549. $core.method({
  47550. selector: "deny:",
  47551. protocol: "testing",
  47552. fn: function (aBoolean){
  47553. var self=this,$self=this;
  47554. return $core.withContext(function($ctx1) {
  47555. $self._assert_($recv(aBoolean)._not());
  47556. return self;
  47557. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47558. },
  47559. args: ["aBoolean"],
  47560. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47561. referencedClasses: [],
  47562. messageSends: ["assert:", "not"]
  47563. }),
  47564. $globals.TestCase);
  47565. $core.addMethod(
  47566. $core.method({
  47567. selector: "errorIfNotAsync:",
  47568. protocol: "error handling",
  47569. fn: function (aString){
  47570. var self=this,$self=this;
  47571. return $core.withContext(function($ctx1) {
  47572. var $1;
  47573. $1=$self._isAsync();
  47574. if(!$core.assert($1)){
  47575. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47576. }
  47577. return self;
  47578. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47579. },
  47580. args: ["aString"],
  47581. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47582. referencedClasses: [],
  47583. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47584. }),
  47585. $globals.TestCase);
  47586. $core.addMethod(
  47587. $core.method({
  47588. selector: "finished",
  47589. protocol: "async",
  47590. fn: function (){
  47591. var self=this,$self=this;
  47592. return $core.withContext(function($ctx1) {
  47593. $self._errorIfNotAsync_("#finished");
  47594. $self["@asyncTimeout"]=nil;
  47595. return self;
  47596. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47597. },
  47598. args: [],
  47599. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47600. referencedClasses: [],
  47601. messageSends: ["errorIfNotAsync:"]
  47602. }),
  47603. $globals.TestCase);
  47604. $core.addMethod(
  47605. $core.method({
  47606. selector: "isAsync",
  47607. protocol: "testing",
  47608. fn: function (){
  47609. var self=this,$self=this;
  47610. return $core.withContext(function($ctx1) {
  47611. return $recv($self["@asyncTimeout"])._notNil();
  47612. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47613. },
  47614. args: [],
  47615. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47616. referencedClasses: [],
  47617. messageSends: ["notNil"]
  47618. }),
  47619. $globals.TestCase);
  47620. $core.addMethod(
  47621. $core.method({
  47622. selector: "performTest",
  47623. protocol: "running",
  47624. fn: function (){
  47625. var self=this,$self=this;
  47626. return $core.withContext(function($ctx1) {
  47627. $self["@asyncTimeout"]=nil;
  47628. $self._perform_($self._selector());
  47629. return self;
  47630. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47631. },
  47632. args: [],
  47633. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47634. referencedClasses: [],
  47635. messageSends: ["perform:", "selector"]
  47636. }),
  47637. $globals.TestCase);
  47638. $core.addMethod(
  47639. $core.method({
  47640. selector: "runCase",
  47641. protocol: "running",
  47642. fn: function (){
  47643. var self=this,$self=this;
  47644. return $core.withContext(function($ctx1) {
  47645. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47646. return self;
  47647. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47648. },
  47649. args: [],
  47650. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47651. referencedClasses: ["TestContext"],
  47652. messageSends: ["start", "testCase:"]
  47653. }),
  47654. $globals.TestCase);
  47655. $core.addMethod(
  47656. $core.method({
  47657. selector: "selector",
  47658. protocol: "accessing",
  47659. fn: function (){
  47660. var self=this,$self=this;
  47661. return $self["@testSelector"];
  47662. },
  47663. args: [],
  47664. source: "selector\x0a\x09^ testSelector",
  47665. referencedClasses: [],
  47666. messageSends: []
  47667. }),
  47668. $globals.TestCase);
  47669. $core.addMethod(
  47670. $core.method({
  47671. selector: "setTestSelector:",
  47672. protocol: "accessing",
  47673. fn: function (aSelector){
  47674. var self=this,$self=this;
  47675. $self["@testSelector"]=aSelector;
  47676. return self;
  47677. },
  47678. args: ["aSelector"],
  47679. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47680. referencedClasses: [],
  47681. messageSends: []
  47682. }),
  47683. $globals.TestCase);
  47684. $core.addMethod(
  47685. $core.method({
  47686. selector: "setUp",
  47687. protocol: "running",
  47688. fn: function (){
  47689. var self=this,$self=this;
  47690. return self;
  47691. },
  47692. args: [],
  47693. source: "setUp",
  47694. referencedClasses: [],
  47695. messageSends: []
  47696. }),
  47697. $globals.TestCase);
  47698. $core.addMethod(
  47699. $core.method({
  47700. selector: "should:",
  47701. protocol: "testing",
  47702. fn: function (aBlock){
  47703. var self=this,$self=this;
  47704. return $core.withContext(function($ctx1) {
  47705. $self._assert_($recv(aBlock)._value());
  47706. return self;
  47707. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47708. },
  47709. args: ["aBlock"],
  47710. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47711. referencedClasses: [],
  47712. messageSends: ["assert:", "value"]
  47713. }),
  47714. $globals.TestCase);
  47715. $core.addMethod(
  47716. $core.method({
  47717. selector: "should:raise:",
  47718. protocol: "testing",
  47719. fn: function (aBlock,anExceptionClass){
  47720. var self=this,$self=this;
  47721. return $core.withContext(function($ctx1) {
  47722. $self._assert_($recv((function(){
  47723. return $core.withContext(function($ctx2) {
  47724. $recv(aBlock)._value();
  47725. return false;
  47726. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47727. }))._on_do_(anExceptionClass,(function(ex){
  47728. return true;
  47729. })));
  47730. return self;
  47731. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47732. },
  47733. args: ["aBlock", "anExceptionClass"],
  47734. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47735. referencedClasses: [],
  47736. messageSends: ["assert:", "on:do:", "value"]
  47737. }),
  47738. $globals.TestCase);
  47739. $core.addMethod(
  47740. $core.method({
  47741. selector: "shouldnt:raise:",
  47742. protocol: "testing",
  47743. fn: function (aBlock,anExceptionClass){
  47744. var self=this,$self=this;
  47745. return $core.withContext(function($ctx1) {
  47746. $self._assert_($recv((function(){
  47747. return $core.withContext(function($ctx2) {
  47748. $recv(aBlock)._value();
  47749. return true;
  47750. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47751. }))._on_do_(anExceptionClass,(function(ex){
  47752. return false;
  47753. })));
  47754. return self;
  47755. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47756. },
  47757. args: ["aBlock", "anExceptionClass"],
  47758. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47759. referencedClasses: [],
  47760. messageSends: ["assert:", "on:do:", "value"]
  47761. }),
  47762. $globals.TestCase);
  47763. $core.addMethod(
  47764. $core.method({
  47765. selector: "signalFailure:",
  47766. protocol: "private",
  47767. fn: function (aString){
  47768. var self=this,$self=this;
  47769. return $core.withContext(function($ctx1) {
  47770. var $1;
  47771. $1=$recv($globals.TestFailure)._new();
  47772. $recv($1)._messageText_(aString);
  47773. $recv($1)._signal();
  47774. return self;
  47775. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47776. },
  47777. args: ["aString"],
  47778. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47779. referencedClasses: ["TestFailure"],
  47780. messageSends: ["messageText:", "new", "signal"]
  47781. }),
  47782. $globals.TestCase);
  47783. $core.addMethod(
  47784. $core.method({
  47785. selector: "tearDown",
  47786. protocol: "running",
  47787. fn: function (){
  47788. var self=this,$self=this;
  47789. return self;
  47790. },
  47791. args: [],
  47792. source: "tearDown",
  47793. referencedClasses: [],
  47794. messageSends: []
  47795. }),
  47796. $globals.TestCase);
  47797. $core.addMethod(
  47798. $core.method({
  47799. selector: "timeout:",
  47800. protocol: "async",
  47801. fn: function (aNumber){
  47802. var self=this,$self=this;
  47803. return $core.withContext(function($ctx1) {
  47804. var $1,$receiver;
  47805. $1=$self["@asyncTimeout"];
  47806. if(($receiver = $1) == null || $receiver.a$nil){
  47807. $1;
  47808. } else {
  47809. $recv($self["@asyncTimeout"])._clearTimeout();
  47810. }
  47811. $self["@asyncTimeout"]=(0);
  47812. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47813. return $core.withContext(function($ctx2) {
  47814. return $self._assert_description_(false,"SUnit grace time exhausted");
  47815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47816. })))._valueWithTimeout_(aNumber);
  47817. return self;
  47818. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47819. },
  47820. args: ["aNumber"],
  47821. 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",
  47822. referencedClasses: [],
  47823. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47824. }),
  47825. $globals.TestCase);
  47826. $core.addMethod(
  47827. $core.method({
  47828. selector: "allTestSelectors",
  47829. protocol: "accessing",
  47830. fn: function (){
  47831. var self=this,$self=this;
  47832. var selectors;
  47833. return $core.withContext(function($ctx1) {
  47834. var $1;
  47835. selectors=$self._testSelectors();
  47836. $1=$self._shouldInheritSelectors();
  47837. if($core.assert($1)){
  47838. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47839. }
  47840. return selectors;
  47841. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47842. },
  47843. args: [],
  47844. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47845. referencedClasses: [],
  47846. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47847. }),
  47848. $globals.TestCase.a$cls);
  47849. $core.addMethod(
  47850. $core.method({
  47851. selector: "buildSuite",
  47852. protocol: "accessing",
  47853. fn: function (){
  47854. var self=this,$self=this;
  47855. return $core.withContext(function($ctx1) {
  47856. return $recv($self._allTestSelectors())._collect_((function(each){
  47857. return $core.withContext(function($ctx2) {
  47858. return $self._selector_(each);
  47859. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47860. }));
  47861. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47862. },
  47863. args: [],
  47864. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47865. referencedClasses: [],
  47866. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47867. }),
  47868. $globals.TestCase.a$cls);
  47869. $core.addMethod(
  47870. $core.method({
  47871. selector: "classTag",
  47872. protocol: "accessing",
  47873. fn: function (){
  47874. var self=this,$self=this;
  47875. return "test";
  47876. },
  47877. args: [],
  47878. 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'",
  47879. referencedClasses: [],
  47880. messageSends: []
  47881. }),
  47882. $globals.TestCase.a$cls);
  47883. $core.addMethod(
  47884. $core.method({
  47885. selector: "isAbstract",
  47886. protocol: "testing",
  47887. fn: function (){
  47888. var self=this,$self=this;
  47889. return $core.withContext(function($ctx1) {
  47890. return $recv($self._name()).__eq("TestCase");
  47891. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47892. },
  47893. args: [],
  47894. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47895. referencedClasses: [],
  47896. messageSends: ["=", "name"]
  47897. }),
  47898. $globals.TestCase.a$cls);
  47899. $core.addMethod(
  47900. $core.method({
  47901. selector: "isTestClass",
  47902. protocol: "testing",
  47903. fn: function (){
  47904. var self=this,$self=this;
  47905. return $core.withContext(function($ctx1) {
  47906. return $recv($self._isAbstract())._not();
  47907. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47908. },
  47909. args: [],
  47910. source: "isTestClass\x0a\x09^ self isAbstract not",
  47911. referencedClasses: [],
  47912. messageSends: ["not", "isAbstract"]
  47913. }),
  47914. $globals.TestCase.a$cls);
  47915. $core.addMethod(
  47916. $core.method({
  47917. selector: "lookupHierarchyRoot",
  47918. protocol: "accessing",
  47919. fn: function (){
  47920. var self=this,$self=this;
  47921. return $globals.TestCase;
  47922. },
  47923. args: [],
  47924. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47925. referencedClasses: ["TestCase"],
  47926. messageSends: []
  47927. }),
  47928. $globals.TestCase.a$cls);
  47929. $core.addMethod(
  47930. $core.method({
  47931. selector: "selector:",
  47932. protocol: "accessing",
  47933. fn: function (aSelector){
  47934. var self=this,$self=this;
  47935. return $core.withContext(function($ctx1) {
  47936. var $1;
  47937. $1=$self._new();
  47938. $recv($1)._setTestSelector_(aSelector);
  47939. return $recv($1)._yourself();
  47940. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47941. },
  47942. args: ["aSelector"],
  47943. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47944. referencedClasses: [],
  47945. messageSends: ["setTestSelector:", "new", "yourself"]
  47946. }),
  47947. $globals.TestCase.a$cls);
  47948. $core.addMethod(
  47949. $core.method({
  47950. selector: "shouldInheritSelectors",
  47951. protocol: "testing",
  47952. fn: function (){
  47953. var self=this,$self=this;
  47954. return $core.withContext(function($ctx1) {
  47955. return $self.__tild_eq($self._lookupHierarchyRoot());
  47956. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47957. },
  47958. args: [],
  47959. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47960. referencedClasses: [],
  47961. messageSends: ["~=", "lookupHierarchyRoot"]
  47962. }),
  47963. $globals.TestCase.a$cls);
  47964. $core.addMethod(
  47965. $core.method({
  47966. selector: "testSelectors",
  47967. protocol: "accessing",
  47968. fn: function (){
  47969. var self=this,$self=this;
  47970. return $core.withContext(function($ctx1) {
  47971. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  47972. return $core.withContext(function($ctx2) {
  47973. return $recv(each)._match_("^test");
  47974. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47975. }));
  47976. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  47977. },
  47978. args: [],
  47979. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  47980. referencedClasses: [],
  47981. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  47982. }),
  47983. $globals.TestCase.a$cls);
  47984. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  47985. $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).";
  47986. $core.addMethod(
  47987. $core.method({
  47988. selector: "execute:",
  47989. protocol: "running",
  47990. fn: function (aBlock){
  47991. var self=this,$self=this;
  47992. var failed;
  47993. return $core.withContext(function($ctx1) {
  47994. var $1,$2;
  47995. $recv($self["@testCase"])._context_(self);
  47996. $ctx1.sendIdx["context:"]=1;
  47997. $recv((function(){
  47998. return $core.withContext(function($ctx2) {
  47999. failed=true;
  48000. $recv(aBlock)._value();
  48001. failed=false;
  48002. return failed;
  48003. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48004. }))._ensure_((function(){
  48005. return $core.withContext(function($ctx2) {
  48006. $recv($self["@testCase"])._context_(nil);
  48007. $1=$recv(failed)._and_((function(){
  48008. return $core.withContext(function($ctx3) {
  48009. return $recv($self["@testCase"])._isAsync();
  48010. $ctx3.sendIdx["isAsync"]=1;
  48011. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  48012. }));
  48013. if($core.assert($1)){
  48014. $recv($self["@testCase"])._finished();
  48015. }
  48016. $2=$recv($self["@testCase"])._isAsync();
  48017. if(!$core.assert($2)){
  48018. return $recv($self["@testCase"])._tearDown();
  48019. }
  48020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48021. }));
  48022. return self;
  48023. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  48024. },
  48025. args: ["aBlock"],
  48026. 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 ] ]",
  48027. referencedClasses: [],
  48028. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  48029. }),
  48030. $globals.TestContext);
  48031. $core.addMethod(
  48032. $core.method({
  48033. selector: "start",
  48034. protocol: "running",
  48035. fn: function (){
  48036. var self=this,$self=this;
  48037. return $core.withContext(function($ctx1) {
  48038. $self._execute_((function(){
  48039. return $core.withContext(function($ctx2) {
  48040. $recv($self["@testCase"])._setUp();
  48041. return $recv($self["@testCase"])._performTest();
  48042. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48043. }));
  48044. return self;
  48045. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  48046. },
  48047. args: [],
  48048. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  48049. referencedClasses: [],
  48050. messageSends: ["execute:", "setUp", "performTest"]
  48051. }),
  48052. $globals.TestContext);
  48053. $core.addMethod(
  48054. $core.method({
  48055. selector: "testCase:",
  48056. protocol: "accessing",
  48057. fn: function (aTestCase){
  48058. var self=this,$self=this;
  48059. $self["@testCase"]=aTestCase;
  48060. return self;
  48061. },
  48062. args: ["aTestCase"],
  48063. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  48064. referencedClasses: [],
  48065. messageSends: []
  48066. }),
  48067. $globals.TestContext);
  48068. $core.addMethod(
  48069. $core.method({
  48070. selector: "testCase:",
  48071. protocol: "instance creation",
  48072. fn: function (aTestCase){
  48073. var self=this,$self=this;
  48074. return $core.withContext(function($ctx1) {
  48075. var $1;
  48076. $1=$self._new();
  48077. $recv($1)._testCase_(aTestCase);
  48078. return $recv($1)._yourself();
  48079. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  48080. },
  48081. args: ["aTestCase"],
  48082. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  48083. referencedClasses: [],
  48084. messageSends: ["testCase:", "new", "yourself"]
  48085. }),
  48086. $globals.TestContext.a$cls);
  48087. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  48088. $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`.";
  48089. $core.addMethod(
  48090. $core.method({
  48091. selector: "execute:",
  48092. protocol: "running",
  48093. fn: function (aBlock){
  48094. var self=this,$self=this;
  48095. return $core.withContext(function($ctx1) {
  48096. var $1;
  48097. $recv((function(){
  48098. return $core.withContext(function($ctx2) {
  48099. return $self._withErrorReporting_((function(){
  48100. return $core.withContext(function($ctx3) {
  48101. return (
  48102. $ctx3.supercall = true,
  48103. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  48104. $ctx3.supercall = false;
  48105. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48106. }));
  48107. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48108. }))._ensure_((function(){
  48109. return $core.withContext(function($ctx2) {
  48110. $1=$recv($self["@testCase"])._isAsync();
  48111. if(!$core.assert($1)){
  48112. $recv($self["@result"])._increaseRuns();
  48113. return $recv($self["@finished"])._value();
  48114. }
  48115. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48116. }));
  48117. return self;
  48118. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48119. },
  48120. args: ["aBlock"],
  48121. 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 ] ]",
  48122. referencedClasses: [],
  48123. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  48124. }),
  48125. $globals.ReportingTestContext);
  48126. $core.addMethod(
  48127. $core.method({
  48128. selector: "finished:",
  48129. protocol: "accessing",
  48130. fn: function (aBlock){
  48131. var self=this,$self=this;
  48132. $self["@finished"]=aBlock;
  48133. return self;
  48134. },
  48135. args: ["aBlock"],
  48136. source: "finished: aBlock\x0a\x09finished := aBlock",
  48137. referencedClasses: [],
  48138. messageSends: []
  48139. }),
  48140. $globals.ReportingTestContext);
  48141. $core.addMethod(
  48142. $core.method({
  48143. selector: "result:",
  48144. protocol: "accessing",
  48145. fn: function (aTestResult){
  48146. var self=this,$self=this;
  48147. $self["@result"]=aTestResult;
  48148. return self;
  48149. },
  48150. args: ["aTestResult"],
  48151. source: "result: aTestResult\x0a\x09result := aTestResult",
  48152. referencedClasses: [],
  48153. messageSends: []
  48154. }),
  48155. $globals.ReportingTestContext);
  48156. $core.addMethod(
  48157. $core.method({
  48158. selector: "withErrorReporting:",
  48159. protocol: "private",
  48160. fn: function (aBlock){
  48161. var self=this,$self=this;
  48162. return $core.withContext(function($ctx1) {
  48163. $recv((function(){
  48164. return $core.withContext(function($ctx2) {
  48165. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  48166. return $core.withContext(function($ctx3) {
  48167. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  48168. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  48169. }));
  48170. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48171. }))._on_do_($globals.Error,(function(ex){
  48172. return $core.withContext(function($ctx2) {
  48173. return $recv($self["@result"])._addError_($self["@testCase"]);
  48174. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  48175. }));
  48176. $ctx1.sendIdx["on:do:"]=1;
  48177. return self;
  48178. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48179. },
  48180. args: ["aBlock"],
  48181. 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 ]",
  48182. referencedClasses: ["TestFailure", "Error"],
  48183. messageSends: ["on:do:", "addFailure:", "addError:"]
  48184. }),
  48185. $globals.ReportingTestContext);
  48186. $core.addMethod(
  48187. $core.method({
  48188. selector: "testCase:result:finished:",
  48189. protocol: "instance creation",
  48190. fn: function (aTestCase,aTestResult,aBlock){
  48191. var self=this,$self=this;
  48192. return $core.withContext(function($ctx1) {
  48193. var $1;
  48194. $1=(
  48195. $ctx1.supercall = true,
  48196. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  48197. $ctx1.supercall = false;
  48198. $recv($1)._result_(aTestResult);
  48199. $recv($1)._finished_(aBlock);
  48200. return $recv($1)._yourself();
  48201. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  48202. },
  48203. args: ["aTestCase", "aTestResult", "aBlock"],
  48204. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  48205. referencedClasses: [],
  48206. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  48207. }),
  48208. $globals.ReportingTestContext.a$cls);
  48209. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  48210. $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.";
  48211. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  48212. $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";
  48213. $core.addMethod(
  48214. $core.method({
  48215. selector: "addError:",
  48216. protocol: "accessing",
  48217. fn: function (anError){
  48218. var self=this,$self=this;
  48219. return $core.withContext(function($ctx1) {
  48220. $recv($self._errors())._add_(anError);
  48221. return self;
  48222. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  48223. },
  48224. args: ["anError"],
  48225. source: "addError: anError\x0a\x09self errors add: anError",
  48226. referencedClasses: [],
  48227. messageSends: ["add:", "errors"]
  48228. }),
  48229. $globals.TestResult);
  48230. $core.addMethod(
  48231. $core.method({
  48232. selector: "addFailure:",
  48233. protocol: "accessing",
  48234. fn: function (aFailure){
  48235. var self=this,$self=this;
  48236. return $core.withContext(function($ctx1) {
  48237. $recv($self._failures())._add_(aFailure);
  48238. return self;
  48239. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  48240. },
  48241. args: ["aFailure"],
  48242. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  48243. referencedClasses: [],
  48244. messageSends: ["add:", "failures"]
  48245. }),
  48246. $globals.TestResult);
  48247. $core.addMethod(
  48248. $core.method({
  48249. selector: "errors",
  48250. protocol: "accessing",
  48251. fn: function (){
  48252. var self=this,$self=this;
  48253. return $self["@errors"];
  48254. },
  48255. args: [],
  48256. source: "errors\x0a\x09^ errors",
  48257. referencedClasses: [],
  48258. messageSends: []
  48259. }),
  48260. $globals.TestResult);
  48261. $core.addMethod(
  48262. $core.method({
  48263. selector: "failures",
  48264. protocol: "accessing",
  48265. fn: function (){
  48266. var self=this,$self=this;
  48267. return $self["@failures"];
  48268. },
  48269. args: [],
  48270. source: "failures\x0a\x09^ failures",
  48271. referencedClasses: [],
  48272. messageSends: []
  48273. }),
  48274. $globals.TestResult);
  48275. $core.addMethod(
  48276. $core.method({
  48277. selector: "increaseRuns",
  48278. protocol: "accessing",
  48279. fn: function (){
  48280. var self=this,$self=this;
  48281. return $core.withContext(function($ctx1) {
  48282. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  48283. return self;
  48284. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  48285. },
  48286. args: [],
  48287. source: "increaseRuns\x0a\x09runs := runs + 1",
  48288. referencedClasses: [],
  48289. messageSends: ["+"]
  48290. }),
  48291. $globals.TestResult);
  48292. $core.addMethod(
  48293. $core.method({
  48294. selector: "initialize",
  48295. protocol: "initialization",
  48296. fn: function (){
  48297. var self=this,$self=this;
  48298. return $core.withContext(function($ctx1) {
  48299. (
  48300. $ctx1.supercall = true,
  48301. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48302. $ctx1.supercall = false;
  48303. $self["@timestamp"]=$recv($globals.Date)._now();
  48304. $self["@runs"]=(0);
  48305. $self["@errors"]=$recv($globals.Array)._new();
  48306. $ctx1.sendIdx["new"]=1;
  48307. $self["@failures"]=$recv($globals.Array)._new();
  48308. $self["@total"]=(0);
  48309. return self;
  48310. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  48311. },
  48312. args: [],
  48313. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  48314. referencedClasses: ["Date", "Array"],
  48315. messageSends: ["initialize", "now", "new"]
  48316. }),
  48317. $globals.TestResult);
  48318. $core.addMethod(
  48319. $core.method({
  48320. selector: "nextRunDo:",
  48321. protocol: "running",
  48322. fn: function (aBlock){
  48323. var self=this,$self=this;
  48324. return $core.withContext(function($ctx1) {
  48325. var $2,$1;
  48326. $2=$self._runs();
  48327. $ctx1.sendIdx["runs"]=1;
  48328. $1=$recv($2).__eq_eq($self._total());
  48329. if(!$core.assert($1)){
  48330. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  48331. }
  48332. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  48333. },
  48334. args: ["aBlock"],
  48335. 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 ]",
  48336. referencedClasses: [],
  48337. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  48338. }),
  48339. $globals.TestResult);
  48340. $core.addMethod(
  48341. $core.method({
  48342. selector: "runCase:",
  48343. protocol: "running",
  48344. fn: function (aTestCase){
  48345. var self=this,$self=this;
  48346. return $core.withContext(function($ctx1) {
  48347. $recv((function(){
  48348. return $core.withContext(function($ctx2) {
  48349. return $recv((function(){
  48350. return $core.withContext(function($ctx3) {
  48351. $self._increaseRuns();
  48352. return $recv(aTestCase)._runCase();
  48353. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48354. }))._on_do_($globals.TestFailure,(function(ex){
  48355. return $core.withContext(function($ctx3) {
  48356. return $self._addFailure_(aTestCase);
  48357. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48358. }));
  48359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48360. }))._on_do_($globals.Error,(function(ex){
  48361. return $core.withContext(function($ctx2) {
  48362. return $self._addError_(aTestCase);
  48363. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  48364. }));
  48365. $ctx1.sendIdx["on:do:"]=1;
  48366. return self;
  48367. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  48368. },
  48369. args: ["aTestCase"],
  48370. 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 ]",
  48371. referencedClasses: ["TestFailure", "Error"],
  48372. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  48373. }),
  48374. $globals.TestResult);
  48375. $core.addMethod(
  48376. $core.method({
  48377. selector: "runs",
  48378. protocol: "accessing",
  48379. fn: function (){
  48380. var self=this,$self=this;
  48381. return $self["@runs"];
  48382. },
  48383. args: [],
  48384. source: "runs\x0a\x09^ runs",
  48385. referencedClasses: [],
  48386. messageSends: []
  48387. }),
  48388. $globals.TestResult);
  48389. $core.addMethod(
  48390. $core.method({
  48391. selector: "status",
  48392. protocol: "accessing",
  48393. fn: function (){
  48394. var self=this,$self=this;
  48395. return $core.withContext(function($ctx1) {
  48396. var $1;
  48397. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  48398. return "error";
  48399. }),(function(){
  48400. return $core.withContext(function($ctx2) {
  48401. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  48402. return "failure";
  48403. }),(function(){
  48404. return "success";
  48405. }));
  48406. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48407. }));
  48408. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  48409. return $1;
  48410. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  48411. },
  48412. args: [],
  48413. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  48414. referencedClasses: [],
  48415. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  48416. }),
  48417. $globals.TestResult);
  48418. $core.addMethod(
  48419. $core.method({
  48420. selector: "timestamp",
  48421. protocol: "accessing",
  48422. fn: function (){
  48423. var self=this,$self=this;
  48424. return $self["@timestamp"];
  48425. },
  48426. args: [],
  48427. source: "timestamp\x0a\x09^ timestamp",
  48428. referencedClasses: [],
  48429. messageSends: []
  48430. }),
  48431. $globals.TestResult);
  48432. $core.addMethod(
  48433. $core.method({
  48434. selector: "total",
  48435. protocol: "accessing",
  48436. fn: function (){
  48437. var self=this,$self=this;
  48438. return $self["@total"];
  48439. },
  48440. args: [],
  48441. source: "total\x0a\x09^ total",
  48442. referencedClasses: [],
  48443. messageSends: []
  48444. }),
  48445. $globals.TestResult);
  48446. $core.addMethod(
  48447. $core.method({
  48448. selector: "total:",
  48449. protocol: "accessing",
  48450. fn: function (aNumber){
  48451. var self=this,$self=this;
  48452. $self["@total"]=aNumber;
  48453. return self;
  48454. },
  48455. args: ["aNumber"],
  48456. source: "total: aNumber\x0a\x09total := aNumber",
  48457. referencedClasses: [],
  48458. messageSends: []
  48459. }),
  48460. $globals.TestResult);
  48461. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  48462. $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`.";
  48463. $core.addMethod(
  48464. $core.method({
  48465. selector: "announcer",
  48466. protocol: "accessing",
  48467. fn: function (){
  48468. var self=this,$self=this;
  48469. return $self["@announcer"];
  48470. },
  48471. args: [],
  48472. source: "announcer\x0a\x09^ announcer",
  48473. referencedClasses: [],
  48474. messageSends: []
  48475. }),
  48476. $globals.TestSuiteRunner);
  48477. $core.addMethod(
  48478. $core.method({
  48479. selector: "contextOf:",
  48480. protocol: "private",
  48481. fn: function (anInteger){
  48482. var self=this,$self=this;
  48483. return $core.withContext(function($ctx1) {
  48484. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  48485. return $core.withContext(function($ctx2) {
  48486. return $self._resume();
  48487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48488. }));
  48489. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48490. },
  48491. args: ["anInteger"],
  48492. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48493. referencedClasses: ["ReportingTestContext"],
  48494. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48495. }),
  48496. $globals.TestSuiteRunner);
  48497. $core.addMethod(
  48498. $core.method({
  48499. selector: "initialize",
  48500. protocol: "initialization",
  48501. fn: function (){
  48502. var self=this,$self=this;
  48503. return $core.withContext(function($ctx1) {
  48504. var $1;
  48505. (
  48506. $ctx1.supercall = true,
  48507. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48508. $ctx1.supercall = false;
  48509. $self["@announcer"]=$recv($globals.Announcer)._new();
  48510. $ctx1.sendIdx["new"]=1;
  48511. $self["@result"]=$recv($globals.TestResult)._new();
  48512. $self["@runNextTest"]=(function(){
  48513. var runs;
  48514. return $core.withContext(function($ctx2) {
  48515. runs=$recv($self["@result"])._runs();
  48516. $1=$recv(runs).__lt($recv($self["@result"])._total());
  48517. if($core.assert($1)){
  48518. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48519. }
  48520. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48521. });
  48522. return self;
  48523. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48524. },
  48525. args: [],
  48526. 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 ] ].",
  48527. referencedClasses: ["Announcer", "TestResult"],
  48528. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48529. }),
  48530. $globals.TestSuiteRunner);
  48531. $core.addMethod(
  48532. $core.method({
  48533. selector: "result",
  48534. protocol: "accessing",
  48535. fn: function (){
  48536. var self=this,$self=this;
  48537. return $self["@result"];
  48538. },
  48539. args: [],
  48540. source: "result\x0a\x09^ result",
  48541. referencedClasses: [],
  48542. messageSends: []
  48543. }),
  48544. $globals.TestSuiteRunner);
  48545. $core.addMethod(
  48546. $core.method({
  48547. selector: "resume",
  48548. protocol: "actions",
  48549. fn: function (){
  48550. var self=this,$self=this;
  48551. return $core.withContext(function($ctx1) {
  48552. $recv($self["@runNextTest"])._fork();
  48553. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48554. return self;
  48555. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48556. },
  48557. args: [],
  48558. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48559. referencedClasses: ["ResultAnnouncement"],
  48560. messageSends: ["fork", "announce:", "result:", "new"]
  48561. }),
  48562. $globals.TestSuiteRunner);
  48563. $core.addMethod(
  48564. $core.method({
  48565. selector: "run",
  48566. protocol: "actions",
  48567. fn: function (){
  48568. var self=this,$self=this;
  48569. return $core.withContext(function($ctx1) {
  48570. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48571. $self._resume();
  48572. return self;
  48573. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48574. },
  48575. args: [],
  48576. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48577. referencedClasses: [],
  48578. messageSends: ["total:", "size", "resume"]
  48579. }),
  48580. $globals.TestSuiteRunner);
  48581. $core.addMethod(
  48582. $core.method({
  48583. selector: "suite:",
  48584. protocol: "accessing",
  48585. fn: function (aCollection){
  48586. var self=this,$self=this;
  48587. $self["@suite"]=aCollection;
  48588. return self;
  48589. },
  48590. args: ["aCollection"],
  48591. source: "suite: aCollection\x0a\x09suite := aCollection",
  48592. referencedClasses: [],
  48593. messageSends: []
  48594. }),
  48595. $globals.TestSuiteRunner);
  48596. $core.addMethod(
  48597. $core.method({
  48598. selector: "new",
  48599. protocol: "instance creation",
  48600. fn: function (){
  48601. var self=this,$self=this;
  48602. return $core.withContext(function($ctx1) {
  48603. $self._shouldNotImplement();
  48604. return self;
  48605. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48606. },
  48607. args: [],
  48608. source: "new\x0a\x09self shouldNotImplement",
  48609. referencedClasses: [],
  48610. messageSends: ["shouldNotImplement"]
  48611. }),
  48612. $globals.TestSuiteRunner.a$cls);
  48613. $core.addMethod(
  48614. $core.method({
  48615. selector: "on:",
  48616. protocol: "instance creation",
  48617. fn: function (aCollection){
  48618. var self=this,$self=this;
  48619. return $core.withContext(function($ctx1) {
  48620. var $1;
  48621. $1=(
  48622. $ctx1.supercall = true,
  48623. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48624. $ctx1.supercall = false;
  48625. return $recv($1)._suite_(aCollection);
  48626. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48627. },
  48628. args: ["aCollection"],
  48629. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48630. referencedClasses: [],
  48631. messageSends: ["suite:", "new"]
  48632. }),
  48633. $globals.TestSuiteRunner.a$cls);
  48634. $core.addMethod(
  48635. $core.method({
  48636. selector: "isTestPackage",
  48637. protocol: "*SUnit",
  48638. fn: function (){
  48639. var self=this,$self=this;
  48640. return $core.withContext(function($ctx1) {
  48641. return $recv($self._classes())._anySatisfy_((function(each){
  48642. return $core.withContext(function($ctx2) {
  48643. return $recv(each)._isTestClass();
  48644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48645. }));
  48646. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48647. },
  48648. args: [],
  48649. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48650. referencedClasses: [],
  48651. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48652. }),
  48653. $globals.Package);
  48654. $core.addMethod(
  48655. $core.method({
  48656. selector: "isTestClass",
  48657. protocol: "*SUnit",
  48658. fn: function (){
  48659. var self=this,$self=this;
  48660. return false;
  48661. },
  48662. args: [],
  48663. source: "isTestClass\x0a\x09^ false",
  48664. referencedClasses: [],
  48665. messageSends: []
  48666. }),
  48667. $globals.TBehaviorDefaults);
  48668. });
  48669. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48670. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48671. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48672. $core.addPackage("Compiler-Tests");
  48673. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  48674. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48675. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48676. $core.addMethod(
  48677. $core.method({
  48678. selector: "parse:forClass:",
  48679. protocol: "parsing",
  48680. fn: function (aString,aClass){
  48681. var self=this,$self=this;
  48682. return $core.withContext(function($ctx1) {
  48683. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  48684. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48685. },
  48686. args: ["aString", "aClass"],
  48687. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  48688. referencedClasses: ["Compiler"],
  48689. messageSends: ["ast:forClass:protocol:", "new"]
  48690. }),
  48691. $globals.ASTParsingTest);
  48692. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48693. $core.addMethod(
  48694. $core.method({
  48695. selector: "astPCNodeVisitor",
  48696. protocol: "factory",
  48697. fn: function (){
  48698. var self=this,$self=this;
  48699. return $core.withContext(function($ctx1) {
  48700. var $1;
  48701. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48702. $recv($1)._index_((0));
  48703. return $recv($1)._yourself();
  48704. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48705. },
  48706. args: [],
  48707. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48708. referencedClasses: ["ASTPCNodeVisitor"],
  48709. messageSends: ["index:", "new", "yourself"]
  48710. }),
  48711. $globals.ASTPCNodeVisitorTest);
  48712. $core.addMethod(
  48713. $core.method({
  48714. selector: "astPCNodeVisitorForSelector:",
  48715. protocol: "factory",
  48716. fn: function (aString){
  48717. var self=this,$self=this;
  48718. return $core.withContext(function($ctx1) {
  48719. var $1;
  48720. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48721. $recv($1)._selector_(aString);
  48722. $recv($1)._index_((0));
  48723. return $recv($1)._yourself();
  48724. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48725. },
  48726. args: ["aString"],
  48727. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48728. referencedClasses: ["ASTPCNodeVisitor"],
  48729. messageSends: ["selector:", "new", "index:", "yourself"]
  48730. }),
  48731. $globals.ASTPCNodeVisitorTest);
  48732. $core.addMethod(
  48733. $core.method({
  48734. selector: "testJSStatementNode",
  48735. protocol: "tests",
  48736. fn: function (){
  48737. var self=this,$self=this;
  48738. var ast,visitor;
  48739. return $core.withContext(function($ctx1) {
  48740. var $3,$2,$1;
  48741. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48742. $3=$self._astPCNodeVisitor();
  48743. $recv($3)._visit_(ast);
  48744. $2=$recv($3)._currentNode();
  48745. $1=$recv($2)._isJSStatementNode();
  48746. $self._assert_($1);
  48747. return self;
  48748. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48749. },
  48750. args: [],
  48751. 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",
  48752. referencedClasses: ["Object"],
  48753. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48754. }),
  48755. $globals.ASTPCNodeVisitorTest);
  48756. $core.addMethod(
  48757. $core.method({
  48758. selector: "testMessageSend",
  48759. protocol: "tests",
  48760. fn: function (){
  48761. var self=this,$self=this;
  48762. var ast;
  48763. return $core.withContext(function($ctx1) {
  48764. var $3,$2,$1;
  48765. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48766. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48767. $recv($3)._visit_(ast);
  48768. $2=$recv($3)._currentNode();
  48769. $1=$recv($2)._selector();
  48770. $self._assert_equals_($1,"yourself");
  48771. return self;
  48772. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48773. },
  48774. args: [],
  48775. 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'",
  48776. referencedClasses: ["Object"],
  48777. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48778. }),
  48779. $globals.ASTPCNodeVisitorTest);
  48780. $core.addMethod(
  48781. $core.method({
  48782. selector: "testMessageSendWithBlocks",
  48783. protocol: "tests",
  48784. fn: function (){
  48785. var self=this,$self=this;
  48786. var ast;
  48787. return $core.withContext(function($ctx1) {
  48788. var $3,$2,$1;
  48789. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48790. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48791. $recv($3)._visit_(ast);
  48792. $2=$recv($3)._currentNode();
  48793. $1=$recv($2)._selector();
  48794. $self._assert_equals_($1,"yourself");
  48795. return self;
  48796. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48797. },
  48798. args: [],
  48799. 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'",
  48800. referencedClasses: ["Object"],
  48801. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48802. }),
  48803. $globals.ASTPCNodeVisitorTest);
  48804. $core.addMethod(
  48805. $core.method({
  48806. selector: "testMessageSendWithInlining",
  48807. protocol: "tests",
  48808. fn: function (){
  48809. var self=this,$self=this;
  48810. var ast;
  48811. return $core.withContext(function($ctx1) {
  48812. var $3,$4,$2,$1,$7,$6,$5;
  48813. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48814. $ctx1.sendIdx["parse:forClass:"]=1;
  48815. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48816. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48817. $recv($3)._visit_(ast);
  48818. $ctx1.sendIdx["visit:"]=1;
  48819. $4=$recv($3)._currentNode();
  48820. $ctx1.sendIdx["currentNode"]=1;
  48821. $2=$4;
  48822. $1=$recv($2)._selector();
  48823. $ctx1.sendIdx["selector"]=1;
  48824. $self._assert_equals_($1,"yourself");
  48825. $ctx1.sendIdx["assert:equals:"]=1;
  48826. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48827. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48828. $recv($7)._visit_(ast);
  48829. $6=$recv($7)._currentNode();
  48830. $5=$recv($6)._selector();
  48831. $self._assert_equals_($5,"asBoolean");
  48832. return self;
  48833. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48834. },
  48835. args: [],
  48836. 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'",
  48837. referencedClasses: ["Object"],
  48838. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48839. }),
  48840. $globals.ASTPCNodeVisitorTest);
  48841. $core.addMethod(
  48842. $core.method({
  48843. selector: "testNoMessageSend",
  48844. protocol: "tests",
  48845. fn: function (){
  48846. var self=this,$self=this;
  48847. var ast;
  48848. return $core.withContext(function($ctx1) {
  48849. var $3,$2,$1;
  48850. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48851. $3=$self._astPCNodeVisitor();
  48852. $recv($3)._visit_(ast);
  48853. $2=$recv($3)._currentNode();
  48854. $1=$recv($2)._isNil();
  48855. $self._assert_($1);
  48856. return self;
  48857. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48858. },
  48859. args: [],
  48860. 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",
  48861. referencedClasses: ["Object"],
  48862. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48863. }),
  48864. $globals.ASTPCNodeVisitorTest);
  48865. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48866. $core.addMethod(
  48867. $core.method({
  48868. selector: "testNodeAtPosition",
  48869. protocol: "tests",
  48870. fn: function (){
  48871. var self=this,$self=this;
  48872. var node;
  48873. return $core.withContext(function($ctx1) {
  48874. var $3,$4,$2,$1,$7,$8,$6,$5;
  48875. node=$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object);
  48876. $ctx1.sendIdx["parse:forClass:"]=1;
  48877. $3=node;
  48878. $4=(2).__at((4));
  48879. $ctx1.sendIdx["@"]=1;
  48880. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48881. return nil;
  48882. }));
  48883. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48884. $1=$recv($2)._source();
  48885. $self._assert_equals_($1,"self");
  48886. $ctx1.sendIdx["assert:equals:"]=1;
  48887. node=$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  48888. $ctx1.sendIdx["parse:forClass:"]=2;
  48889. $7=node;
  48890. $8=(2).__at((7));
  48891. $ctx1.sendIdx["@"]=2;
  48892. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48893. return nil;
  48894. }));
  48895. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48896. $5=$recv($6)._selector();
  48897. $ctx1.sendIdx["selector"]=1;
  48898. $self._assert_equals_($5,"ifTrue:");
  48899. $ctx1.sendIdx["assert:equals:"]=2;
  48900. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  48901. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48902. return nil;
  48903. })))._selector(),"foo");
  48904. return self;
  48905. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48906. },
  48907. args: [],
  48908. source: "testNodeAtPosition\x0a\x09| node |\x0a\x09\x0a\x09node := self parse: 'yourself\x0a\x09^ self' forClass: Object.\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 ]' forClass: Object.\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' forClass: Object.\x0a\x09\x0a\x09self assert: (node navigationNodeAt: 2@8 ifAbsent: [ nil ]) selector equals: 'foo'",
  48909. referencedClasses: ["Object"],
  48910. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48911. }),
  48912. $globals.ASTPositionTest);
  48913. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48914. $core.addMethod(
  48915. $core.method({
  48916. selector: "codeGeneratorClass",
  48917. protocol: "accessing",
  48918. fn: function (){
  48919. var self=this,$self=this;
  48920. return $globals.CodeGenerator;
  48921. },
  48922. args: [],
  48923. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48924. referencedClasses: ["CodeGenerator"],
  48925. messageSends: []
  48926. }),
  48927. $globals.CodeGeneratorTest);
  48928. $core.addMethod(
  48929. $core.method({
  48930. selector: "compiler",
  48931. protocol: "factory",
  48932. fn: function (){
  48933. var self=this,$self=this;
  48934. return $core.withContext(function($ctx1) {
  48935. var $1;
  48936. $1=$recv($globals.Compiler)._new();
  48937. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48938. return $recv($1)._yourself();
  48939. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48940. },
  48941. args: [],
  48942. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48943. referencedClasses: ["Compiler"],
  48944. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48945. }),
  48946. $globals.CodeGeneratorTest);
  48947. $core.addMethod(
  48948. $core.method({
  48949. selector: "setUp",
  48950. protocol: "initialization",
  48951. fn: function (){
  48952. var self=this,$self=this;
  48953. return $core.withContext(function($ctx1) {
  48954. $self["@receiver"]=$recv($globals.DoIt)._new();
  48955. return self;
  48956. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48957. },
  48958. args: [],
  48959. source: "setUp\x0a\x09receiver := DoIt new",
  48960. referencedClasses: ["DoIt"],
  48961. messageSends: ["new"]
  48962. }),
  48963. $globals.CodeGeneratorTest);
  48964. $core.addMethod(
  48965. $core.method({
  48966. selector: "should:receiver:raise:",
  48967. protocol: "testing",
  48968. fn: function (aString,anObject,anErrorClass){
  48969. var self=this,$self=this;
  48970. var method,result;
  48971. return $core.withContext(function($ctx1) {
  48972. var $1,$2,$3,$receiver;
  48973. $self["@receiver"]=anObject;
  48974. $recv((function(){
  48975. return $core.withContext(function($ctx2) {
  48976. return $self._should_raise_((function(){
  48977. return $core.withContext(function($ctx3) {
  48978. $1=$self._compiler();
  48979. $2=$recv(anObject)._class();
  48980. $ctx3.sendIdx["class"]=1;
  48981. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  48982. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  48983. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48984. }),anErrorClass);
  48985. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48986. }))._ensure_((function(){
  48987. return $core.withContext(function($ctx2) {
  48988. $3=method;
  48989. if(($receiver = $3) == null || $receiver.a$nil){
  48990. return $3;
  48991. } else {
  48992. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  48993. }
  48994. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48995. }));
  48996. return self;
  48997. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  48998. },
  48999. args: ["aString", "anObject", "anErrorClass"],
  49000. 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 ] ]",
  49001. referencedClasses: [],
  49002. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  49003. }),
  49004. $globals.CodeGeneratorTest);
  49005. $core.addMethod(
  49006. $core.method({
  49007. selector: "should:receiver:return:",
  49008. protocol: "testing",
  49009. fn: function (aString,anObject,aResult){
  49010. var self=this,$self=this;
  49011. var method,result;
  49012. return $core.withContext(function($ctx1) {
  49013. var $1,$2;
  49014. $self["@receiver"]=anObject;
  49015. $1=$self._compiler();
  49016. $2=$recv(anObject)._class();
  49017. $ctx1.sendIdx["class"]=1;
  49018. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  49019. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  49020. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  49021. $self._assert_equals_(aResult,result);
  49022. return self;
  49023. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  49024. },
  49025. args: ["aString", "anObject", "aResult"],
  49026. 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",
  49027. referencedClasses: [],
  49028. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  49029. }),
  49030. $globals.CodeGeneratorTest);
  49031. $core.addMethod(
  49032. $core.method({
  49033. selector: "should:return:",
  49034. protocol: "testing",
  49035. fn: function (aString,anObject){
  49036. var self=this,$self=this;
  49037. return $core.withContext(function($ctx1) {
  49038. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  49039. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  49040. },
  49041. args: ["aString", "anObject"],
  49042. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  49043. referencedClasses: [],
  49044. messageSends: ["should:receiver:return:"]
  49045. }),
  49046. $globals.CodeGeneratorTest);
  49047. $core.addMethod(
  49048. $core.method({
  49049. selector: "tearDown",
  49050. protocol: "initialization",
  49051. fn: function (){
  49052. var self=this,$self=this;
  49053. return self;
  49054. },
  49055. args: [],
  49056. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  49057. referencedClasses: [],
  49058. messageSends: []
  49059. }),
  49060. $globals.CodeGeneratorTest);
  49061. $core.addMethod(
  49062. $core.method({
  49063. selector: "testAssignment",
  49064. protocol: "tests",
  49065. fn: function (){
  49066. var self=this,$self=this;
  49067. return $core.withContext(function($ctx1) {
  49068. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  49069. $ctx1.sendIdx["should:return:"]=1;
  49070. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  49071. $ctx1.sendIdx["should:return:"]=2;
  49072. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  49073. return self;
  49074. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  49075. },
  49076. args: [],
  49077. 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",
  49078. referencedClasses: [],
  49079. messageSends: ["should:return:"]
  49080. }),
  49081. $globals.CodeGeneratorTest);
  49082. $core.addMethod(
  49083. $core.method({
  49084. selector: "testBackslashSelectors",
  49085. protocol: "tests",
  49086. fn: function (){
  49087. var self=this,$self=this;
  49088. return $core.withContext(function($ctx1) {
  49089. $self._should_return_("\x5c arg ^ 4",(4));
  49090. $ctx1.sendIdx["should:return:"]=1;
  49091. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  49092. return self;
  49093. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  49094. },
  49095. args: [],
  49096. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  49097. referencedClasses: [],
  49098. messageSends: ["should:return:"]
  49099. }),
  49100. $globals.CodeGeneratorTest);
  49101. $core.addMethod(
  49102. $core.method({
  49103. selector: "testBlockReturn",
  49104. protocol: "tests",
  49105. fn: function (){
  49106. var self=this,$self=this;
  49107. return $core.withContext(function($ctx1) {
  49108. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  49109. $ctx1.sendIdx["should:return:"]=1;
  49110. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  49111. $ctx1.sendIdx["should:return:"]=2;
  49112. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  49113. return self;
  49114. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  49115. },
  49116. args: [],
  49117. 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).",
  49118. referencedClasses: [],
  49119. messageSends: ["should:return:"]
  49120. }),
  49121. $globals.CodeGeneratorTest);
  49122. $core.addMethod(
  49123. $core.method({
  49124. selector: "testCascades",
  49125. protocol: "tests",
  49126. fn: function (){
  49127. var self=this,$self=this;
  49128. return $core.withContext(function($ctx1) {
  49129. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  49130. return self;
  49131. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  49132. },
  49133. args: [],
  49134. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  49135. referencedClasses: [],
  49136. messageSends: ["should:return:"]
  49137. }),
  49138. $globals.CodeGeneratorTest);
  49139. $core.addMethod(
  49140. $core.method({
  49141. selector: "testCascadesInDynamicArray",
  49142. protocol: "tests",
  49143. fn: function (){
  49144. var self=this,$self=this;
  49145. return $core.withContext(function($ctx1) {
  49146. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  49147. return self;
  49148. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  49149. },
  49150. args: [],
  49151. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  49152. referencedClasses: [],
  49153. messageSends: ["should:return:"]
  49154. }),
  49155. $globals.CodeGeneratorTest);
  49156. $core.addMethod(
  49157. $core.method({
  49158. selector: "testCascadesInDynamicDictioary",
  49159. protocol: "tests",
  49160. fn: function (){
  49161. var self=this,$self=this;
  49162. return $core.withContext(function($ctx1) {
  49163. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  49164. return self;
  49165. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  49166. },
  49167. args: [],
  49168. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  49169. referencedClasses: [],
  49170. messageSends: ["should:return:"]
  49171. }),
  49172. $globals.CodeGeneratorTest);
  49173. $core.addMethod(
  49174. $core.method({
  49175. selector: "testCascadesInSend",
  49176. protocol: "tests",
  49177. fn: function (){
  49178. var self=this,$self=this;
  49179. return $core.withContext(function($ctx1) {
  49180. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  49181. return self;
  49182. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  49183. },
  49184. args: [],
  49185. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  49186. referencedClasses: [],
  49187. messageSends: ["should:return:"]
  49188. }),
  49189. $globals.CodeGeneratorTest);
  49190. $core.addMethod(
  49191. $core.method({
  49192. selector: "testCascadesWithInlining",
  49193. protocol: "tests",
  49194. fn: function (){
  49195. var self=this,$self=this;
  49196. return $core.withContext(function($ctx1) {
  49197. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  49198. $ctx1.sendIdx["should:return:"]=1;
  49199. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  49200. return self;
  49201. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  49202. },
  49203. args: [],
  49204. 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",
  49205. referencedClasses: [],
  49206. messageSends: ["should:return:"]
  49207. }),
  49208. $globals.CodeGeneratorTest);
  49209. $core.addMethod(
  49210. $core.method({
  49211. selector: "testDynamicArrayElementsOrdered",
  49212. protocol: "tests",
  49213. fn: function (){
  49214. var self=this,$self=this;
  49215. return $core.withContext(function($ctx1) {
  49216. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  49217. $ctx1.sendIdx["should:return:"]=1;
  49218. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  49219. return self;
  49220. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  49221. },
  49222. args: [],
  49223. 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).",
  49224. referencedClasses: [],
  49225. messageSends: ["should:return:"]
  49226. }),
  49227. $globals.CodeGeneratorTest);
  49228. $core.addMethod(
  49229. $core.method({
  49230. selector: "testDynamicDictionaryElementsOrdered",
  49231. protocol: "tests",
  49232. fn: function (){
  49233. var self=this,$self=this;
  49234. return $core.withContext(function($ctx1) {
  49235. $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)]));
  49236. return self;
  49237. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  49238. },
  49239. args: [],
  49240. 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}.",
  49241. referencedClasses: [],
  49242. messageSends: ["should:return:"]
  49243. }),
  49244. $globals.CodeGeneratorTest);
  49245. $core.addMethod(
  49246. $core.method({
  49247. selector: "testDynamicDictionaryWithMoreArrows",
  49248. protocol: "tests",
  49249. fn: function (){
  49250. var self=this,$self=this;
  49251. return $core.withContext(function($ctx1) {
  49252. var $2,$1;
  49253. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  49254. $ctx1.sendIdx["->"]=1;
  49255. $1=$recv($globals.HashedCollection)._with_($2);
  49256. $self._should_return_("foo ^ #{1->2->3}",$1);
  49257. return self;
  49258. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  49259. },
  49260. args: [],
  49261. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  49262. referencedClasses: ["HashedCollection"],
  49263. messageSends: ["should:return:", "with:", "->"]
  49264. }),
  49265. $globals.CodeGeneratorTest);
  49266. $core.addMethod(
  49267. $core.method({
  49268. selector: "testGlobalVar",
  49269. protocol: "tests",
  49270. fn: function (){
  49271. var self=this,$self=this;
  49272. return $core.withContext(function($ctx1) {
  49273. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  49274. $ctx1.sendIdx["should:return:"]=1;
  49275. $self._should_return_("foo ^ Math cos: 0",(1));
  49276. $ctx1.sendIdx["should:return:"]=2;
  49277. $self._should_return_("foo ^ NonExistingVar",nil);
  49278. return self;
  49279. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  49280. },
  49281. args: [],
  49282. 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",
  49283. referencedClasses: ["BlockClosure"],
  49284. messageSends: ["should:return:"]
  49285. }),
  49286. $globals.CodeGeneratorTest);
  49287. $core.addMethod(
  49288. $core.method({
  49289. selector: "testInnerTemporalDependentElementsOrdered",
  49290. protocol: "tests",
  49291. fn: function (){
  49292. var self=this,$self=this;
  49293. return $core.withContext(function($ctx1) {
  49294. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  49295. $2="foo".__minus_gt($globals.Array);
  49296. $ctx1.sendIdx["->"]=1;
  49297. $3="bar".__minus_gt((2));
  49298. $ctx1.sendIdx["->"]=2;
  49299. $1=[$2,$3];
  49300. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  49301. $ctx1.sendIdx["should:return:"]=1;
  49302. $5="foo".__minus_gt($globals.Array);
  49303. $ctx1.sendIdx["->"]=3;
  49304. $6="bar".__minus_gt((2));
  49305. $ctx1.sendIdx["->"]=4;
  49306. $4=[$5,$6];
  49307. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  49308. $ctx1.sendIdx["should:return:"]=2;
  49309. $8="foo".__minus_gt((1));
  49310. $ctx1.sendIdx["->"]=5;
  49311. $9="bar".__minus_gt((2));
  49312. $ctx1.sendIdx["->"]=6;
  49313. $7=[$8,$9];
  49314. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  49315. $ctx1.sendIdx["should:return:"]=3;
  49316. $11="foo".__minus_gt((1));
  49317. $ctx1.sendIdx["->"]=7;
  49318. $10=[$11,"bar".__minus_gt((2))];
  49319. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  49320. $ctx1.sendIdx["should:return:"]=4;
  49321. $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)]));
  49322. return self;
  49323. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  49324. },
  49325. args: [],
  49326. 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}.",
  49327. referencedClasses: ["Array"],
  49328. messageSends: ["should:return:", "->"]
  49329. }),
  49330. $globals.CodeGeneratorTest);
  49331. $core.addMethod(
  49332. $core.method({
  49333. selector: "testLexicalScope",
  49334. protocol: "tests",
  49335. fn: function (){
  49336. var self=this,$self=this;
  49337. return $core.withContext(function($ctx1) {
  49338. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  49339. return self;
  49340. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  49341. },
  49342. args: [],
  49343. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  49344. referencedClasses: [],
  49345. messageSends: ["should:return:"]
  49346. }),
  49347. $globals.CodeGeneratorTest);
  49348. $core.addMethod(
  49349. $core.method({
  49350. selector: "testLiterals",
  49351. protocol: "tests",
  49352. fn: function (){
  49353. var self=this,$self=this;
  49354. return $core.withContext(function($ctx1) {
  49355. $self._should_return_("foo ^ 1",(1));
  49356. $ctx1.sendIdx["should:return:"]=1;
  49357. $self._should_return_("foo ^ 'hello'","hello");
  49358. $ctx1.sendIdx["should:return:"]=2;
  49359. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  49360. $ctx1.sendIdx["should:return:"]=3;
  49361. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  49362. $ctx1.sendIdx["should:return:"]=4;
  49363. $self._should_return_("foo ^ true",true);
  49364. $ctx1.sendIdx["should:return:"]=5;
  49365. $self._should_return_("foo ^ false",false);
  49366. $ctx1.sendIdx["should:return:"]=6;
  49367. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  49368. $ctx1.sendIdx["should:return:"]=7;
  49369. $self._should_return_("foo ^ #hello","hello");
  49370. $ctx1.sendIdx["should:return:"]=8;
  49371. $self._should_return_("foo ^ $h","h");
  49372. $ctx1.sendIdx["should:return:"]=9;
  49373. $self._should_return_("foo ^ -123.456",(-123.456));
  49374. $ctx1.sendIdx["should:return:"]=10;
  49375. $self._should_return_("foo ^ -2.5e4",(-25000));
  49376. return self;
  49377. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  49378. },
  49379. args: [],
  49380. 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.",
  49381. referencedClasses: [],
  49382. messageSends: ["should:return:"]
  49383. }),
  49384. $globals.CodeGeneratorTest);
  49385. $core.addMethod(
  49386. $core.method({
  49387. selector: "testLocalReturn",
  49388. protocol: "tests",
  49389. fn: function (){
  49390. var self=this,$self=this;
  49391. return $core.withContext(function($ctx1) {
  49392. $self._should_return_("foo ^ 1",(1));
  49393. $ctx1.sendIdx["should:return:"]=1;
  49394. $self._should_return_("foo ^ 1 + 1",(2));
  49395. $ctx1.sendIdx["should:return:"]=2;
  49396. $self._should_return_("foo ",$self["@receiver"]);
  49397. $ctx1.sendIdx["should:return:"]=3;
  49398. $self._should_return_("foo self asString",$self["@receiver"]);
  49399. $ctx1.sendIdx["should:return:"]=4;
  49400. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49401. return self;
  49402. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49403. },
  49404. args: [],
  49405. 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",
  49406. referencedClasses: [],
  49407. messageSends: ["should:return:"]
  49408. }),
  49409. $globals.CodeGeneratorTest);
  49410. $core.addMethod(
  49411. $core.method({
  49412. selector: "testMessageSends",
  49413. protocol: "tests",
  49414. fn: function (){
  49415. var self=this,$self=this;
  49416. return $core.withContext(function($ctx1) {
  49417. $self._should_return_("foo ^ 1 asString","1");
  49418. $ctx1.sendIdx["should:return:"]=1;
  49419. $self._should_return_("foo ^ 1 + 1",(2));
  49420. $ctx1.sendIdx["should:return:"]=2;
  49421. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49422. $ctx1.sendIdx["should:return:"]=3;
  49423. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49424. $ctx1.sendIdx["should:return:"]=4;
  49425. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49426. return self;
  49427. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49428. },
  49429. args: [],
  49430. 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)",
  49431. referencedClasses: [],
  49432. messageSends: ["should:return:"]
  49433. }),
  49434. $globals.CodeGeneratorTest);
  49435. $core.addMethod(
  49436. $core.method({
  49437. selector: "testMistypedPragmaJSStatement",
  49438. protocol: "tests",
  49439. fn: function (){
  49440. var self=this,$self=this;
  49441. return $core.withContext(function($ctx1) {
  49442. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  49443. return self;
  49444. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49445. },
  49446. args: [],
  49447. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49448. referencedClasses: ["ParseError"],
  49449. messageSends: ["should:receiver:raise:"]
  49450. }),
  49451. $globals.CodeGeneratorTest);
  49452. $core.addMethod(
  49453. $core.method({
  49454. selector: "testMultipleSequences",
  49455. protocol: "tests",
  49456. fn: function (){
  49457. var self=this,$self=this;
  49458. return $core.withContext(function($ctx1) {
  49459. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49460. return self;
  49461. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49462. },
  49463. args: [],
  49464. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49465. referencedClasses: [],
  49466. messageSends: ["should:return:"]
  49467. }),
  49468. $globals.CodeGeneratorTest);
  49469. $core.addMethod(
  49470. $core.method({
  49471. selector: "testMutableLiterals",
  49472. protocol: "tests",
  49473. fn: function (){
  49474. var self=this,$self=this;
  49475. return $core.withContext(function($ctx1) {
  49476. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49477. return self;
  49478. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49479. },
  49480. args: [],
  49481. 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)",
  49482. referencedClasses: [],
  49483. messageSends: ["should:return:"]
  49484. }),
  49485. $globals.CodeGeneratorTest);
  49486. $core.addMethod(
  49487. $core.method({
  49488. selector: "testNestedIfTrue",
  49489. protocol: "tests",
  49490. fn: function (){
  49491. var self=this,$self=this;
  49492. return $core.withContext(function($ctx1) {
  49493. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49494. $ctx1.sendIdx["should:return:"]=1;
  49495. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49496. $ctx1.sendIdx["should:return:"]=2;
  49497. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49498. $ctx1.sendIdx["should:return:"]=3;
  49499. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49500. return self;
  49501. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49502. },
  49503. args: [],
  49504. 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.",
  49505. referencedClasses: [],
  49506. messageSends: ["should:return:"]
  49507. }),
  49508. $globals.CodeGeneratorTest);
  49509. $core.addMethod(
  49510. $core.method({
  49511. selector: "testNestedSends",
  49512. protocol: "tests",
  49513. fn: function (){
  49514. var self=this,$self=this;
  49515. return $core.withContext(function($ctx1) {
  49516. $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());
  49517. return self;
  49518. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49519. },
  49520. args: [],
  49521. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49522. referencedClasses: ["Point"],
  49523. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49524. }),
  49525. $globals.CodeGeneratorTest);
  49526. $core.addMethod(
  49527. $core.method({
  49528. selector: "testNonLocalReturn",
  49529. protocol: "tests",
  49530. fn: function (){
  49531. var self=this,$self=this;
  49532. return $core.withContext(function($ctx1) {
  49533. $self._should_return_("foo [ ^ 1 ] value",(1));
  49534. $ctx1.sendIdx["should:return:"]=1;
  49535. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49536. $ctx1.sendIdx["should:return:"]=2;
  49537. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49538. $ctx1.sendIdx["should:return:"]=3;
  49539. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49540. return self;
  49541. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49542. },
  49543. args: [],
  49544. 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",
  49545. referencedClasses: [],
  49546. messageSends: ["should:return:"]
  49547. }),
  49548. $globals.CodeGeneratorTest);
  49549. $core.addMethod(
  49550. $core.method({
  49551. selector: "testPascalCaseGlobal",
  49552. protocol: "tests",
  49553. fn: function (){
  49554. var self=this,$self=this;
  49555. return $core.withContext(function($ctx1) {
  49556. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49557. $ctx1.sendIdx["should:return:"]=1;
  49558. $self._should_return_("foo ^NonExistent",nil);
  49559. return self;
  49560. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49561. },
  49562. args: [],
  49563. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49564. referencedClasses: ["Smalltalk"],
  49565. messageSends: ["should:return:", "at:", "globals"]
  49566. }),
  49567. $globals.CodeGeneratorTest);
  49568. $core.addMethod(
  49569. $core.method({
  49570. selector: "testPragmaInBlock",
  49571. protocol: "tests",
  49572. fn: function (){
  49573. var self=this,$self=this;
  49574. return $core.withContext(function($ctx1) {
  49575. $self._should_receiver_raise_("foo ^ [ < fooBar > 4 ] value",$self["@receiver"],$globals.CompilerError);
  49576. return self;
  49577. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{},$globals.CodeGeneratorTest)});
  49578. },
  49579. args: [],
  49580. source: "testPragmaInBlock\x0a\x09self should: 'foo ^ [ < fooBar > 4 ] value' receiver: receiver raise: CompilerError",
  49581. referencedClasses: ["CompilerError"],
  49582. messageSends: ["should:receiver:raise:"]
  49583. }),
  49584. $globals.CodeGeneratorTest);
  49585. $core.addMethod(
  49586. $core.method({
  49587. selector: "testPragmaJSStatement",
  49588. protocol: "tests",
  49589. fn: function (){
  49590. var self=this,$self=this;
  49591. return $core.withContext(function($ctx1) {
  49592. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49593. return self;
  49594. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49595. },
  49596. args: [],
  49597. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49598. referencedClasses: [],
  49599. messageSends: ["should:return:"]
  49600. }),
  49601. $globals.CodeGeneratorTest);
  49602. $core.addMethod(
  49603. $core.method({
  49604. selector: "testRootSuperSend",
  49605. protocol: "tests",
  49606. fn: function (){
  49607. var self=this,$self=this;
  49608. return $core.withContext(function($ctx1) {
  49609. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49610. return self;
  49611. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49612. },
  49613. args: [],
  49614. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49615. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49616. messageSends: ["should:receiver:raise:", "new"]
  49617. }),
  49618. $globals.CodeGeneratorTest);
  49619. $core.addMethod(
  49620. $core.method({
  49621. selector: "testSendReceiverAndArgumentsOrdered",
  49622. protocol: "tests",
  49623. fn: function (){
  49624. var self=this,$self=this;
  49625. return $core.withContext(function($ctx1) {
  49626. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49627. $ctx1.sendIdx["should:return:"]=1;
  49628. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49629. return self;
  49630. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49631. },
  49632. args: [],
  49633. 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}.",
  49634. referencedClasses: ["Array"],
  49635. messageSends: ["should:return:"]
  49636. }),
  49637. $globals.CodeGeneratorTest);
  49638. $core.addMethod(
  49639. $core.method({
  49640. selector: "testSuperSend",
  49641. protocol: "tests",
  49642. fn: function (){
  49643. var self=this,$self=this;
  49644. return $core.withContext(function($ctx1) {
  49645. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49646. return self;
  49647. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49648. },
  49649. args: [],
  49650. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49651. referencedClasses: [],
  49652. messageSends: ["should:receiver:return:"]
  49653. }),
  49654. $globals.CodeGeneratorTest);
  49655. $core.addMethod(
  49656. $core.method({
  49657. selector: "testTempVariables",
  49658. protocol: "tests",
  49659. fn: function (){
  49660. var self=this,$self=this;
  49661. return $core.withContext(function($ctx1) {
  49662. $self._should_return_("foo | a | ^ a",nil);
  49663. $ctx1.sendIdx["should:return:"]=1;
  49664. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49665. $ctx1.sendIdx["should:return:"]=2;
  49666. $self._should_return_("foo | a b c | ^ c",nil);
  49667. $ctx1.sendIdx["should:return:"]=3;
  49668. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49669. $ctx1.sendIdx["should:return:"]=4;
  49670. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49671. $ctx1.sendIdx["should:return:"]=5;
  49672. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49673. return self;
  49674. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49675. },
  49676. args: [],
  49677. 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.",
  49678. referencedClasses: [],
  49679. messageSends: ["should:return:"]
  49680. }),
  49681. $globals.CodeGeneratorTest);
  49682. $core.addMethod(
  49683. $core.method({
  49684. selector: "testThisContext",
  49685. protocol: "tests",
  49686. fn: function (){
  49687. var self=this,$self=this;
  49688. return $core.withContext(function($ctx1) {
  49689. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49690. return self;
  49691. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49692. },
  49693. args: [],
  49694. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49695. referencedClasses: [],
  49696. messageSends: ["should:return:"]
  49697. }),
  49698. $globals.CodeGeneratorTest);
  49699. $core.addMethod(
  49700. $core.method({
  49701. selector: "testUnknownPragma",
  49702. protocol: "tests",
  49703. fn: function (){
  49704. var self=this,$self=this;
  49705. return $core.withContext(function($ctx1) {
  49706. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  49707. $ctx1.sendIdx["should:return:"]=1;
  49708. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  49709. return self;
  49710. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{},$globals.CodeGeneratorTest)});
  49711. },
  49712. args: [],
  49713. source: "testUnknownPragma\x0a\x09self should: 'foo < fooBar: ''return 2+3'' > | x | ^ x := 6' return: 6.\x0a\x09self should: 'foo | x | < fooBar: ''return 2+3'' > ^ x := 6' return: 6",
  49714. referencedClasses: [],
  49715. messageSends: ["should:return:"]
  49716. }),
  49717. $globals.CodeGeneratorTest);
  49718. $core.addMethod(
  49719. $core.method({
  49720. selector: "testifFalse",
  49721. protocol: "tests",
  49722. fn: function (){
  49723. var self=this,$self=this;
  49724. return $core.withContext(function($ctx1) {
  49725. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49726. $ctx1.sendIdx["should:return:"]=1;
  49727. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49728. $ctx1.sendIdx["should:return:"]=2;
  49729. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49730. $ctx1.sendIdx["should:return:"]=3;
  49731. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49732. return self;
  49733. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49734. },
  49735. args: [],
  49736. 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.",
  49737. referencedClasses: [],
  49738. messageSends: ["should:return:"]
  49739. }),
  49740. $globals.CodeGeneratorTest);
  49741. $core.addMethod(
  49742. $core.method({
  49743. selector: "testifFalseIfTrue",
  49744. protocol: "tests",
  49745. fn: function (){
  49746. var self=this,$self=this;
  49747. return $core.withContext(function($ctx1) {
  49748. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49749. $ctx1.sendIdx["should:return:"]=1;
  49750. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49751. $ctx1.sendIdx["should:return:"]=2;
  49752. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49753. $ctx1.sendIdx["should:return:"]=3;
  49754. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49755. return self;
  49756. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49757. },
  49758. args: [],
  49759. 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.",
  49760. referencedClasses: [],
  49761. messageSends: ["should:return:"]
  49762. }),
  49763. $globals.CodeGeneratorTest);
  49764. $core.addMethod(
  49765. $core.method({
  49766. selector: "testifNil",
  49767. protocol: "tests",
  49768. fn: function (){
  49769. var self=this,$self=this;
  49770. return $core.withContext(function($ctx1) {
  49771. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49772. $ctx1.sendIdx["should:return:"]=1;
  49773. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49774. $ctx1.sendIdx["should:return:"]=2;
  49775. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49776. $ctx1.sendIdx["should:return:"]=3;
  49777. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49778. return self;
  49779. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49780. },
  49781. args: [],
  49782. 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.",
  49783. referencedClasses: [],
  49784. messageSends: ["should:return:"]
  49785. }),
  49786. $globals.CodeGeneratorTest);
  49787. $core.addMethod(
  49788. $core.method({
  49789. selector: "testifNilIfNotNil",
  49790. protocol: "tests",
  49791. fn: function (){
  49792. var self=this,$self=this;
  49793. return $core.withContext(function($ctx1) {
  49794. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49795. $ctx1.sendIdx["should:return:"]=1;
  49796. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49797. $ctx1.sendIdx["should:return:"]=2;
  49798. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49799. $ctx1.sendIdx["should:return:"]=3;
  49800. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49801. return self;
  49802. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49803. },
  49804. args: [],
  49805. 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.",
  49806. referencedClasses: [],
  49807. messageSends: ["should:return:"]
  49808. }),
  49809. $globals.CodeGeneratorTest);
  49810. $core.addMethod(
  49811. $core.method({
  49812. selector: "testifNotNil",
  49813. protocol: "tests",
  49814. fn: function (){
  49815. var self=this,$self=this;
  49816. return $core.withContext(function($ctx1) {
  49817. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49818. $ctx1.sendIdx["should:return:"]=1;
  49819. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49820. $ctx1.sendIdx["should:return:"]=2;
  49821. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49822. $ctx1.sendIdx["should:return:"]=3;
  49823. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49824. return self;
  49825. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49826. },
  49827. args: [],
  49828. 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.",
  49829. referencedClasses: [],
  49830. messageSends: ["should:return:"]
  49831. }),
  49832. $globals.CodeGeneratorTest);
  49833. $core.addMethod(
  49834. $core.method({
  49835. selector: "testifNotNilWithArgument",
  49836. protocol: "tests",
  49837. fn: function (){
  49838. var self=this,$self=this;
  49839. return $core.withContext(function($ctx1) {
  49840. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49841. $ctx1.sendIdx["should:return:"]=1;
  49842. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49843. $ctx1.sendIdx["should:return:"]=2;
  49844. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49845. $ctx1.sendIdx["should:return:"]=3;
  49846. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49847. $ctx1.sendIdx["should:return:"]=4;
  49848. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49849. $ctx1.sendIdx["should:return:"]=5;
  49850. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49851. return self;
  49852. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49853. },
  49854. args: [],
  49855. 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",
  49856. referencedClasses: [],
  49857. messageSends: ["should:return:"]
  49858. }),
  49859. $globals.CodeGeneratorTest);
  49860. $core.addMethod(
  49861. $core.method({
  49862. selector: "testifTrue",
  49863. protocol: "tests",
  49864. fn: function (){
  49865. var self=this,$self=this;
  49866. return $core.withContext(function($ctx1) {
  49867. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49868. $ctx1.sendIdx["should:return:"]=1;
  49869. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49870. $ctx1.sendIdx["should:return:"]=2;
  49871. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49872. $ctx1.sendIdx["should:return:"]=3;
  49873. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49874. return self;
  49875. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49876. },
  49877. args: [],
  49878. 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.",
  49879. referencedClasses: [],
  49880. messageSends: ["should:return:"]
  49881. }),
  49882. $globals.CodeGeneratorTest);
  49883. $core.addMethod(
  49884. $core.method({
  49885. selector: "testifTrueIfFalse",
  49886. protocol: "tests",
  49887. fn: function (){
  49888. var self=this,$self=this;
  49889. return $core.withContext(function($ctx1) {
  49890. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49891. $ctx1.sendIdx["should:return:"]=1;
  49892. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49893. $ctx1.sendIdx["should:return:"]=2;
  49894. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49895. $ctx1.sendIdx["should:return:"]=3;
  49896. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49897. return self;
  49898. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49899. },
  49900. args: [],
  49901. 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.",
  49902. referencedClasses: [],
  49903. messageSends: ["should:return:"]
  49904. }),
  49905. $globals.CodeGeneratorTest);
  49906. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49907. $core.addMethod(
  49908. $core.method({
  49909. selector: "interpret:receiver:withArguments:",
  49910. protocol: "private",
  49911. fn: function (aString,anObject,aDictionary){
  49912. var self=this,$self=this;
  49913. var ctx,ast,interpreter;
  49914. return $core.withContext(function($ctx1) {
  49915. var $1,$2,$3,$receiver;
  49916. interpreter=$recv($globals.ASTInterpreter)._new();
  49917. $ctx1.sendIdx["new"]=1;
  49918. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49919. $1=$recv($globals.AIContext)._new();
  49920. $recv($1)._receiver_(anObject);
  49921. $recv($1)._interpreter_(interpreter);
  49922. ctx=$recv($1)._yourself();
  49923. $2=$recv(ast)._sequenceNode();
  49924. if(($receiver = $2) == null || $receiver.a$nil){
  49925. $2;
  49926. } else {
  49927. var sequence;
  49928. sequence=$receiver;
  49929. $recv($recv(sequence)._temps())._do_((function(each){
  49930. return $core.withContext(function($ctx2) {
  49931. return $recv(ctx)._defineLocal_(each);
  49932. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49933. }));
  49934. }
  49935. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49936. return $core.withContext(function($ctx2) {
  49937. return $recv(ctx)._localAt_put_(key,value);
  49938. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49939. }));
  49940. $3=interpreter;
  49941. $recv($3)._context_(ctx);
  49942. $recv($3)._node_(ast);
  49943. $recv($3)._enterNode();
  49944. $recv($3)._proceed();
  49945. return $recv($3)._result();
  49946. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49947. },
  49948. args: ["aString", "anObject", "aDictionary"],
  49949. 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",
  49950. referencedClasses: ["ASTInterpreter", "AIContext"],
  49951. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49952. }),
  49953. $globals.ASTInterpreterTest);
  49954. $core.addMethod(
  49955. $core.method({
  49956. selector: "should:receiver:return:",
  49957. protocol: "testing",
  49958. fn: function (aString,anObject,aResult){
  49959. var self=this,$self=this;
  49960. return $core.withContext(function($ctx1) {
  49961. $self["@receiver"]=anObject;
  49962. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49963. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49964. },
  49965. args: ["aString", "anObject", "aResult"],
  49966. 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",
  49967. referencedClasses: [],
  49968. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  49969. }),
  49970. $globals.ASTInterpreterTest);
  49971. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  49972. $core.addMethod(
  49973. $core.method({
  49974. selector: "interpret:receiver:withArguments:",
  49975. protocol: "private",
  49976. fn: function (aString,anObject,aDictionary){
  49977. var self=this,$self=this;
  49978. var ctx,ast,debugger_;
  49979. return $core.withContext(function($ctx1) {
  49980. var $1,$2,$3,$4,$5,$receiver;
  49981. $1=$recv($globals.AIContext)._new();
  49982. $ctx1.sendIdx["new"]=1;
  49983. $recv($1)._receiver_(anObject);
  49984. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  49985. ctx=$recv($1)._yourself();
  49986. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49987. $2=$recv(ast)._sequenceNode();
  49988. if(($receiver = $2) == null || $receiver.a$nil){
  49989. $2;
  49990. } else {
  49991. var sequence;
  49992. sequence=$receiver;
  49993. $recv($recv(sequence)._temps())._do_((function(each){
  49994. return $core.withContext(function($ctx2) {
  49995. return $recv(ctx)._defineLocal_(each);
  49996. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49997. }));
  49998. }
  49999. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  50000. return $core.withContext(function($ctx2) {
  50001. return $recv(ctx)._localAt_put_(key,value);
  50002. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  50003. }));
  50004. $3=$recv(ctx)._interpreter();
  50005. $ctx1.sendIdx["interpreter"]=1;
  50006. $recv($3)._context_(ctx);
  50007. $ctx1.sendIdx["context:"]=1;
  50008. $4=$recv(ctx)._interpreter();
  50009. $recv($4)._node_(ast);
  50010. $recv($4)._enterNode();
  50011. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  50012. $5=debugger_;
  50013. $recv($5)._proceed();
  50014. return $recv($5)._result();
  50015. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  50016. },
  50017. args: ["aString", "anObject", "aDictionary"],
  50018. 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",
  50019. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  50020. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  50021. }),
  50022. $globals.ASTDebuggerTest);
  50023. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  50024. $core.addMethod(
  50025. $core.method({
  50026. selector: "codeGeneratorClass",
  50027. protocol: "accessing",
  50028. fn: function (){
  50029. var self=this,$self=this;
  50030. return $globals.InliningCodeGenerator;
  50031. },
  50032. args: [],
  50033. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  50034. referencedClasses: ["InliningCodeGenerator"],
  50035. messageSends: []
  50036. }),
  50037. $globals.InliningCodeGeneratorTest);
  50038. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  50039. $core.addMethod(
  50040. $core.method({
  50041. selector: "testClassRefVar",
  50042. protocol: "tests",
  50043. fn: function (){
  50044. var self=this,$self=this;
  50045. var node;
  50046. return $core.withContext(function($ctx1) {
  50047. var $1,$2;
  50048. $1=$recv($globals.VariableNode)._new();
  50049. $ctx1.sendIdx["new"]=1;
  50050. $recv($1)._value_("Object");
  50051. node=$recv($1)._yourself();
  50052. $2=$recv($globals.SemanticAnalyzer)._new();
  50053. $ctx1.sendIdx["new"]=2;
  50054. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  50055. $recv($2)._visit_(node);
  50056. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  50057. return self;
  50058. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  50059. },
  50060. args: [],
  50061. 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",
  50062. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  50063. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  50064. }),
  50065. $globals.ScopeVarTest);
  50066. $core.addMethod(
  50067. $core.method({
  50068. selector: "testInstanceVar",
  50069. protocol: "tests",
  50070. fn: function (){
  50071. var self=this,$self=this;
  50072. var node,scope;
  50073. return $core.withContext(function($ctx1) {
  50074. var $1;
  50075. $1=$recv($globals.VariableNode)._new();
  50076. $ctx1.sendIdx["new"]=1;
  50077. $recv($1)._value_("bzzz");
  50078. node=$recv($1)._yourself();
  50079. scope=$recv($globals.MethodLexicalScope)._new();
  50080. $recv(scope)._addIVar_("bzzz");
  50081. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  50082. return self;
  50083. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50084. },
  50085. args: [],
  50086. 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",
  50087. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50088. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  50089. }),
  50090. $globals.ScopeVarTest);
  50091. $core.addMethod(
  50092. $core.method({
  50093. selector: "testPseudoVar",
  50094. protocol: "tests",
  50095. fn: function (){
  50096. var self=this,$self=this;
  50097. var node,pseudoVars;
  50098. return $core.withContext(function($ctx1) {
  50099. var $1;
  50100. pseudoVars=["self", "super", "true", "false", "nil"];
  50101. $recv(pseudoVars)._do_((function(each){
  50102. return $core.withContext(function($ctx2) {
  50103. $1=$recv($globals.VariableNode)._new();
  50104. $ctx2.sendIdx["new"]=1;
  50105. $recv($1)._value_(each);
  50106. node=$recv($1)._yourself();
  50107. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  50108. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50109. }));
  50110. return self;
  50111. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  50112. },
  50113. args: [],
  50114. 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]",
  50115. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50116. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  50117. }),
  50118. $globals.ScopeVarTest);
  50119. $core.addMethod(
  50120. $core.method({
  50121. selector: "testTempVar",
  50122. protocol: "tests",
  50123. fn: function (){
  50124. var self=this,$self=this;
  50125. var node,scope;
  50126. return $core.withContext(function($ctx1) {
  50127. var $1;
  50128. $1=$recv($globals.VariableNode)._new();
  50129. $ctx1.sendIdx["new"]=1;
  50130. $recv($1)._value_("bzzz");
  50131. node=$recv($1)._yourself();
  50132. scope=$recv($globals.MethodLexicalScope)._new();
  50133. $recv(scope)._addTemp_("bzzz");
  50134. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  50135. return self;
  50136. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50137. },
  50138. args: [],
  50139. 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",
  50140. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50141. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  50142. }),
  50143. $globals.ScopeVarTest);
  50144. $core.addMethod(
  50145. $core.method({
  50146. selector: "testUnknownVar",
  50147. protocol: "tests",
  50148. fn: function (){
  50149. var self=this,$self=this;
  50150. var node;
  50151. return $core.withContext(function($ctx1) {
  50152. var $1;
  50153. $1=$recv($globals.VariableNode)._new();
  50154. $ctx1.sendIdx["new"]=1;
  50155. $recv($1)._value_("bzzz");
  50156. node=$recv($1)._yourself();
  50157. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  50158. return self;
  50159. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  50160. },
  50161. args: [],
  50162. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  50163. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50164. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  50165. }),
  50166. $globals.ScopeVarTest);
  50167. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  50168. $core.addMethod(
  50169. $core.method({
  50170. selector: "setUp",
  50171. protocol: "running",
  50172. fn: function (){
  50173. var self=this,$self=this;
  50174. return $core.withContext(function($ctx1) {
  50175. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  50176. return self;
  50177. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  50178. },
  50179. args: [],
  50180. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  50181. referencedClasses: ["SemanticAnalyzer", "Object"],
  50182. messageSends: ["on:"]
  50183. }),
  50184. $globals.SemanticAnalyzerTest);
  50185. $core.addMethod(
  50186. $core.method({
  50187. selector: "testAssignment",
  50188. protocol: "tests",
  50189. fn: function (){
  50190. var self=this,$self=this;
  50191. var src,ast;
  50192. return $core.withContext(function($ctx1) {
  50193. src="foo self := 1";
  50194. ast=$recv($globals.Smalltalk)._parse_(src);
  50195. $self._should_raise_((function(){
  50196. return $core.withContext(function($ctx2) {
  50197. return $recv($self["@analyzer"])._visit_(ast);
  50198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50199. }),$globals.InvalidAssignmentError);
  50200. return self;
  50201. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50202. },
  50203. args: [],
  50204. 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",
  50205. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  50206. messageSends: ["parse:", "should:raise:", "visit:"]
  50207. }),
  50208. $globals.SemanticAnalyzerTest);
  50209. $core.addMethod(
  50210. $core.method({
  50211. selector: "testNonLocalReturn",
  50212. protocol: "tests",
  50213. fn: function (){
  50214. var self=this,$self=this;
  50215. var src,ast;
  50216. return $core.withContext(function($ctx1) {
  50217. src="foo | a | a + 1. ^ a";
  50218. ast=$recv($globals.Smalltalk)._parse_(src);
  50219. $recv($self["@analyzer"])._visit_(ast);
  50220. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50221. return self;
  50222. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50223. },
  50224. args: [],
  50225. 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",
  50226. referencedClasses: ["Smalltalk"],
  50227. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  50228. }),
  50229. $globals.SemanticAnalyzerTest);
  50230. $core.addMethod(
  50231. $core.method({
  50232. selector: "testNonLocalReturn2",
  50233. protocol: "tests",
  50234. fn: function (){
  50235. var self=this,$self=this;
  50236. var src,ast;
  50237. return $core.withContext(function($ctx1) {
  50238. src="foo | a | a + 1. [ [ ^ a] ]";
  50239. ast=$recv($globals.Smalltalk)._parse_(src);
  50240. $recv($self["@analyzer"])._visit_(ast);
  50241. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50242. return self;
  50243. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50244. },
  50245. args: [],
  50246. 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",
  50247. referencedClasses: ["Smalltalk"],
  50248. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  50249. }),
  50250. $globals.SemanticAnalyzerTest);
  50251. $core.addMethod(
  50252. $core.method({
  50253. selector: "testScope",
  50254. protocol: "tests",
  50255. fn: function (){
  50256. var self=this,$self=this;
  50257. var src,ast;
  50258. return $core.withContext(function($ctx1) {
  50259. var $4,$3,$2,$1;
  50260. src="foo | a | a + 1. [ | b | b := a ]";
  50261. ast=$recv($globals.Smalltalk)._parse_(src);
  50262. $recv($self["@analyzer"])._visit_(ast);
  50263. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50264. $ctx1.sendIdx["dagChildren"]=1;
  50265. $3=$recv($4)._last();
  50266. $2=$recv($3)._scope();
  50267. $ctx1.sendIdx["scope"]=1;
  50268. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50269. $self._deny_($1);
  50270. return self;
  50271. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50272. },
  50273. args: [],
  50274. 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.",
  50275. referencedClasses: ["Smalltalk"],
  50276. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  50277. }),
  50278. $globals.SemanticAnalyzerTest);
  50279. $core.addMethod(
  50280. $core.method({
  50281. selector: "testScope2",
  50282. protocol: "tests",
  50283. fn: function (){
  50284. var self=this,$self=this;
  50285. var src,ast;
  50286. return $core.withContext(function($ctx1) {
  50287. var $8,$7,$6,$5,$4,$3,$2,$1;
  50288. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50289. ast=$recv($globals.Smalltalk)._parse_(src);
  50290. $recv($self["@analyzer"])._visit_(ast);
  50291. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50292. $ctx1.sendIdx["dagChildren"]=3;
  50293. $7=$recv($8)._last();
  50294. $6=$recv($7)._dagChildren();
  50295. $ctx1.sendIdx["dagChildren"]=2;
  50296. $5=$recv($6)._first();
  50297. $ctx1.sendIdx["first"]=2;
  50298. $4=$recv($5)._dagChildren();
  50299. $ctx1.sendIdx["dagChildren"]=1;
  50300. $3=$recv($4)._first();
  50301. $ctx1.sendIdx["first"]=1;
  50302. $2=$recv($3)._scope();
  50303. $ctx1.sendIdx["scope"]=1;
  50304. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50305. $self._deny_($1);
  50306. return self;
  50307. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50308. },
  50309. args: [],
  50310. 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.",
  50311. referencedClasses: ["Smalltalk"],
  50312. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  50313. }),
  50314. $globals.SemanticAnalyzerTest);
  50315. $core.addMethod(
  50316. $core.method({
  50317. selector: "testScopeLevel",
  50318. protocol: "tests",
  50319. fn: function (){
  50320. var self=this,$self=this;
  50321. var src,ast;
  50322. return $core.withContext(function($ctx1) {
  50323. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  50324. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50325. ast=$recv($globals.Smalltalk)._parse_(src);
  50326. $recv($self["@analyzer"])._visit_(ast);
  50327. $2=$recv(ast)._scope();
  50328. $ctx1.sendIdx["scope"]=1;
  50329. $1=$recv($2)._scopeLevel();
  50330. $ctx1.sendIdx["scopeLevel"]=1;
  50331. $self._assert_equals_($1,(1));
  50332. $ctx1.sendIdx["assert:equals:"]=1;
  50333. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50334. $ctx1.sendIdx["dagChildren"]=3;
  50335. $9=$recv($10)._last();
  50336. $8=$recv($9)._dagChildren();
  50337. $ctx1.sendIdx["dagChildren"]=2;
  50338. $7=$recv($8)._first();
  50339. $ctx1.sendIdx["first"]=2;
  50340. $6=$recv($7)._dagChildren();
  50341. $ctx1.sendIdx["dagChildren"]=1;
  50342. $5=$recv($6)._first();
  50343. $ctx1.sendIdx["first"]=1;
  50344. $4=$recv($5)._scope();
  50345. $3=$recv($4)._scopeLevel();
  50346. $self._assert_equals_($3,(3));
  50347. return self;
  50348. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50349. },
  50350. args: [],
  50351. 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",
  50352. referencedClasses: ["Smalltalk"],
  50353. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  50354. }),
  50355. $globals.SemanticAnalyzerTest);
  50356. $core.addMethod(
  50357. $core.method({
  50358. selector: "testUnknownVariables",
  50359. protocol: "tests",
  50360. fn: function (){
  50361. var self=this,$self=this;
  50362. var src,ast;
  50363. return $core.withContext(function($ctx1) {
  50364. src="foo | a | b + a";
  50365. ast=$recv($globals.Smalltalk)._parse_(src);
  50366. $self._should_raise_((function(){
  50367. return $core.withContext(function($ctx2) {
  50368. return $recv($self["@analyzer"])._visit_(ast);
  50369. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50370. }),$globals.UnknownVariableError);
  50371. return self;
  50372. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50373. },
  50374. args: [],
  50375. 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",
  50376. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50377. messageSends: ["parse:", "should:raise:", "visit:"]
  50378. }),
  50379. $globals.SemanticAnalyzerTest);
  50380. $core.addMethod(
  50381. $core.method({
  50382. selector: "testUnknownVariablesWithScope",
  50383. protocol: "tests",
  50384. fn: function (){
  50385. var self=this,$self=this;
  50386. var src,ast;
  50387. return $core.withContext(function($ctx1) {
  50388. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50389. ast=$recv($globals.Smalltalk)._parse_(src);
  50390. $self._should_raise_((function(){
  50391. return $core.withContext(function($ctx2) {
  50392. return $recv($self["@analyzer"])._visit_(ast);
  50393. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50394. }),$globals.UnknownVariableError);
  50395. return self;
  50396. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50397. },
  50398. args: [],
  50399. 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",
  50400. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50401. messageSends: ["parse:", "should:raise:", "visit:"]
  50402. }),
  50403. $globals.SemanticAnalyzerTest);
  50404. $core.addMethod(
  50405. $core.method({
  50406. selector: "testVariableShadowing",
  50407. protocol: "tests",
  50408. fn: function (){
  50409. var self=this,$self=this;
  50410. var src,ast;
  50411. return $core.withContext(function($ctx1) {
  50412. src="foo | a | a + 1";
  50413. ast=$recv($globals.Smalltalk)._parse_(src);
  50414. $recv($self["@analyzer"])._visit_(ast);
  50415. return self;
  50416. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50417. },
  50418. args: [],
  50419. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50420. referencedClasses: ["Smalltalk"],
  50421. messageSends: ["parse:", "visit:"]
  50422. }),
  50423. $globals.SemanticAnalyzerTest);
  50424. $core.addMethod(
  50425. $core.method({
  50426. selector: "testVariableShadowing2",
  50427. protocol: "tests",
  50428. fn: function (){
  50429. var self=this,$self=this;
  50430. var src,ast;
  50431. return $core.withContext(function($ctx1) {
  50432. src="foo | a | a + 1. [ | a | a := 2 ]";
  50433. ast=$recv($globals.Smalltalk)._parse_(src);
  50434. $self._should_raise_((function(){
  50435. return $core.withContext(function($ctx2) {
  50436. return $recv($self["@analyzer"])._visit_(ast);
  50437. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50438. }),$globals.ShadowingVariableError);
  50439. return self;
  50440. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50441. },
  50442. args: [],
  50443. 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",
  50444. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50445. messageSends: ["parse:", "should:raise:", "visit:"]
  50446. }),
  50447. $globals.SemanticAnalyzerTest);
  50448. $core.addMethod(
  50449. $core.method({
  50450. selector: "testVariableShadowing3",
  50451. protocol: "tests",
  50452. fn: function (){
  50453. var self=this,$self=this;
  50454. var src,ast;
  50455. return $core.withContext(function($ctx1) {
  50456. src="foo | a | a + 1. [ | b | b := 2 ]";
  50457. ast=$recv($globals.Smalltalk)._parse_(src);
  50458. $recv($self["@analyzer"])._visit_(ast);
  50459. return self;
  50460. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50461. },
  50462. args: [],
  50463. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50464. referencedClasses: ["Smalltalk"],
  50465. messageSends: ["parse:", "visit:"]
  50466. }),
  50467. $globals.SemanticAnalyzerTest);
  50468. $core.addMethod(
  50469. $core.method({
  50470. selector: "testVariableShadowing4",
  50471. protocol: "tests",
  50472. fn: function (){
  50473. var self=this,$self=this;
  50474. var src,ast;
  50475. return $core.withContext(function($ctx1) {
  50476. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50477. ast=$recv($globals.Smalltalk)._parse_(src);
  50478. $recv($self["@analyzer"])._visit_(ast);
  50479. return self;
  50480. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50481. },
  50482. args: [],
  50483. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50484. referencedClasses: ["Smalltalk"],
  50485. messageSends: ["parse:", "visit:"]
  50486. }),
  50487. $globals.SemanticAnalyzerTest);
  50488. $core.addMethod(
  50489. $core.method({
  50490. selector: "testVariableShadowing5",
  50491. protocol: "tests",
  50492. fn: function (){
  50493. var self=this,$self=this;
  50494. var src,ast;
  50495. return $core.withContext(function($ctx1) {
  50496. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50497. ast=$recv($globals.Smalltalk)._parse_(src);
  50498. $self._should_raise_((function(){
  50499. return $core.withContext(function($ctx2) {
  50500. return $recv($self["@analyzer"])._visit_(ast);
  50501. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50502. }),$globals.ShadowingVariableError);
  50503. return self;
  50504. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50505. },
  50506. args: [],
  50507. 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",
  50508. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50509. messageSends: ["parse:", "should:raise:", "visit:"]
  50510. }),
  50511. $globals.SemanticAnalyzerTest);
  50512. $core.addMethod(
  50513. $core.method({
  50514. selector: "testVariablesLookup",
  50515. protocol: "tests",
  50516. fn: function (){
  50517. var self=this,$self=this;
  50518. var src,ast;
  50519. return $core.withContext(function($ctx1) {
  50520. 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;
  50521. src="foo | a | a + 1. [ | b | b := a ]";
  50522. ast=$recv($globals.Smalltalk)._parse_(src);
  50523. $recv($self["@analyzer"])._visit_(ast);
  50524. $7=$recv(ast)._dagChildren();
  50525. $ctx1.sendIdx["dagChildren"]=2;
  50526. $6=$recv($7)._first();
  50527. $ctx1.sendIdx["first"]=2;
  50528. $5=$recv($6)._dagChildren();
  50529. $ctx1.sendIdx["dagChildren"]=1;
  50530. $4=$recv($5)._first();
  50531. $ctx1.sendIdx["first"]=1;
  50532. $3=$recv($4)._receiver();
  50533. $ctx1.sendIdx["receiver"]=1;
  50534. $2=$recv($3)._binding();
  50535. $ctx1.sendIdx["binding"]=1;
  50536. $1=$recv($2)._isTempVar();
  50537. $ctx1.sendIdx["isTempVar"]=1;
  50538. $self._assert_($1);
  50539. $ctx1.sendIdx["assert:"]=1;
  50540. $15=$recv(ast)._dagChildren();
  50541. $ctx1.sendIdx["dagChildren"]=4;
  50542. $14=$recv($15)._first();
  50543. $ctx1.sendIdx["first"]=4;
  50544. $13=$recv($14)._dagChildren();
  50545. $ctx1.sendIdx["dagChildren"]=3;
  50546. $12=$recv($13)._first();
  50547. $ctx1.sendIdx["first"]=3;
  50548. $11=$recv($12)._receiver();
  50549. $10=$recv($11)._binding();
  50550. $ctx1.sendIdx["binding"]=2;
  50551. $9=$recv($10)._scope();
  50552. $ctx1.sendIdx["scope"]=1;
  50553. $16=$recv(ast)._scope();
  50554. $ctx1.sendIdx["scope"]=2;
  50555. $8=$recv($9).__eq_eq($16);
  50556. $ctx1.sendIdx["=="]=1;
  50557. $self._assert_($8);
  50558. $ctx1.sendIdx["assert:"]=2;
  50559. $27=$recv(ast)._dagChildren();
  50560. $ctx1.sendIdx["dagChildren"]=8;
  50561. $26=$recv($27)._first();
  50562. $ctx1.sendIdx["first"]=7;
  50563. $25=$recv($26)._dagChildren();
  50564. $ctx1.sendIdx["dagChildren"]=7;
  50565. $24=$recv($25)._last();
  50566. $ctx1.sendIdx["last"]=1;
  50567. $23=$recv($24)._dagChildren();
  50568. $ctx1.sendIdx["dagChildren"]=6;
  50569. $22=$recv($23)._first();
  50570. $ctx1.sendIdx["first"]=6;
  50571. $21=$recv($22)._dagChildren();
  50572. $ctx1.sendIdx["dagChildren"]=5;
  50573. $20=$recv($21)._first();
  50574. $ctx1.sendIdx["first"]=5;
  50575. $19=$recv($20)._left();
  50576. $ctx1.sendIdx["left"]=1;
  50577. $18=$recv($19)._binding();
  50578. $ctx1.sendIdx["binding"]=3;
  50579. $17=$recv($18)._isTempVar();
  50580. $self._assert_($17);
  50581. $ctx1.sendIdx["assert:"]=3;
  50582. $39=$recv(ast)._dagChildren();
  50583. $ctx1.sendIdx["dagChildren"]=12;
  50584. $38=$recv($39)._first();
  50585. $ctx1.sendIdx["first"]=10;
  50586. $37=$recv($38)._dagChildren();
  50587. $ctx1.sendIdx["dagChildren"]=11;
  50588. $36=$recv($37)._last();
  50589. $ctx1.sendIdx["last"]=2;
  50590. $35=$recv($36)._dagChildren();
  50591. $ctx1.sendIdx["dagChildren"]=10;
  50592. $34=$recv($35)._first();
  50593. $ctx1.sendIdx["first"]=9;
  50594. $33=$recv($34)._dagChildren();
  50595. $ctx1.sendIdx["dagChildren"]=9;
  50596. $32=$recv($33)._first();
  50597. $ctx1.sendIdx["first"]=8;
  50598. $31=$recv($32)._left();
  50599. $30=$recv($31)._binding();
  50600. $29=$recv($30)._scope();
  50601. $ctx1.sendIdx["scope"]=3;
  50602. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50603. $ctx1.sendIdx["dagChildren"]=13;
  50604. $41=$recv($42)._last();
  50605. $40=$recv($41)._scope();
  50606. $28=$recv($29).__eq_eq($40);
  50607. $self._assert_($28);
  50608. return self;
  50609. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50610. },
  50611. args: [],
  50612. 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.",
  50613. referencedClasses: ["Smalltalk"],
  50614. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50615. }),
  50616. $globals.SemanticAnalyzerTest);
  50617. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50618. $core.addMethod(
  50619. $core.method({
  50620. selector: "setUp",
  50621. protocol: "running",
  50622. fn: function (){
  50623. var self=this,$self=this;
  50624. return $core.withContext(function($ctx1) {
  50625. var $1,$3,$4,$2;
  50626. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50627. $3=$recv($globals.AIContext)._new();
  50628. $recv($3)._defineLocal_("local");
  50629. $recv($3)._localAt_put_("local",(3));
  50630. $4=$recv($3)._yourself();
  50631. $ctx1.sendIdx["yourself"]=1;
  50632. $2=$4;
  50633. $recv($1)._context_($2);
  50634. $self["@analyzer"]=$recv($1)._yourself();
  50635. return self;
  50636. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50637. },
  50638. args: [],
  50639. 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",
  50640. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50641. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50642. }),
  50643. $globals.AISemanticAnalyzerTest);
  50644. $core.addMethod(
  50645. $core.method({
  50646. selector: "testContextVariables",
  50647. protocol: "tests",
  50648. fn: function (){
  50649. var self=this,$self=this;
  50650. var src,ast;
  50651. return $core.withContext(function($ctx1) {
  50652. src="foo | a | local + a";
  50653. ast=$recv($globals.Smalltalk)._parse_(src);
  50654. $self._shouldnt_raise_((function(){
  50655. return $core.withContext(function($ctx2) {
  50656. return $recv($self["@analyzer"])._visit_(ast);
  50657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50658. }),$globals.UnknownVariableError);
  50659. return self;
  50660. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50661. },
  50662. args: [],
  50663. 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",
  50664. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50665. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50666. }),
  50667. $globals.AISemanticAnalyzerTest);
  50668. });
  50669. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50670. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50671. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50672. $core.addPackage("Kernel-Tests");
  50673. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  50674. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  50675. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50676. $core.addMethod(
  50677. $core.method({
  50678. selector: "testAddExtensionMethod",
  50679. protocol: "tests",
  50680. fn: function (){
  50681. var self=this,$self=this;
  50682. var method,dirty;
  50683. return $core.withContext(function($ctx1) {
  50684. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50685. $2=$self._class();
  50686. $ctx1.sendIdx["class"]=1;
  50687. $1=$recv($2)._package();
  50688. $ctx1.sendIdx["package"]=1;
  50689. dirty=$recv($1)._isDirty();
  50690. $ctx1.sendIdx["isDirty"]=1;
  50691. $4=$self._class();
  50692. $ctx1.sendIdx["class"]=2;
  50693. $3=$recv($4)._package();
  50694. $ctx1.sendIdx["package"]=2;
  50695. $recv($3)._beClean();
  50696. $5=$self._class();
  50697. $ctx1.sendIdx["class"]=3;
  50698. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50699. $8=$self._class();
  50700. $ctx1.sendIdx["class"]=4;
  50701. $7=$recv($8)._package();
  50702. $ctx1.sendIdx["package"]=3;
  50703. $6=$recv($7)._isDirty();
  50704. $self._deny_($6);
  50705. $9=$self._class();
  50706. $ctx1.sendIdx["class"]=5;
  50707. $recv($9)._removeCompiledMethod_(method);
  50708. $10=dirty;
  50709. if($core.assert($10)){
  50710. $recv($recv($self._class())._package())._beDirty();
  50711. }
  50712. return self;
  50713. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50714. },
  50715. args: [],
  50716. 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 ]",
  50717. referencedClasses: [],
  50718. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50719. }),
  50720. $globals.AnnouncementSubscriptionTest);
  50721. $core.addMethod(
  50722. $core.method({
  50723. selector: "testHandlesAnnouncement",
  50724. protocol: "tests",
  50725. fn: function (){
  50726. var self=this,$self=this;
  50727. var subscription,announcementClass1,announcementClass2,classBuilder;
  50728. return $core.withContext(function($ctx1) {
  50729. var $1,$2;
  50730. classBuilder=$recv($globals.ClassBuilder)._new();
  50731. $ctx1.sendIdx["new"]=1;
  50732. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50733. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  50734. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  50735. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50736. $self._assert_equals_($1,true);
  50737. $ctx1.sendIdx["assert:equals:"]=1;
  50738. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  50739. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50740. $self._assert_equals_($2,true);
  50741. $ctx1.sendIdx["assert:equals:"]=2;
  50742. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  50743. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50744. return self;
  50745. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50746. },
  50747. args: [],
  50748. 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.",
  50749. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50750. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50751. }),
  50752. $globals.AnnouncementSubscriptionTest);
  50753. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50754. $core.addMethod(
  50755. $core.method({
  50756. selector: "testOnDo",
  50757. protocol: "tests",
  50758. fn: function (){
  50759. var self=this,$self=this;
  50760. var counter,announcer;
  50761. return $core.withContext(function($ctx1) {
  50762. var $1,$2;
  50763. counter=(0);
  50764. announcer=$recv($globals.Announcer)._new();
  50765. $ctx1.sendIdx["new"]=1;
  50766. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50767. return $core.withContext(function($ctx2) {
  50768. counter=$recv(counter).__plus((1));
  50769. return counter;
  50770. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50771. }));
  50772. $1=announcer;
  50773. $2=$recv($globals.SystemAnnouncement)._new();
  50774. $ctx1.sendIdx["new"]=2;
  50775. $recv($1)._announce_($2);
  50776. $ctx1.sendIdx["announce:"]=1;
  50777. $self._assert_equals_(counter,(1));
  50778. $ctx1.sendIdx["assert:equals:"]=1;
  50779. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50780. $self._assert_equals_(counter,(2));
  50781. return self;
  50782. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50783. },
  50784. args: [],
  50785. 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.",
  50786. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50787. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50788. }),
  50789. $globals.AnnouncerTest);
  50790. $core.addMethod(
  50791. $core.method({
  50792. selector: "testOnDoFor",
  50793. protocol: "tests",
  50794. fn: function (){
  50795. var self=this,$self=this;
  50796. var counter,announcer;
  50797. return $core.withContext(function($ctx1) {
  50798. var $1,$2,$3,$4;
  50799. counter=(0);
  50800. announcer=$recv($globals.Announcer)._new();
  50801. $ctx1.sendIdx["new"]=1;
  50802. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50803. return $core.withContext(function($ctx2) {
  50804. counter=$recv(counter).__plus((1));
  50805. return counter;
  50806. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50807. }),self);
  50808. $1=announcer;
  50809. $2=$recv($globals.SystemAnnouncement)._new();
  50810. $ctx1.sendIdx["new"]=2;
  50811. $recv($1)._announce_($2);
  50812. $ctx1.sendIdx["announce:"]=1;
  50813. $self._assert_equals_(counter,(1));
  50814. $ctx1.sendIdx["assert:equals:"]=1;
  50815. $3=announcer;
  50816. $4=$recv($globals.SystemAnnouncement)._new();
  50817. $ctx1.sendIdx["new"]=3;
  50818. $recv($3)._announce_($4);
  50819. $ctx1.sendIdx["announce:"]=2;
  50820. $self._assert_equals_(counter,(2));
  50821. $ctx1.sendIdx["assert:equals:"]=2;
  50822. $recv(announcer)._unsubscribe_(self);
  50823. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50824. $self._assert_equals_(counter,(2));
  50825. return self;
  50826. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50827. },
  50828. args: [],
  50829. 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.",
  50830. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50831. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50832. }),
  50833. $globals.AnnouncerTest);
  50834. $core.addMethod(
  50835. $core.method({
  50836. selector: "testOnDoOnce",
  50837. protocol: "tests",
  50838. fn: function (){
  50839. var self=this,$self=this;
  50840. var counter,announcer;
  50841. return $core.withContext(function($ctx1) {
  50842. var $1,$2;
  50843. counter=(0);
  50844. announcer=$recv($globals.Announcer)._new();
  50845. $ctx1.sendIdx["new"]=1;
  50846. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50847. return $core.withContext(function($ctx2) {
  50848. counter=$recv(counter).__plus((1));
  50849. return counter;
  50850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50851. }));
  50852. $1=announcer;
  50853. $2=$recv($globals.SystemAnnouncement)._new();
  50854. $ctx1.sendIdx["new"]=2;
  50855. $recv($1)._announce_($2);
  50856. $ctx1.sendIdx["announce:"]=1;
  50857. $self._assert_equals_(counter,(1));
  50858. $ctx1.sendIdx["assert:equals:"]=1;
  50859. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50860. $self._assert_equals_(counter,(1));
  50861. return self;
  50862. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50863. },
  50864. args: [],
  50865. 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.",
  50866. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50867. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50868. }),
  50869. $globals.AnnouncerTest);
  50870. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50871. $core.addMethod(
  50872. $core.method({
  50873. selector: "localReturnOnDoCatch",
  50874. protocol: "fixture",
  50875. fn: function (){
  50876. var self=this,$self=this;
  50877. return $core.withContext(function($ctx1) {
  50878. var $early={};
  50879. try {
  50880. $recv((function(){
  50881. throw $early=[(2)];
  50882. }))._on_do_($globals.Error,(function(){
  50883. }));
  50884. return (3);
  50885. }
  50886. catch(e) {if(e===$early)return e[0]; throw e}
  50887. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50888. },
  50889. args: [],
  50890. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50891. referencedClasses: ["Error"],
  50892. messageSends: ["on:do:"]
  50893. }),
  50894. $globals.BlockClosureTest);
  50895. $core.addMethod(
  50896. $core.method({
  50897. selector: "localReturnOnDoMiss",
  50898. protocol: "fixture",
  50899. fn: function (){
  50900. var self=this,$self=this;
  50901. return $core.withContext(function($ctx1) {
  50902. var $early={};
  50903. try {
  50904. $recv((function(){
  50905. throw $early=[(2)];
  50906. }))._on_do_($globals.Class,(function(){
  50907. }));
  50908. return (3);
  50909. }
  50910. catch(e) {if(e===$early)return e[0]; throw e}
  50911. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50912. },
  50913. args: [],
  50914. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50915. referencedClasses: ["Class"],
  50916. messageSends: ["on:do:"]
  50917. }),
  50918. $globals.BlockClosureTest);
  50919. $core.addMethod(
  50920. $core.method({
  50921. selector: "testCanClearInterval",
  50922. protocol: "tests",
  50923. fn: function (){
  50924. var self=this,$self=this;
  50925. return $core.withContext(function($ctx1) {
  50926. $self._shouldnt_raise_((function(){
  50927. return $core.withContext(function($ctx2) {
  50928. return $recv($recv((function(){
  50929. return $core.withContext(function($ctx3) {
  50930. return $recv($recv($globals.Error)._new())._signal();
  50931. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50932. }))._valueWithInterval_((0)))._clearInterval();
  50933. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50934. }),$globals.Error);
  50935. return self;
  50936. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50937. },
  50938. args: [],
  50939. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50940. referencedClasses: ["Error"],
  50941. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50942. }),
  50943. $globals.BlockClosureTest);
  50944. $core.addMethod(
  50945. $core.method({
  50946. selector: "testCanClearTimeout",
  50947. protocol: "tests",
  50948. fn: function (){
  50949. var self=this,$self=this;
  50950. return $core.withContext(function($ctx1) {
  50951. $self._shouldnt_raise_((function(){
  50952. return $core.withContext(function($ctx2) {
  50953. return $recv($recv((function(){
  50954. return $core.withContext(function($ctx3) {
  50955. return $recv($recv($globals.Error)._new())._signal();
  50956. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50957. }))._valueWithTimeout_((0)))._clearTimeout();
  50958. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50959. }),$globals.Error);
  50960. return self;
  50961. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50962. },
  50963. args: [],
  50964. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50965. referencedClasses: ["Error"],
  50966. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50967. }),
  50968. $globals.BlockClosureTest);
  50969. $core.addMethod(
  50970. $core.method({
  50971. selector: "testCompiledSource",
  50972. protocol: "tests",
  50973. fn: function (){
  50974. var self=this,$self=this;
  50975. return $core.withContext(function($ctx1) {
  50976. $self._assert_($recv($recv((function(){
  50977. return $core.withContext(function($ctx2) {
  50978. return (1).__plus((1));
  50979. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50980. }))._compiledSource())._includesSubString_("function"));
  50981. return self;
  50982. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  50983. },
  50984. args: [],
  50985. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  50986. referencedClasses: [],
  50987. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  50988. }),
  50989. $globals.BlockClosureTest);
  50990. $core.addMethod(
  50991. $core.method({
  50992. selector: "testCurrySelf",
  50993. protocol: "tests",
  50994. fn: function (){
  50995. var self=this,$self=this;
  50996. var curriedMethod,array;
  50997. return $core.withContext(function($ctx1) {
  50998. curriedMethod=$recv($recv((function(selfarg,x){
  50999. return $core.withContext(function($ctx2) {
  51000. return $recv(selfarg)._at_(x);
  51001. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  51002. }))._currySelf())._asCompiledMethod_("foo:");
  51003. array=[(3), (1), (4)];
  51004. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  51005. $recv((function(){
  51006. return $core.withContext(function($ctx2) {
  51007. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  51008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51009. }))._ensure_((function(){
  51010. return $core.withContext(function($ctx2) {
  51011. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  51012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51013. }));
  51014. return self;
  51015. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  51016. },
  51017. args: [],
  51018. 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 ]",
  51019. referencedClasses: ["ClassBuilder", "Array"],
  51020. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  51021. }),
  51022. $globals.BlockClosureTest);
  51023. $core.addMethod(
  51024. $core.method({
  51025. selector: "testEnsure",
  51026. protocol: "tests",
  51027. fn: function (){
  51028. var self=this,$self=this;
  51029. return $core.withContext(function($ctx1) {
  51030. $self._assert_equals_($recv((function(){
  51031. return (3);
  51032. }))._ensure_((function(){
  51033. return (4);
  51034. })),(3));
  51035. return self;
  51036. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  51037. },
  51038. args: [],
  51039. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  51040. referencedClasses: [],
  51041. messageSends: ["assert:equals:", "ensure:"]
  51042. }),
  51043. $globals.BlockClosureTest);
  51044. $core.addMethod(
  51045. $core.method({
  51046. selector: "testEnsureRaises",
  51047. protocol: "tests",
  51048. fn: function (){
  51049. var self=this,$self=this;
  51050. return $core.withContext(function($ctx1) {
  51051. $self._should_raise_((function(){
  51052. return $core.withContext(function($ctx2) {
  51053. return $recv((function(){
  51054. return $core.withContext(function($ctx3) {
  51055. return $recv($recv($globals.Error)._new())._signal();
  51056. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51057. }))._ensure_((function(){
  51058. return true;
  51059. }));
  51060. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51061. }),$globals.Error);
  51062. return self;
  51063. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  51064. },
  51065. args: [],
  51066. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  51067. referencedClasses: ["Error"],
  51068. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  51069. }),
  51070. $globals.BlockClosureTest);
  51071. $core.addMethod(
  51072. $core.method({
  51073. selector: "testExceptionSemantics",
  51074. protocol: "tests",
  51075. fn: function (){
  51076. var self=this,$self=this;
  51077. return $core.withContext(function($ctx1) {
  51078. $self._timeout_((100));
  51079. $recv($self._async_((function(){
  51080. return $core.withContext(function($ctx2) {
  51081. return $recv((function(){
  51082. return $core.withContext(function($ctx3) {
  51083. $self._assert_(true);
  51084. $recv($globals.Error)._signal();
  51085. $self._deny_(true);
  51086. return $self._finished();
  51087. $ctx3.sendIdx["finished"]=1;
  51088. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51089. }))._on_do_($globals.Error,(function(ex){
  51090. return $core.withContext(function($ctx3) {
  51091. return $self._finished();
  51092. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  51093. }));
  51094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51095. })))._valueWithTimeout_((0));
  51096. return self;
  51097. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  51098. },
  51099. args: [],
  51100. 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",
  51101. referencedClasses: ["Error"],
  51102. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  51103. }),
  51104. $globals.BlockClosureTest);
  51105. $core.addMethod(
  51106. $core.method({
  51107. selector: "testLocalReturnOnDoCatch",
  51108. protocol: "tests",
  51109. fn: function (){
  51110. var self=this,$self=this;
  51111. return $core.withContext(function($ctx1) {
  51112. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  51113. return self;
  51114. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  51115. },
  51116. args: [],
  51117. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  51118. referencedClasses: [],
  51119. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  51120. }),
  51121. $globals.BlockClosureTest);
  51122. $core.addMethod(
  51123. $core.method({
  51124. selector: "testLocalReturnOnDoMiss",
  51125. protocol: "tests",
  51126. fn: function (){
  51127. var self=this,$self=this;
  51128. return $core.withContext(function($ctx1) {
  51129. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  51130. return self;
  51131. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  51132. },
  51133. args: [],
  51134. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  51135. referencedClasses: [],
  51136. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  51137. }),
  51138. $globals.BlockClosureTest);
  51139. $core.addMethod(
  51140. $core.method({
  51141. selector: "testNewWithValues",
  51142. protocol: "tests",
  51143. fn: function (){
  51144. var self=this,$self=this;
  51145. return $core.withContext(function($ctx1) {
  51146. function TestConstructor(arg1, arg2, arg3) {}
  51147. TestConstructor.prototype.name = "theTestPrototype";
  51148. var wrappedConstructor = $recv(TestConstructor);
  51149. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  51150. $self._assert_(result instanceof TestConstructor);
  51151. $self._assert_equals_(result.name, "theTestPrototype");
  51152. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  51153. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  51154. return self;
  51155. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  51156. },
  51157. args: [],
  51158. 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'>",
  51159. referencedClasses: [],
  51160. messageSends: []
  51161. }),
  51162. $globals.BlockClosureTest);
  51163. $core.addMethod(
  51164. $core.method({
  51165. selector: "testNumArgs",
  51166. protocol: "tests",
  51167. fn: function (){
  51168. var self=this,$self=this;
  51169. return $core.withContext(function($ctx1) {
  51170. var $1;
  51171. $1=$recv((function(){
  51172. }))._numArgs();
  51173. $ctx1.sendIdx["numArgs"]=1;
  51174. $self._assert_equals_($1,(0));
  51175. $ctx1.sendIdx["assert:equals:"]=1;
  51176. $self._assert_equals_($recv((function(a,b){
  51177. }))._numArgs(),(2));
  51178. return self;
  51179. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  51180. },
  51181. args: [],
  51182. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  51183. referencedClasses: [],
  51184. messageSends: ["assert:equals:", "numArgs"]
  51185. }),
  51186. $globals.BlockClosureTest);
  51187. $core.addMethod(
  51188. $core.method({
  51189. selector: "testOnDo",
  51190. protocol: "tests",
  51191. fn: function (){
  51192. var self=this,$self=this;
  51193. return $core.withContext(function($ctx1) {
  51194. $self._assert_($recv((function(){
  51195. return $core.withContext(function($ctx2) {
  51196. return $recv($recv($globals.Error)._new())._signal();
  51197. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51198. }))._on_do_($globals.Error,(function(ex){
  51199. return true;
  51200. })));
  51201. return self;
  51202. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  51203. },
  51204. args: [],
  51205. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  51206. referencedClasses: ["Error"],
  51207. messageSends: ["assert:", "on:do:", "signal", "new"]
  51208. }),
  51209. $globals.BlockClosureTest);
  51210. $core.addMethod(
  51211. $core.method({
  51212. selector: "testValue",
  51213. protocol: "tests",
  51214. fn: function (){
  51215. var self=this,$self=this;
  51216. return $core.withContext(function($ctx1) {
  51217. var $1;
  51218. $1=$recv((function(){
  51219. return $core.withContext(function($ctx2) {
  51220. return (1).__plus((1));
  51221. $ctx2.sendIdx["+"]=1;
  51222. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51223. }))._value();
  51224. $ctx1.sendIdx["value"]=1;
  51225. $self._assert_equals_($1,(2));
  51226. $ctx1.sendIdx["assert:equals:"]=1;
  51227. $self._assert_equals_($recv((function(x){
  51228. return $core.withContext(function($ctx2) {
  51229. return $recv(x).__plus((1));
  51230. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  51231. }))._value_((2)),(3));
  51232. $ctx1.sendIdx["assert:equals:"]=2;
  51233. $self._assert_equals_($recv((function(x,y){
  51234. return $core.withContext(function($ctx2) {
  51235. return $recv(x).__star(y);
  51236. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  51237. }))._value_value_((2),(4)),(8));
  51238. $ctx1.sendIdx["assert:equals:"]=3;
  51239. $self._assert_equals_($recv((function(a,b,c){
  51240. return (1);
  51241. }))._value(),(1));
  51242. return self;
  51243. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  51244. },
  51245. args: [],
  51246. 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",
  51247. referencedClasses: [],
  51248. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  51249. }),
  51250. $globals.BlockClosureTest);
  51251. $core.addMethod(
  51252. $core.method({
  51253. selector: "testValueWithPossibleArguments",
  51254. protocol: "tests",
  51255. fn: function (){
  51256. var self=this,$self=this;
  51257. return $core.withContext(function($ctx1) {
  51258. var $1,$2;
  51259. $1=$recv((function(){
  51260. return (1);
  51261. }))._valueWithPossibleArguments_([(3), (4)]);
  51262. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  51263. $self._assert_equals_($1,(1));
  51264. $ctx1.sendIdx["assert:equals:"]=1;
  51265. $2=$recv((function(a){
  51266. return $core.withContext(function($ctx2) {
  51267. return $recv(a).__plus((4));
  51268. $ctx2.sendIdx["+"]=1;
  51269. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  51270. }))._valueWithPossibleArguments_([(3), (4)]);
  51271. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  51272. $self._assert_equals_($2,(7));
  51273. $ctx1.sendIdx["assert:equals:"]=2;
  51274. $self._assert_equals_($recv((function(a,b){
  51275. return $core.withContext(function($ctx2) {
  51276. return $recv(a).__plus(b);
  51277. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  51278. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  51279. return self;
  51280. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  51281. },
  51282. args: [],
  51283. 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.",
  51284. referencedClasses: [],
  51285. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  51286. }),
  51287. $globals.BlockClosureTest);
  51288. $core.addMethod(
  51289. $core.method({
  51290. selector: "testWhileFalse",
  51291. protocol: "tests",
  51292. fn: function (){
  51293. var self=this,$self=this;
  51294. var i;
  51295. return $core.withContext(function($ctx1) {
  51296. i=(0);
  51297. $recv((function(){
  51298. return $core.withContext(function($ctx2) {
  51299. return $recv(i).__gt((5));
  51300. $ctx2.sendIdx[">"]=1;
  51301. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51302. }))._whileFalse_((function(){
  51303. return $core.withContext(function($ctx2) {
  51304. i=$recv(i).__plus((1));
  51305. $ctx2.sendIdx["+"]=1;
  51306. return i;
  51307. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51308. }));
  51309. $self._assert_equals_(i,(6));
  51310. $ctx1.sendIdx["assert:equals:"]=1;
  51311. i=(0);
  51312. $recv((function(){
  51313. return $core.withContext(function($ctx2) {
  51314. i=$recv(i).__plus((1));
  51315. return $recv(i).__gt((5));
  51316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51317. }))._whileFalse();
  51318. $self._assert_equals_(i,(6));
  51319. return self;
  51320. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  51321. },
  51322. args: [],
  51323. 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",
  51324. referencedClasses: [],
  51325. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  51326. }),
  51327. $globals.BlockClosureTest);
  51328. $core.addMethod(
  51329. $core.method({
  51330. selector: "testWhileTrue",
  51331. protocol: "tests",
  51332. fn: function (){
  51333. var self=this,$self=this;
  51334. var i;
  51335. return $core.withContext(function($ctx1) {
  51336. i=(0);
  51337. $recv((function(){
  51338. return $core.withContext(function($ctx2) {
  51339. return $recv(i).__lt((5));
  51340. $ctx2.sendIdx["<"]=1;
  51341. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51342. }))._whileTrue_((function(){
  51343. return $core.withContext(function($ctx2) {
  51344. i=$recv(i).__plus((1));
  51345. $ctx2.sendIdx["+"]=1;
  51346. return i;
  51347. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51348. }));
  51349. $self._assert_equals_(i,(5));
  51350. $ctx1.sendIdx["assert:equals:"]=1;
  51351. i=(0);
  51352. $recv((function(){
  51353. return $core.withContext(function($ctx2) {
  51354. i=$recv(i).__plus((1));
  51355. return $recv(i).__lt((5));
  51356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51357. }))._whileTrue();
  51358. $self._assert_equals_(i,(5));
  51359. return self;
  51360. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  51361. },
  51362. args: [],
  51363. 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",
  51364. referencedClasses: [],
  51365. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  51366. }),
  51367. $globals.BlockClosureTest);
  51368. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  51369. $core.addMethod(
  51370. $core.method({
  51371. selector: "testEquality",
  51372. protocol: "tests",
  51373. fn: function (){
  51374. var self=this,$self=this;
  51375. return $core.withContext(function($ctx1) {
  51376. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51377. $1=(0).__eq(false);
  51378. $ctx1.sendIdx["="]=1;
  51379. $self._deny_($1);
  51380. $ctx1.sendIdx["deny:"]=1;
  51381. $2=false.__eq((0));
  51382. $ctx1.sendIdx["="]=2;
  51383. $self._deny_($2);
  51384. $ctx1.sendIdx["deny:"]=2;
  51385. $3="".__eq(false);
  51386. $ctx1.sendIdx["="]=3;
  51387. $self._deny_($3);
  51388. $ctx1.sendIdx["deny:"]=3;
  51389. $4=false.__eq("");
  51390. $ctx1.sendIdx["="]=4;
  51391. $self._deny_($4);
  51392. $ctx1.sendIdx["deny:"]=4;
  51393. $5=true.__eq(true);
  51394. $ctx1.sendIdx["="]=5;
  51395. $self._assert_($5);
  51396. $ctx1.sendIdx["assert:"]=1;
  51397. $6=false.__eq(true);
  51398. $ctx1.sendIdx["="]=6;
  51399. $self._deny_($6);
  51400. $ctx1.sendIdx["deny:"]=5;
  51401. $7=true.__eq(false);
  51402. $ctx1.sendIdx["="]=7;
  51403. $self._deny_($7);
  51404. $8=false.__eq(false);
  51405. $ctx1.sendIdx["="]=8;
  51406. $self._assert_($8);
  51407. $ctx1.sendIdx["assert:"]=2;
  51408. $10=true._yourself();
  51409. $ctx1.sendIdx["yourself"]=1;
  51410. $9=$recv($10).__eq(true);
  51411. $ctx1.sendIdx["="]=9;
  51412. $self._assert_($9);
  51413. $ctx1.sendIdx["assert:"]=3;
  51414. $12=true._yourself();
  51415. $ctx1.sendIdx["yourself"]=2;
  51416. $11=$recv($12).__eq(true._yourself());
  51417. $self._assert_($11);
  51418. return self;
  51419. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51420. },
  51421. args: [],
  51422. 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)",
  51423. referencedClasses: [],
  51424. messageSends: ["deny:", "=", "assert:", "yourself"]
  51425. }),
  51426. $globals.BooleanTest);
  51427. $core.addMethod(
  51428. $core.method({
  51429. selector: "testIdentity",
  51430. protocol: "tests",
  51431. fn: function (){
  51432. var self=this,$self=this;
  51433. return $core.withContext(function($ctx1) {
  51434. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51435. $1=(0).__eq_eq(false);
  51436. $ctx1.sendIdx["=="]=1;
  51437. $self._deny_($1);
  51438. $ctx1.sendIdx["deny:"]=1;
  51439. $2=false.__eq_eq((0));
  51440. $ctx1.sendIdx["=="]=2;
  51441. $self._deny_($2);
  51442. $ctx1.sendIdx["deny:"]=2;
  51443. $3="".__eq_eq(false);
  51444. $ctx1.sendIdx["=="]=3;
  51445. $self._deny_($3);
  51446. $ctx1.sendIdx["deny:"]=3;
  51447. $4=false.__eq_eq("");
  51448. $ctx1.sendIdx["=="]=4;
  51449. $self._deny_($4);
  51450. $ctx1.sendIdx["deny:"]=4;
  51451. $5=true.__eq_eq(true);
  51452. $ctx1.sendIdx["=="]=5;
  51453. $self._assert_($5);
  51454. $ctx1.sendIdx["assert:"]=1;
  51455. $6=false.__eq_eq(true);
  51456. $ctx1.sendIdx["=="]=6;
  51457. $self._deny_($6);
  51458. $ctx1.sendIdx["deny:"]=5;
  51459. $7=true.__eq_eq(false);
  51460. $ctx1.sendIdx["=="]=7;
  51461. $self._deny_($7);
  51462. $8=false.__eq_eq(false);
  51463. $ctx1.sendIdx["=="]=8;
  51464. $self._assert_($8);
  51465. $ctx1.sendIdx["assert:"]=2;
  51466. $10=true._yourself();
  51467. $ctx1.sendIdx["yourself"]=1;
  51468. $9=$recv($10).__eq_eq(true);
  51469. $ctx1.sendIdx["=="]=9;
  51470. $self._assert_($9);
  51471. $ctx1.sendIdx["assert:"]=3;
  51472. $12=true._yourself();
  51473. $ctx1.sendIdx["yourself"]=2;
  51474. $11=$recv($12).__eq_eq(true._yourself());
  51475. $self._assert_($11);
  51476. return self;
  51477. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51478. },
  51479. args: [],
  51480. 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",
  51481. referencedClasses: [],
  51482. messageSends: ["deny:", "==", "assert:", "yourself"]
  51483. }),
  51484. $globals.BooleanTest);
  51485. $core.addMethod(
  51486. $core.method({
  51487. selector: "testIfTrueIfFalse",
  51488. protocol: "tests",
  51489. fn: function (){
  51490. var self=this,$self=this;
  51491. return $core.withContext(function($ctx1) {
  51492. var $1,$2,$3,$4,$5,$6,$7,$8;
  51493. if($core.assert(true)){
  51494. $1="alternative block";
  51495. }
  51496. $self._assert_equals_($1,"alternative block");
  51497. $ctx1.sendIdx["assert:equals:"]=1;
  51498. if(!$core.assert(true)){
  51499. $2="alternative block";
  51500. }
  51501. $self._assert_equals_($2,nil);
  51502. $ctx1.sendIdx["assert:equals:"]=2;
  51503. if($core.assert(false)){
  51504. $3="alternative block";
  51505. }
  51506. $self._assert_equals_($3,nil);
  51507. $ctx1.sendIdx["assert:equals:"]=3;
  51508. if(!$core.assert(false)){
  51509. $4="alternative block";
  51510. }
  51511. $self._assert_equals_($4,"alternative block");
  51512. $ctx1.sendIdx["assert:equals:"]=4;
  51513. if($core.assert(false)){
  51514. $5="alternative block";
  51515. } else {
  51516. $5="alternative block2";
  51517. }
  51518. $self._assert_equals_($5,"alternative block2");
  51519. $ctx1.sendIdx["assert:equals:"]=5;
  51520. if($core.assert(false)){
  51521. $6="alternative block2";
  51522. } else {
  51523. $6="alternative block";
  51524. }
  51525. $self._assert_equals_($6,"alternative block");
  51526. $ctx1.sendIdx["assert:equals:"]=6;
  51527. if($core.assert(true)){
  51528. $7="alternative block";
  51529. } else {
  51530. $7="alternative block2";
  51531. }
  51532. $self._assert_equals_($7,"alternative block");
  51533. $ctx1.sendIdx["assert:equals:"]=7;
  51534. if($core.assert(true)){
  51535. $8="alternative block2";
  51536. } else {
  51537. $8="alternative block";
  51538. }
  51539. $self._assert_equals_($8,"alternative block2");
  51540. return self;
  51541. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51542. },
  51543. args: [],
  51544. 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'.",
  51545. referencedClasses: [],
  51546. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51547. }),
  51548. $globals.BooleanTest);
  51549. $core.addMethod(
  51550. $core.method({
  51551. selector: "testIfTrueIfFalseWithBoxing",
  51552. protocol: "tests",
  51553. fn: function (){
  51554. var self=this,$self=this;
  51555. return $core.withContext(function($ctx1) {
  51556. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51557. $2=true._yourself();
  51558. $ctx1.sendIdx["yourself"]=1;
  51559. if($core.assert($2)){
  51560. $1="alternative block";
  51561. }
  51562. $self._assert_equals_($1,"alternative block");
  51563. $ctx1.sendIdx["assert:equals:"]=1;
  51564. $4=true._yourself();
  51565. $ctx1.sendIdx["yourself"]=2;
  51566. if(!$core.assert($4)){
  51567. $3="alternative block";
  51568. }
  51569. $self._assert_equals_($3,nil);
  51570. $ctx1.sendIdx["assert:equals:"]=2;
  51571. $6=false._yourself();
  51572. $ctx1.sendIdx["yourself"]=3;
  51573. if($core.assert($6)){
  51574. $5="alternative block";
  51575. }
  51576. $self._assert_equals_($5,nil);
  51577. $ctx1.sendIdx["assert:equals:"]=3;
  51578. $8=false._yourself();
  51579. $ctx1.sendIdx["yourself"]=4;
  51580. if(!$core.assert($8)){
  51581. $7="alternative block";
  51582. }
  51583. $self._assert_equals_($7,"alternative block");
  51584. $ctx1.sendIdx["assert:equals:"]=4;
  51585. $10=false._yourself();
  51586. $ctx1.sendIdx["yourself"]=5;
  51587. if($core.assert($10)){
  51588. $9="alternative block";
  51589. } else {
  51590. $9="alternative block2";
  51591. }
  51592. $self._assert_equals_($9,"alternative block2");
  51593. $ctx1.sendIdx["assert:equals:"]=5;
  51594. $12=false._yourself();
  51595. $ctx1.sendIdx["yourself"]=6;
  51596. if($core.assert($12)){
  51597. $11="alternative block2";
  51598. } else {
  51599. $11="alternative block";
  51600. }
  51601. $self._assert_equals_($11,"alternative block");
  51602. $ctx1.sendIdx["assert:equals:"]=6;
  51603. $14=true._yourself();
  51604. $ctx1.sendIdx["yourself"]=7;
  51605. if($core.assert($14)){
  51606. $13="alternative block";
  51607. } else {
  51608. $13="alternative block2";
  51609. }
  51610. $self._assert_equals_($13,"alternative block");
  51611. $ctx1.sendIdx["assert:equals:"]=7;
  51612. $16=true._yourself();
  51613. if($core.assert($16)){
  51614. $15="alternative block2";
  51615. } else {
  51616. $15="alternative block";
  51617. }
  51618. $self._assert_equals_($15,"alternative block2");
  51619. return self;
  51620. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51621. },
  51622. args: [],
  51623. 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'.",
  51624. referencedClasses: [],
  51625. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51626. }),
  51627. $globals.BooleanTest);
  51628. $core.addMethod(
  51629. $core.method({
  51630. selector: "testLogic",
  51631. protocol: "tests",
  51632. fn: function (){
  51633. var self=this,$self=this;
  51634. return $core.withContext(function($ctx1) {
  51635. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51636. $1=true.__and(true);
  51637. $ctx1.sendIdx["&"]=1;
  51638. $self._assert_($1);
  51639. $ctx1.sendIdx["assert:"]=1;
  51640. $2=true.__and(false);
  51641. $ctx1.sendIdx["&"]=2;
  51642. $self._deny_($2);
  51643. $ctx1.sendIdx["deny:"]=1;
  51644. $3=false.__and(true);
  51645. $ctx1.sendIdx["&"]=3;
  51646. $self._deny_($3);
  51647. $ctx1.sendIdx["deny:"]=2;
  51648. $5=false.__and(false);
  51649. $ctx1.sendIdx["&"]=4;
  51650. $4=$self._deny_($5);
  51651. $ctx1.sendIdx["deny:"]=3;
  51652. $6=true.__or(true);
  51653. $ctx1.sendIdx["|"]=1;
  51654. $self._assert_($6);
  51655. $ctx1.sendIdx["assert:"]=2;
  51656. $7=true.__or(false);
  51657. $ctx1.sendIdx["|"]=2;
  51658. $self._assert_($7);
  51659. $ctx1.sendIdx["assert:"]=3;
  51660. $8=false.__or(true);
  51661. $ctx1.sendIdx["|"]=3;
  51662. $self._assert_($8);
  51663. $ctx1.sendIdx["assert:"]=4;
  51664. $10=false.__or(false);
  51665. $ctx1.sendIdx["|"]=4;
  51666. $9=$self._deny_($10);
  51667. $ctx1.sendIdx["deny:"]=4;
  51668. $12=(1).__gt((0));
  51669. $ctx1.sendIdx[">"]=1;
  51670. $11=true.__and($12);
  51671. $ctx1.sendIdx["&"]=5;
  51672. $self._assert_($11);
  51673. $ctx1.sendIdx["assert:"]=5;
  51674. $14=(1).__gt((0));
  51675. $ctx1.sendIdx[">"]=2;
  51676. $13=$recv($14).__and(false);
  51677. $ctx1.sendIdx["&"]=6;
  51678. $self._deny_($13);
  51679. $ctx1.sendIdx["deny:"]=5;
  51680. $16=(1).__gt((0));
  51681. $ctx1.sendIdx[">"]=3;
  51682. $17=(1).__gt((2));
  51683. $ctx1.sendIdx[">"]=4;
  51684. $15=$recv($16).__and($17);
  51685. $self._deny_($15);
  51686. $19=(1).__gt((0));
  51687. $ctx1.sendIdx[">"]=5;
  51688. $18=false.__or($19);
  51689. $ctx1.sendIdx["|"]=5;
  51690. $self._assert_($18);
  51691. $ctx1.sendIdx["assert:"]=6;
  51692. $21=(1).__gt((0));
  51693. $ctx1.sendIdx[">"]=6;
  51694. $20=$recv($21).__or(false);
  51695. $ctx1.sendIdx["|"]=6;
  51696. $self._assert_($20);
  51697. $ctx1.sendIdx["assert:"]=7;
  51698. $23=(1).__gt((0));
  51699. $ctx1.sendIdx[">"]=7;
  51700. $22=$recv($23).__or((1).__gt((2)));
  51701. $self._assert_($22);
  51702. return self;
  51703. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51704. },
  51705. args: [],
  51706. 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))",
  51707. referencedClasses: [],
  51708. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51709. }),
  51710. $globals.BooleanTest);
  51711. $core.addMethod(
  51712. $core.method({
  51713. selector: "testLogicKeywords",
  51714. protocol: "tests",
  51715. fn: function (){
  51716. var self=this,$self=this;
  51717. return $core.withContext(function($ctx1) {
  51718. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51719. $1=true._and_((function(){
  51720. return true;
  51721. }));
  51722. $ctx1.sendIdx["and:"]=1;
  51723. $self._assert_($1);
  51724. $ctx1.sendIdx["assert:"]=1;
  51725. $2=true._and_((function(){
  51726. return false;
  51727. }));
  51728. $ctx1.sendIdx["and:"]=2;
  51729. $self._deny_($2);
  51730. $ctx1.sendIdx["deny:"]=1;
  51731. $3=false._and_((function(){
  51732. return true;
  51733. }));
  51734. $ctx1.sendIdx["and:"]=3;
  51735. $self._deny_($3);
  51736. $ctx1.sendIdx["deny:"]=2;
  51737. $5=false._and_((function(){
  51738. return false;
  51739. }));
  51740. $ctx1.sendIdx["and:"]=4;
  51741. $4=$self._deny_($5);
  51742. $ctx1.sendIdx["deny:"]=3;
  51743. $6=true._or_((function(){
  51744. return true;
  51745. }));
  51746. $ctx1.sendIdx["or:"]=1;
  51747. $self._assert_($6);
  51748. $ctx1.sendIdx["assert:"]=2;
  51749. $7=true._or_((function(){
  51750. return false;
  51751. }));
  51752. $ctx1.sendIdx["or:"]=2;
  51753. $self._assert_($7);
  51754. $ctx1.sendIdx["assert:"]=3;
  51755. $8=false._or_((function(){
  51756. return true;
  51757. }));
  51758. $ctx1.sendIdx["or:"]=3;
  51759. $self._assert_($8);
  51760. $ctx1.sendIdx["assert:"]=4;
  51761. $10=false._or_((function(){
  51762. return false;
  51763. }));
  51764. $ctx1.sendIdx["or:"]=4;
  51765. $9=$self._deny_($10);
  51766. $ctx1.sendIdx["deny:"]=4;
  51767. $11=true._and_((function(){
  51768. return $core.withContext(function($ctx2) {
  51769. return (1).__gt((0));
  51770. $ctx2.sendIdx[">"]=1;
  51771. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51772. }));
  51773. $ctx1.sendIdx["and:"]=5;
  51774. $self._assert_($11);
  51775. $ctx1.sendIdx["assert:"]=5;
  51776. $13=(1).__gt((0));
  51777. $ctx1.sendIdx[">"]=2;
  51778. $12=$recv($13)._and_((function(){
  51779. return false;
  51780. }));
  51781. $ctx1.sendIdx["and:"]=6;
  51782. $self._deny_($12);
  51783. $ctx1.sendIdx["deny:"]=5;
  51784. $15=(1).__gt((0));
  51785. $ctx1.sendIdx[">"]=3;
  51786. $14=$recv($15)._and_((function(){
  51787. return $core.withContext(function($ctx2) {
  51788. return (1).__gt((2));
  51789. $ctx2.sendIdx[">"]=4;
  51790. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51791. }));
  51792. $self._deny_($14);
  51793. $16=false._or_((function(){
  51794. return $core.withContext(function($ctx2) {
  51795. return (1).__gt((0));
  51796. $ctx2.sendIdx[">"]=5;
  51797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51798. }));
  51799. $ctx1.sendIdx["or:"]=5;
  51800. $self._assert_($16);
  51801. $ctx1.sendIdx["assert:"]=6;
  51802. $18=(1).__gt((0));
  51803. $ctx1.sendIdx[">"]=6;
  51804. $17=$recv($18)._or_((function(){
  51805. return false;
  51806. }));
  51807. $ctx1.sendIdx["or:"]=6;
  51808. $self._assert_($17);
  51809. $ctx1.sendIdx["assert:"]=7;
  51810. $20=(1).__gt((0));
  51811. $ctx1.sendIdx[">"]=7;
  51812. $19=$recv($20)._or_((function(){
  51813. return $core.withContext(function($ctx2) {
  51814. return (1).__gt((2));
  51815. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51816. }));
  51817. $self._assert_($19);
  51818. return self;
  51819. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51820. },
  51821. args: [],
  51822. 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 ])",
  51823. referencedClasses: [],
  51824. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51825. }),
  51826. $globals.BooleanTest);
  51827. $core.addMethod(
  51828. $core.method({
  51829. selector: "testNonBooleanError",
  51830. protocol: "tests",
  51831. fn: function (){
  51832. var self=this,$self=this;
  51833. return $core.withContext(function($ctx1) {
  51834. $self._should_raise_((function(){
  51835. return $core.withContext(function($ctx2) {
  51836. if($core.assert("")){
  51837. } else {
  51838. }
  51839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51840. }),$globals.NonBooleanReceiver);
  51841. return self;
  51842. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51843. },
  51844. args: [],
  51845. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51846. referencedClasses: ["NonBooleanReceiver"],
  51847. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51848. }),
  51849. $globals.BooleanTest);
  51850. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51851. $core.addMethod(
  51852. $core.method({
  51853. selector: "setUp",
  51854. protocol: "running",
  51855. fn: function (){
  51856. var self=this,$self=this;
  51857. return $core.withContext(function($ctx1) {
  51858. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51859. return self;
  51860. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51861. },
  51862. args: [],
  51863. source: "setUp\x0a\x09builder := ClassBuilder new",
  51864. referencedClasses: ["ClassBuilder"],
  51865. messageSends: ["new"]
  51866. }),
  51867. $globals.ClassBuilderTest);
  51868. $core.addMethod(
  51869. $core.method({
  51870. selector: "tearDown",
  51871. protocol: "running",
  51872. fn: function (){
  51873. var self=this,$self=this;
  51874. return $core.withContext(function($ctx1) {
  51875. var $1,$receiver;
  51876. $1=$self["@theClass"];
  51877. if(($receiver = $1) == null || $receiver.a$nil){
  51878. $1;
  51879. } else {
  51880. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51881. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51882. $self["@theClass"]=nil;
  51883. $self["@theClass"];
  51884. }
  51885. return self;
  51886. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51887. },
  51888. args: [],
  51889. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51890. referencedClasses: ["Smalltalk"],
  51891. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51892. }),
  51893. $globals.ClassBuilderTest);
  51894. $core.addMethod(
  51895. $core.method({
  51896. selector: "testAddTrait",
  51897. protocol: "tests",
  51898. fn: function (){
  51899. var self=this,$self=this;
  51900. return $core.withContext(function($ctx1) {
  51901. var $3,$2,$1,$4;
  51902. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51903. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51904. $ctx1.sendIdx["assert:equals:"]=1;
  51905. $3=$recv($self["@theClass"])._package();
  51906. $ctx1.sendIdx["package"]=1;
  51907. $2=$recv($3)._classes();
  51908. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51909. $self._assert_equals_($1,(1));
  51910. $ctx1.sendIdx["assert:equals:"]=2;
  51911. $4=$recv($self["@theClass"])._package();
  51912. $ctx1.sendIdx["package"]=2;
  51913. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51914. return self;
  51915. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51916. },
  51917. args: [],
  51918. source: "testAddTrait\x0a\x09theClass := builder addTraitNamed: 'ObjectMock2' package: 'Kernel-Tests'.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: (theClass package classes occurrencesOf: theClass) equals: 1.\x0a\x09self assert: theClass package equals: ObjectMock package",
  51919. referencedClasses: ["ObjectMock"],
  51920. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51921. }),
  51922. $globals.ClassBuilderTest);
  51923. $core.addMethod(
  51924. $core.method({
  51925. selector: "testClassCopy",
  51926. protocol: "tests",
  51927. fn: function (){
  51928. var self=this,$self=this;
  51929. return $core.withContext(function($ctx1) {
  51930. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51931. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51932. $2=$recv($self["@theClass"])._superclass();
  51933. $ctx1.sendIdx["superclass"]=1;
  51934. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51935. $ctx1.sendIdx["=="]=1;
  51936. $self._assert_($1);
  51937. $ctx1.sendIdx["assert:"]=1;
  51938. $4=$recv($self["@theClass"])._instanceVariableNames();
  51939. $ctx1.sendIdx["instanceVariableNames"]=1;
  51940. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51941. $ctx1.sendIdx["=="]=2;
  51942. $self._assert_($3);
  51943. $ctx1.sendIdx["assert:"]=2;
  51944. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51945. $ctx1.sendIdx["assert:equals:"]=1;
  51946. $6=$recv($self["@theClass"])._package();
  51947. $ctx1.sendIdx["package"]=1;
  51948. $7=$recv($globals.ObjectMock)._package();
  51949. $ctx1.sendIdx["package"]=2;
  51950. $5=$recv($6).__eq_eq($7);
  51951. $self._assert_($5);
  51952. $ctx1.sendIdx["assert:"]=3;
  51953. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51954. $9=$recv($self["@theClass"])._methodDictionary();
  51955. $ctx1.sendIdx["methodDictionary"]=1;
  51956. $8=$recv($9)._keys();
  51957. $ctx1.sendIdx["keys"]=1;
  51958. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51959. return self;
  51960. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51961. },
  51962. args: [],
  51963. 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 package classes includes: theClass).\x0a\x09self assert: theClass methodDictionary keys equals: ObjectMock methodDictionary keys",
  51964. referencedClasses: ["ObjectMock"],
  51965. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51966. }),
  51967. $globals.ClassBuilderTest);
  51968. $core.addMethod(
  51969. $core.method({
  51970. selector: "testClassMigration",
  51971. protocol: "tests",
  51972. fn: function (){
  51973. var self=this,$self=this;
  51974. var instance,oldClass;
  51975. return $core.withContext(function($ctx1) {
  51976. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  51977. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51978. $2=$recv($globals.Smalltalk)._globals();
  51979. $ctx1.sendIdx["globals"]=1;
  51980. $1=$recv($2)._at_("ObjectMock2");
  51981. $ctx1.sendIdx["at:"]=1;
  51982. instance=$recv($1)._new();
  51983. $4=$recv($globals.Smalltalk)._globals();
  51984. $ctx1.sendIdx["globals"]=2;
  51985. $3=$recv($4)._at_("ObjectMock2");
  51986. $ctx1.sendIdx["at:"]=2;
  51987. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  51988. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  51989. $ctx1.sendIdx["=="]=1;
  51990. $self._deny_($5);
  51991. $ctx1.sendIdx["deny:"]=1;
  51992. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  51993. $ctx1.sendIdx["=="]=2;
  51994. $self._assert_($6);
  51995. $ctx1.sendIdx["assert:"]=1;
  51996. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  51997. $ctx1.sendIdx["assert:"]=2;
  51998. $7=$recv($globals.ObjectMock2)._selectors();
  51999. $ctx1.sendIdx["selectors"]=1;
  52000. $self._assert_equals_($7,$recv(oldClass)._selectors());
  52001. $ctx1.sendIdx["assert:equals:"]=1;
  52002. $8=$recv($globals.ObjectMock2)._comment();
  52003. $ctx1.sendIdx["comment"]=1;
  52004. $self._assert_equals_($8,$recv(oldClass)._comment());
  52005. $ctx1.sendIdx["assert:equals:"]=2;
  52006. $10=$recv($globals.ObjectMock2)._package();
  52007. $ctx1.sendIdx["package"]=1;
  52008. $9=$recv($10)._name();
  52009. $ctx1.sendIdx["name"]=1;
  52010. $self._assert_equals_($9,"Kernel-Tests");
  52011. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  52012. $ctx1.sendIdx["assert:"]=3;
  52013. $12=$recv(instance)._class();
  52014. $ctx1.sendIdx["class"]=1;
  52015. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  52016. $self._deny_($11);
  52017. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  52018. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  52019. return self;
  52020. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  52021. },
  52022. args: [],
  52023. 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\x09self assert: (ObjectMock2 package classes includes: ObjectMock2).\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",
  52024. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  52025. messageSends: ["copyClass:named:", "new", "at:", "globals", "subclass:instanceVariableNames:package:", "deny:", "==", "assert:", "superclass", "isEmpty", "instanceVariableNames", "assert:equals:", "selectors", "comment", "name", "package", "includes:", "classes", "class", "isNil", "removeClass:"]
  52026. }),
  52027. $globals.ClassBuilderTest);
  52028. $core.addMethod(
  52029. $core.method({
  52030. selector: "testClassMigrationWithClassInstanceVariables",
  52031. protocol: "tests",
  52032. fn: function (){
  52033. var self=this,$self=this;
  52034. return $core.withContext(function($ctx1) {
  52035. var $1;
  52036. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52037. $1=$recv($globals.ObjectMock2)._class();
  52038. $ctx1.sendIdx["class"]=1;
  52039. $recv($1)._instanceVariableNames_("foo bar");
  52040. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  52041. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  52042. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  52043. return self;
  52044. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  52045. },
  52046. args: [],
  52047. 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",
  52048. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  52049. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  52050. }),
  52051. $globals.ClassBuilderTest);
  52052. $core.addMethod(
  52053. $core.method({
  52054. selector: "testClassMigrationWithSubclasses",
  52055. protocol: "tests",
  52056. fn: function (){
  52057. var self=this,$self=this;
  52058. return $core.withContext(function($ctx1) {
  52059. var $2,$1,$4,$3;
  52060. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52061. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  52062. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  52063. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  52064. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  52065. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  52066. $2=$recv($globals.ObjectMock)._subclasses();
  52067. $ctx1.sendIdx["subclasses"]=1;
  52068. $1=$recv($2)._includes_($globals.ObjectMock2);
  52069. $ctx1.sendIdx["includes:"]=1;
  52070. $self._assert_($1);
  52071. $ctx1.sendIdx["assert:"]=1;
  52072. $4=$recv($globals.ObjectMock2)._subclasses();
  52073. $ctx1.sendIdx["subclasses"]=2;
  52074. $3=$recv($4)._includes_($globals.ObjectMock3);
  52075. $ctx1.sendIdx["includes:"]=2;
  52076. $self._assert_($3);
  52077. $ctx1.sendIdx["assert:"]=2;
  52078. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  52079. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  52080. return $core.withContext(function($ctx2) {
  52081. return $recv($globals.Smalltalk)._removeClass_(each);
  52082. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52083. }));
  52084. return self;
  52085. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  52086. },
  52087. args: [],
  52088. 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 ]",
  52089. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  52090. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  52091. }),
  52092. $globals.ClassBuilderTest);
  52093. $core.addMethod(
  52094. $core.method({
  52095. selector: "testInstanceVariableNames",
  52096. protocol: "tests",
  52097. fn: function (){
  52098. var self=this,$self=this;
  52099. return $core.withContext(function($ctx1) {
  52100. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  52101. return self;
  52102. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  52103. },
  52104. args: [],
  52105. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  52106. referencedClasses: [],
  52107. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  52108. }),
  52109. $globals.ClassBuilderTest);
  52110. $core.addMethod(
  52111. $core.method({
  52112. selector: "testSubclass",
  52113. protocol: "tests",
  52114. fn: function (){
  52115. var self=this,$self=this;
  52116. return $core.withContext(function($ctx1) {
  52117. var $3,$2,$1,$4;
  52118. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  52119. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  52120. $ctx1.sendIdx["assert:equals:"]=1;
  52121. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  52122. $ctx1.sendIdx["assert:equals:"]=2;
  52123. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52124. $ctx1.sendIdx["assert:equals:"]=3;
  52125. $3=$recv($self["@theClass"])._package();
  52126. $ctx1.sendIdx["package"]=1;
  52127. $2=$recv($3)._classes();
  52128. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  52129. $self._assert_equals_($1,(1));
  52130. $ctx1.sendIdx["assert:equals:"]=4;
  52131. $4=$recv($self["@theClass"])._package();
  52132. $ctx1.sendIdx["package"]=2;
  52133. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  52134. $ctx1.sendIdx["assert:equals:"]=5;
  52135. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  52136. return self;
  52137. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  52138. },
  52139. args: [],
  52140. source: "testSubclass\x0a\x09theClass := builder addSubclassOf: ObjectMock named: 'ObjectMock2' instanceVariableNames: 'foo bar' package: 'Kernel-Tests'.\x0a\x09self assert: theClass superclass equals: ObjectMock.\x0a\x09self assert: theClass instanceVariableNames equals: 'foo bar'.\x0a\x09self assert: theClass name equals: 'ObjectMock2'.\x0a\x09self assert: (theClass package classes occurrencesOf: theClass) equals: 1.\x0a\x09self assert: theClass package equals: ObjectMock package.\x0a\x09self assert: theClass methodDictionary keys size equals: 0",
  52141. referencedClasses: ["ObjectMock"],
  52142. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  52143. }),
  52144. $globals.ClassBuilderTest);
  52145. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  52146. $core.addMethod(
  52147. $core.method({
  52148. selector: "jsConstructor",
  52149. protocol: "running",
  52150. fn: function (){
  52151. var self=this,$self=this;
  52152. return $core.withContext(function($ctx1) {
  52153. function Foo(){}
  52154. Foo.prototype.valueOf = function () {return 4;};
  52155. return Foo;
  52156. ;
  52157. return self;
  52158. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  52159. },
  52160. args: [],
  52161. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52162. referencedClasses: [],
  52163. messageSends: []
  52164. }),
  52165. $globals.ClassTest);
  52166. $core.addMethod(
  52167. $core.method({
  52168. selector: "setUp",
  52169. protocol: "running",
  52170. fn: function (){
  52171. var self=this,$self=this;
  52172. return $core.withContext(function($ctx1) {
  52173. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  52174. return self;
  52175. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  52176. },
  52177. args: [],
  52178. source: "setUp\x0a\x09builder := ClassBuilder new",
  52179. referencedClasses: ["ClassBuilder"],
  52180. messageSends: ["new"]
  52181. }),
  52182. $globals.ClassTest);
  52183. $core.addMethod(
  52184. $core.method({
  52185. selector: "tearDown",
  52186. protocol: "running",
  52187. fn: function (){
  52188. var self=this,$self=this;
  52189. return $core.withContext(function($ctx1) {
  52190. var $1,$receiver;
  52191. $1=$self["@theClass"];
  52192. if(($receiver = $1) == null || $receiver.a$nil){
  52193. $1;
  52194. } else {
  52195. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  52196. return $core.withContext(function($ctx2) {
  52197. return $recv($globals.Smalltalk)._removeClass_(each);
  52198. $ctx2.sendIdx["removeClass:"]=1;
  52199. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52200. }));
  52201. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  52202. $self["@theClass"]=nil;
  52203. $self["@theClass"];
  52204. }
  52205. return self;
  52206. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  52207. },
  52208. args: [],
  52209. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  52210. referencedClasses: ["Smalltalk"],
  52211. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  52212. }),
  52213. $globals.ClassTest);
  52214. $core.addMethod(
  52215. $core.method({
  52216. selector: "testAllSubclasses",
  52217. protocol: "tests",
  52218. fn: function (){
  52219. var self=this,$self=this;
  52220. var subclasses,index;
  52221. return $core.withContext(function($ctx1) {
  52222. subclasses=$recv($globals.Object)._subclasses();
  52223. $ctx1.sendIdx["subclasses"]=1;
  52224. index=(1);
  52225. $recv((function(){
  52226. return $core.withContext(function($ctx2) {
  52227. return $recv(index).__gt($recv(subclasses)._size());
  52228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52229. }))._whileFalse_((function(){
  52230. return $core.withContext(function($ctx2) {
  52231. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  52232. index=$recv(index).__plus((1));
  52233. return index;
  52234. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52235. }));
  52236. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  52237. return self;
  52238. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  52239. },
  52240. args: [],
  52241. 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",
  52242. referencedClasses: ["Object"],
  52243. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  52244. }),
  52245. $globals.ClassTest);
  52246. $core.addMethod(
  52247. $core.method({
  52248. selector: "testMetaclassSubclasses",
  52249. protocol: "tests",
  52250. fn: function (){
  52251. var self=this,$self=this;
  52252. var subclasses;
  52253. return $core.withContext(function($ctx1) {
  52254. var $4,$3,$2,$1;
  52255. $4=$recv($globals.Object)._class();
  52256. $ctx1.sendIdx["class"]=1;
  52257. $3=$recv($4)._instanceClass();
  52258. $2=$recv($3)._subclasses();
  52259. $ctx1.sendIdx["subclasses"]=1;
  52260. $1=$recv($2)._select_((function(each){
  52261. return $core.withContext(function($ctx2) {
  52262. return $recv($recv(each)._isMetaclass())._not();
  52263. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52264. }));
  52265. subclasses=$recv($1)._collect_((function(each){
  52266. return $core.withContext(function($ctx2) {
  52267. return $recv(each)._theMetaClass();
  52268. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52269. }));
  52270. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  52271. return self;
  52272. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  52273. },
  52274. args: [],
  52275. 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",
  52276. referencedClasses: ["Object"],
  52277. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  52278. }),
  52279. $globals.ClassTest);
  52280. $core.addMethod(
  52281. $core.method({
  52282. selector: "testSetJavaScriptConstructor",
  52283. protocol: "tests",
  52284. fn: function (){
  52285. var self=this,$self=this;
  52286. var instance;
  52287. return $core.withContext(function($ctx1) {
  52288. var $2,$1,$4,$3,$6,$5,$8,$7;
  52289. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52290. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  52291. $2=$recv($self["@theClass"])._superclass();
  52292. $ctx1.sendIdx["superclass"]=1;
  52293. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52294. $ctx1.sendIdx["=="]=1;
  52295. $self._assert_($1);
  52296. $ctx1.sendIdx["assert:"]=1;
  52297. $4=$recv($self["@theClass"])._instanceVariableNames();
  52298. $ctx1.sendIdx["instanceVariableNames"]=1;
  52299. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52300. $ctx1.sendIdx["=="]=2;
  52301. $self._assert_($3);
  52302. $ctx1.sendIdx["assert:"]=2;
  52303. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52304. $ctx1.sendIdx["assert:equals:"]=1;
  52305. $6=$recv($self["@theClass"])._package();
  52306. $ctx1.sendIdx["package"]=1;
  52307. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52308. $ctx1.sendIdx["=="]=3;
  52309. $self._assert_($5);
  52310. $ctx1.sendIdx["assert:"]=3;
  52311. $8=$recv($self["@theClass"])._methodDictionary();
  52312. $ctx1.sendIdx["methodDictionary"]=1;
  52313. $7=$recv($8)._keys();
  52314. $ctx1.sendIdx["keys"]=1;
  52315. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52316. $ctx1.sendIdx["assert:equals:"]=2;
  52317. instance=$recv($self["@theClass"])._new();
  52318. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52319. $self._assert_equals_($recv(instance)._value(),(4));
  52320. $ctx1.sendIdx["assert:equals:"]=3;
  52321. $self._shouldnt_raise_((function(){
  52322. return $core.withContext(function($ctx2) {
  52323. return $recv(instance)._foo_((9));
  52324. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52325. }),$globals.Error);
  52326. $self._assert_equals_($recv(instance)._foo(),(9));
  52327. return self;
  52328. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52329. },
  52330. args: [],
  52331. 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",
  52332. referencedClasses: ["ObjectMock", "Error"],
  52333. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52334. }),
  52335. $globals.ClassTest);
  52336. $core.addMethod(
  52337. $core.method({
  52338. selector: "testTrickySetJavaScriptConstructor",
  52339. protocol: "tests",
  52340. fn: function (){
  52341. var self=this,$self=this;
  52342. var instance;
  52343. return $core.withContext(function($ctx1) {
  52344. var $2,$1,$4,$3,$6,$5,$8,$7;
  52345. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52346. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  52347. $2=$recv($self["@theClass"])._superclass();
  52348. $ctx1.sendIdx["superclass"]=1;
  52349. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52350. $ctx1.sendIdx["=="]=1;
  52351. $self._assert_($1);
  52352. $ctx1.sendIdx["assert:"]=1;
  52353. $4=$recv($self["@theClass"])._instanceVariableNames();
  52354. $ctx1.sendIdx["instanceVariableNames"]=1;
  52355. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52356. $ctx1.sendIdx["=="]=2;
  52357. $self._assert_($3);
  52358. $ctx1.sendIdx["assert:"]=2;
  52359. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52360. $ctx1.sendIdx["assert:equals:"]=1;
  52361. $6=$recv($self["@theClass"])._package();
  52362. $ctx1.sendIdx["package"]=1;
  52363. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52364. $ctx1.sendIdx["=="]=3;
  52365. $self._assert_($5);
  52366. $ctx1.sendIdx["assert:"]=3;
  52367. $8=$recv($self["@theClass"])._methodDictionary();
  52368. $ctx1.sendIdx["methodDictionary"]=1;
  52369. $7=$recv($8)._keys();
  52370. $ctx1.sendIdx["keys"]=1;
  52371. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52372. $ctx1.sendIdx["assert:equals:"]=2;
  52373. instance=$recv($self["@theClass"])._new();
  52374. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52375. $self._assert_equals_($recv(instance)._value(),(4));
  52376. $ctx1.sendIdx["assert:equals:"]=3;
  52377. $self._shouldnt_raise_((function(){
  52378. return $core.withContext(function($ctx2) {
  52379. return $recv(instance)._foo_((9));
  52380. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52381. }),$globals.Error);
  52382. $self._assert_equals_($recv(instance)._foo(),(9));
  52383. return self;
  52384. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52385. },
  52386. args: [],
  52387. 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",
  52388. referencedClasses: ["ObjectMock", "Error"],
  52389. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52390. }),
  52391. $globals.ClassTest);
  52392. $core.addMethod(
  52393. $core.method({
  52394. selector: "trickyJsConstructor",
  52395. protocol: "running",
  52396. fn: function (){
  52397. var self=this,$self=this;
  52398. return $core.withContext(function($ctx1) {
  52399. function Foo(){}
  52400. Foo.prototype.valueOf = function () {return 4;};
  52401. Foo.prototype._foo = function () {return "bar";};
  52402. return Foo;
  52403. ;
  52404. return self;
  52405. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52406. },
  52407. args: [],
  52408. 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'>",
  52409. referencedClasses: [],
  52410. messageSends: []
  52411. }),
  52412. $globals.ClassTest);
  52413. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52414. $core.addMethod(
  52415. $core.method({
  52416. selector: "assertSameContents:as:",
  52417. protocol: "convenience",
  52418. fn: function (aCollection,anotherCollection){
  52419. var self=this,$self=this;
  52420. return $core.withContext(function($ctx1) {
  52421. var $2,$1,$4,$3;
  52422. $2=$recv(aCollection)._size();
  52423. $ctx1.sendIdx["size"]=1;
  52424. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52425. $ctx1.sendIdx["="]=1;
  52426. $self._assert_($1);
  52427. $ctx1.sendIdx["assert:"]=1;
  52428. $recv(aCollection)._do_((function(each){
  52429. return $core.withContext(function($ctx2) {
  52430. $4=$recv(aCollection)._occurrencesOf_(each);
  52431. $ctx2.sendIdx["occurrencesOf:"]=1;
  52432. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52433. return $self._assert_($3);
  52434. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52435. }));
  52436. return self;
  52437. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52438. },
  52439. args: ["aCollection", "anotherCollection"],
  52440. 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)) ]",
  52441. referencedClasses: [],
  52442. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52443. }),
  52444. $globals.CollectionTest);
  52445. $core.addMethod(
  52446. $core.method({
  52447. selector: "collection",
  52448. protocol: "fixture",
  52449. fn: function (){
  52450. var self=this,$self=this;
  52451. return $core.withContext(function($ctx1) {
  52452. $self._subclassResponsibility();
  52453. return self;
  52454. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52455. },
  52456. args: [],
  52457. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52458. referencedClasses: [],
  52459. messageSends: ["subclassResponsibility"]
  52460. }),
  52461. $globals.CollectionTest);
  52462. $core.addMethod(
  52463. $core.method({
  52464. selector: "collectionClass",
  52465. protocol: "fixture",
  52466. fn: function (){
  52467. var self=this,$self=this;
  52468. return $core.withContext(function($ctx1) {
  52469. return $recv($self._class())._collectionClass();
  52470. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52471. },
  52472. args: [],
  52473. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52474. referencedClasses: [],
  52475. messageSends: ["collectionClass", "class"]
  52476. }),
  52477. $globals.CollectionTest);
  52478. $core.addMethod(
  52479. $core.method({
  52480. selector: "collectionOfPrintStrings",
  52481. protocol: "fixture",
  52482. fn: function (){
  52483. var self=this,$self=this;
  52484. return $core.withContext(function($ctx1) {
  52485. $self._subclassResponsibility();
  52486. return self;
  52487. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52488. },
  52489. args: [],
  52490. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52491. referencedClasses: [],
  52492. messageSends: ["subclassResponsibility"]
  52493. }),
  52494. $globals.CollectionTest);
  52495. $core.addMethod(
  52496. $core.method({
  52497. selector: "collectionSize",
  52498. protocol: "fixture",
  52499. fn: function (){
  52500. var self=this,$self=this;
  52501. return $core.withContext(function($ctx1) {
  52502. $self._subclassResponsibility();
  52503. return self;
  52504. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52505. },
  52506. args: [],
  52507. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52508. referencedClasses: [],
  52509. messageSends: ["subclassResponsibility"]
  52510. }),
  52511. $globals.CollectionTest);
  52512. $core.addMethod(
  52513. $core.method({
  52514. selector: "collectionWithDuplicates",
  52515. protocol: "fixture",
  52516. fn: function (){
  52517. var self=this,$self=this;
  52518. return $core.withContext(function($ctx1) {
  52519. $self._subclassResponsibility();
  52520. return self;
  52521. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52522. },
  52523. args: [],
  52524. source: "collectionWithDuplicates\x0a\x09\x22Answers pre-filled collection of type tested,\x0a\x09with exactly six distinct elements,\x0a\x09some of them appearing multiple times, if possible.\x22\x0a\x0a\x09self subclassResponsibility",
  52525. referencedClasses: [],
  52526. messageSends: ["subclassResponsibility"]
  52527. }),
  52528. $globals.CollectionTest);
  52529. $core.addMethod(
  52530. $core.method({
  52531. selector: "collectionWithNewValue",
  52532. protocol: "fixture",
  52533. fn: function (){
  52534. var self=this,$self=this;
  52535. return $core.withContext(function($ctx1) {
  52536. $self._subclassResponsibility();
  52537. return self;
  52538. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52539. },
  52540. args: [],
  52541. 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",
  52542. referencedClasses: [],
  52543. messageSends: ["subclassResponsibility"]
  52544. }),
  52545. $globals.CollectionTest);
  52546. $core.addMethod(
  52547. $core.method({
  52548. selector: "initialize",
  52549. protocol: "initialization",
  52550. fn: function (){
  52551. var self=this,$self=this;
  52552. return $core.withContext(function($ctx1) {
  52553. (
  52554. $ctx1.supercall = true,
  52555. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52556. $ctx1.supercall = false;
  52557. $self["@sampleBlock"]=(function(){
  52558. });
  52559. return self;
  52560. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52561. },
  52562. args: [],
  52563. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52564. referencedClasses: [],
  52565. messageSends: ["initialize"]
  52566. }),
  52567. $globals.CollectionTest);
  52568. $core.addMethod(
  52569. $core.method({
  52570. selector: "sampleNewValue",
  52571. protocol: "fixture",
  52572. fn: function (){
  52573. var self=this,$self=this;
  52574. return "N";
  52575. },
  52576. args: [],
  52577. 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'",
  52578. referencedClasses: [],
  52579. messageSends: []
  52580. }),
  52581. $globals.CollectionTest);
  52582. $core.addMethod(
  52583. $core.method({
  52584. selector: "sampleNewValueAsCollection",
  52585. protocol: "fixture",
  52586. fn: function (){
  52587. var self=this,$self=this;
  52588. return $core.withContext(function($ctx1) {
  52589. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52590. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52591. },
  52592. args: [],
  52593. 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",
  52594. referencedClasses: [],
  52595. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52596. }),
  52597. $globals.CollectionTest);
  52598. $core.addMethod(
  52599. $core.method({
  52600. selector: "testAddAll",
  52601. protocol: "tests",
  52602. fn: function (){
  52603. var self=this,$self=this;
  52604. return $core.withContext(function($ctx1) {
  52605. 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;
  52606. $2=$self._collection();
  52607. $ctx1.sendIdx["collection"]=1;
  52608. $4=$self._collectionClass();
  52609. $ctx1.sendIdx["collectionClass"]=1;
  52610. $3=$recv($4)._new();
  52611. $ctx1.sendIdx["new"]=1;
  52612. $recv($2)._addAll_($3);
  52613. $ctx1.sendIdx["addAll:"]=1;
  52614. $5=$recv($2)._yourself();
  52615. $ctx1.sendIdx["yourself"]=1;
  52616. $1=$5;
  52617. $6=$self._collection();
  52618. $ctx1.sendIdx["collection"]=2;
  52619. $self._assert_equals_($1,$6);
  52620. $ctx1.sendIdx["assert:equals:"]=1;
  52621. $9=$self._collectionClass();
  52622. $ctx1.sendIdx["collectionClass"]=2;
  52623. $8=$recv($9)._new();
  52624. $ctx1.sendIdx["new"]=2;
  52625. $10=$self._collection();
  52626. $ctx1.sendIdx["collection"]=3;
  52627. $recv($8)._addAll_($10);
  52628. $ctx1.sendIdx["addAll:"]=2;
  52629. $11=$recv($8)._yourself();
  52630. $ctx1.sendIdx["yourself"]=2;
  52631. $7=$11;
  52632. $12=$self._collection();
  52633. $ctx1.sendIdx["collection"]=4;
  52634. $self._assert_equals_($7,$12);
  52635. $ctx1.sendIdx["assert:equals:"]=2;
  52636. $15=$self._collectionClass();
  52637. $ctx1.sendIdx["collectionClass"]=3;
  52638. $14=$recv($15)._new();
  52639. $ctx1.sendIdx["new"]=3;
  52640. $17=$self._collectionClass();
  52641. $ctx1.sendIdx["collectionClass"]=4;
  52642. $16=$recv($17)._new();
  52643. $ctx1.sendIdx["new"]=4;
  52644. $recv($14)._addAll_($16);
  52645. $ctx1.sendIdx["addAll:"]=3;
  52646. $18=$recv($14)._yourself();
  52647. $ctx1.sendIdx["yourself"]=3;
  52648. $13=$18;
  52649. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52650. $ctx1.sendIdx["assert:equals:"]=3;
  52651. $20=$self._collection();
  52652. $ctx1.sendIdx["collection"]=5;
  52653. $21=$self._sampleNewValueAsCollection();
  52654. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52655. $recv($20)._addAll_($21);
  52656. $ctx1.sendIdx["addAll:"]=4;
  52657. $22=$recv($20)._yourself();
  52658. $ctx1.sendIdx["yourself"]=4;
  52659. $19=$22;
  52660. $23=$self._collectionWithNewValue();
  52661. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52662. $self._assert_equals_($19,$23);
  52663. $25=$self._sampleNewValueAsCollection();
  52664. $recv($25)._addAll_($self._collection());
  52665. $24=$recv($25)._yourself();
  52666. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52667. return self;
  52668. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52669. },
  52670. args: [],
  52671. 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",
  52672. referencedClasses: [],
  52673. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52674. }),
  52675. $globals.CollectionTest);
  52676. $core.addMethod(
  52677. $core.method({
  52678. selector: "testAllSatisfy",
  52679. protocol: "tests",
  52680. fn: function (){
  52681. var self=this,$self=this;
  52682. var collection,anyOne;
  52683. return $core.withContext(function($ctx1) {
  52684. var $1;
  52685. collection=$self._collection();
  52686. anyOne=$recv(collection)._anyOne();
  52687. $1=$recv(collection)._allSatisfy_((function(each){
  52688. return $core.withContext(function($ctx2) {
  52689. return $recv(collection)._includes_(each);
  52690. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52691. }));
  52692. $ctx1.sendIdx["allSatisfy:"]=1;
  52693. $self._assert_($1);
  52694. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52695. return $core.withContext(function($ctx2) {
  52696. return $recv(each).__tild_eq(anyOne);
  52697. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52698. })));
  52699. return self;
  52700. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52701. },
  52702. args: [],
  52703. 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 ])",
  52704. referencedClasses: [],
  52705. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52706. }),
  52707. $globals.CollectionTest);
  52708. $core.addMethod(
  52709. $core.method({
  52710. selector: "testAnyOne",
  52711. protocol: "tests",
  52712. fn: function (){
  52713. var self=this,$self=this;
  52714. return $core.withContext(function($ctx1) {
  52715. var $2,$1;
  52716. $self._should_raise_((function(){
  52717. return $core.withContext(function($ctx2) {
  52718. return $recv($recv($self._collectionClass())._new())._anyOne();
  52719. $ctx2.sendIdx["anyOne"]=1;
  52720. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52721. }),$globals.Error);
  52722. $2=$self._collection();
  52723. $ctx1.sendIdx["collection"]=1;
  52724. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52725. $self._assert_($1);
  52726. return self;
  52727. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52728. },
  52729. args: [],
  52730. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52731. referencedClasses: ["Error"],
  52732. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52733. }),
  52734. $globals.CollectionTest);
  52735. $core.addMethod(
  52736. $core.method({
  52737. selector: "testAnySatisfy",
  52738. protocol: "tests",
  52739. fn: function (){
  52740. var self=this,$self=this;
  52741. var anyOne;
  52742. return $core.withContext(function($ctx1) {
  52743. var $1,$3,$2;
  52744. $1=$self._collection();
  52745. $ctx1.sendIdx["collection"]=1;
  52746. anyOne=$recv($1)._anyOne();
  52747. $3=$self._collection();
  52748. $ctx1.sendIdx["collection"]=2;
  52749. $2=$recv($3)._anySatisfy_((function(each){
  52750. return $core.withContext(function($ctx2) {
  52751. return $recv(each).__eq(anyOne);
  52752. $ctx2.sendIdx["="]=1;
  52753. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52754. }));
  52755. $ctx1.sendIdx["anySatisfy:"]=1;
  52756. $self._assert_($2);
  52757. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52758. return $core.withContext(function($ctx2) {
  52759. return $recv(each).__eq($recv($globals.Object)._new());
  52760. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52761. })));
  52762. return self;
  52763. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52764. },
  52765. args: [],
  52766. 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 ])",
  52767. referencedClasses: ["Object"],
  52768. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52769. }),
  52770. $globals.CollectionTest);
  52771. $core.addMethod(
  52772. $core.method({
  52773. selector: "testAsArray",
  52774. protocol: "tests",
  52775. fn: function (){
  52776. var self=this,$self=this;
  52777. return $core.withContext(function($ctx1) {
  52778. var $1;
  52779. $1=$self._collection();
  52780. $ctx1.sendIdx["collection"]=1;
  52781. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52782. return self;
  52783. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52784. },
  52785. args: [],
  52786. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52787. referencedClasses: [],
  52788. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52789. }),
  52790. $globals.CollectionTest);
  52791. $core.addMethod(
  52792. $core.method({
  52793. selector: "testAsOrderedCollection",
  52794. protocol: "tests",
  52795. fn: function (){
  52796. var self=this,$self=this;
  52797. return $core.withContext(function($ctx1) {
  52798. var $1;
  52799. $1=$self._collection();
  52800. $ctx1.sendIdx["collection"]=1;
  52801. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52802. return self;
  52803. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52804. },
  52805. args: [],
  52806. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52807. referencedClasses: [],
  52808. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52809. }),
  52810. $globals.CollectionTest);
  52811. $core.addMethod(
  52812. $core.method({
  52813. selector: "testAsSet",
  52814. protocol: "tests",
  52815. fn: function (){
  52816. var self=this,$self=this;
  52817. var c,set;
  52818. return $core.withContext(function($ctx1) {
  52819. c=$self._collectionWithDuplicates();
  52820. set=$recv(c)._asSet();
  52821. $self._assert_equals_($recv(set)._size(),(6));
  52822. $recv(c)._do_((function(each){
  52823. return $core.withContext(function($ctx2) {
  52824. return $self._assert_($recv(set)._includes_(each));
  52825. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52826. }));
  52827. return self;
  52828. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52829. },
  52830. args: [],
  52831. 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) ]",
  52832. referencedClasses: [],
  52833. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52834. }),
  52835. $globals.CollectionTest);
  52836. $core.addMethod(
  52837. $core.method({
  52838. selector: "testCollect",
  52839. protocol: "tests",
  52840. fn: function (){
  52841. var self=this,$self=this;
  52842. return $core.withContext(function($ctx1) {
  52843. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52844. $2=$self._collection();
  52845. $ctx1.sendIdx["collection"]=1;
  52846. $1=$recv($2)._collect_((function(each){
  52847. return each;
  52848. }));
  52849. $ctx1.sendIdx["collect:"]=1;
  52850. $3=$self._collection();
  52851. $ctx1.sendIdx["collection"]=2;
  52852. $self._assert_equals_($1,$3);
  52853. $ctx1.sendIdx["assert:equals:"]=1;
  52854. $5=$self._collectionWithNewValue();
  52855. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52856. $4=$recv($5)._collect_((function(each){
  52857. return each;
  52858. }));
  52859. $ctx1.sendIdx["collect:"]=2;
  52860. $self._assert_equals_($4,$self._collectionWithNewValue());
  52861. $ctx1.sendIdx["assert:equals:"]=2;
  52862. $8=$self._collectionClass();
  52863. $ctx1.sendIdx["collectionClass"]=1;
  52864. $7=$recv($8)._new();
  52865. $ctx1.sendIdx["new"]=1;
  52866. $6=$recv($7)._collect_((function(each){
  52867. return $core.withContext(function($ctx2) {
  52868. return $recv(each)._printString();
  52869. $ctx2.sendIdx["printString"]=1;
  52870. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52871. }));
  52872. $ctx1.sendIdx["collect:"]=3;
  52873. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52874. $ctx1.sendIdx["assert:equals:"]=3;
  52875. $11=$self._collection();
  52876. $ctx1.sendIdx["collection"]=3;
  52877. $10=$recv($11)._collect_((function(){
  52878. return $core.withContext(function($ctx2) {
  52879. return $self._sampleNewValue();
  52880. $ctx2.sendIdx["sampleNewValue"]=1;
  52881. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52882. }));
  52883. $ctx1.sendIdx["collect:"]=4;
  52884. $9=$recv($10)._detect_((function(){
  52885. return true;
  52886. }));
  52887. $self._assert_equals_($9,$self._sampleNewValue());
  52888. $ctx1.sendIdx["assert:equals:"]=4;
  52889. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52890. return $core.withContext(function($ctx2) {
  52891. return $recv(each)._printString();
  52892. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52893. })),$self._collectionOfPrintStrings());
  52894. return self;
  52895. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52896. },
  52897. args: [],
  52898. 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",
  52899. referencedClasses: [],
  52900. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52901. }),
  52902. $globals.CollectionTest);
  52903. $core.addMethod(
  52904. $core.method({
  52905. selector: "testComma",
  52906. protocol: "tests",
  52907. fn: function (){
  52908. var self=this,$self=this;
  52909. return $core.withContext(function($ctx1) {
  52910. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52911. $2=$self._collection();
  52912. $ctx1.sendIdx["collection"]=1;
  52913. $4=$self._collectionClass();
  52914. $ctx1.sendIdx["collectionClass"]=1;
  52915. $3=$recv($4)._new();
  52916. $ctx1.sendIdx["new"]=1;
  52917. $1=$recv($2).__comma($3);
  52918. $ctx1.sendIdx[","]=1;
  52919. $5=$self._collection();
  52920. $ctx1.sendIdx["collection"]=2;
  52921. $self._assert_equals_($1,$5);
  52922. $ctx1.sendIdx["assert:equals:"]=1;
  52923. $8=$self._collectionClass();
  52924. $ctx1.sendIdx["collectionClass"]=2;
  52925. $7=$recv($8)._new();
  52926. $ctx1.sendIdx["new"]=2;
  52927. $9=$self._collection();
  52928. $ctx1.sendIdx["collection"]=3;
  52929. $6=$recv($7).__comma($9);
  52930. $ctx1.sendIdx[","]=2;
  52931. $10=$self._collection();
  52932. $ctx1.sendIdx["collection"]=4;
  52933. $self._assert_equals_($6,$10);
  52934. $ctx1.sendIdx["assert:equals:"]=2;
  52935. $13=$self._collectionClass();
  52936. $ctx1.sendIdx["collectionClass"]=3;
  52937. $12=$recv($13)._new();
  52938. $ctx1.sendIdx["new"]=3;
  52939. $15=$self._collectionClass();
  52940. $ctx1.sendIdx["collectionClass"]=4;
  52941. $14=$recv($15)._new();
  52942. $ctx1.sendIdx["new"]=4;
  52943. $11=$recv($12).__comma($14);
  52944. $ctx1.sendIdx[","]=3;
  52945. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52946. $ctx1.sendIdx["assert:equals:"]=3;
  52947. $17=$self._collection();
  52948. $ctx1.sendIdx["collection"]=5;
  52949. $18=$self._sampleNewValueAsCollection();
  52950. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52951. $16=$recv($17).__comma($18);
  52952. $ctx1.sendIdx[","]=4;
  52953. $19=$self._collectionWithNewValue();
  52954. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52955. $self._assert_equals_($16,$19);
  52956. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52957. return self;
  52958. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52959. },
  52960. args: [],
  52961. 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",
  52962. referencedClasses: [],
  52963. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52964. }),
  52965. $globals.CollectionTest);
  52966. $core.addMethod(
  52967. $core.method({
  52968. selector: "testCopy",
  52969. protocol: "tests",
  52970. fn: function (){
  52971. var self=this,$self=this;
  52972. return $core.withContext(function($ctx1) {
  52973. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  52974. $3=$self._collectionClass();
  52975. $ctx1.sendIdx["collectionClass"]=1;
  52976. $2=$recv($3)._new();
  52977. $ctx1.sendIdx["new"]=1;
  52978. $1=$recv($2)._copy();
  52979. $ctx1.sendIdx["copy"]=1;
  52980. $5=$self._collectionClass();
  52981. $ctx1.sendIdx["collectionClass"]=2;
  52982. $4=$recv($5)._new();
  52983. $ctx1.sendIdx["new"]=2;
  52984. $self._assert_equals_($1,$4);
  52985. $ctx1.sendIdx["assert:equals:"]=1;
  52986. $7=$self._collection();
  52987. $ctx1.sendIdx["collection"]=1;
  52988. $6=$recv($7)._copy();
  52989. $ctx1.sendIdx["copy"]=2;
  52990. $8=$self._collection();
  52991. $ctx1.sendIdx["collection"]=2;
  52992. $self._assert_equals_($6,$8);
  52993. $ctx1.sendIdx["assert:equals:"]=2;
  52994. $10=$self._collectionWithNewValue();
  52995. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52996. $9=$recv($10)._copy();
  52997. $ctx1.sendIdx["copy"]=3;
  52998. $11=$self._collectionWithNewValue();
  52999. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53000. $self._assert_equals_($9,$11);
  53001. $15=$self._collectionClass();
  53002. $ctx1.sendIdx["collectionClass"]=3;
  53003. $14=$recv($15)._new();
  53004. $ctx1.sendIdx["new"]=3;
  53005. $13=$recv($14)._copy();
  53006. $ctx1.sendIdx["copy"]=4;
  53007. $16=$self._collection();
  53008. $ctx1.sendIdx["collection"]=3;
  53009. $12=$recv($13).__eq($16);
  53010. $ctx1.sendIdx["="]=1;
  53011. $self._deny_($12);
  53012. $ctx1.sendIdx["deny:"]=1;
  53013. $19=$self._collection();
  53014. $ctx1.sendIdx["collection"]=4;
  53015. $18=$recv($19)._copy();
  53016. $ctx1.sendIdx["copy"]=5;
  53017. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  53018. $ctx1.sendIdx["="]=2;
  53019. $self._deny_($17);
  53020. $ctx1.sendIdx["deny:"]=2;
  53021. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  53022. return self;
  53023. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  53024. },
  53025. args: [],
  53026. 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",
  53027. referencedClasses: [],
  53028. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53029. }),
  53030. $globals.CollectionTest);
  53031. $core.addMethod(
  53032. $core.method({
  53033. selector: "testCopySeparates",
  53034. protocol: "tests",
  53035. fn: function (){
  53036. var self=this,$self=this;
  53037. var original,copy;
  53038. return $core.withContext(function($ctx1) {
  53039. original=$self._collection();
  53040. $ctx1.sendIdx["collection"]=1;
  53041. copy=$recv(original)._copy();
  53042. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  53043. $self._assert_($recv(original).__eq($self._collection()));
  53044. return self;
  53045. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  53046. },
  53047. args: [],
  53048. 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",
  53049. referencedClasses: [],
  53050. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  53051. }),
  53052. $globals.CollectionTest);
  53053. $core.addMethod(
  53054. $core.method({
  53055. selector: "testDetect",
  53056. protocol: "tests",
  53057. fn: function (){
  53058. var self=this,$self=this;
  53059. return $core.withContext(function($ctx1) {
  53060. var $1,$2,$3,$4,$6,$5,$7;
  53061. $self._shouldnt_raise_((function(){
  53062. return $core.withContext(function($ctx2) {
  53063. $1=$self._collection();
  53064. $ctx2.sendIdx["collection"]=1;
  53065. return $recv($1)._detect_((function(){
  53066. return true;
  53067. }));
  53068. $ctx2.sendIdx["detect:"]=1;
  53069. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53070. }),$globals.Error);
  53071. $self._should_raise_((function(){
  53072. return $core.withContext(function($ctx2) {
  53073. $2=$self._collection();
  53074. $ctx2.sendIdx["collection"]=2;
  53075. return $recv($2)._detect_((function(){
  53076. return false;
  53077. }));
  53078. $ctx2.sendIdx["detect:"]=2;
  53079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53080. }),$globals.Error);
  53081. $ctx1.sendIdx["should:raise:"]=1;
  53082. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  53083. return true;
  53084. }));
  53085. $ctx1.sendIdx["detect:"]=3;
  53086. $4=$self._sampleNewValue();
  53087. $ctx1.sendIdx["sampleNewValue"]=1;
  53088. $self._assert_equals_($3,$4);
  53089. $ctx1.sendIdx["assert:equals:"]=1;
  53090. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  53091. return $core.withContext(function($ctx2) {
  53092. $6=$self._sampleNewValue();
  53093. $ctx2.sendIdx["sampleNewValue"]=2;
  53094. return $recv(each).__eq($6);
  53095. $ctx2.sendIdx["="]=1;
  53096. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53097. }));
  53098. $ctx1.sendIdx["detect:"]=4;
  53099. $7=$self._sampleNewValue();
  53100. $ctx1.sendIdx["sampleNewValue"]=3;
  53101. $self._assert_equals_($5,$7);
  53102. $self._should_raise_((function(){
  53103. return $core.withContext(function($ctx2) {
  53104. return $recv($self._collection())._detect_((function(each){
  53105. return $core.withContext(function($ctx3) {
  53106. return $recv(each).__eq($self._sampleNewValue());
  53107. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  53108. }));
  53109. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  53110. }),$globals.Error);
  53111. return self;
  53112. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  53113. },
  53114. args: [],
  53115. 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",
  53116. referencedClasses: ["Error"],
  53117. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53118. }),
  53119. $globals.CollectionTest);
  53120. $core.addMethod(
  53121. $core.method({
  53122. selector: "testDetectIfNone",
  53123. protocol: "tests",
  53124. fn: function (){
  53125. var self=this,$self=this;
  53126. var sentinel;
  53127. return $core.withContext(function($ctx1) {
  53128. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  53129. sentinel=$recv($globals.Object)._new();
  53130. $3=$self._collection();
  53131. $ctx1.sendIdx["collection"]=1;
  53132. $2=$recv($3)._detect_ifNone_((function(){
  53133. return true;
  53134. }),(function(){
  53135. return sentinel;
  53136. }));
  53137. $ctx1.sendIdx["detect:ifNone:"]=1;
  53138. $1=$recv($2).__tild_eq(sentinel);
  53139. $self._assert_($1);
  53140. $5=$self._collection();
  53141. $ctx1.sendIdx["collection"]=2;
  53142. $4=$recv($5)._detect_ifNone_((function(){
  53143. return false;
  53144. }),(function(){
  53145. return sentinel;
  53146. }));
  53147. $ctx1.sendIdx["detect:ifNone:"]=2;
  53148. $self._assert_equals_($4,sentinel);
  53149. $ctx1.sendIdx["assert:equals:"]=1;
  53150. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  53151. return true;
  53152. }),(function(){
  53153. return sentinel;
  53154. }));
  53155. $ctx1.sendIdx["detect:ifNone:"]=3;
  53156. $7=$self._sampleNewValue();
  53157. $ctx1.sendIdx["sampleNewValue"]=1;
  53158. $self._assert_equals_($6,$7);
  53159. $ctx1.sendIdx["assert:equals:"]=2;
  53160. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  53161. return $core.withContext(function($ctx2) {
  53162. $9=$self._sampleNewValue();
  53163. $ctx2.sendIdx["sampleNewValue"]=2;
  53164. return $recv(each).__eq($9);
  53165. $ctx2.sendIdx["="]=1;
  53166. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  53167. }),(function(){
  53168. return sentinel;
  53169. }));
  53170. $ctx1.sendIdx["detect:ifNone:"]=4;
  53171. $10=$self._sampleNewValue();
  53172. $ctx1.sendIdx["sampleNewValue"]=3;
  53173. $self._assert_equals_($8,$10);
  53174. $ctx1.sendIdx["assert:equals:"]=3;
  53175. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  53176. return $core.withContext(function($ctx2) {
  53177. return $recv(each).__eq($self._sampleNewValue());
  53178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  53179. }),(function(){
  53180. return sentinel;
  53181. })),sentinel);
  53182. return self;
  53183. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  53184. },
  53185. args: [],
  53186. 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",
  53187. referencedClasses: ["Object"],
  53188. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53189. }),
  53190. $globals.CollectionTest);
  53191. $core.addMethod(
  53192. $core.method({
  53193. selector: "testDo",
  53194. protocol: "tests",
  53195. fn: function (){
  53196. var self=this,$self=this;
  53197. var newCollection;
  53198. return $core.withContext(function($ctx1) {
  53199. var $1,$2;
  53200. newCollection=$recv($globals.OrderedCollection)._new();
  53201. $ctx1.sendIdx["new"]=1;
  53202. $1=$self._collection();
  53203. $ctx1.sendIdx["collection"]=1;
  53204. $recv($1)._do_((function(each){
  53205. return $core.withContext(function($ctx2) {
  53206. return $recv(newCollection)._add_(each);
  53207. $ctx2.sendIdx["add:"]=1;
  53208. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53209. }));
  53210. $ctx1.sendIdx["do:"]=1;
  53211. $self._assertSameContents_as_($self._collection(),newCollection);
  53212. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53213. newCollection=$recv($globals.OrderedCollection)._new();
  53214. $2=$self._collectionWithDuplicates();
  53215. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  53216. $recv($2)._do_((function(each){
  53217. return $core.withContext(function($ctx2) {
  53218. return $recv(newCollection)._add_(each);
  53219. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53220. }));
  53221. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  53222. return self;
  53223. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  53224. },
  53225. args: [],
  53226. 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",
  53227. referencedClasses: ["OrderedCollection"],
  53228. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  53229. }),
  53230. $globals.CollectionTest);
  53231. $core.addMethod(
  53232. $core.method({
  53233. selector: "testEquality",
  53234. protocol: "tests",
  53235. fn: function (){
  53236. var self=this,$self=this;
  53237. return $core.withContext(function($ctx1) {
  53238. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  53239. $2=$self._collectionClass();
  53240. $ctx1.sendIdx["collectionClass"]=1;
  53241. $1=$recv($2)._new();
  53242. $ctx1.sendIdx["new"]=1;
  53243. $4=$self._collectionClass();
  53244. $ctx1.sendIdx["collectionClass"]=2;
  53245. $3=$recv($4)._new();
  53246. $ctx1.sendIdx["new"]=2;
  53247. $self._assert_equals_($1,$3);
  53248. $ctx1.sendIdx["assert:equals:"]=1;
  53249. $5=$self._collection();
  53250. $ctx1.sendIdx["collection"]=1;
  53251. $6=$self._collection();
  53252. $ctx1.sendIdx["collection"]=2;
  53253. $self._assert_equals_($5,$6);
  53254. $ctx1.sendIdx["assert:equals:"]=2;
  53255. $7=$self._collectionWithNewValue();
  53256. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53257. $8=$self._collectionWithNewValue();
  53258. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53259. $self._assert_equals_($7,$8);
  53260. $11=$self._collectionClass();
  53261. $ctx1.sendIdx["collectionClass"]=3;
  53262. $10=$recv($11)._new();
  53263. $ctx1.sendIdx["new"]=3;
  53264. $12=$self._collection();
  53265. $ctx1.sendIdx["collection"]=3;
  53266. $9=$recv($10).__eq($12);
  53267. $ctx1.sendIdx["="]=1;
  53268. $self._deny_($9);
  53269. $ctx1.sendIdx["deny:"]=1;
  53270. $14=$self._collection();
  53271. $ctx1.sendIdx["collection"]=4;
  53272. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  53273. $ctx1.sendIdx["="]=2;
  53274. $self._deny_($13);
  53275. $ctx1.sendIdx["deny:"]=2;
  53276. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  53277. return self;
  53278. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  53279. },
  53280. args: [],
  53281. 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",
  53282. referencedClasses: [],
  53283. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53284. }),
  53285. $globals.CollectionTest);
  53286. $core.addMethod(
  53287. $core.method({
  53288. selector: "testIfEmptyFamily",
  53289. protocol: "tests",
  53290. fn: function (){
  53291. var self=this,$self=this;
  53292. return $core.withContext(function($ctx1) {
  53293. 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;
  53294. $3=$self._collectionClass();
  53295. $ctx1.sendIdx["collectionClass"]=1;
  53296. $2=$recv($3)._new();
  53297. $ctx1.sendIdx["new"]=1;
  53298. $1=$recv($2)._ifEmpty_((function(){
  53299. return (42);
  53300. }));
  53301. $ctx1.sendIdx["ifEmpty:"]=1;
  53302. $self._assert_equals_($1,(42));
  53303. $ctx1.sendIdx["assert:equals:"]=1;
  53304. $5=$self._collection();
  53305. $ctx1.sendIdx["collection"]=1;
  53306. $4=$recv($5)._ifEmpty_((function(){
  53307. return (42);
  53308. }));
  53309. $6=$self._collection();
  53310. $ctx1.sendIdx["collection"]=2;
  53311. $self._assert_equals_($4,$6);
  53312. $ctx1.sendIdx["assert:equals:"]=2;
  53313. $9=$self._collectionClass();
  53314. $ctx1.sendIdx["collectionClass"]=2;
  53315. $8=$recv($9)._new();
  53316. $ctx1.sendIdx["new"]=2;
  53317. $7=$recv($8)._ifNotEmpty_((function(){
  53318. return (42);
  53319. }));
  53320. $ctx1.sendIdx["ifNotEmpty:"]=1;
  53321. $11=$self._collectionClass();
  53322. $ctx1.sendIdx["collectionClass"]=3;
  53323. $10=$recv($11)._new();
  53324. $ctx1.sendIdx["new"]=3;
  53325. $self._assert_equals_($7,$10);
  53326. $ctx1.sendIdx["assert:equals:"]=3;
  53327. $13=$self._collection();
  53328. $ctx1.sendIdx["collection"]=3;
  53329. $12=$recv($13)._ifNotEmpty_((function(){
  53330. return (42);
  53331. }));
  53332. $ctx1.sendIdx["ifNotEmpty:"]=2;
  53333. $self._assert_equals_($12,(42));
  53334. $ctx1.sendIdx["assert:equals:"]=4;
  53335. $15=$self._collection();
  53336. $ctx1.sendIdx["collection"]=4;
  53337. $14=$recv($15)._ifNotEmpty_((function(col){
  53338. return col;
  53339. }));
  53340. $16=$self._collection();
  53341. $ctx1.sendIdx["collection"]=5;
  53342. $self._assert_equals_($14,$16);
  53343. $ctx1.sendIdx["assert:equals:"]=5;
  53344. $19=$self._collectionClass();
  53345. $ctx1.sendIdx["collectionClass"]=4;
  53346. $18=$recv($19)._new();
  53347. $ctx1.sendIdx["new"]=4;
  53348. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  53349. return (42);
  53350. }),(function(){
  53351. return (999);
  53352. }));
  53353. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  53354. $self._assert_equals_($17,(42));
  53355. $ctx1.sendIdx["assert:equals:"]=6;
  53356. $21=$self._collection();
  53357. $ctx1.sendIdx["collection"]=6;
  53358. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  53359. return (42);
  53360. }),(function(){
  53361. return (999);
  53362. }));
  53363. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  53364. $self._assert_equals_($20,(999));
  53365. $ctx1.sendIdx["assert:equals:"]=7;
  53366. $23=$self._collection();
  53367. $ctx1.sendIdx["collection"]=7;
  53368. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  53369. return (42);
  53370. }),(function(col){
  53371. return col;
  53372. }));
  53373. $24=$self._collection();
  53374. $ctx1.sendIdx["collection"]=8;
  53375. $self._assert_equals_($22,$24);
  53376. $ctx1.sendIdx["assert:equals:"]=8;
  53377. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53378. return (42);
  53379. }),(function(){
  53380. return (999);
  53381. }));
  53382. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53383. $self._assert_equals_($25,(999));
  53384. $ctx1.sendIdx["assert:equals:"]=9;
  53385. $27=$self._collection();
  53386. $ctx1.sendIdx["collection"]=9;
  53387. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53388. return (42);
  53389. }),(function(){
  53390. return (999);
  53391. }));
  53392. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53393. $self._assert_equals_($26,(42));
  53394. $ctx1.sendIdx["assert:equals:"]=10;
  53395. $29=$self._collection();
  53396. $ctx1.sendIdx["collection"]=10;
  53397. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53398. return col;
  53399. }),(function(){
  53400. return (999);
  53401. }));
  53402. $self._assert_equals_($28,$self._collection());
  53403. return self;
  53404. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53405. },
  53406. args: [],
  53407. 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.",
  53408. referencedClasses: [],
  53409. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53410. }),
  53411. $globals.CollectionTest);
  53412. $core.addMethod(
  53413. $core.method({
  53414. selector: "testIsEmpty",
  53415. protocol: "tests",
  53416. fn: function (){
  53417. var self=this,$self=this;
  53418. return $core.withContext(function($ctx1) {
  53419. var $1;
  53420. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53421. $ctx1.sendIdx["isEmpty"]=1;
  53422. $self._assert_($1);
  53423. $self._deny_($recv($self._collection())._isEmpty());
  53424. return self;
  53425. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53426. },
  53427. args: [],
  53428. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53429. referencedClasses: [],
  53430. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53431. }),
  53432. $globals.CollectionTest);
  53433. $core.addMethod(
  53434. $core.method({
  53435. selector: "testNoneSatisfy",
  53436. protocol: "tests",
  53437. fn: function (){
  53438. var self=this,$self=this;
  53439. var anyOne;
  53440. return $core.withContext(function($ctx1) {
  53441. var $1,$3,$2;
  53442. $1=$self._collection();
  53443. $ctx1.sendIdx["collection"]=1;
  53444. anyOne=$recv($1)._anyOne();
  53445. $3=$self._collection();
  53446. $ctx1.sendIdx["collection"]=2;
  53447. $2=$recv($3)._noneSatisfy_((function(each){
  53448. return $core.withContext(function($ctx2) {
  53449. return $recv(each).__eq(anyOne);
  53450. $ctx2.sendIdx["="]=1;
  53451. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53452. }));
  53453. $ctx1.sendIdx["noneSatisfy:"]=1;
  53454. $self._deny_($2);
  53455. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53456. return $core.withContext(function($ctx2) {
  53457. return $recv(each).__eq($recv($globals.Object)._new());
  53458. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53459. })));
  53460. return self;
  53461. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53462. },
  53463. args: [],
  53464. 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 ])",
  53465. referencedClasses: ["Object"],
  53466. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53467. }),
  53468. $globals.CollectionTest);
  53469. $core.addMethod(
  53470. $core.method({
  53471. selector: "testRegression1224",
  53472. protocol: "tests",
  53473. fn: function (){
  53474. var self=this,$self=this;
  53475. return $core.withContext(function($ctx1) {
  53476. var $3,$2,$1;
  53477. $3=$recv($self._collectionClass())._new();
  53478. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53479. }));
  53480. $2=$recv($3)._yourself();
  53481. $1=$recv($2)._size();
  53482. $self._assert_equals_($1,(0));
  53483. return self;
  53484. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53485. },
  53486. args: [],
  53487. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53488. referencedClasses: [],
  53489. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53490. }),
  53491. $globals.CollectionTest);
  53492. $core.addMethod(
  53493. $core.method({
  53494. selector: "testRemoveAll",
  53495. protocol: "tests",
  53496. fn: function (){
  53497. var self=this,$self=this;
  53498. return $core.withContext(function($ctx1) {
  53499. var $2,$1;
  53500. $2=$self._collection();
  53501. $recv($2)._removeAll();
  53502. $1=$recv($2)._yourself();
  53503. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53504. return self;
  53505. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53506. },
  53507. args: [],
  53508. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53509. referencedClasses: [],
  53510. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53511. }),
  53512. $globals.CollectionTest);
  53513. $core.addMethod(
  53514. $core.method({
  53515. selector: "testSelect",
  53516. protocol: "tests",
  53517. fn: function (){
  53518. var self=this,$self=this;
  53519. return $core.withContext(function($ctx1) {
  53520. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53521. $2=$self._collection();
  53522. $ctx1.sendIdx["collection"]=1;
  53523. $1=$recv($2)._select_((function(){
  53524. return false;
  53525. }));
  53526. $ctx1.sendIdx["select:"]=1;
  53527. $4=$self._collectionClass();
  53528. $ctx1.sendIdx["collectionClass"]=1;
  53529. $3=$recv($4)._new();
  53530. $ctx1.sendIdx["new"]=1;
  53531. $self._assert_equals_($1,$3);
  53532. $ctx1.sendIdx["assert:equals:"]=1;
  53533. $6=$self._collection();
  53534. $ctx1.sendIdx["collection"]=2;
  53535. $5=$recv($6)._select_((function(){
  53536. return true;
  53537. }));
  53538. $ctx1.sendIdx["select:"]=2;
  53539. $7=$self._collection();
  53540. $ctx1.sendIdx["collection"]=3;
  53541. $self._assert_equals_($5,$7);
  53542. $ctx1.sendIdx["assert:equals:"]=2;
  53543. $9=$self._collectionWithNewValue();
  53544. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53545. $8=$recv($9)._select_((function(each){
  53546. return $core.withContext(function($ctx2) {
  53547. $10=$self._sampleNewValue();
  53548. $ctx2.sendIdx["sampleNewValue"]=1;
  53549. return $recv(each).__eq($10);
  53550. $ctx2.sendIdx["="]=1;
  53551. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53552. }));
  53553. $ctx1.sendIdx["select:"]=3;
  53554. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53555. $ctx1.sendIdx["assert:equals:"]=3;
  53556. $12=$self._collectionWithNewValue();
  53557. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53558. $11=$recv($12)._select_((function(each){
  53559. return $core.withContext(function($ctx2) {
  53560. $13=$self._sampleNewValue();
  53561. $ctx2.sendIdx["sampleNewValue"]=2;
  53562. return $recv(each).__tild_eq($13);
  53563. $ctx2.sendIdx["~="]=1;
  53564. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53565. }));
  53566. $ctx1.sendIdx["select:"]=4;
  53567. $14=$self._collection();
  53568. $ctx1.sendIdx["collection"]=4;
  53569. $self._assert_equals_($11,$14);
  53570. $ctx1.sendIdx["assert:equals:"]=4;
  53571. $16=$self._collection();
  53572. $ctx1.sendIdx["collection"]=5;
  53573. $15=$recv($16)._select_((function(each){
  53574. return $core.withContext(function($ctx2) {
  53575. $17=$self._sampleNewValue();
  53576. $ctx2.sendIdx["sampleNewValue"]=3;
  53577. return $recv(each).__eq($17);
  53578. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53579. }));
  53580. $ctx1.sendIdx["select:"]=5;
  53581. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53582. $ctx1.sendIdx["assert:equals:"]=5;
  53583. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53584. return $core.withContext(function($ctx2) {
  53585. return $recv(each).__tild_eq($self._sampleNewValue());
  53586. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53587. })),$self._collection());
  53588. return self;
  53589. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53590. },
  53591. args: [],
  53592. 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",
  53593. referencedClasses: [],
  53594. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53595. }),
  53596. $globals.CollectionTest);
  53597. $core.addMethod(
  53598. $core.method({
  53599. selector: "testSelectThenCollect",
  53600. protocol: "tests",
  53601. fn: function (){
  53602. var self=this,$self=this;
  53603. return $core.withContext(function($ctx1) {
  53604. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53605. $2=$self._collection();
  53606. $ctx1.sendIdx["collection"]=1;
  53607. $1=$recv($2)._select_thenCollect_((function(){
  53608. return false;
  53609. }),"isString");
  53610. $ctx1.sendIdx["select:thenCollect:"]=1;
  53611. $4=$self._collectionClass();
  53612. $ctx1.sendIdx["collectionClass"]=1;
  53613. $3=$recv($4)._new();
  53614. $ctx1.sendIdx["new"]=1;
  53615. $self._assert_equals_($1,$3);
  53616. $ctx1.sendIdx["assert:equals:"]=1;
  53617. $6=$self._collection();
  53618. $ctx1.sendIdx["collection"]=2;
  53619. $5=$recv($6)._select_thenCollect_((function(){
  53620. return true;
  53621. }),(function(x){
  53622. return x;
  53623. }));
  53624. $ctx1.sendIdx["select:thenCollect:"]=2;
  53625. $7=$self._collection();
  53626. $ctx1.sendIdx["collection"]=3;
  53627. $self._assert_equals_($5,$7);
  53628. $ctx1.sendIdx["assert:equals:"]=2;
  53629. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53630. return $core.withContext(function($ctx2) {
  53631. $9=$self._sampleNewValue();
  53632. $ctx2.sendIdx["sampleNewValue"]=1;
  53633. return $recv(each).__eq($9);
  53634. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53635. }),(function(x){
  53636. return x;
  53637. }));
  53638. $ctx1.sendIdx["select:thenCollect:"]=3;
  53639. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53640. $ctx1.sendIdx["assert:equals:"]=3;
  53641. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53642. return $core.withContext(function($ctx2) {
  53643. return $recv(each).__tild_eq($self._sampleNewValue());
  53644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53645. }),"printString"),$self._collectionOfPrintStrings());
  53646. return self;
  53647. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53648. },
  53649. args: [],
  53650. 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",
  53651. referencedClasses: [],
  53652. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53653. }),
  53654. $globals.CollectionTest);
  53655. $core.addMethod(
  53656. $core.method({
  53657. selector: "testSingle",
  53658. protocol: "tests",
  53659. fn: function (){
  53660. var self=this,$self=this;
  53661. return $core.withContext(function($ctx1) {
  53662. $self._should_raise_((function(){
  53663. return $core.withContext(function($ctx2) {
  53664. return $recv($recv($self._collectionClass())._new())._single();
  53665. $ctx2.sendIdx["single"]=1;
  53666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53667. }),$globals.Error);
  53668. $ctx1.sendIdx["should:raise:"]=1;
  53669. $self._should_raise_((function(){
  53670. return $core.withContext(function($ctx2) {
  53671. return $recv($self._collection())._single();
  53672. $ctx2.sendIdx["single"]=2;
  53673. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53674. }),$globals.Error);
  53675. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53676. return self;
  53677. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53678. },
  53679. args: [],
  53680. 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",
  53681. referencedClasses: ["Error"],
  53682. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53683. }),
  53684. $globals.CollectionTest);
  53685. $core.addMethod(
  53686. $core.method({
  53687. selector: "testSize",
  53688. protocol: "tests",
  53689. fn: function (){
  53690. var self=this,$self=this;
  53691. return $core.withContext(function($ctx1) {
  53692. var $1,$2;
  53693. $1=$recv($recv($self._collectionClass())._new())._size();
  53694. $ctx1.sendIdx["size"]=1;
  53695. $self._assert_equals_($1,(0));
  53696. $ctx1.sendIdx["assert:equals:"]=1;
  53697. $2=$recv($self._sampleNewValueAsCollection())._size();
  53698. $ctx1.sendIdx["size"]=2;
  53699. $self._assert_equals_($2,(1));
  53700. $ctx1.sendIdx["assert:equals:"]=2;
  53701. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53702. return self;
  53703. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53704. },
  53705. args: [],
  53706. 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",
  53707. referencedClasses: [],
  53708. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53709. }),
  53710. $globals.CollectionTest);
  53711. $core.addMethod(
  53712. $core.method({
  53713. selector: "collectionClass",
  53714. protocol: "fixture",
  53715. fn: function (){
  53716. var self=this,$self=this;
  53717. return nil;
  53718. },
  53719. args: [],
  53720. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53721. referencedClasses: [],
  53722. messageSends: []
  53723. }),
  53724. $globals.CollectionTest.a$cls);
  53725. $core.addMethod(
  53726. $core.method({
  53727. selector: "isAbstract",
  53728. protocol: "testing",
  53729. fn: function (){
  53730. var self=this,$self=this;
  53731. return $core.withContext(function($ctx1) {
  53732. return $recv($self._collectionClass())._isNil();
  53733. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53734. },
  53735. args: [],
  53736. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53737. referencedClasses: [],
  53738. messageSends: ["isNil", "collectionClass"]
  53739. }),
  53740. $globals.CollectionTest.a$cls);
  53741. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53742. $core.addMethod(
  53743. $core.method({
  53744. selector: "collectionWithNewValue",
  53745. protocol: "fixture",
  53746. fn: function (){
  53747. var self=this,$self=this;
  53748. return $core.withContext(function($ctx1) {
  53749. $self._subclassResponsibility();
  53750. return self;
  53751. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53752. },
  53753. args: [],
  53754. 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",
  53755. referencedClasses: [],
  53756. messageSends: ["subclassResponsibility"]
  53757. }),
  53758. $globals.IndexableCollectionTest);
  53759. $core.addMethod(
  53760. $core.method({
  53761. selector: "nonIndexesDo:",
  53762. protocol: "fixture",
  53763. fn: function (aBlock){
  53764. var self=this,$self=this;
  53765. return $core.withContext(function($ctx1) {
  53766. $self._subclassResponsibility();
  53767. return self;
  53768. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53769. },
  53770. args: ["aBlock"],
  53771. source: "nonIndexesDo: 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",
  53772. referencedClasses: [],
  53773. messageSends: ["subclassResponsibility"]
  53774. }),
  53775. $globals.IndexableCollectionTest);
  53776. $core.addMethod(
  53777. $core.method({
  53778. selector: "sampleNewIndex",
  53779. protocol: "fixture",
  53780. fn: function (){
  53781. var self=this,$self=this;
  53782. return $core.withContext(function($ctx1) {
  53783. $self._subclassResponsibility();
  53784. return self;
  53785. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53786. },
  53787. args: [],
  53788. 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",
  53789. referencedClasses: [],
  53790. messageSends: ["subclassResponsibility"]
  53791. }),
  53792. $globals.IndexableCollectionTest);
  53793. $core.addMethod(
  53794. $core.method({
  53795. selector: "samplesDo:",
  53796. protocol: "fixture",
  53797. fn: function (aBlock){
  53798. var self=this,$self=this;
  53799. return $core.withContext(function($ctx1) {
  53800. $self._subclassResponsibility();
  53801. return self;
  53802. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53803. },
  53804. args: ["aBlock"],
  53805. 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",
  53806. referencedClasses: [],
  53807. messageSends: ["subclassResponsibility"]
  53808. }),
  53809. $globals.IndexableCollectionTest);
  53810. $core.addMethod(
  53811. $core.method({
  53812. selector: "testAt",
  53813. protocol: "tests",
  53814. fn: function (){
  53815. var self=this,$self=this;
  53816. return $core.withContext(function($ctx1) {
  53817. var $1;
  53818. $self._nonIndexesDo_((function(each){
  53819. return $core.withContext(function($ctx2) {
  53820. return $self._should_raise_((function(){
  53821. return $core.withContext(function($ctx3) {
  53822. $1=$self._collection();
  53823. $ctx3.sendIdx["collection"]=1;
  53824. return $recv($1)._at_(each);
  53825. $ctx3.sendIdx["at:"]=1;
  53826. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53827. }),$globals.Error);
  53828. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53829. }));
  53830. $self._samplesDo_((function(index,value){
  53831. return $core.withContext(function($ctx2) {
  53832. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53833. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53834. }));
  53835. return self;
  53836. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53837. },
  53838. args: [],
  53839. 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 ]",
  53840. referencedClasses: ["Error"],
  53841. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53842. }),
  53843. $globals.IndexableCollectionTest);
  53844. $core.addMethod(
  53845. $core.method({
  53846. selector: "testAtIfAbsent",
  53847. protocol: "tests",
  53848. fn: function (){
  53849. var self=this,$self=this;
  53850. return $core.withContext(function($ctx1) {
  53851. var $2,$1,$3;
  53852. $self._nonIndexesDo_((function(each){
  53853. return $core.withContext(function($ctx2) {
  53854. $2=$self._collection();
  53855. $ctx2.sendIdx["collection"]=1;
  53856. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53857. return $core.withContext(function($ctx3) {
  53858. return $self._sampleNewValue();
  53859. $ctx3.sendIdx["sampleNewValue"]=1;
  53860. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53861. }));
  53862. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53863. $3=$self._sampleNewValue();
  53864. $ctx2.sendIdx["sampleNewValue"]=2;
  53865. return $self._assert_equals_($1,$3);
  53866. $ctx2.sendIdx["assert:equals:"]=1;
  53867. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53868. }));
  53869. $self._samplesDo_((function(index,value){
  53870. return $core.withContext(function($ctx2) {
  53871. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53872. return $core.withContext(function($ctx3) {
  53873. return $self._sampleNewValue();
  53874. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53875. })),value);
  53876. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53877. }));
  53878. return self;
  53879. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53880. },
  53881. args: [],
  53882. 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 ].",
  53883. referencedClasses: [],
  53884. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53885. }),
  53886. $globals.IndexableCollectionTest);
  53887. $core.addMethod(
  53888. $core.method({
  53889. selector: "testAtIfAbsentPut",
  53890. protocol: "tests",
  53891. fn: function (){
  53892. var self=this,$self=this;
  53893. var newCollection;
  53894. return $core.withContext(function($ctx1) {
  53895. var $1;
  53896. newCollection=$self._collection();
  53897. $ctx1.sendIdx["collection"]=1;
  53898. $self._samplesDo_((function(index,value){
  53899. return $core.withContext(function($ctx2) {
  53900. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53901. return $core.withContext(function($ctx3) {
  53902. return $self._sampleNewValue();
  53903. $ctx3.sendIdx["sampleNewValue"]=1;
  53904. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53905. }));
  53906. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53907. return $self._assert_equals_($1,value);
  53908. $ctx2.sendIdx["assert:equals:"]=1;
  53909. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53910. }));
  53911. $self._assert_equals_(newCollection,$self._collection());
  53912. $ctx1.sendIdx["assert:equals:"]=2;
  53913. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53914. return $core.withContext(function($ctx2) {
  53915. return $self._sampleNewValue();
  53916. $ctx2.sendIdx["sampleNewValue"]=2;
  53917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53918. })),$self._sampleNewValue());
  53919. $ctx1.sendIdx["assert:equals:"]=3;
  53920. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53921. return self;
  53922. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53923. },
  53924. args: [],
  53925. 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",
  53926. referencedClasses: [],
  53927. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53928. }),
  53929. $globals.IndexableCollectionTest);
  53930. $core.addMethod(
  53931. $core.method({
  53932. selector: "testAtIfPresent",
  53933. protocol: "tests",
  53934. fn: function (){
  53935. var self=this,$self=this;
  53936. var visited,sentinel;
  53937. return $core.withContext(function($ctx1) {
  53938. var $2,$1,$4,$3;
  53939. sentinel=$recv($globals.Object)._new();
  53940. $self._nonIndexesDo_((function(each){
  53941. return $core.withContext(function($ctx2) {
  53942. visited=nil;
  53943. $2=$self._collection();
  53944. $ctx2.sendIdx["collection"]=1;
  53945. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53946. visited=value1;
  53947. return sentinel;
  53948. }));
  53949. $ctx2.sendIdx["at:ifPresent:"]=1;
  53950. $self._assert_equals_($1,nil);
  53951. $ctx2.sendIdx["assert:equals:"]=1;
  53952. return $self._assert_($recv(visited)._isNil());
  53953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53954. }));
  53955. $self._samplesDo_((function(index,value){
  53956. return $core.withContext(function($ctx2) {
  53957. visited=nil;
  53958. $4=$self._collection();
  53959. $ctx2.sendIdx["collection"]=2;
  53960. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53961. visited=value2;
  53962. return sentinel;
  53963. }));
  53964. $self._assert_equals_($3,sentinel);
  53965. $ctx2.sendIdx["assert:equals:"]=2;
  53966. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53967. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53968. }));
  53969. return self;
  53970. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  53971. },
  53972. args: [],
  53973. 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) ]",
  53974. referencedClasses: ["Object"],
  53975. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  53976. }),
  53977. $globals.IndexableCollectionTest);
  53978. $core.addMethod(
  53979. $core.method({
  53980. selector: "testAtIfPresentIfAbsent",
  53981. protocol: "tests",
  53982. fn: function (){
  53983. var self=this,$self=this;
  53984. var visited,sentinel;
  53985. return $core.withContext(function($ctx1) {
  53986. var $2,$1,$3,$5,$4;
  53987. sentinel=$recv($globals.Object)._new();
  53988. $self._nonIndexesDo_((function(each){
  53989. return $core.withContext(function($ctx2) {
  53990. visited=nil;
  53991. $2=$self._collection();
  53992. $ctx2.sendIdx["collection"]=1;
  53993. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  53994. visited=value1;
  53995. return sentinel;
  53996. }),(function(){
  53997. return $core.withContext(function($ctx3) {
  53998. return $self._sampleNewValue();
  53999. $ctx3.sendIdx["sampleNewValue"]=1;
  54000. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  54001. }));
  54002. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  54003. $3=$self._sampleNewValue();
  54004. $ctx2.sendIdx["sampleNewValue"]=2;
  54005. $self._assert_equals_($1,$3);
  54006. $ctx2.sendIdx["assert:equals:"]=1;
  54007. return $self._assert_($recv(visited)._isNil());
  54008. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54009. }));
  54010. $self._samplesDo_((function(index,value){
  54011. return $core.withContext(function($ctx2) {
  54012. visited=nil;
  54013. $5=$self._collection();
  54014. $ctx2.sendIdx["collection"]=2;
  54015. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  54016. visited=value2;
  54017. return sentinel;
  54018. }),(function(){
  54019. return $core.withContext(function($ctx3) {
  54020. return $self._sampleNewValue();
  54021. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  54022. }));
  54023. $self._assert_equals_($4,sentinel);
  54024. $ctx2.sendIdx["assert:equals:"]=2;
  54025. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  54026. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  54027. }));
  54028. return self;
  54029. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  54030. },
  54031. args: [],
  54032. 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) ]",
  54033. referencedClasses: ["Object"],
  54034. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  54035. }),
  54036. $globals.IndexableCollectionTest);
  54037. $core.addMethod(
  54038. $core.method({
  54039. selector: "testAtPut",
  54040. protocol: "tests",
  54041. fn: function (){
  54042. var self=this,$self=this;
  54043. var newCollection;
  54044. return $core.withContext(function($ctx1) {
  54045. newCollection=$self._collection();
  54046. $ctx1.sendIdx["collection"]=1;
  54047. $self._samplesDo_((function(index,value){
  54048. return $core.withContext(function($ctx2) {
  54049. return $recv(newCollection)._at_put_(index,value);
  54050. $ctx2.sendIdx["at:put:"]=1;
  54051. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54052. }));
  54053. $self._assert_equals_(newCollection,$self._collection());
  54054. $ctx1.sendIdx["assert:equals:"]=1;
  54055. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  54056. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  54057. return self;
  54058. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  54059. },
  54060. args: [],
  54061. 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",
  54062. referencedClasses: [],
  54063. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  54064. }),
  54065. $globals.IndexableCollectionTest);
  54066. $core.addMethod(
  54067. $core.method({
  54068. selector: "testIndexOf",
  54069. protocol: "tests",
  54070. fn: function (){
  54071. var self=this,$self=this;
  54072. return $core.withContext(function($ctx1) {
  54073. var $1;
  54074. $self._should_raise_((function(){
  54075. return $core.withContext(function($ctx2) {
  54076. $1=$self._collection();
  54077. $ctx2.sendIdx["collection"]=1;
  54078. return $recv($1)._indexOf_($self._sampleNewValue());
  54079. $ctx2.sendIdx["indexOf:"]=1;
  54080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54081. }),$globals.Error);
  54082. $self._samplesDo_((function(index,value){
  54083. return $core.withContext(function($ctx2) {
  54084. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  54085. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  54086. }));
  54087. return self;
  54088. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  54089. },
  54090. args: [],
  54091. 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 ]",
  54092. referencedClasses: ["Error"],
  54093. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  54094. }),
  54095. $globals.IndexableCollectionTest);
  54096. $core.addMethod(
  54097. $core.method({
  54098. selector: "testIndexOfWithNull",
  54099. protocol: "tests",
  54100. fn: function (){
  54101. var self=this,$self=this;
  54102. var jsNull;
  54103. return $core.withContext(function($ctx1) {
  54104. var $2,$1;
  54105. jsNull=$recv($globals.JSON)._parse_("null");
  54106. $self._samplesDo_((function(index,value){
  54107. return $core.withContext(function($ctx2) {
  54108. $2=$self._collection();
  54109. $recv($2)._at_put_(index,jsNull);
  54110. $1=$recv($2)._indexOf_(jsNull);
  54111. return $self._assert_equals_($1,index);
  54112. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54113. }));
  54114. return self;
  54115. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  54116. },
  54117. args: [],
  54118. 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 ]",
  54119. referencedClasses: ["JSON"],
  54120. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  54121. }),
  54122. $globals.IndexableCollectionTest);
  54123. $core.addMethod(
  54124. $core.method({
  54125. selector: "testWithIndexDo",
  54126. protocol: "tests",
  54127. fn: function (){
  54128. var self=this,$self=this;
  54129. var collection;
  54130. return $core.withContext(function($ctx1) {
  54131. collection=$self._collection();
  54132. $ctx1.sendIdx["collection"]=1;
  54133. $recv($self._collection())._withIndexDo_((function(each,index){
  54134. return $core.withContext(function($ctx2) {
  54135. return $self._assert_equals_($recv(collection)._at_(index),each);
  54136. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  54137. }));
  54138. return self;
  54139. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  54140. },
  54141. args: [],
  54142. 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 ]",
  54143. referencedClasses: [],
  54144. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  54145. }),
  54146. $globals.IndexableCollectionTest);
  54147. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54148. $core.addMethod(
  54149. $core.method({
  54150. selector: "collectionKeys",
  54151. protocol: "fixture",
  54152. fn: function (){
  54153. var self=this,$self=this;
  54154. return $core.withContext(function($ctx1) {
  54155. $self._subclassResponsibility();
  54156. return self;
  54157. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  54158. },
  54159. args: [],
  54160. source: "collectionKeys\x0a\x09self subclassResponsibility",
  54161. referencedClasses: [],
  54162. messageSends: ["subclassResponsibility"]
  54163. }),
  54164. $globals.AssociativeCollectionTest);
  54165. $core.addMethod(
  54166. $core.method({
  54167. selector: "collectionValues",
  54168. protocol: "fixture",
  54169. fn: function (){
  54170. var self=this,$self=this;
  54171. return $core.withContext(function($ctx1) {
  54172. $self._subclassResponsibility();
  54173. return self;
  54174. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  54175. },
  54176. args: [],
  54177. source: "collectionValues\x0a\x09self subclassResponsibility",
  54178. referencedClasses: [],
  54179. messageSends: ["subclassResponsibility"]
  54180. }),
  54181. $globals.AssociativeCollectionTest);
  54182. $core.addMethod(
  54183. $core.method({
  54184. selector: "nonIndexesDo:",
  54185. protocol: "fixture",
  54186. fn: function (aBlock){
  54187. var self=this,$self=this;
  54188. return $core.withContext(function($ctx1) {
  54189. $recv(aBlock)._value_((5));
  54190. $ctx1.sendIdx["value:"]=1;
  54191. $recv(aBlock)._value_((function(){
  54192. }));
  54193. $ctx1.sendIdx["value:"]=2;
  54194. $recv(aBlock)._value_($recv($globals.Object)._new());
  54195. $ctx1.sendIdx["value:"]=3;
  54196. $recv(aBlock)._value_("z");
  54197. return self;
  54198. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54199. },
  54200. args: ["aBlock"],
  54201. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  54202. referencedClasses: ["Object"],
  54203. messageSends: ["value:", "new"]
  54204. }),
  54205. $globals.AssociativeCollectionTest);
  54206. $core.addMethod(
  54207. $core.method({
  54208. selector: "sampleNewIndex",
  54209. protocol: "fixture",
  54210. fn: function (){
  54211. var self=this,$self=this;
  54212. return "new";
  54213. },
  54214. args: [],
  54215. source: "sampleNewIndex\x0a\x09^ 'new'",
  54216. referencedClasses: [],
  54217. messageSends: []
  54218. }),
  54219. $globals.AssociativeCollectionTest);
  54220. $core.addMethod(
  54221. $core.method({
  54222. selector: "samplesDo:",
  54223. protocol: "fixture",
  54224. fn: function (aBlock){
  54225. var self=this,$self=this;
  54226. return $core.withContext(function($ctx1) {
  54227. $recv(aBlock)._value_value_("a",(2));
  54228. return self;
  54229. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54230. },
  54231. args: ["aBlock"],
  54232. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  54233. referencedClasses: [],
  54234. messageSends: ["value:value:"]
  54235. }),
  54236. $globals.AssociativeCollectionTest);
  54237. $core.addMethod(
  54238. $core.method({
  54239. selector: "testAddAll",
  54240. protocol: "tests",
  54241. fn: function (){
  54242. var self=this,$self=this;
  54243. return $core.withContext(function($ctx1) {
  54244. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  54245. (
  54246. $ctx1.supercall = true,
  54247. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  54248. $ctx1.supercall = false;
  54249. $2=$self._collection();
  54250. $ctx1.sendIdx["collection"]=1;
  54251. $3=$self._collection();
  54252. $ctx1.sendIdx["collection"]=2;
  54253. $recv($2)._addAll_($3);
  54254. $ctx1.sendIdx["addAll:"]=1;
  54255. $4=$recv($2)._yourself();
  54256. $ctx1.sendIdx["yourself"]=1;
  54257. $1=$4;
  54258. $5=$self._collection();
  54259. $ctx1.sendIdx["collection"]=3;
  54260. $self._assert_equals_($1,$5);
  54261. $ctx1.sendIdx["assert:equals:"]=1;
  54262. $7=$self._collection();
  54263. $ctx1.sendIdx["collection"]=4;
  54264. $8=$self._collectionWithNewValue();
  54265. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54266. $recv($7)._addAll_($8);
  54267. $ctx1.sendIdx["addAll:"]=2;
  54268. $9=$recv($7)._yourself();
  54269. $ctx1.sendIdx["yourself"]=2;
  54270. $6=$9;
  54271. $10=$self._collectionWithNewValue();
  54272. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54273. $self._assert_equals_($6,$10);
  54274. $ctx1.sendIdx["assert:equals:"]=2;
  54275. $12=$self._collectionWithNewValue();
  54276. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54277. $recv($12)._addAll_($self._collection());
  54278. $11=$recv($12)._yourself();
  54279. $self._assert_equals_($11,$self._collectionWithNewValue());
  54280. return self;
  54281. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  54282. },
  54283. args: [],
  54284. 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",
  54285. referencedClasses: [],
  54286. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54287. }),
  54288. $globals.AssociativeCollectionTest);
  54289. $core.addMethod(
  54290. $core.method({
  54291. selector: "testAsDictionary",
  54292. protocol: "tests",
  54293. fn: function (){
  54294. var self=this,$self=this;
  54295. return $core.withContext(function($ctx1) {
  54296. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  54297. return self;
  54298. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  54299. },
  54300. args: [],
  54301. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  54302. referencedClasses: ["Dictionary"],
  54303. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  54304. }),
  54305. $globals.AssociativeCollectionTest);
  54306. $core.addMethod(
  54307. $core.method({
  54308. selector: "testAsHashedCollection",
  54309. protocol: "tests",
  54310. fn: function (){
  54311. var self=this,$self=this;
  54312. return $core.withContext(function($ctx1) {
  54313. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  54314. return self;
  54315. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  54316. },
  54317. args: [],
  54318. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  54319. referencedClasses: ["HashedCollection"],
  54320. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  54321. }),
  54322. $globals.AssociativeCollectionTest);
  54323. $core.addMethod(
  54324. $core.method({
  54325. selector: "testComma",
  54326. protocol: "tests",
  54327. fn: function (){
  54328. var self=this,$self=this;
  54329. return $core.withContext(function($ctx1) {
  54330. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54331. (
  54332. $ctx1.supercall = true,
  54333. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  54334. $ctx1.supercall = false;
  54335. $2=$self._collection();
  54336. $ctx1.sendIdx["collection"]=1;
  54337. $3=$self._collection();
  54338. $ctx1.sendIdx["collection"]=2;
  54339. $1=$recv($2).__comma($3);
  54340. $ctx1.sendIdx[","]=1;
  54341. $4=$self._collection();
  54342. $ctx1.sendIdx["collection"]=3;
  54343. $self._assert_equals_($1,$4);
  54344. $ctx1.sendIdx["assert:equals:"]=1;
  54345. $6=$self._collection();
  54346. $ctx1.sendIdx["collection"]=4;
  54347. $7=$self._collectionWithNewValue();
  54348. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54349. $5=$recv($6).__comma($7);
  54350. $ctx1.sendIdx[","]=2;
  54351. $8=$self._collectionWithNewValue();
  54352. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54353. $self._assert_equals_($5,$8);
  54354. $ctx1.sendIdx["assert:equals:"]=2;
  54355. $10=$self._collectionWithNewValue();
  54356. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54357. $9=$recv($10).__comma($self._collection());
  54358. $self._assert_equals_($9,$self._collectionWithNewValue());
  54359. return self;
  54360. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  54361. },
  54362. args: [],
  54363. 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",
  54364. referencedClasses: [],
  54365. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54366. }),
  54367. $globals.AssociativeCollectionTest);
  54368. $core.addMethod(
  54369. $core.method({
  54370. selector: "testFrom",
  54371. protocol: "tests",
  54372. fn: function (){
  54373. var self=this,$self=this;
  54374. var associations;
  54375. return $core.withContext(function($ctx1) {
  54376. var $1;
  54377. $1="a".__minus_gt((1));
  54378. $ctx1.sendIdx["->"]=1;
  54379. associations=[$1,"b".__minus_gt((2))];
  54380. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54381. return self;
  54382. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54383. },
  54384. args: [],
  54385. 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 }.",
  54386. referencedClasses: [],
  54387. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54388. }),
  54389. $globals.AssociativeCollectionTest);
  54390. $core.addMethod(
  54391. $core.method({
  54392. selector: "testKeys",
  54393. protocol: "tests",
  54394. fn: function (){
  54395. var self=this,$self=this;
  54396. return $core.withContext(function($ctx1) {
  54397. var $2,$1,$3,$4;
  54398. $2=$recv($recv($self._collectionClass())._new())._keys();
  54399. $ctx1.sendIdx["keys"]=1;
  54400. $1=$recv($2)._isEmpty();
  54401. $self._assert_($1);
  54402. $3=$recv($self._collection())._keys();
  54403. $ctx1.sendIdx["keys"]=2;
  54404. $4=$self._collectionKeys();
  54405. $ctx1.sendIdx["collectionKeys"]=1;
  54406. $self._assertSameContents_as_($3,$4);
  54407. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54408. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54409. return self;
  54410. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54411. },
  54412. args: [],
  54413. 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 }",
  54414. referencedClasses: [],
  54415. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54416. }),
  54417. $globals.AssociativeCollectionTest);
  54418. $core.addMethod(
  54419. $core.method({
  54420. selector: "testNewFromPairs",
  54421. protocol: "tests",
  54422. fn: function (){
  54423. var self=this,$self=this;
  54424. var flattenedAssociations;
  54425. return $core.withContext(function($ctx1) {
  54426. flattenedAssociations=["a",(1),"b",(2)];
  54427. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54428. return self;
  54429. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54430. },
  54431. args: [],
  54432. 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 }.",
  54433. referencedClasses: [],
  54434. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54435. }),
  54436. $globals.AssociativeCollectionTest);
  54437. $core.addMethod(
  54438. $core.method({
  54439. selector: "testPrintString",
  54440. protocol: "tests",
  54441. fn: function (){
  54442. var self=this,$self=this;
  54443. return $core.withContext(function($ctx1) {
  54444. var $3,$2,$1,$4;
  54445. $3=$self._collectionClass();
  54446. $ctx1.sendIdx["collectionClass"]=1;
  54447. $2=$recv($3)._new();
  54448. $recv($2)._at_put_("firstname","James");
  54449. $ctx1.sendIdx["at:put:"]=1;
  54450. $recv($2)._at_put_("lastname","Bond");
  54451. $1=$recv($2)._printString();
  54452. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54453. $ctx1.sendIdx[","]=1;
  54454. $self._assert_equals_($1,$4);
  54455. return self;
  54456. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54457. },
  54458. args: [],
  54459. 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'')'",
  54460. referencedClasses: [],
  54461. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54462. }),
  54463. $globals.AssociativeCollectionTest);
  54464. $core.addMethod(
  54465. $core.method({
  54466. selector: "testRemoveKey",
  54467. protocol: "tests",
  54468. fn: function (){
  54469. var self=this,$self=this;
  54470. return $core.withContext(function($ctx1) {
  54471. var $1,$2,$3,$5,$6,$4,$8,$7;
  54472. $self._nonIndexesDo_((function(each){
  54473. var collection;
  54474. return $core.withContext(function($ctx2) {
  54475. collection=$self._collection();
  54476. $ctx2.sendIdx["collection"]=1;
  54477. $self._should_raise_((function(){
  54478. return $core.withContext(function($ctx3) {
  54479. return $recv(collection)._removeKey_(each);
  54480. $ctx3.sendIdx["removeKey:"]=1;
  54481. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54482. }),$globals.Error);
  54483. $1=collection;
  54484. $2=$self._collection();
  54485. $ctx2.sendIdx["collection"]=2;
  54486. return $self._assert_equals_($1,$2);
  54487. $ctx2.sendIdx["assert:equals:"]=1;
  54488. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54489. }));
  54490. $self._samplesDo_((function(index,value){
  54491. var collection;
  54492. return $core.withContext(function($ctx2) {
  54493. collection=$self._collection();
  54494. $ctx2.sendIdx["collection"]=3;
  54495. $3=$recv(collection)._removeKey_(index);
  54496. $ctx2.sendIdx["removeKey:"]=2;
  54497. $self._assert_equals_($3,value);
  54498. $ctx2.sendIdx["assert:equals:"]=2;
  54499. $5=collection;
  54500. $6=$self._collection();
  54501. $ctx2.sendIdx["collection"]=4;
  54502. $4=$recv($5).__eq($6);
  54503. return $self._deny_($4);
  54504. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54505. }));
  54506. $8=$self._collectionWithNewValue();
  54507. $recv($8)._removeKey_($self._sampleNewIndex());
  54508. $7=$recv($8)._yourself();
  54509. $self._assert_equals_($7,$self._collection());
  54510. return self;
  54511. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54512. },
  54513. args: [],
  54514. 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",
  54515. referencedClasses: ["Error"],
  54516. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54517. }),
  54518. $globals.AssociativeCollectionTest);
  54519. $core.addMethod(
  54520. $core.method({
  54521. selector: "testRemoveKeyIfAbsent",
  54522. protocol: "tests",
  54523. fn: function (){
  54524. var self=this,$self=this;
  54525. return $core.withContext(function($ctx1) {
  54526. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54527. $self._nonIndexesDo_((function(each){
  54528. var collection;
  54529. return $core.withContext(function($ctx2) {
  54530. collection=$self._collection();
  54531. $ctx2.sendIdx["collection"]=1;
  54532. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54533. return $core.withContext(function($ctx3) {
  54534. return $self._sampleNewValue();
  54535. $ctx3.sendIdx["sampleNewValue"]=1;
  54536. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54537. }));
  54538. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54539. $2=$self._sampleNewValue();
  54540. $ctx2.sendIdx["sampleNewValue"]=2;
  54541. $self._assert_equals_($1,$2);
  54542. $ctx2.sendIdx["assert:equals:"]=1;
  54543. $3=collection;
  54544. $4=$self._collection();
  54545. $ctx2.sendIdx["collection"]=2;
  54546. return $self._assert_equals_($3,$4);
  54547. $ctx2.sendIdx["assert:equals:"]=2;
  54548. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54549. }));
  54550. $self._samplesDo_((function(index,value){
  54551. var collection;
  54552. return $core.withContext(function($ctx2) {
  54553. collection=$self._collection();
  54554. $ctx2.sendIdx["collection"]=3;
  54555. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54556. return $core.withContext(function($ctx3) {
  54557. return $self._sampleNewValue();
  54558. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54559. }));
  54560. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54561. $self._assert_equals_($5,value);
  54562. $ctx2.sendIdx["assert:equals:"]=3;
  54563. $7=collection;
  54564. $8=$self._collection();
  54565. $ctx2.sendIdx["collection"]=4;
  54566. $6=$recv($7).__eq($8);
  54567. return $self._deny_($6);
  54568. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54569. }));
  54570. $10=$self._collectionWithNewValue();
  54571. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54572. return $core.withContext(function($ctx2) {
  54573. return $self._assert_(false);
  54574. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54575. }));
  54576. $9=$recv($10)._yourself();
  54577. $self._assert_equals_($9,$self._collection());
  54578. return self;
  54579. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54580. },
  54581. args: [],
  54582. 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",
  54583. referencedClasses: [],
  54584. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54585. }),
  54586. $globals.AssociativeCollectionTest);
  54587. $core.addMethod(
  54588. $core.method({
  54589. selector: "testValues",
  54590. protocol: "tests",
  54591. fn: function (){
  54592. var self=this,$self=this;
  54593. return $core.withContext(function($ctx1) {
  54594. var $2,$1,$3,$4;
  54595. $2=$recv($recv($self._collectionClass())._new())._values();
  54596. $ctx1.sendIdx["values"]=1;
  54597. $1=$recv($2)._isEmpty();
  54598. $self._assert_($1);
  54599. $3=$recv($self._collection())._values();
  54600. $ctx1.sendIdx["values"]=2;
  54601. $4=$self._collectionValues();
  54602. $ctx1.sendIdx["collectionValues"]=1;
  54603. $self._assertSameContents_as_($3,$4);
  54604. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54605. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54606. return self;
  54607. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54608. },
  54609. args: [],
  54610. 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 }",
  54611. referencedClasses: [],
  54612. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54613. }),
  54614. $globals.AssociativeCollectionTest);
  54615. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54616. $core.addMethod(
  54617. $core.method({
  54618. selector: "collection",
  54619. protocol: "fixture",
  54620. fn: function (){
  54621. var self=this,$self=this;
  54622. return $core.withContext(function($ctx1) {
  54623. var $1;
  54624. $1=$recv($globals.Dictionary)._new();
  54625. $recv($1)._at_put_((1),(1));
  54626. $ctx1.sendIdx["at:put:"]=1;
  54627. $recv($1)._at_put_("a",(2));
  54628. $ctx1.sendIdx["at:put:"]=2;
  54629. $recv($1)._at_put_(true,(3));
  54630. $ctx1.sendIdx["at:put:"]=3;
  54631. $recv($1)._at_put_((1).__at((3)),(-4));
  54632. $ctx1.sendIdx["at:put:"]=4;
  54633. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54634. return $recv($1)._yourself();
  54635. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54636. },
  54637. args: [],
  54638. 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",
  54639. referencedClasses: ["Dictionary"],
  54640. messageSends: ["at:put:", "new", "@", "yourself"]
  54641. }),
  54642. $globals.DictionaryTest);
  54643. $core.addMethod(
  54644. $core.method({
  54645. selector: "collectionKeys",
  54646. protocol: "fixture",
  54647. fn: function (){
  54648. var self=this,$self=this;
  54649. return $core.withContext(function($ctx1) {
  54650. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54651. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54652. },
  54653. args: [],
  54654. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54655. referencedClasses: [],
  54656. messageSends: ["@"]
  54657. }),
  54658. $globals.DictionaryTest);
  54659. $core.addMethod(
  54660. $core.method({
  54661. selector: "collectionOfPrintStrings",
  54662. protocol: "fixture",
  54663. fn: function (){
  54664. var self=this,$self=this;
  54665. return $core.withContext(function($ctx1) {
  54666. var $1;
  54667. $1=$recv($globals.Dictionary)._new();
  54668. $recv($1)._at_put_((1),"1");
  54669. $ctx1.sendIdx["at:put:"]=1;
  54670. $recv($1)._at_put_("a","2");
  54671. $ctx1.sendIdx["at:put:"]=2;
  54672. $recv($1)._at_put_(true,"3");
  54673. $ctx1.sendIdx["at:put:"]=3;
  54674. $recv($1)._at_put_((1).__at((3)),"-4");
  54675. $ctx1.sendIdx["at:put:"]=4;
  54676. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54677. return $recv($1)._yourself();
  54678. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54679. },
  54680. args: [],
  54681. 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",
  54682. referencedClasses: ["Dictionary"],
  54683. messageSends: ["at:put:", "new", "@", "yourself"]
  54684. }),
  54685. $globals.DictionaryTest);
  54686. $core.addMethod(
  54687. $core.method({
  54688. selector: "collectionSize",
  54689. protocol: "fixture",
  54690. fn: function (){
  54691. var self=this,$self=this;
  54692. return (5);
  54693. },
  54694. args: [],
  54695. source: "collectionSize\x0a\x09^ 5",
  54696. referencedClasses: [],
  54697. messageSends: []
  54698. }),
  54699. $globals.DictionaryTest);
  54700. $core.addMethod(
  54701. $core.method({
  54702. selector: "collectionValues",
  54703. protocol: "fixture",
  54704. fn: function (){
  54705. var self=this,$self=this;
  54706. return [(1),(2),(3),(-4),(9)];
  54707. },
  54708. args: [],
  54709. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54710. referencedClasses: [],
  54711. messageSends: []
  54712. }),
  54713. $globals.DictionaryTest);
  54714. $core.addMethod(
  54715. $core.method({
  54716. selector: "collectionWithDuplicates",
  54717. protocol: "fixture",
  54718. fn: function (){
  54719. var self=this,$self=this;
  54720. return $core.withContext(function($ctx1) {
  54721. var $1;
  54722. $1=$recv($globals.Dictionary)._new();
  54723. $recv($1)._at_put_((1),(1));
  54724. $ctx1.sendIdx["at:put:"]=1;
  54725. $recv($1)._at_put_("a",(2));
  54726. $ctx1.sendIdx["at:put:"]=2;
  54727. $recv($1)._at_put_(true,(3));
  54728. $ctx1.sendIdx["at:put:"]=3;
  54729. $recv($1)._at_put_((4),(-4));
  54730. $ctx1.sendIdx["at:put:"]=4;
  54731. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54732. $ctx1.sendIdx["at:put:"]=5;
  54733. $recv($1)._at_put_("b",(1));
  54734. $ctx1.sendIdx["at:put:"]=6;
  54735. $recv($1)._at_put_((3),(3));
  54736. $ctx1.sendIdx["at:put:"]=7;
  54737. $recv($1)._at_put_(false,(12));
  54738. return $recv($1)._yourself();
  54739. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54740. },
  54741. args: [],
  54742. 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",
  54743. referencedClasses: ["Dictionary"],
  54744. messageSends: ["at:put:", "new", "yourself"]
  54745. }),
  54746. $globals.DictionaryTest);
  54747. $core.addMethod(
  54748. $core.method({
  54749. selector: "collectionWithNewValue",
  54750. protocol: "fixture",
  54751. fn: function (){
  54752. var self=this,$self=this;
  54753. return $core.withContext(function($ctx1) {
  54754. var $1;
  54755. $1=$recv($globals.Dictionary)._new();
  54756. $recv($1)._at_put_((1),(1));
  54757. $ctx1.sendIdx["at:put:"]=1;
  54758. $recv($1)._at_put_("a",(2));
  54759. $ctx1.sendIdx["at:put:"]=2;
  54760. $recv($1)._at_put_(true,(3));
  54761. $ctx1.sendIdx["at:put:"]=3;
  54762. $recv($1)._at_put_((1).__at((3)),(-4));
  54763. $ctx1.sendIdx["at:put:"]=4;
  54764. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54765. $ctx1.sendIdx["at:put:"]=5;
  54766. $recv($1)._at_put_("new","N");
  54767. return $recv($1)._yourself();
  54768. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54769. },
  54770. args: [],
  54771. 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",
  54772. referencedClasses: ["Dictionary"],
  54773. messageSends: ["at:put:", "new", "@", "yourself"]
  54774. }),
  54775. $globals.DictionaryTest);
  54776. $core.addMethod(
  54777. $core.method({
  54778. selector: "sampleNewValueAsCollection",
  54779. protocol: "fixture",
  54780. fn: function (){
  54781. var self=this,$self=this;
  54782. return $core.withContext(function($ctx1) {
  54783. var $1;
  54784. $1=$recv($globals.Dictionary)._new();
  54785. $recv($1)._at_put_("new","N");
  54786. return $recv($1)._yourself();
  54787. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54788. },
  54789. args: [],
  54790. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54791. referencedClasses: ["Dictionary"],
  54792. messageSends: ["at:put:", "new", "yourself"]
  54793. }),
  54794. $globals.DictionaryTest);
  54795. $core.addMethod(
  54796. $core.method({
  54797. selector: "samplesDo:",
  54798. protocol: "fixture",
  54799. fn: function (aBlock){
  54800. var self=this,$self=this;
  54801. return $core.withContext(function($ctx1) {
  54802. (
  54803. $ctx1.supercall = true,
  54804. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54805. $ctx1.supercall = false;
  54806. $recv(aBlock)._value_value_(true,(3));
  54807. $ctx1.sendIdx["value:value:"]=1;
  54808. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54809. $ctx1.sendIdx["value:value:"]=2;
  54810. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54811. return self;
  54812. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54813. },
  54814. args: ["aBlock"],
  54815. 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",
  54816. referencedClasses: [],
  54817. messageSends: ["samplesDo:", "value:value:", "@"]
  54818. }),
  54819. $globals.DictionaryTest);
  54820. $core.addMethod(
  54821. $core.method({
  54822. selector: "testAccessing",
  54823. protocol: "tests",
  54824. fn: function (){
  54825. var self=this,$self=this;
  54826. var d;
  54827. return $core.withContext(function($ctx1) {
  54828. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54829. d=$recv($globals.Dictionary)._new();
  54830. $recv(d)._at_put_("hello","world");
  54831. $ctx1.sendIdx["at:put:"]=1;
  54832. $1=$recv(d)._at_("hello");
  54833. $ctx1.sendIdx["at:"]=1;
  54834. $self._assert_equals_($1,"world");
  54835. $ctx1.sendIdx["assert:equals:"]=1;
  54836. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54837. return nil;
  54838. }));
  54839. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54840. $self._assert_equals_($2,"world");
  54841. $ctx1.sendIdx["assert:equals:"]=2;
  54842. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54843. return nil;
  54844. }))).__eq("world"));
  54845. $ctx1.sendIdx["deny:"]=1;
  54846. $3=$recv(d)._includesKey_("hello");
  54847. $ctx1.sendIdx["includesKey:"]=1;
  54848. $self._assert_($3);
  54849. $ctx1.sendIdx["assert:"]=1;
  54850. $4=$recv(d)._includesKey_("foo");
  54851. $ctx1.sendIdx["includesKey:"]=2;
  54852. $self._deny_($4);
  54853. $ctx1.sendIdx["deny:"]=2;
  54854. $recv(d)._at_put_((1),(2));
  54855. $ctx1.sendIdx["at:put:"]=2;
  54856. $5=$recv(d)._at_((1));
  54857. $ctx1.sendIdx["at:"]=2;
  54858. $self._assert_equals_($5,(2));
  54859. $ctx1.sendIdx["assert:equals:"]=3;
  54860. $6=d;
  54861. $7=(1).__at((3));
  54862. $ctx1.sendIdx["@"]=1;
  54863. $recv($6)._at_put_($7,(3));
  54864. $9=d;
  54865. $10=(1).__at((3));
  54866. $ctx1.sendIdx["@"]=2;
  54867. $8=$recv($9)._at_($10);
  54868. $self._assert_equals_($8,(3));
  54869. $12=d;
  54870. $13=(1).__at((3));
  54871. $ctx1.sendIdx["@"]=3;
  54872. $11=$recv($12)._includesKey_($13);
  54873. $ctx1.sendIdx["includesKey:"]=3;
  54874. $self._assert_($11);
  54875. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54876. return self;
  54877. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54878. },
  54879. args: [],
  54880. 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)",
  54881. referencedClasses: ["Dictionary"],
  54882. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54883. }),
  54884. $globals.DictionaryTest);
  54885. $core.addMethod(
  54886. $core.method({
  54887. selector: "testDynamicDictionaries",
  54888. protocol: "tests",
  54889. fn: function (){
  54890. var self=this,$self=this;
  54891. return $core.withContext(function($ctx1) {
  54892. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54893. return self;
  54894. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54895. },
  54896. args: [],
  54897. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54898. referencedClasses: ["Dictionary"],
  54899. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54900. }),
  54901. $globals.DictionaryTest);
  54902. $core.addMethod(
  54903. $core.method({
  54904. selector: "collectionClass",
  54905. protocol: "fixture",
  54906. fn: function (){
  54907. var self=this,$self=this;
  54908. return $globals.Dictionary;
  54909. },
  54910. args: [],
  54911. source: "collectionClass\x0a\x09^ Dictionary",
  54912. referencedClasses: ["Dictionary"],
  54913. messageSends: []
  54914. }),
  54915. $globals.DictionaryTest.a$cls);
  54916. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54917. $core.addMethod(
  54918. $core.method({
  54919. selector: "collection",
  54920. protocol: "fixture",
  54921. fn: function (){
  54922. var self=this,$self=this;
  54923. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54924. },
  54925. args: [],
  54926. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54927. referencedClasses: [],
  54928. messageSends: []
  54929. }),
  54930. $globals.HashedCollectionTest);
  54931. $core.addMethod(
  54932. $core.method({
  54933. selector: "collectionKeys",
  54934. protocol: "fixture",
  54935. fn: function (){
  54936. var self=this,$self=this;
  54937. return ["b","a","c","d"];
  54938. },
  54939. args: [],
  54940. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54941. referencedClasses: [],
  54942. messageSends: []
  54943. }),
  54944. $globals.HashedCollectionTest);
  54945. $core.addMethod(
  54946. $core.method({
  54947. selector: "collectionOfPrintStrings",
  54948. protocol: "fixture",
  54949. fn: function (){
  54950. var self=this,$self=this;
  54951. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54952. },
  54953. args: [],
  54954. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54955. referencedClasses: [],
  54956. messageSends: []
  54957. }),
  54958. $globals.HashedCollectionTest);
  54959. $core.addMethod(
  54960. $core.method({
  54961. selector: "collectionSize",
  54962. protocol: "fixture",
  54963. fn: function (){
  54964. var self=this,$self=this;
  54965. return (4);
  54966. },
  54967. args: [],
  54968. source: "collectionSize\x0a\x09^ 4",
  54969. referencedClasses: [],
  54970. messageSends: []
  54971. }),
  54972. $globals.HashedCollectionTest);
  54973. $core.addMethod(
  54974. $core.method({
  54975. selector: "collectionValues",
  54976. protocol: "fixture",
  54977. fn: function (){
  54978. var self=this,$self=this;
  54979. return [(1),(2),(3),(-4)];
  54980. },
  54981. args: [],
  54982. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  54983. referencedClasses: [],
  54984. messageSends: []
  54985. }),
  54986. $globals.HashedCollectionTest);
  54987. $core.addMethod(
  54988. $core.method({
  54989. selector: "collectionWithDuplicates",
  54990. protocol: "fixture",
  54991. fn: function (){
  54992. var self=this,$self=this;
  54993. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  54994. },
  54995. args: [],
  54996. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  54997. referencedClasses: [],
  54998. messageSends: []
  54999. }),
  55000. $globals.HashedCollectionTest);
  55001. $core.addMethod(
  55002. $core.method({
  55003. selector: "collectionWithNewValue",
  55004. protocol: "fixture",
  55005. fn: function (){
  55006. var self=this,$self=this;
  55007. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  55008. },
  55009. args: [],
  55010. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  55011. referencedClasses: [],
  55012. messageSends: []
  55013. }),
  55014. $globals.HashedCollectionTest);
  55015. $core.addMethod(
  55016. $core.method({
  55017. selector: "sampleNewValueAsCollection",
  55018. protocol: "fixture",
  55019. fn: function (){
  55020. var self=this,$self=this;
  55021. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  55022. },
  55023. args: [],
  55024. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  55025. referencedClasses: [],
  55026. messageSends: []
  55027. }),
  55028. $globals.HashedCollectionTest);
  55029. $core.addMethod(
  55030. $core.method({
  55031. selector: "testDynamicDictionaries",
  55032. protocol: "tests",
  55033. fn: function (){
  55034. var self=this,$self=this;
  55035. return $core.withContext(function($ctx1) {
  55036. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  55037. return self;
  55038. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  55039. },
  55040. args: [],
  55041. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  55042. referencedClasses: ["HashedCollection"],
  55043. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  55044. }),
  55045. $globals.HashedCollectionTest);
  55046. $core.addMethod(
  55047. $core.method({
  55048. selector: "collectionClass",
  55049. protocol: "fixture",
  55050. fn: function (){
  55051. var self=this,$self=this;
  55052. return $globals.HashedCollection;
  55053. },
  55054. args: [],
  55055. source: "collectionClass\x0a\x09^ HashedCollection",
  55056. referencedClasses: ["HashedCollection"],
  55057. messageSends: []
  55058. }),
  55059. $globals.HashedCollectionTest.a$cls);
  55060. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  55061. $core.addMethod(
  55062. $core.method({
  55063. selector: "collectionFirst",
  55064. protocol: "fixture",
  55065. fn: function (){
  55066. var self=this,$self=this;
  55067. return $core.withContext(function($ctx1) {
  55068. $self._subclassResponsibility();
  55069. return self;
  55070. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  55071. },
  55072. args: [],
  55073. source: "collectionFirst\x0a\x09self subclassResponsibility",
  55074. referencedClasses: [],
  55075. messageSends: ["subclassResponsibility"]
  55076. }),
  55077. $globals.SequenceableCollectionTest);
  55078. $core.addMethod(
  55079. $core.method({
  55080. selector: "collectionFirstTwo",
  55081. protocol: "fixture",
  55082. fn: function (){
  55083. var self=this,$self=this;
  55084. return $core.withContext(function($ctx1) {
  55085. $self._subclassResponsibility();
  55086. return self;
  55087. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  55088. },
  55089. args: [],
  55090. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  55091. referencedClasses: [],
  55092. messageSends: ["subclassResponsibility"]
  55093. }),
  55094. $globals.SequenceableCollectionTest);
  55095. $core.addMethod(
  55096. $core.method({
  55097. selector: "collectionLast",
  55098. protocol: "fixture",
  55099. fn: function (){
  55100. var self=this,$self=this;
  55101. return $core.withContext(function($ctx1) {
  55102. $self._subclassResponsibility();
  55103. return self;
  55104. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  55105. },
  55106. args: [],
  55107. source: "collectionLast\x0a\x09self subclassResponsibility",
  55108. referencedClasses: [],
  55109. messageSends: ["subclassResponsibility"]
  55110. }),
  55111. $globals.SequenceableCollectionTest);
  55112. $core.addMethod(
  55113. $core.method({
  55114. selector: "collectionLastTwo",
  55115. protocol: "fixture",
  55116. fn: function (){
  55117. var self=this,$self=this;
  55118. return $core.withContext(function($ctx1) {
  55119. $self._subclassResponsibility();
  55120. return self;
  55121. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  55122. },
  55123. args: [],
  55124. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  55125. referencedClasses: [],
  55126. messageSends: ["subclassResponsibility"]
  55127. }),
  55128. $globals.SequenceableCollectionTest);
  55129. $core.addMethod(
  55130. $core.method({
  55131. selector: "nonIndexesDo:",
  55132. protocol: "fixture",
  55133. fn: function (aBlock){
  55134. var self=this,$self=this;
  55135. return $core.withContext(function($ctx1) {
  55136. $recv(aBlock)._value_((0));
  55137. $ctx1.sendIdx["value:"]=1;
  55138. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  55139. $ctx1.sendIdx["value:"]=2;
  55140. $recv(aBlock)._value_("z");
  55141. return self;
  55142. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55143. },
  55144. args: ["aBlock"],
  55145. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  55146. referencedClasses: [],
  55147. messageSends: ["value:", "+", "collectionSize"]
  55148. }),
  55149. $globals.SequenceableCollectionTest);
  55150. $core.addMethod(
  55151. $core.method({
  55152. selector: "samplesDo:",
  55153. protocol: "fixture",
  55154. fn: function (aBlock){
  55155. var self=this,$self=this;
  55156. return $core.withContext(function($ctx1) {
  55157. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  55158. $ctx1.sendIdx["value:value:"]=1;
  55159. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  55160. return self;
  55161. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55162. },
  55163. args: ["aBlock"],
  55164. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  55165. referencedClasses: [],
  55166. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  55167. }),
  55168. $globals.SequenceableCollectionTest);
  55169. $core.addMethod(
  55170. $core.method({
  55171. selector: "testBeginsWith",
  55172. protocol: "tests",
  55173. fn: function (){
  55174. var self=this,$self=this;
  55175. return $core.withContext(function($ctx1) {
  55176. var $2,$1,$4,$5,$3,$7,$6;
  55177. $2=$self._collection();
  55178. $ctx1.sendIdx["collection"]=1;
  55179. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  55180. $ctx1.sendIdx["beginsWith:"]=1;
  55181. $self._assert_($1);
  55182. $ctx1.sendIdx["assert:"]=1;
  55183. $4=$self._collection();
  55184. $ctx1.sendIdx["collection"]=2;
  55185. $5=$self._collection();
  55186. $ctx1.sendIdx["collection"]=3;
  55187. $3=$recv($4)._beginsWith_($5);
  55188. $ctx1.sendIdx["beginsWith:"]=2;
  55189. $self._assert_($3);
  55190. $ctx1.sendIdx["assert:"]=2;
  55191. $7=$self._collection();
  55192. $ctx1.sendIdx["collection"]=4;
  55193. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  55194. $ctx1.sendIdx["beginsWith:"]=3;
  55195. $self._assert_($6);
  55196. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  55197. return self;
  55198. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  55199. },
  55200. args: [],
  55201. 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)",
  55202. referencedClasses: [],
  55203. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  55204. }),
  55205. $globals.SequenceableCollectionTest);
  55206. $core.addMethod(
  55207. $core.method({
  55208. selector: "testEndsWith",
  55209. protocol: "tests",
  55210. fn: function (){
  55211. var self=this,$self=this;
  55212. return $core.withContext(function($ctx1) {
  55213. var $2,$1,$4,$5,$3,$7,$6;
  55214. $2=$self._collection();
  55215. $ctx1.sendIdx["collection"]=1;
  55216. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  55217. $ctx1.sendIdx["endsWith:"]=1;
  55218. $self._assert_($1);
  55219. $ctx1.sendIdx["assert:"]=1;
  55220. $4=$self._collection();
  55221. $ctx1.sendIdx["collection"]=2;
  55222. $5=$self._collection();
  55223. $ctx1.sendIdx["collection"]=3;
  55224. $3=$recv($4)._endsWith_($5);
  55225. $ctx1.sendIdx["endsWith:"]=2;
  55226. $self._assert_($3);
  55227. $ctx1.sendIdx["assert:"]=2;
  55228. $7=$self._collection();
  55229. $ctx1.sendIdx["collection"]=4;
  55230. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  55231. $ctx1.sendIdx["endsWith:"]=3;
  55232. $self._assert_($6);
  55233. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  55234. return self;
  55235. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  55236. },
  55237. args: [],
  55238. 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)",
  55239. referencedClasses: [],
  55240. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  55241. }),
  55242. $globals.SequenceableCollectionTest);
  55243. $core.addMethod(
  55244. $core.method({
  55245. selector: "testFirst",
  55246. protocol: "tests",
  55247. fn: function (){
  55248. var self=this,$self=this;
  55249. return $core.withContext(function($ctx1) {
  55250. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  55251. return self;
  55252. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  55253. },
  55254. args: [],
  55255. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  55256. referencedClasses: [],
  55257. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  55258. }),
  55259. $globals.SequenceableCollectionTest);
  55260. $core.addMethod(
  55261. $core.method({
  55262. selector: "testFirstN",
  55263. protocol: "tests",
  55264. fn: function (){
  55265. var self=this,$self=this;
  55266. return $core.withContext(function($ctx1) {
  55267. var $2,$1,$4,$3,$6,$5,$7;
  55268. $2=$self._collection();
  55269. $ctx1.sendIdx["collection"]=1;
  55270. $1=$recv($2)._first_((2));
  55271. $ctx1.sendIdx["first:"]=1;
  55272. $self._assert_equals_($1,$self._collectionFirstTwo());
  55273. $ctx1.sendIdx["assert:equals:"]=1;
  55274. $4=$self._collection();
  55275. $ctx1.sendIdx["collection"]=2;
  55276. $3=$recv($4)._first_((0));
  55277. $ctx1.sendIdx["first:"]=2;
  55278. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55279. $ctx1.sendIdx["assert:equals:"]=2;
  55280. $6=$self._collection();
  55281. $ctx1.sendIdx["collection"]=3;
  55282. $5=$recv($6)._first_($self._collectionSize());
  55283. $ctx1.sendIdx["first:"]=3;
  55284. $7=$self._collection();
  55285. $ctx1.sendIdx["collection"]=4;
  55286. $self._assert_equals_($5,$7);
  55287. $self._should_raise_((function(){
  55288. return $core.withContext(function($ctx2) {
  55289. return $recv($self._collection())._first_((33));
  55290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55291. }),$globals.Error);
  55292. return self;
  55293. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  55294. },
  55295. args: [],
  55296. 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",
  55297. referencedClasses: ["Error"],
  55298. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55299. }),
  55300. $globals.SequenceableCollectionTest);
  55301. $core.addMethod(
  55302. $core.method({
  55303. selector: "testFourth",
  55304. protocol: "tests",
  55305. fn: function (){
  55306. var self=this,$self=this;
  55307. return $core.withContext(function($ctx1) {
  55308. var $2,$1;
  55309. $2=$self._collection();
  55310. $ctx1.sendIdx["collection"]=1;
  55311. $1=$recv($2)._fourth();
  55312. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  55313. return self;
  55314. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  55315. },
  55316. args: [],
  55317. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  55318. referencedClasses: [],
  55319. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  55320. }),
  55321. $globals.SequenceableCollectionTest);
  55322. $core.addMethod(
  55323. $core.method({
  55324. selector: "testIndexOfStartingAt",
  55325. protocol: "tests",
  55326. fn: function (){
  55327. var self=this,$self=this;
  55328. var jsNull;
  55329. return $core.withContext(function($ctx1) {
  55330. var $2,$1,$4,$3;
  55331. jsNull=$recv($globals.JSON)._parse_("null");
  55332. $self._samplesDo_((function(index,value){
  55333. return $core.withContext(function($ctx2) {
  55334. $2=$self._collection();
  55335. $ctx2.sendIdx["collection"]=1;
  55336. $1=$recv($2)._indexOf_startingAt_(value,(1));
  55337. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55338. $self._assert_equals_($1,index);
  55339. $ctx2.sendIdx["assert:equals:"]=1;
  55340. $4=$self._collection();
  55341. $ctx2.sendIdx["collection"]=2;
  55342. $3=$recv($4)._indexOf_startingAt_(value,index);
  55343. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55344. $self._assert_equals_($3,index);
  55345. $ctx2.sendIdx["assert:equals:"]=2;
  55346. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  55347. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  55348. }));
  55349. return self;
  55350. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55351. },
  55352. args: [],
  55353. 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 ]",
  55354. referencedClasses: ["JSON"],
  55355. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  55356. }),
  55357. $globals.SequenceableCollectionTest);
  55358. $core.addMethod(
  55359. $core.method({
  55360. selector: "testIndexOfStartingAtWithNull",
  55361. protocol: "tests",
  55362. fn: function (){
  55363. var self=this,$self=this;
  55364. var jsNull;
  55365. return $core.withContext(function($ctx1) {
  55366. var $1,$2;
  55367. jsNull=$recv($globals.JSON)._parse_("null");
  55368. $self._samplesDo_((function(index,value){
  55369. var collection;
  55370. return $core.withContext(function($ctx2) {
  55371. collection=$self._collection();
  55372. $recv(collection)._at_put_(index,jsNull);
  55373. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55374. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55375. $self._assert_equals_($1,index);
  55376. $ctx2.sendIdx["assert:equals:"]=1;
  55377. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55378. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55379. $self._assert_equals_($2,index);
  55380. $ctx2.sendIdx["assert:equals:"]=2;
  55381. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55382. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55383. }));
  55384. return self;
  55385. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55386. },
  55387. args: [],
  55388. 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 ]",
  55389. referencedClasses: ["JSON"],
  55390. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55391. }),
  55392. $globals.SequenceableCollectionTest);
  55393. $core.addMethod(
  55394. $core.method({
  55395. selector: "testLast",
  55396. protocol: "tests",
  55397. fn: function (){
  55398. var self=this,$self=this;
  55399. return $core.withContext(function($ctx1) {
  55400. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55401. return self;
  55402. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55403. },
  55404. args: [],
  55405. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55406. referencedClasses: [],
  55407. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55408. }),
  55409. $globals.SequenceableCollectionTest);
  55410. $core.addMethod(
  55411. $core.method({
  55412. selector: "testLastN",
  55413. protocol: "tests",
  55414. fn: function (){
  55415. var self=this,$self=this;
  55416. return $core.withContext(function($ctx1) {
  55417. var $2,$1,$4,$3,$6,$5,$7;
  55418. $2=$self._collection();
  55419. $ctx1.sendIdx["collection"]=1;
  55420. $1=$recv($2)._last_((2));
  55421. $ctx1.sendIdx["last:"]=1;
  55422. $self._assert_equals_($1,$self._collectionLastTwo());
  55423. $ctx1.sendIdx["assert:equals:"]=1;
  55424. $4=$self._collection();
  55425. $ctx1.sendIdx["collection"]=2;
  55426. $3=$recv($4)._last_((0));
  55427. $ctx1.sendIdx["last:"]=2;
  55428. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55429. $ctx1.sendIdx["assert:equals:"]=2;
  55430. $6=$self._collection();
  55431. $ctx1.sendIdx["collection"]=3;
  55432. $5=$recv($6)._last_($self._collectionSize());
  55433. $ctx1.sendIdx["last:"]=3;
  55434. $7=$self._collection();
  55435. $ctx1.sendIdx["collection"]=4;
  55436. $self._assert_equals_($5,$7);
  55437. $self._should_raise_((function(){
  55438. return $core.withContext(function($ctx2) {
  55439. return $recv($self._collection())._last_((33));
  55440. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55441. }),$globals.Error);
  55442. return self;
  55443. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55444. },
  55445. args: [],
  55446. 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",
  55447. referencedClasses: ["Error"],
  55448. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55449. }),
  55450. $globals.SequenceableCollectionTest);
  55451. $core.addMethod(
  55452. $core.method({
  55453. selector: "testSecond",
  55454. protocol: "tests",
  55455. fn: function (){
  55456. var self=this,$self=this;
  55457. return $core.withContext(function($ctx1) {
  55458. var $2,$1;
  55459. $2=$self._collection();
  55460. $ctx1.sendIdx["collection"]=1;
  55461. $1=$recv($2)._second();
  55462. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55463. return self;
  55464. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55465. },
  55466. args: [],
  55467. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55468. referencedClasses: [],
  55469. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55470. }),
  55471. $globals.SequenceableCollectionTest);
  55472. $core.addMethod(
  55473. $core.method({
  55474. selector: "testThird",
  55475. protocol: "tests",
  55476. fn: function (){
  55477. var self=this,$self=this;
  55478. return $core.withContext(function($ctx1) {
  55479. var $2,$1;
  55480. $2=$self._collection();
  55481. $ctx1.sendIdx["collection"]=1;
  55482. $1=$recv($2)._third();
  55483. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55484. return self;
  55485. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55486. },
  55487. args: [],
  55488. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55489. referencedClasses: [],
  55490. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55491. }),
  55492. $globals.SequenceableCollectionTest);
  55493. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55494. $core.addMethod(
  55495. $core.method({
  55496. selector: "collection",
  55497. protocol: "fixture",
  55498. fn: function (){
  55499. var self=this,$self=this;
  55500. return [(1), (2), (3), (-4)];
  55501. },
  55502. args: [],
  55503. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55504. referencedClasses: [],
  55505. messageSends: []
  55506. }),
  55507. $globals.ArrayTest);
  55508. $core.addMethod(
  55509. $core.method({
  55510. selector: "collectionFirst",
  55511. protocol: "fixture",
  55512. fn: function (){
  55513. var self=this,$self=this;
  55514. return (1);
  55515. },
  55516. args: [],
  55517. source: "collectionFirst\x0a\x09^ 1",
  55518. referencedClasses: [],
  55519. messageSends: []
  55520. }),
  55521. $globals.ArrayTest);
  55522. $core.addMethod(
  55523. $core.method({
  55524. selector: "collectionFirstTwo",
  55525. protocol: "fixture",
  55526. fn: function (){
  55527. var self=this,$self=this;
  55528. return [(1), (2)];
  55529. },
  55530. args: [],
  55531. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55532. referencedClasses: [],
  55533. messageSends: []
  55534. }),
  55535. $globals.ArrayTest);
  55536. $core.addMethod(
  55537. $core.method({
  55538. selector: "collectionLast",
  55539. protocol: "fixture",
  55540. fn: function (){
  55541. var self=this,$self=this;
  55542. return (-4);
  55543. },
  55544. args: [],
  55545. source: "collectionLast\x0a\x09^ -4",
  55546. referencedClasses: [],
  55547. messageSends: []
  55548. }),
  55549. $globals.ArrayTest);
  55550. $core.addMethod(
  55551. $core.method({
  55552. selector: "collectionLastTwo",
  55553. protocol: "fixture",
  55554. fn: function (){
  55555. var self=this,$self=this;
  55556. return [(3), (-4)];
  55557. },
  55558. args: [],
  55559. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55560. referencedClasses: [],
  55561. messageSends: []
  55562. }),
  55563. $globals.ArrayTest);
  55564. $core.addMethod(
  55565. $core.method({
  55566. selector: "collectionOfPrintStrings",
  55567. protocol: "fixture",
  55568. fn: function (){
  55569. var self=this,$self=this;
  55570. return ["1", "2", "3", "-4"];
  55571. },
  55572. args: [],
  55573. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55574. referencedClasses: [],
  55575. messageSends: []
  55576. }),
  55577. $globals.ArrayTest);
  55578. $core.addMethod(
  55579. $core.method({
  55580. selector: "collectionSize",
  55581. protocol: "fixture",
  55582. fn: function (){
  55583. var self=this,$self=this;
  55584. return (4);
  55585. },
  55586. args: [],
  55587. source: "collectionSize\x0a\x09^ 4",
  55588. referencedClasses: [],
  55589. messageSends: []
  55590. }),
  55591. $globals.ArrayTest);
  55592. $core.addMethod(
  55593. $core.method({
  55594. selector: "collectionWithDuplicates",
  55595. protocol: "fixture",
  55596. fn: function (){
  55597. var self=this,$self=this;
  55598. return ["a", "b", "c", (1), (2), (1), "a", []];
  55599. },
  55600. args: [],
  55601. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55602. referencedClasses: [],
  55603. messageSends: []
  55604. }),
  55605. $globals.ArrayTest);
  55606. $core.addMethod(
  55607. $core.method({
  55608. selector: "collectionWithNewValue",
  55609. protocol: "fixture",
  55610. fn: function (){
  55611. var self=this,$self=this;
  55612. return [(1), (2), (3), (-4), "N"];
  55613. },
  55614. args: [],
  55615. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55616. referencedClasses: [],
  55617. messageSends: []
  55618. }),
  55619. $globals.ArrayTest);
  55620. $core.addMethod(
  55621. $core.method({
  55622. selector: "sampleNewIndex",
  55623. protocol: "fixture",
  55624. fn: function (){
  55625. var self=this,$self=this;
  55626. return (5);
  55627. },
  55628. args: [],
  55629. source: "sampleNewIndex\x0a\x09^ 5",
  55630. referencedClasses: [],
  55631. messageSends: []
  55632. }),
  55633. $globals.ArrayTest);
  55634. $core.addMethod(
  55635. $core.method({
  55636. selector: "samplesDo:",
  55637. protocol: "fixture",
  55638. fn: function (aBlock){
  55639. var self=this,$self=this;
  55640. return $core.withContext(function($ctx1) {
  55641. (
  55642. $ctx1.supercall = true,
  55643. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55644. $ctx1.supercall = false;
  55645. $recv(aBlock)._value_value_((3),(3));
  55646. return self;
  55647. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55648. },
  55649. args: ["aBlock"],
  55650. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55651. referencedClasses: [],
  55652. messageSends: ["samplesDo:", "value:value:"]
  55653. }),
  55654. $globals.ArrayTest);
  55655. $core.addMethod(
  55656. $core.method({
  55657. selector: "testAdd",
  55658. protocol: "tests",
  55659. fn: function (){
  55660. var self=this,$self=this;
  55661. var array;
  55662. return $core.withContext(function($ctx1) {
  55663. array=$self._collection();
  55664. $recv(array)._add_((6));
  55665. $self._assert_equals_($recv(array)._last(),(6));
  55666. return self;
  55667. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55668. },
  55669. args: [],
  55670. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55671. referencedClasses: [],
  55672. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55673. }),
  55674. $globals.ArrayTest);
  55675. $core.addMethod(
  55676. $core.method({
  55677. selector: "testAddFirst",
  55678. protocol: "tests",
  55679. fn: function (){
  55680. var self=this,$self=this;
  55681. return $core.withContext(function($ctx1) {
  55682. var $3,$2,$1;
  55683. $3=$self._collection();
  55684. $recv($3)._addFirst_((0));
  55685. $2=$recv($3)._yourself();
  55686. $1=$recv($2)._first();
  55687. $self._assert_equals_($1,(0));
  55688. return self;
  55689. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55690. },
  55691. args: [],
  55692. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55693. referencedClasses: [],
  55694. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55695. }),
  55696. $globals.ArrayTest);
  55697. $core.addMethod(
  55698. $core.method({
  55699. selector: "testPrintString",
  55700. protocol: "tests",
  55701. fn: function (){
  55702. var self=this,$self=this;
  55703. var array;
  55704. return $core.withContext(function($ctx1) {
  55705. var $1,$2,$3,$4,$5,$6,$7,$8;
  55706. array=$recv($globals.Array)._new();
  55707. $1=$recv(array)._printString();
  55708. $ctx1.sendIdx["printString"]=1;
  55709. $self._assert_equals_($1,"an Array ()");
  55710. $ctx1.sendIdx["assert:equals:"]=1;
  55711. $2=array;
  55712. $recv($2)._add_((1));
  55713. $ctx1.sendIdx["add:"]=1;
  55714. $3=$recv($2)._add_((3));
  55715. $ctx1.sendIdx["add:"]=2;
  55716. $4=$recv(array)._printString();
  55717. $ctx1.sendIdx["printString"]=2;
  55718. $self._assert_equals_($4,"an Array (1 3)");
  55719. $ctx1.sendIdx["assert:equals:"]=2;
  55720. $recv(array)._add_("foo");
  55721. $5=$recv(array)._printString();
  55722. $ctx1.sendIdx["printString"]=3;
  55723. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55724. $ctx1.sendIdx["assert:equals:"]=3;
  55725. $6=array;
  55726. $recv($6)._remove_((1));
  55727. $ctx1.sendIdx["remove:"]=1;
  55728. $recv($6)._remove_((3));
  55729. $7=$recv(array)._printString();
  55730. $ctx1.sendIdx["printString"]=4;
  55731. $self._assert_equals_($7,"an Array ('foo')");
  55732. $ctx1.sendIdx["assert:equals:"]=4;
  55733. $recv(array)._addLast_((3));
  55734. $ctx1.sendIdx["addLast:"]=1;
  55735. $8=$recv(array)._printString();
  55736. $ctx1.sendIdx["printString"]=5;
  55737. $self._assert_equals_($8,"an Array ('foo' 3)");
  55738. $ctx1.sendIdx["assert:equals:"]=5;
  55739. $recv(array)._addLast_((3));
  55740. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55741. return self;
  55742. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55743. },
  55744. args: [],
  55745. 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)'.",
  55746. referencedClasses: ["Array"],
  55747. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55748. }),
  55749. $globals.ArrayTest);
  55750. $core.addMethod(
  55751. $core.method({
  55752. selector: "testRemove",
  55753. protocol: "tests",
  55754. fn: function (){
  55755. var self=this,$self=this;
  55756. var array;
  55757. return $core.withContext(function($ctx1) {
  55758. array=[(1), (2), (3), (4), (5)];
  55759. $recv(array)._remove_((3));
  55760. $ctx1.sendIdx["remove:"]=1;
  55761. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55762. $self._should_raise_((function(){
  55763. return $core.withContext(function($ctx2) {
  55764. return $recv(array)._remove_((3));
  55765. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55766. }),$globals.Error);
  55767. return self;
  55768. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55769. },
  55770. args: [],
  55771. 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",
  55772. referencedClasses: ["Error"],
  55773. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55774. }),
  55775. $globals.ArrayTest);
  55776. $core.addMethod(
  55777. $core.method({
  55778. selector: "testRemoveFromTo",
  55779. protocol: "tests",
  55780. fn: function (){
  55781. var self=this,$self=this;
  55782. return $core.withContext(function($ctx1) {
  55783. var $1,$2;
  55784. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55785. $ctx1.sendIdx["removeFrom:to:"]=1;
  55786. $self._assert_equals_($1,[(4)]);
  55787. $ctx1.sendIdx["assert:equals:"]=1;
  55788. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55789. $ctx1.sendIdx["removeFrom:to:"]=2;
  55790. $self._assert_equals_($2,[(1), (4)]);
  55791. $ctx1.sendIdx["assert:equals:"]=2;
  55792. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55793. return self;
  55794. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55795. },
  55796. args: [],
  55797. 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)",
  55798. referencedClasses: [],
  55799. messageSends: ["assert:equals:", "removeFrom:to:"]
  55800. }),
  55801. $globals.ArrayTest);
  55802. $core.addMethod(
  55803. $core.method({
  55804. selector: "testRemoveIndex",
  55805. protocol: "tests",
  55806. fn: function (){
  55807. var self=this,$self=this;
  55808. return $core.withContext(function($ctx1) {
  55809. var $1,$2;
  55810. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55811. $ctx1.sendIdx["removeIndex:"]=1;
  55812. $self._assert_equals_($1,[(1), (3), (4)]);
  55813. $ctx1.sendIdx["assert:equals:"]=1;
  55814. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55815. $ctx1.sendIdx["removeIndex:"]=2;
  55816. $self._assert_equals_($2,[(2), (3), (4)]);
  55817. $ctx1.sendIdx["assert:equals:"]=2;
  55818. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55819. return self;
  55820. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55821. },
  55822. args: [],
  55823. 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: #()",
  55824. referencedClasses: [],
  55825. messageSends: ["assert:equals:", "removeIndex:"]
  55826. }),
  55827. $globals.ArrayTest);
  55828. $core.addMethod(
  55829. $core.method({
  55830. selector: "testRemoveLast",
  55831. protocol: "tests",
  55832. fn: function (){
  55833. var self=this,$self=this;
  55834. var array;
  55835. return $core.withContext(function($ctx1) {
  55836. array=[(1), (2)];
  55837. $recv(array)._removeLast();
  55838. $self._assert_equals_($recv(array)._last(),(1));
  55839. return self;
  55840. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55841. },
  55842. args: [],
  55843. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55844. referencedClasses: [],
  55845. messageSends: ["removeLast", "assert:equals:", "last"]
  55846. }),
  55847. $globals.ArrayTest);
  55848. $core.addMethod(
  55849. $core.method({
  55850. selector: "testReversed",
  55851. protocol: "tests",
  55852. fn: function (){
  55853. var self=this,$self=this;
  55854. var array;
  55855. return $core.withContext(function($ctx1) {
  55856. array=[(5), (4), (3), (2), (1)];
  55857. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55858. return self;
  55859. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55860. },
  55861. args: [],
  55862. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55863. referencedClasses: [],
  55864. messageSends: ["assert:equals:", "reversed"]
  55865. }),
  55866. $globals.ArrayTest);
  55867. $core.addMethod(
  55868. $core.method({
  55869. selector: "testSort",
  55870. protocol: "tests",
  55871. fn: function (){
  55872. var self=this,$self=this;
  55873. var array;
  55874. return $core.withContext(function($ctx1) {
  55875. array=[(10), (1), (5)];
  55876. $recv(array)._sort();
  55877. $self._assert_equals_(array,[(1), (5), (10)]);
  55878. return self;
  55879. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55880. },
  55881. args: [],
  55882. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55883. referencedClasses: [],
  55884. messageSends: ["sort", "assert:equals:"]
  55885. }),
  55886. $globals.ArrayTest);
  55887. $core.addMethod(
  55888. $core.method({
  55889. selector: "collectionClass",
  55890. protocol: "fixture",
  55891. fn: function (){
  55892. var self=this,$self=this;
  55893. return $globals.Array;
  55894. },
  55895. args: [],
  55896. source: "collectionClass\x0a\x09^ Array",
  55897. referencedClasses: ["Array"],
  55898. messageSends: []
  55899. }),
  55900. $globals.ArrayTest.a$cls);
  55901. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55902. $core.addMethod(
  55903. $core.method({
  55904. selector: "collection",
  55905. protocol: "fixture",
  55906. fn: function (){
  55907. var self=this,$self=this;
  55908. return "helLo";
  55909. },
  55910. args: [],
  55911. source: "collection\x0a\x09^ 'helLo'",
  55912. referencedClasses: [],
  55913. messageSends: []
  55914. }),
  55915. $globals.StringTest);
  55916. $core.addMethod(
  55917. $core.method({
  55918. selector: "collectionFirst",
  55919. protocol: "fixture",
  55920. fn: function (){
  55921. var self=this,$self=this;
  55922. return "h";
  55923. },
  55924. args: [],
  55925. source: "collectionFirst\x0a\x09^ 'h'",
  55926. referencedClasses: [],
  55927. messageSends: []
  55928. }),
  55929. $globals.StringTest);
  55930. $core.addMethod(
  55931. $core.method({
  55932. selector: "collectionFirstTwo",
  55933. protocol: "fixture",
  55934. fn: function (){
  55935. var self=this,$self=this;
  55936. return "he";
  55937. },
  55938. args: [],
  55939. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55940. referencedClasses: [],
  55941. messageSends: []
  55942. }),
  55943. $globals.StringTest);
  55944. $core.addMethod(
  55945. $core.method({
  55946. selector: "collectionLast",
  55947. protocol: "fixture",
  55948. fn: function (){
  55949. var self=this,$self=this;
  55950. return "o";
  55951. },
  55952. args: [],
  55953. source: "collectionLast\x0a\x09^ 'o'",
  55954. referencedClasses: [],
  55955. messageSends: []
  55956. }),
  55957. $globals.StringTest);
  55958. $core.addMethod(
  55959. $core.method({
  55960. selector: "collectionLastTwo",
  55961. protocol: "fixture",
  55962. fn: function (){
  55963. var self=this,$self=this;
  55964. return "Lo";
  55965. },
  55966. args: [],
  55967. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  55968. referencedClasses: [],
  55969. messageSends: []
  55970. }),
  55971. $globals.StringTest);
  55972. $core.addMethod(
  55973. $core.method({
  55974. selector: "collectionOfPrintStrings",
  55975. protocol: "fixture",
  55976. fn: function (){
  55977. var self=this,$self=this;
  55978. return "'h''e''l''L''o'";
  55979. },
  55980. args: [],
  55981. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  55982. referencedClasses: [],
  55983. messageSends: []
  55984. }),
  55985. $globals.StringTest);
  55986. $core.addMethod(
  55987. $core.method({
  55988. selector: "collectionSize",
  55989. protocol: "fixture",
  55990. fn: function (){
  55991. var self=this,$self=this;
  55992. return (5);
  55993. },
  55994. args: [],
  55995. source: "collectionSize\x0a\x09^ 5",
  55996. referencedClasses: [],
  55997. messageSends: []
  55998. }),
  55999. $globals.StringTest);
  56000. $core.addMethod(
  56001. $core.method({
  56002. selector: "collectionWithDuplicates",
  56003. protocol: "fixture",
  56004. fn: function (){
  56005. var self=this,$self=this;
  56006. return "abbaerten";
  56007. },
  56008. args: [],
  56009. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  56010. referencedClasses: [],
  56011. messageSends: []
  56012. }),
  56013. $globals.StringTest);
  56014. $core.addMethod(
  56015. $core.method({
  56016. selector: "collectionWithNewValue",
  56017. protocol: "fixture",
  56018. fn: function (){
  56019. var self=this,$self=this;
  56020. return "helLoN";
  56021. },
  56022. args: [],
  56023. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  56024. referencedClasses: [],
  56025. messageSends: []
  56026. }),
  56027. $globals.StringTest);
  56028. $core.addMethod(
  56029. $core.method({
  56030. selector: "sampleNewValueAsCollection",
  56031. protocol: "fixture",
  56032. fn: function (){
  56033. var self=this,$self=this;
  56034. return "N";
  56035. },
  56036. args: [],
  56037. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  56038. referencedClasses: [],
  56039. messageSends: []
  56040. }),
  56041. $globals.StringTest);
  56042. $core.addMethod(
  56043. $core.method({
  56044. selector: "samplesDo:",
  56045. protocol: "fixture",
  56046. fn: function (aBlock){
  56047. var self=this,$self=this;
  56048. return $core.withContext(function($ctx1) {
  56049. (
  56050. $ctx1.supercall = true,
  56051. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  56052. $ctx1.supercall = false;
  56053. $recv(aBlock)._value_value_((3),"l");
  56054. return self;
  56055. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  56056. },
  56057. args: ["aBlock"],
  56058. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  56059. referencedClasses: [],
  56060. messageSends: ["samplesDo:", "value:value:"]
  56061. }),
  56062. $globals.StringTest);
  56063. $core.addMethod(
  56064. $core.method({
  56065. selector: "testAddAll",
  56066. protocol: "tests",
  56067. fn: function (){
  56068. var self=this,$self=this;
  56069. return $core.withContext(function($ctx1) {
  56070. var $1;
  56071. $self._should_raise_((function(){
  56072. return $core.withContext(function($ctx2) {
  56073. $1=$self._collection();
  56074. $ctx2.sendIdx["collection"]=1;
  56075. return $recv($1)._addAll_($self._collection());
  56076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56077. }),$globals.Error);
  56078. return self;
  56079. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  56080. },
  56081. args: [],
  56082. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  56083. referencedClasses: ["Error"],
  56084. messageSends: ["should:raise:", "addAll:", "collection"]
  56085. }),
  56086. $globals.StringTest);
  56087. $core.addMethod(
  56088. $core.method({
  56089. selector: "testAddRemove",
  56090. protocol: "tests",
  56091. fn: function (){
  56092. var self=this,$self=this;
  56093. return $core.withContext(function($ctx1) {
  56094. $self._should_raise_((function(){
  56095. return $core.withContext(function($ctx2) {
  56096. return "hello"._add_("a");
  56097. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56098. }),$globals.Error);
  56099. $ctx1.sendIdx["should:raise:"]=1;
  56100. $self._should_raise_((function(){
  56101. return $core.withContext(function($ctx2) {
  56102. return "hello"._remove_("h");
  56103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56104. }),$globals.Error);
  56105. return self;
  56106. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  56107. },
  56108. args: [],
  56109. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  56110. referencedClasses: ["Error"],
  56111. messageSends: ["should:raise:", "add:", "remove:"]
  56112. }),
  56113. $globals.StringTest);
  56114. $core.addMethod(
  56115. $core.method({
  56116. selector: "testAsArray",
  56117. protocol: "tests",
  56118. fn: function (){
  56119. var self=this,$self=this;
  56120. return $core.withContext(function($ctx1) {
  56121. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  56122. return self;
  56123. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  56124. },
  56125. args: [],
  56126. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  56127. referencedClasses: [],
  56128. messageSends: ["assert:equals:", "asArray"]
  56129. }),
  56130. $globals.StringTest);
  56131. $core.addMethod(
  56132. $core.method({
  56133. selector: "testAsLowerCase",
  56134. protocol: "tests",
  56135. fn: function (){
  56136. var self=this,$self=this;
  56137. return $core.withContext(function($ctx1) {
  56138. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  56139. return self;
  56140. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  56141. },
  56142. args: [],
  56143. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  56144. referencedClasses: [],
  56145. messageSends: ["assert:equals:", "asLowercase"]
  56146. }),
  56147. $globals.StringTest);
  56148. $core.addMethod(
  56149. $core.method({
  56150. selector: "testAsNumber",
  56151. protocol: "tests",
  56152. fn: function (){
  56153. var self=this,$self=this;
  56154. return $core.withContext(function($ctx1) {
  56155. var $1,$2;
  56156. $1="3"._asNumber();
  56157. $ctx1.sendIdx["asNumber"]=1;
  56158. $self._assert_equals_($1,(3));
  56159. $ctx1.sendIdx["assert:equals:"]=1;
  56160. $2="-3"._asNumber();
  56161. $ctx1.sendIdx["asNumber"]=2;
  56162. $self._assert_equals_($2,(-3));
  56163. $ctx1.sendIdx["assert:equals:"]=2;
  56164. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  56165. return self;
  56166. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  56167. },
  56168. args: [],
  56169. 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.",
  56170. referencedClasses: [],
  56171. messageSends: ["assert:equals:", "asNumber"]
  56172. }),
  56173. $globals.StringTest);
  56174. $core.addMethod(
  56175. $core.method({
  56176. selector: "testAsUpperCase",
  56177. protocol: "tests",
  56178. fn: function (){
  56179. var self=this,$self=this;
  56180. return $core.withContext(function($ctx1) {
  56181. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  56182. return self;
  56183. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  56184. },
  56185. args: [],
  56186. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  56187. referencedClasses: [],
  56188. messageSends: ["assert:equals:", "asUppercase"]
  56189. }),
  56190. $globals.StringTest);
  56191. $core.addMethod(
  56192. $core.method({
  56193. selector: "testAsciiValue",
  56194. protocol: "tests",
  56195. fn: function (){
  56196. var self=this,$self=this;
  56197. var characterA,characterU;
  56198. return $core.withContext(function($ctx1) {
  56199. var $1;
  56200. characterA="A";
  56201. characterU="U";
  56202. $1=$recv(characterA)._asciiValue();
  56203. $ctx1.sendIdx["asciiValue"]=1;
  56204. $self._assert_equals_($1,(65));
  56205. $ctx1.sendIdx["assert:equals:"]=1;
  56206. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  56207. return self;
  56208. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  56209. },
  56210. args: [],
  56211. 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",
  56212. referencedClasses: [],
  56213. messageSends: ["assert:equals:", "asciiValue"]
  56214. }),
  56215. $globals.StringTest);
  56216. $core.addMethod(
  56217. $core.method({
  56218. selector: "testAtIfAbsentPut",
  56219. protocol: "tests",
  56220. fn: function (){
  56221. var self=this,$self=this;
  56222. return $core.withContext(function($ctx1) {
  56223. $self._should_raise_((function(){
  56224. return $core.withContext(function($ctx2) {
  56225. return "hello"._at_ifAbsentPut_((6),(function(){
  56226. return "a";
  56227. }));
  56228. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56229. }),$globals.Error);
  56230. return self;
  56231. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  56232. },
  56233. args: [],
  56234. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  56235. referencedClasses: ["Error"],
  56236. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  56237. }),
  56238. $globals.StringTest);
  56239. $core.addMethod(
  56240. $core.method({
  56241. selector: "testAtPut",
  56242. protocol: "tests",
  56243. fn: function (){
  56244. var self=this,$self=this;
  56245. return $core.withContext(function($ctx1) {
  56246. $self._should_raise_((function(){
  56247. return $core.withContext(function($ctx2) {
  56248. return "hello"._at_put_((1),"a");
  56249. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56250. }),$globals.Error);
  56251. return self;
  56252. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  56253. },
  56254. args: [],
  56255. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  56256. referencedClasses: ["Error"],
  56257. messageSends: ["should:raise:", "at:put:"]
  56258. }),
  56259. $globals.StringTest);
  56260. $core.addMethod(
  56261. $core.method({
  56262. selector: "testCapitalized",
  56263. protocol: "tests",
  56264. fn: function (){
  56265. var self=this,$self=this;
  56266. return $core.withContext(function($ctx1) {
  56267. var $1,$2,$3;
  56268. $1="test"._capitalized();
  56269. $ctx1.sendIdx["capitalized"]=1;
  56270. $self._assert_equals_($1,"Test");
  56271. $ctx1.sendIdx["assert:equals:"]=1;
  56272. $2="Test"._capitalized();
  56273. $ctx1.sendIdx["capitalized"]=2;
  56274. $self._assert_equals_($2,"Test");
  56275. $ctx1.sendIdx["assert:equals:"]=2;
  56276. $self._assert_equals_(""._capitalized(),"");
  56277. $ctx1.sendIdx["assert:equals:"]=3;
  56278. $3="Test"._isCapitalized();
  56279. $ctx1.sendIdx["isCapitalized"]=1;
  56280. $self._assert_equals_($3,true);
  56281. $ctx1.sendIdx["assert:equals:"]=4;
  56282. $self._assert_equals_("test"._isCapitalized(),false);
  56283. return self;
  56284. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  56285. },
  56286. args: [],
  56287. 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.",
  56288. referencedClasses: [],
  56289. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  56290. }),
  56291. $globals.StringTest);
  56292. $core.addMethod(
  56293. $core.method({
  56294. selector: "testCharCodeAt",
  56295. protocol: "tests",
  56296. fn: function (){
  56297. var self=this,$self=this;
  56298. return $core.withContext(function($ctx1) {
  56299. var $1,$2,$3,$4,$5;
  56300. $1="jackie"._charCodeAt_((1));
  56301. $ctx1.sendIdx["charCodeAt:"]=1;
  56302. $self._assert_equals_($1,(106));
  56303. $ctx1.sendIdx["assert:equals:"]=1;
  56304. $2="jackie"._charCodeAt_((2));
  56305. $ctx1.sendIdx["charCodeAt:"]=2;
  56306. $self._assert_equals_($2,(97));
  56307. $ctx1.sendIdx["assert:equals:"]=2;
  56308. $3="jackie"._charCodeAt_((3));
  56309. $ctx1.sendIdx["charCodeAt:"]=3;
  56310. $self._assert_equals_($3,(99));
  56311. $ctx1.sendIdx["assert:equals:"]=3;
  56312. $4="jackie"._charCodeAt_((4));
  56313. $ctx1.sendIdx["charCodeAt:"]=4;
  56314. $self._assert_equals_($4,(107));
  56315. $ctx1.sendIdx["assert:equals:"]=4;
  56316. $5="jackie"._charCodeAt_((5));
  56317. $ctx1.sendIdx["charCodeAt:"]=5;
  56318. $self._assert_equals_($5,(105));
  56319. $ctx1.sendIdx["assert:equals:"]=5;
  56320. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  56321. return self;
  56322. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  56323. },
  56324. args: [],
  56325. 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",
  56326. referencedClasses: [],
  56327. messageSends: ["assert:equals:", "charCodeAt:"]
  56328. }),
  56329. $globals.StringTest);
  56330. $core.addMethod(
  56331. $core.method({
  56332. selector: "testCopyFromTo",
  56333. protocol: "tests",
  56334. fn: function (){
  56335. var self=this,$self=this;
  56336. return $core.withContext(function($ctx1) {
  56337. var $1;
  56338. $1="jackie"._copyFrom_to_((1),(3));
  56339. $ctx1.sendIdx["copyFrom:to:"]=1;
  56340. $self._assert_equals_($1,"jac");
  56341. $ctx1.sendIdx["assert:equals:"]=1;
  56342. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  56343. return self;
  56344. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  56345. },
  56346. args: [],
  56347. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  56348. referencedClasses: [],
  56349. messageSends: ["assert:equals:", "copyFrom:to:"]
  56350. }),
  56351. $globals.StringTest);
  56352. $core.addMethod(
  56353. $core.method({
  56354. selector: "testCopySeparates",
  56355. protocol: "tests",
  56356. fn: function (){
  56357. var self=this,$self=this;
  56358. return $core.withContext(function($ctx1) {
  56359. var $3,$2,$1;
  56360. $3=$self._collection();
  56361. $ctx1.sendIdx["collection"]=1;
  56362. $2=$recv($3)._copy();
  56363. $1=$recv($2).__eq_eq($self._collection());
  56364. $self._assert_($1);
  56365. return self;
  56366. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56367. },
  56368. args: [],
  56369. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56370. referencedClasses: [],
  56371. messageSends: ["assert:", "==", "copy", "collection"]
  56372. }),
  56373. $globals.StringTest);
  56374. $core.addMethod(
  56375. $core.method({
  56376. selector: "testCopyWithoutAll",
  56377. protocol: "tests",
  56378. fn: function (){
  56379. var self=this,$self=this;
  56380. return $core.withContext(function($ctx1) {
  56381. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56382. return self;
  56383. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56384. },
  56385. args: [],
  56386. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56387. referencedClasses: [],
  56388. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56389. }),
  56390. $globals.StringTest);
  56391. $core.addMethod(
  56392. $core.method({
  56393. selector: "testEquality",
  56394. protocol: "tests",
  56395. fn: function (){
  56396. var self=this,$self=this;
  56397. return $core.withContext(function($ctx1) {
  56398. var $1,$2,$3;
  56399. $self._assert_equals_("hello","hello");
  56400. $ctx1.sendIdx["assert:equals:"]=1;
  56401. $1="hello".__eq("world");
  56402. $ctx1.sendIdx["="]=1;
  56403. $self._deny_($1);
  56404. $ctx1.sendIdx["deny:"]=1;
  56405. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56406. })));
  56407. $ctx1.sendIdx["="]=2;
  56408. $self._deny_($2);
  56409. $ctx1.sendIdx["deny:"]=2;
  56410. $3="hello"._yourself();
  56411. $ctx1.sendIdx["yourself"]=1;
  56412. $self._assert_equals_("hello",$3);
  56413. $ctx1.sendIdx["assert:equals:"]=2;
  56414. $self._assert_equals_("hello"._yourself(),"hello");
  56415. $self._deny_("".__eq((0)));
  56416. return self;
  56417. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56418. },
  56419. args: [],
  56420. 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",
  56421. referencedClasses: [],
  56422. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56423. }),
  56424. $globals.StringTest);
  56425. $core.addMethod(
  56426. $core.method({
  56427. selector: "testIdentity",
  56428. protocol: "tests",
  56429. fn: function (){
  56430. var self=this,$self=this;
  56431. return $core.withContext(function($ctx1) {
  56432. var $1,$2,$4,$3,$5;
  56433. $1="hello".__eq_eq("hello");
  56434. $ctx1.sendIdx["=="]=1;
  56435. $self._assert_($1);
  56436. $ctx1.sendIdx["assert:"]=1;
  56437. $2="hello".__eq_eq("world");
  56438. $ctx1.sendIdx["=="]=2;
  56439. $self._deny_($2);
  56440. $ctx1.sendIdx["deny:"]=1;
  56441. $4="hello"._yourself();
  56442. $ctx1.sendIdx["yourself"]=1;
  56443. $3="hello".__eq_eq($4);
  56444. $ctx1.sendIdx["=="]=3;
  56445. $self._assert_($3);
  56446. $ctx1.sendIdx["assert:"]=2;
  56447. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56448. $ctx1.sendIdx["=="]=4;
  56449. $self._assert_($5);
  56450. $self._deny_("".__eq_eq((0)));
  56451. return self;
  56452. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56453. },
  56454. args: [],
  56455. 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",
  56456. referencedClasses: [],
  56457. messageSends: ["assert:", "==", "deny:", "yourself"]
  56458. }),
  56459. $globals.StringTest);
  56460. $core.addMethod(
  56461. $core.method({
  56462. selector: "testIncludesSubString",
  56463. protocol: "tests",
  56464. fn: function (){
  56465. var self=this,$self=this;
  56466. return $core.withContext(function($ctx1) {
  56467. var $1;
  56468. $1="amber"._includesSubString_("ber");
  56469. $ctx1.sendIdx["includesSubString:"]=1;
  56470. $self._assert_($1);
  56471. $self._deny_("amber"._includesSubString_("zork"));
  56472. return self;
  56473. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56474. },
  56475. args: [],
  56476. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56477. referencedClasses: [],
  56478. messageSends: ["assert:", "includesSubString:", "deny:"]
  56479. }),
  56480. $globals.StringTest);
  56481. $core.addMethod(
  56482. $core.method({
  56483. selector: "testIndexOfStartingAtWithNull",
  56484. protocol: "tests",
  56485. fn: function (){
  56486. var self=this,$self=this;
  56487. return self;
  56488. },
  56489. args: [],
  56490. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56491. referencedClasses: [],
  56492. messageSends: []
  56493. }),
  56494. $globals.StringTest);
  56495. $core.addMethod(
  56496. $core.method({
  56497. selector: "testIndexOfWithNull",
  56498. protocol: "tests",
  56499. fn: function (){
  56500. var self=this,$self=this;
  56501. return self;
  56502. },
  56503. args: [],
  56504. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56505. referencedClasses: [],
  56506. messageSends: []
  56507. }),
  56508. $globals.StringTest);
  56509. $core.addMethod(
  56510. $core.method({
  56511. selector: "testIsVowel",
  56512. protocol: "tests",
  56513. fn: function (){
  56514. var self=this,$self=this;
  56515. var vowel,consonant;
  56516. return $core.withContext(function($ctx1) {
  56517. var $1;
  56518. vowel="u";
  56519. consonant="z";
  56520. $1=$recv(vowel)._isVowel();
  56521. $ctx1.sendIdx["isVowel"]=1;
  56522. $self._assert_equals_($1,true);
  56523. $ctx1.sendIdx["assert:equals:"]=1;
  56524. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56525. return self;
  56526. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56527. },
  56528. args: [],
  56529. 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",
  56530. referencedClasses: [],
  56531. messageSends: ["assert:equals:", "isVowel"]
  56532. }),
  56533. $globals.StringTest);
  56534. $core.addMethod(
  56535. $core.method({
  56536. selector: "testJoin",
  56537. protocol: "tests",
  56538. fn: function (){
  56539. var self=this,$self=this;
  56540. return $core.withContext(function($ctx1) {
  56541. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56542. return self;
  56543. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56544. },
  56545. args: [],
  56546. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56547. referencedClasses: [],
  56548. messageSends: ["assert:equals:", "join:"]
  56549. }),
  56550. $globals.StringTest);
  56551. $core.addMethod(
  56552. $core.method({
  56553. selector: "testRegression1224",
  56554. protocol: "tests",
  56555. fn: function (){
  56556. var self=this,$self=this;
  56557. return $core.withContext(function($ctx1) {
  56558. var $2,$1;
  56559. $self._should_raise_((function(){
  56560. return $core.withContext(function($ctx2) {
  56561. $2=$recv($self._collectionClass())._new();
  56562. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56563. }));
  56564. $1=$recv($2)._yourself();
  56565. return $recv($1)._size();
  56566. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56567. }),$globals.Error);
  56568. return self;
  56569. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56570. },
  56571. args: [],
  56572. source: "testRegression1224\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size ] raise: Error",
  56573. referencedClasses: ["Error"],
  56574. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56575. }),
  56576. $globals.StringTest);
  56577. $core.addMethod(
  56578. $core.method({
  56579. selector: "testRemoveAll",
  56580. protocol: "tests",
  56581. fn: function (){
  56582. var self=this,$self=this;
  56583. return $core.withContext(function($ctx1) {
  56584. $self._should_raise_((function(){
  56585. return $core.withContext(function($ctx2) {
  56586. return $recv($self._collection())._removeAll();
  56587. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56588. }),$globals.Error);
  56589. return self;
  56590. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56591. },
  56592. args: [],
  56593. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56594. referencedClasses: ["Error"],
  56595. messageSends: ["should:raise:", "removeAll", "collection"]
  56596. }),
  56597. $globals.StringTest);
  56598. $core.addMethod(
  56599. $core.method({
  56600. selector: "testReversed",
  56601. protocol: "tests",
  56602. fn: function (){
  56603. var self=this,$self=this;
  56604. return $core.withContext(function($ctx1) {
  56605. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56606. return self;
  56607. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56608. },
  56609. args: [],
  56610. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56611. referencedClasses: [],
  56612. messageSends: ["assert:equals:", "reversed"]
  56613. }),
  56614. $globals.StringTest);
  56615. $core.addMethod(
  56616. $core.method({
  56617. selector: "testStreamContents",
  56618. protocol: "tests",
  56619. fn: function (){
  56620. var self=this,$self=this;
  56621. return $core.withContext(function($ctx1) {
  56622. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56623. return $core.withContext(function($ctx2) {
  56624. $recv(aStream)._nextPutAll_("hello");
  56625. $ctx2.sendIdx["nextPutAll:"]=1;
  56626. $recv(aStream)._space();
  56627. return $recv(aStream)._nextPutAll_("world");
  56628. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56629. })),"hello world");
  56630. return self;
  56631. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56632. },
  56633. args: [],
  56634. 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'",
  56635. referencedClasses: ["String"],
  56636. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56637. }),
  56638. $globals.StringTest);
  56639. $core.addMethod(
  56640. $core.method({
  56641. selector: "testSubStrings",
  56642. protocol: "tests",
  56643. fn: function (){
  56644. var self=this,$self=this;
  56645. return $core.withContext(function($ctx1) {
  56646. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56647. return self;
  56648. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56649. },
  56650. args: [],
  56651. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56652. referencedClasses: [],
  56653. messageSends: ["assert:equals:", "subStrings:"]
  56654. }),
  56655. $globals.StringTest);
  56656. $core.addMethod(
  56657. $core.method({
  56658. selector: "testTrim",
  56659. protocol: "tests",
  56660. fn: function (){
  56661. var self=this,$self=this;
  56662. return $core.withContext(function($ctx1) {
  56663. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56664. $ctx1.sendIdx["assert:equals:"]=1;
  56665. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56666. return self;
  56667. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56668. },
  56669. args: [],
  56670. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56671. referencedClasses: [],
  56672. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56673. }),
  56674. $globals.StringTest);
  56675. $core.addMethod(
  56676. $core.method({
  56677. selector: "testValue",
  56678. protocol: "tests",
  56679. fn: function (){
  56680. var self=this,$self=this;
  56681. return $core.withContext(function($ctx1) {
  56682. $self._assert_equals_("asString"._value_((1)),"1");
  56683. $ctx1.sendIdx["assert:equals:"]=1;
  56684. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56685. return self;
  56686. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56687. },
  56688. args: [],
  56689. 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')",
  56690. referencedClasses: [],
  56691. messageSends: ["assert:equals:", "value:", "collect:"]
  56692. }),
  56693. $globals.StringTest);
  56694. $core.addMethod(
  56695. $core.method({
  56696. selector: "collectionClass",
  56697. protocol: "fixture",
  56698. fn: function (){
  56699. var self=this,$self=this;
  56700. return $globals.String;
  56701. },
  56702. args: [],
  56703. source: "collectionClass\x0a\x09^ String",
  56704. referencedClasses: ["String"],
  56705. messageSends: []
  56706. }),
  56707. $globals.StringTest.a$cls);
  56708. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56709. $core.addMethod(
  56710. $core.method({
  56711. selector: "collection",
  56712. protocol: "fixture",
  56713. fn: function (){
  56714. var self=this,$self=this;
  56715. return $core.withContext(function($ctx1) {
  56716. var $1;
  56717. $1=$recv($globals.Set)._new();
  56718. $recv($1)._add_($globals.Smalltalk);
  56719. $ctx1.sendIdx["add:"]=1;
  56720. $recv($1)._add_(nil);
  56721. $ctx1.sendIdx["add:"]=2;
  56722. $recv($1)._add_((3).__at((3)));
  56723. $ctx1.sendIdx["add:"]=3;
  56724. $recv($1)._add_(false);
  56725. $ctx1.sendIdx["add:"]=4;
  56726. $recv($1)._add_($self["@sampleBlock"]);
  56727. return $recv($1)._yourself();
  56728. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56729. },
  56730. args: [],
  56731. 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",
  56732. referencedClasses: ["Set", "Smalltalk"],
  56733. messageSends: ["add:", "new", "@", "yourself"]
  56734. }),
  56735. $globals.SetTest);
  56736. $core.addMethod(
  56737. $core.method({
  56738. selector: "collectionOfPrintStrings",
  56739. protocol: "fixture",
  56740. fn: function (){
  56741. var self=this,$self=this;
  56742. return $core.withContext(function($ctx1) {
  56743. var $1;
  56744. $1=$recv($globals.Set)._new();
  56745. $recv($1)._add_("a SmalltalkImage");
  56746. $ctx1.sendIdx["add:"]=1;
  56747. $recv($1)._add_("nil");
  56748. $ctx1.sendIdx["add:"]=2;
  56749. $recv($1)._add_("3@3");
  56750. $ctx1.sendIdx["add:"]=3;
  56751. $recv($1)._add_("false");
  56752. $ctx1.sendIdx["add:"]=4;
  56753. $recv($1)._add_("a BlockClosure");
  56754. return $recv($1)._yourself();
  56755. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56756. },
  56757. args: [],
  56758. 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",
  56759. referencedClasses: ["Set"],
  56760. messageSends: ["add:", "new", "yourself"]
  56761. }),
  56762. $globals.SetTest);
  56763. $core.addMethod(
  56764. $core.method({
  56765. selector: "collectionSize",
  56766. protocol: "fixture",
  56767. fn: function (){
  56768. var self=this,$self=this;
  56769. return (5);
  56770. },
  56771. args: [],
  56772. source: "collectionSize\x0a\x09^ 5",
  56773. referencedClasses: [],
  56774. messageSends: []
  56775. }),
  56776. $globals.SetTest);
  56777. $core.addMethod(
  56778. $core.method({
  56779. selector: "collectionWithDuplicates",
  56780. protocol: "fixture",
  56781. fn: function (){
  56782. var self=this,$self=this;
  56783. return $core.withContext(function($ctx1) {
  56784. var $1;
  56785. $1=$self._collection();
  56786. $recv($1)._add_((0));
  56787. return $recv($1)._yourself();
  56788. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56789. },
  56790. args: [],
  56791. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56792. referencedClasses: [],
  56793. messageSends: ["add:", "collection", "yourself"]
  56794. }),
  56795. $globals.SetTest);
  56796. $core.addMethod(
  56797. $core.method({
  56798. selector: "collectionWithNewValue",
  56799. protocol: "fixture",
  56800. fn: function (){
  56801. var self=this,$self=this;
  56802. return $core.withContext(function($ctx1) {
  56803. var $1;
  56804. $1=$recv($globals.Set)._new();
  56805. $recv($1)._add_($globals.Smalltalk);
  56806. $ctx1.sendIdx["add:"]=1;
  56807. $recv($1)._add_(nil);
  56808. $ctx1.sendIdx["add:"]=2;
  56809. $recv($1)._add_((3).__at((3)));
  56810. $ctx1.sendIdx["add:"]=3;
  56811. $recv($1)._add_("N");
  56812. $ctx1.sendIdx["add:"]=4;
  56813. $recv($1)._add_(false);
  56814. $ctx1.sendIdx["add:"]=5;
  56815. $recv($1)._add_($self["@sampleBlock"]);
  56816. return $recv($1)._yourself();
  56817. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56818. },
  56819. args: [],
  56820. 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",
  56821. referencedClasses: ["Set", "Smalltalk"],
  56822. messageSends: ["add:", "new", "@", "yourself"]
  56823. }),
  56824. $globals.SetTest);
  56825. $core.addMethod(
  56826. $core.method({
  56827. selector: "testAddAll",
  56828. protocol: "tests",
  56829. fn: function (){
  56830. var self=this,$self=this;
  56831. return $core.withContext(function($ctx1) {
  56832. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56833. (
  56834. $ctx1.supercall = true,
  56835. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56836. $ctx1.supercall = false;
  56837. $2=$self._collection();
  56838. $ctx1.sendIdx["collection"]=1;
  56839. $3=$self._collection();
  56840. $ctx1.sendIdx["collection"]=2;
  56841. $recv($2)._addAll_($3);
  56842. $ctx1.sendIdx["addAll:"]=1;
  56843. $4=$recv($2)._yourself();
  56844. $ctx1.sendIdx["yourself"]=1;
  56845. $1=$4;
  56846. $5=$self._collection();
  56847. $ctx1.sendIdx["collection"]=3;
  56848. $self._assert_equals_($1,$5);
  56849. $ctx1.sendIdx["assert:equals:"]=1;
  56850. $7=$self._collection();
  56851. $ctx1.sendIdx["collection"]=4;
  56852. $8=$self._collectionWithNewValue();
  56853. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56854. $recv($7)._addAll_($8);
  56855. $ctx1.sendIdx["addAll:"]=2;
  56856. $9=$recv($7)._yourself();
  56857. $ctx1.sendIdx["yourself"]=2;
  56858. $6=$9;
  56859. $10=$self._collectionWithNewValue();
  56860. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56861. $self._assert_equals_($6,$10);
  56862. $ctx1.sendIdx["assert:equals:"]=2;
  56863. $12=$self._collectionWithNewValue();
  56864. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56865. $recv($12)._addAll_($self._collection());
  56866. $11=$recv($12)._yourself();
  56867. $self._assert_equals_($11,$self._collectionWithNewValue());
  56868. return self;
  56869. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56870. },
  56871. args: [],
  56872. 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",
  56873. referencedClasses: [],
  56874. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56875. }),
  56876. $globals.SetTest);
  56877. $core.addMethod(
  56878. $core.method({
  56879. selector: "testAddRemove",
  56880. protocol: "tests",
  56881. fn: function (){
  56882. var self=this,$self=this;
  56883. var set;
  56884. return $core.withContext(function($ctx1) {
  56885. var $1,$2;
  56886. set=$recv($globals.Set)._new();
  56887. $self._assert_($recv(set)._isEmpty());
  56888. $ctx1.sendIdx["assert:"]=1;
  56889. $recv(set)._add_((3));
  56890. $ctx1.sendIdx["add:"]=1;
  56891. $1=$recv(set)._includes_((3));
  56892. $ctx1.sendIdx["includes:"]=1;
  56893. $self._assert_($1);
  56894. $ctx1.sendIdx["assert:"]=2;
  56895. $recv(set)._add_((5));
  56896. $2=$recv(set)._includes_((5));
  56897. $ctx1.sendIdx["includes:"]=2;
  56898. $self._assert_($2);
  56899. $recv(set)._remove_((3));
  56900. $self._deny_($recv(set)._includes_((3)));
  56901. return self;
  56902. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56903. },
  56904. args: [],
  56905. 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)",
  56906. referencedClasses: ["Set"],
  56907. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56908. }),
  56909. $globals.SetTest);
  56910. $core.addMethod(
  56911. $core.method({
  56912. selector: "testAt",
  56913. protocol: "tests",
  56914. fn: function (){
  56915. var self=this,$self=this;
  56916. return $core.withContext(function($ctx1) {
  56917. $self._should_raise_((function(){
  56918. return $core.withContext(function($ctx2) {
  56919. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56920. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56921. }),$globals.Error);
  56922. return self;
  56923. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56924. },
  56925. args: [],
  56926. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56927. referencedClasses: ["Set", "Error"],
  56928. messageSends: ["should:raise:", "at:put:", "new"]
  56929. }),
  56930. $globals.SetTest);
  56931. $core.addMethod(
  56932. $core.method({
  56933. selector: "testCollect",
  56934. protocol: "tests",
  56935. fn: function (){
  56936. var self=this,$self=this;
  56937. return $core.withContext(function($ctx1) {
  56938. var $2,$1;
  56939. (
  56940. $ctx1.supercall = true,
  56941. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56942. $ctx1.supercall = false;
  56943. $2=[(5), (6), (8)]._asSet();
  56944. $ctx1.sendIdx["asSet"]=1;
  56945. $1=$recv($2)._collect_((function(x){
  56946. return $core.withContext(function($ctx2) {
  56947. return $recv(x).__backslash_backslash((3));
  56948. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56949. }));
  56950. $self._assert_equals_($1,[(0), (2)]._asSet());
  56951. return self;
  56952. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56953. },
  56954. args: [],
  56955. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56956. referencedClasses: [],
  56957. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56958. }),
  56959. $globals.SetTest);
  56960. $core.addMethod(
  56961. $core.method({
  56962. selector: "testComma",
  56963. protocol: "tests",
  56964. fn: function (){
  56965. var self=this,$self=this;
  56966. return $core.withContext(function($ctx1) {
  56967. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  56968. (
  56969. $ctx1.supercall = true,
  56970. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  56971. $ctx1.supercall = false;
  56972. $2=$self._collection();
  56973. $ctx1.sendIdx["collection"]=1;
  56974. $3=$self._collection();
  56975. $ctx1.sendIdx["collection"]=2;
  56976. $1=$recv($2).__comma($3);
  56977. $ctx1.sendIdx[","]=1;
  56978. $4=$self._collection();
  56979. $ctx1.sendIdx["collection"]=3;
  56980. $self._assert_equals_($1,$4);
  56981. $ctx1.sendIdx["assert:equals:"]=1;
  56982. $6=$self._collection();
  56983. $ctx1.sendIdx["collection"]=4;
  56984. $7=$self._collectionWithNewValue();
  56985. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56986. $5=$recv($6).__comma($7);
  56987. $ctx1.sendIdx[","]=2;
  56988. $8=$self._collectionWithNewValue();
  56989. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56990. $self._assert_equals_($5,$8);
  56991. $ctx1.sendIdx["assert:equals:"]=2;
  56992. $10=$self._collectionWithNewValue();
  56993. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56994. $9=$recv($10).__comma($self._collection());
  56995. $self._assert_equals_($9,$self._collectionWithNewValue());
  56996. return self;
  56997. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  56998. },
  56999. args: [],
  57000. 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",
  57001. referencedClasses: [],
  57002. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  57003. }),
  57004. $globals.SetTest);
  57005. $core.addMethod(
  57006. $core.method({
  57007. selector: "testComparing",
  57008. protocol: "tests",
  57009. fn: function (){
  57010. var self=this,$self=this;
  57011. return $core.withContext(function($ctx1) {
  57012. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  57013. $1=[(0), (2)]._asSet();
  57014. $ctx1.sendIdx["asSet"]=1;
  57015. $2=[(0), (2)]._asSet();
  57016. $ctx1.sendIdx["asSet"]=2;
  57017. $self._assert_equals_($1,$2);
  57018. $ctx1.sendIdx["assert:equals:"]=1;
  57019. $3=[(2), (0)]._asSet();
  57020. $ctx1.sendIdx["asSet"]=3;
  57021. $4=[(0), (2)]._asSet();
  57022. $ctx1.sendIdx["asSet"]=4;
  57023. $self._assert_equals_($3,$4);
  57024. $6=[(0), (2), (3)]._asSet();
  57025. $ctx1.sendIdx["asSet"]=5;
  57026. $7=[(0), (2)]._asSet();
  57027. $ctx1.sendIdx["asSet"]=6;
  57028. $5=$recv($6).__eq($7);
  57029. $ctx1.sendIdx["="]=1;
  57030. $self._deny_($5);
  57031. $ctx1.sendIdx["deny:"]=1;
  57032. $9=[(1), (2)]._asSet();
  57033. $ctx1.sendIdx["asSet"]=7;
  57034. $8=$recv($9).__eq([(0), (2)]._asSet());
  57035. $self._deny_($8);
  57036. return self;
  57037. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  57038. },
  57039. args: [],
  57040. 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",
  57041. referencedClasses: [],
  57042. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  57043. }),
  57044. $globals.SetTest);
  57045. $core.addMethod(
  57046. $core.method({
  57047. selector: "testPrintString",
  57048. protocol: "tests",
  57049. fn: function (){
  57050. var self=this,$self=this;
  57051. var set;
  57052. return $core.withContext(function($ctx1) {
  57053. var $1,$2,$3,$4,$5,$6,$7,$8;
  57054. set=$recv($globals.Set)._new();
  57055. $1=$recv(set)._printString();
  57056. $ctx1.sendIdx["printString"]=1;
  57057. $self._assert_equals_($1,"a Set ()");
  57058. $ctx1.sendIdx["assert:equals:"]=1;
  57059. $2=set;
  57060. $recv($2)._add_((1));
  57061. $ctx1.sendIdx["add:"]=1;
  57062. $3=$recv($2)._add_((3));
  57063. $ctx1.sendIdx["add:"]=2;
  57064. $4=$recv(set)._printString();
  57065. $ctx1.sendIdx["printString"]=2;
  57066. $self._assert_equals_($4,"a Set (1 3)");
  57067. $ctx1.sendIdx["assert:equals:"]=2;
  57068. $recv(set)._add_("foo");
  57069. $ctx1.sendIdx["add:"]=3;
  57070. $5=$recv(set)._printString();
  57071. $ctx1.sendIdx["printString"]=3;
  57072. $self._assert_equals_($5,"a Set (1 3 'foo')");
  57073. $ctx1.sendIdx["assert:equals:"]=3;
  57074. $6=set;
  57075. $recv($6)._remove_((1));
  57076. $ctx1.sendIdx["remove:"]=1;
  57077. $recv($6)._remove_((3));
  57078. $7=$recv(set)._printString();
  57079. $ctx1.sendIdx["printString"]=4;
  57080. $self._assert_equals_($7,"a Set ('foo')");
  57081. $ctx1.sendIdx["assert:equals:"]=4;
  57082. $recv(set)._add_((3));
  57083. $ctx1.sendIdx["add:"]=4;
  57084. $8=$recv(set)._printString();
  57085. $ctx1.sendIdx["printString"]=5;
  57086. $self._assert_equals_($8,"a Set (3 'foo')");
  57087. $ctx1.sendIdx["assert:equals:"]=5;
  57088. $recv(set)._add_((3));
  57089. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  57090. return self;
  57091. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  57092. },
  57093. args: [],
  57094. 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'')'",
  57095. referencedClasses: ["Set"],
  57096. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  57097. }),
  57098. $globals.SetTest);
  57099. $core.addMethod(
  57100. $core.method({
  57101. selector: "testUnboxedObjects",
  57102. protocol: "tests",
  57103. fn: function (){
  57104. var self=this,$self=this;
  57105. return $core.withContext(function($ctx1) {
  57106. var $4,$3,$2,$1;
  57107. $4="foo"._yourself();
  57108. $ctx1.sendIdx["yourself"]=1;
  57109. $3=[$4,"foo"._yourself()];
  57110. $2=$recv($3)._asSet();
  57111. $1=$recv($2)._asArray();
  57112. $self._assert_equals_($1,["foo"]);
  57113. return self;
  57114. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  57115. },
  57116. args: [],
  57117. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  57118. referencedClasses: [],
  57119. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  57120. }),
  57121. $globals.SetTest);
  57122. $core.addMethod(
  57123. $core.method({
  57124. selector: "testUnicity",
  57125. protocol: "tests",
  57126. fn: function (){
  57127. var self=this,$self=this;
  57128. var set;
  57129. return $core.withContext(function($ctx1) {
  57130. var $1;
  57131. set=$recv($globals.Set)._new();
  57132. $recv(set)._add_((21));
  57133. $ctx1.sendIdx["add:"]=1;
  57134. $recv(set)._add_("hello");
  57135. $ctx1.sendIdx["add:"]=2;
  57136. $recv(set)._add_((21));
  57137. $ctx1.sendIdx["add:"]=3;
  57138. $1=$recv(set)._size();
  57139. $ctx1.sendIdx["size"]=1;
  57140. $self._assert_equals_($1,(2));
  57141. $ctx1.sendIdx["assert:equals:"]=1;
  57142. $recv(set)._add_("hello");
  57143. $self._assert_equals_($recv(set)._size(),(2));
  57144. $ctx1.sendIdx["assert:equals:"]=2;
  57145. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  57146. return self;
  57147. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  57148. },
  57149. args: [],
  57150. 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')",
  57151. referencedClasses: ["Set"],
  57152. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  57153. }),
  57154. $globals.SetTest);
  57155. $core.addMethod(
  57156. $core.method({
  57157. selector: "collectionClass",
  57158. protocol: "fixture",
  57159. fn: function (){
  57160. var self=this,$self=this;
  57161. return $globals.Set;
  57162. },
  57163. args: [],
  57164. source: "collectionClass\x0a\x09^ Set",
  57165. referencedClasses: ["Set"],
  57166. messageSends: []
  57167. }),
  57168. $globals.SetTest.a$cls);
  57169. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  57170. $core.addMethod(
  57171. $core.method({
  57172. selector: "testShow",
  57173. protocol: "tests",
  57174. fn: function (){
  57175. var self=this,$self=this;
  57176. var originalTranscript;
  57177. return $core.withContext(function($ctx1) {
  57178. originalTranscript=$recv($globals.Transcript)._current();
  57179. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  57180. $ctx1.sendIdx["register:"]=1;
  57181. $self._shouldnt_raise_((function(){
  57182. return $core.withContext(function($ctx2) {
  57183. return $recv($globals.Transcript)._show_("Hello console!");
  57184. $ctx2.sendIdx["show:"]=1;
  57185. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57186. }),$globals.Error);
  57187. $ctx1.sendIdx["shouldnt:raise:"]=1;
  57188. $self._shouldnt_raise_((function(){
  57189. return $core.withContext(function($ctx2) {
  57190. return $recv($globals.Transcript)._show_(console);
  57191. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57192. }),$globals.Error);
  57193. $recv($globals.Transcript)._register_(originalTranscript);
  57194. return self;
  57195. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  57196. },
  57197. args: [],
  57198. 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.",
  57199. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  57200. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  57201. }),
  57202. $globals.ConsoleTranscriptTest);
  57203. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  57204. $core.addMethod(
  57205. $core.method({
  57206. selector: "testEquality",
  57207. protocol: "tests",
  57208. fn: function (){
  57209. var self=this,$self=this;
  57210. var now;
  57211. return $core.withContext(function($ctx1) {
  57212. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57213. now=$recv($globals.Date)._new();
  57214. $1=$recv(now).__eq(now);
  57215. $ctx1.sendIdx["="]=1;
  57216. $self._assert_($1);
  57217. $ctx1.sendIdx["assert:"]=1;
  57218. $3=now;
  57219. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57220. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57221. $2=$recv($3).__eq($4);
  57222. $ctx1.sendIdx["="]=2;
  57223. $self._deny_($2);
  57224. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57225. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57226. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57227. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57228. $5=$recv($6).__eq($7);
  57229. $ctx1.sendIdx["="]=3;
  57230. $self._assert_($5);
  57231. $ctx1.sendIdx["assert:"]=2;
  57232. $9=now;
  57233. $11=$recv(now)._asMilliseconds();
  57234. $ctx1.sendIdx["asMilliseconds"]=1;
  57235. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57236. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57237. $8=$recv($9).__eq($10);
  57238. $ctx1.sendIdx["="]=4;
  57239. $self._assert_($8);
  57240. $ctx1.sendIdx["assert:"]=3;
  57241. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  57242. return self;
  57243. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  57244. },
  57245. args: [],
  57246. 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",
  57247. referencedClasses: ["Date"],
  57248. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57249. }),
  57250. $globals.DateTest);
  57251. $core.addMethod(
  57252. $core.method({
  57253. selector: "testIdentity",
  57254. protocol: "tests",
  57255. fn: function (){
  57256. var self=this,$self=this;
  57257. var now;
  57258. return $core.withContext(function($ctx1) {
  57259. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57260. now=$recv($globals.Date)._new();
  57261. $1=$recv(now).__eq_eq(now);
  57262. $ctx1.sendIdx["=="]=1;
  57263. $self._assert_($1);
  57264. $3=now;
  57265. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57266. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57267. $2=$recv($3).__eq_eq($4);
  57268. $ctx1.sendIdx["=="]=2;
  57269. $self._deny_($2);
  57270. $ctx1.sendIdx["deny:"]=1;
  57271. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57272. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57273. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57274. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57275. $5=$recv($6).__eq_eq($7);
  57276. $ctx1.sendIdx["=="]=3;
  57277. $self._deny_($5);
  57278. $ctx1.sendIdx["deny:"]=2;
  57279. $9=now;
  57280. $11=$recv(now)._asMilliseconds();
  57281. $ctx1.sendIdx["asMilliseconds"]=1;
  57282. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57283. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57284. $8=$recv($9).__eq_eq($10);
  57285. $ctx1.sendIdx["=="]=4;
  57286. $self._deny_($8);
  57287. $ctx1.sendIdx["deny:"]=3;
  57288. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  57289. return self;
  57290. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  57291. },
  57292. args: [],
  57293. 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",
  57294. referencedClasses: ["Date"],
  57295. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57296. }),
  57297. $globals.DateTest);
  57298. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  57299. $core.addMethod(
  57300. $core.method({
  57301. selector: "jsObject",
  57302. protocol: "accessing",
  57303. fn: function (){
  57304. var self=this,$self=this;
  57305. return $core.withContext(function($ctx1) {
  57306. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  57307. return self;
  57308. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  57309. },
  57310. args: [],
  57311. 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}'>",
  57312. referencedClasses: [],
  57313. messageSends: []
  57314. }),
  57315. $globals.JSObjectProxyTest);
  57316. $core.addMethod(
  57317. $core.method({
  57318. selector: "jsUndefined",
  57319. protocol: "accessing",
  57320. fn: function (){
  57321. var self=this,$self=this;
  57322. return $core.withContext(function($ctx1) {
  57323. return;
  57324. return self;
  57325. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  57326. },
  57327. args: [],
  57328. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  57329. referencedClasses: [],
  57330. messageSends: []
  57331. }),
  57332. $globals.JSObjectProxyTest);
  57333. $core.addMethod(
  57334. $core.method({
  57335. selector: "testAtIfAbsent",
  57336. protocol: "tests",
  57337. fn: function (){
  57338. var self=this,$self=this;
  57339. var testObject;
  57340. return $core.withContext(function($ctx1) {
  57341. var $1,$2,$3;
  57342. testObject=$self._jsObject();
  57343. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  57344. return "Property does not exist";
  57345. }));
  57346. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57347. $self._assert_equals_($1,"Property does not exist");
  57348. $ctx1.sendIdx["assert:equals:"]=1;
  57349. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57350. return "Property does not exist";
  57351. }));
  57352. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57353. $self._assert_equals_($2,nil);
  57354. $ctx1.sendIdx["assert:equals:"]=2;
  57355. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57356. return "Property does not exist";
  57357. }));
  57358. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57359. $self._assert_equals_($3,(1));
  57360. $ctx1.sendIdx["assert:equals:"]=3;
  57361. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57362. return "Property does not exist";
  57363. })),nil);
  57364. return self;
  57365. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57366. },
  57367. args: [],
  57368. 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.",
  57369. referencedClasses: [],
  57370. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57371. }),
  57372. $globals.JSObjectProxyTest);
  57373. $core.addMethod(
  57374. $core.method({
  57375. selector: "testAtIfPresent",
  57376. protocol: "tests",
  57377. fn: function (){
  57378. var self=this,$self=this;
  57379. var testObject;
  57380. return $core.withContext(function($ctx1) {
  57381. var $2,$1,$4,$3,$6,$5;
  57382. testObject=$self._jsObject();
  57383. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57384. return $core.withContext(function($ctx2) {
  57385. $2=$recv(x)._asString();
  57386. $ctx2.sendIdx["asString"]=1;
  57387. return "hello ".__comma($2);
  57388. $ctx2.sendIdx[","]=1;
  57389. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57390. }));
  57391. $ctx1.sendIdx["at:ifPresent:"]=1;
  57392. $self._assert_equals_($1,nil);
  57393. $ctx1.sendIdx["assert:equals:"]=1;
  57394. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57395. return $core.withContext(function($ctx2) {
  57396. $4=$recv(x)._asString();
  57397. $ctx2.sendIdx["asString"]=2;
  57398. return "hello ".__comma($4);
  57399. $ctx2.sendIdx[","]=2;
  57400. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57401. }));
  57402. $ctx1.sendIdx["at:ifPresent:"]=2;
  57403. $self._assert_equals_($3,"hello nil");
  57404. $ctx1.sendIdx["assert:equals:"]=2;
  57405. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57406. return $core.withContext(function($ctx2) {
  57407. $6=$recv(x)._asString();
  57408. $ctx2.sendIdx["asString"]=3;
  57409. return "hello ".__comma($6);
  57410. $ctx2.sendIdx[","]=3;
  57411. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57412. }));
  57413. $ctx1.sendIdx["at:ifPresent:"]=3;
  57414. $self._assert_equals_($5,"hello 1");
  57415. $ctx1.sendIdx["assert:equals:"]=3;
  57416. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57417. return $core.withContext(function($ctx2) {
  57418. return "hello ".__comma($recv(x)._asString());
  57419. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57420. })),"hello nil");
  57421. return self;
  57422. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57423. },
  57424. args: [],
  57425. 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'.",
  57426. referencedClasses: [],
  57427. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57428. }),
  57429. $globals.JSObjectProxyTest);
  57430. $core.addMethod(
  57431. $core.method({
  57432. selector: "testAtIfPresentIfAbsent",
  57433. protocol: "tests",
  57434. fn: function (){
  57435. var self=this,$self=this;
  57436. var testObject;
  57437. return $core.withContext(function($ctx1) {
  57438. var $2,$1,$4,$3,$6,$5;
  57439. testObject=$self._jsObject();
  57440. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57441. return $core.withContext(function($ctx2) {
  57442. $2=$recv(x)._asString();
  57443. $ctx2.sendIdx["asString"]=1;
  57444. return "hello ".__comma($2);
  57445. $ctx2.sendIdx[","]=1;
  57446. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57447. }),(function(){
  57448. return "not present";
  57449. }));
  57450. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57451. $self._assert_equals_($1,"not present");
  57452. $ctx1.sendIdx["assert:equals:"]=1;
  57453. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57454. return $core.withContext(function($ctx2) {
  57455. $4=$recv(x)._asString();
  57456. $ctx2.sendIdx["asString"]=2;
  57457. return "hello ".__comma($4);
  57458. $ctx2.sendIdx[","]=2;
  57459. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57460. }),(function(){
  57461. return "not present";
  57462. }));
  57463. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57464. $self._assert_equals_($3,"hello nil");
  57465. $ctx1.sendIdx["assert:equals:"]=2;
  57466. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57467. return $core.withContext(function($ctx2) {
  57468. $6=$recv(x)._asString();
  57469. $ctx2.sendIdx["asString"]=3;
  57470. return "hello ".__comma($6);
  57471. $ctx2.sendIdx[","]=3;
  57472. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57473. }),(function(){
  57474. return "not present";
  57475. }));
  57476. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57477. $self._assert_equals_($5,"hello 1");
  57478. $ctx1.sendIdx["assert:equals:"]=3;
  57479. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57480. return $core.withContext(function($ctx2) {
  57481. return "hello ".__comma($recv(x)._asString());
  57482. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57483. }),(function(){
  57484. return "not present";
  57485. })),"hello nil");
  57486. return self;
  57487. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57488. },
  57489. args: [],
  57490. 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'.",
  57491. referencedClasses: [],
  57492. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57493. }),
  57494. $globals.JSObjectProxyTest);
  57495. $core.addMethod(
  57496. $core.method({
  57497. selector: "testAtPut",
  57498. protocol: "tests",
  57499. fn: function (){
  57500. var self=this,$self=this;
  57501. var testObject;
  57502. return $core.withContext(function($ctx1) {
  57503. var $2,$1;
  57504. testObject=$self._jsObject();
  57505. $2=$recv(testObject)._at_("abc");
  57506. $ctx1.sendIdx["at:"]=1;
  57507. $1=$recv($2).__tild_eq("xyz");
  57508. $self._assert_($1);
  57509. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57510. $ctx1.sendIdx["assert:equals:"]=1;
  57511. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57512. return self;
  57513. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57514. },
  57515. args: [],
  57516. 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'",
  57517. referencedClasses: [],
  57518. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57519. }),
  57520. $globals.JSObjectProxyTest);
  57521. $core.addMethod(
  57522. $core.method({
  57523. selector: "testComparison",
  57524. protocol: "tests",
  57525. fn: function (){
  57526. var self=this,$self=this;
  57527. return $core.withContext(function($ctx1) {
  57528. var $1,$2;
  57529. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57530. $1=$recv(console).__eq(console);
  57531. $ctx1.sendIdx["="]=1;
  57532. $self._assert_($1);
  57533. $2=$recv(console).__eq($recv($globals.Object)._new());
  57534. $ctx1.sendIdx["="]=2;
  57535. $self._deny_($2);
  57536. $ctx1.sendIdx["deny:"]=1;
  57537. $self._deny_($recv(console).__eq($self._jsObject()));
  57538. return self;
  57539. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57540. },
  57541. args: [],
  57542. 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",
  57543. referencedClasses: ["Object"],
  57544. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57545. }),
  57546. $globals.JSObjectProxyTest);
  57547. $core.addMethod(
  57548. $core.method({
  57549. selector: "testDNU",
  57550. protocol: "tests",
  57551. fn: function (){
  57552. var self=this,$self=this;
  57553. return $core.withContext(function($ctx1) {
  57554. $self._should_raise_((function(){
  57555. return $core.withContext(function($ctx2) {
  57556. return $recv($self._jsObject())._foo();
  57557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57558. }),$globals.MessageNotUnderstood);
  57559. return self;
  57560. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57561. },
  57562. args: [],
  57563. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57564. referencedClasses: ["MessageNotUnderstood"],
  57565. messageSends: ["should:raise:", "foo", "jsObject"]
  57566. }),
  57567. $globals.JSObjectProxyTest);
  57568. $core.addMethod(
  57569. $core.method({
  57570. selector: "testDNUWithAllowJavaScriptCalls",
  57571. protocol: "tests",
  57572. fn: function (){
  57573. var self=this,$self=this;
  57574. var jsObject;
  57575. return $core.withContext(function($ctx1) {
  57576. jsObject=[];
  57577. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57578. $self._should_raise_((function(){
  57579. return $core.withContext(function($ctx2) {
  57580. return $recv(jsObject)._foo();
  57581. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57582. }),$globals.MessageNotUnderstood);
  57583. return self;
  57584. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57585. },
  57586. args: [],
  57587. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57588. referencedClasses: ["MessageNotUnderstood"],
  57589. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57590. }),
  57591. $globals.JSObjectProxyTest);
  57592. $core.addMethod(
  57593. $core.method({
  57594. selector: "testMessageSend",
  57595. protocol: "tests",
  57596. fn: function (){
  57597. var self=this,$self=this;
  57598. return $core.withContext(function($ctx1) {
  57599. var $2,$1,$4,$3;
  57600. $2=$self._jsObject();
  57601. $ctx1.sendIdx["jsObject"]=1;
  57602. $1=$recv($2)._a();
  57603. $self._assert_equals_($1,(1));
  57604. $ctx1.sendIdx["assert:equals:"]=1;
  57605. $4=$self._jsObject();
  57606. $ctx1.sendIdx["jsObject"]=2;
  57607. $3=$recv($4)._b();
  57608. $self._assert_equals_($3,(2));
  57609. $ctx1.sendIdx["assert:equals:"]=2;
  57610. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57611. return self;
  57612. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57613. },
  57614. args: [],
  57615. 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",
  57616. referencedClasses: [],
  57617. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57618. }),
  57619. $globals.JSObjectProxyTest);
  57620. $core.addMethod(
  57621. $core.method({
  57622. selector: "testMethodWithArguments",
  57623. protocol: "tests",
  57624. fn: function (){
  57625. var self=this,$self=this;
  57626. return $core.withContext(function($ctx1) {
  57627. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57628. return self;
  57629. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57630. },
  57631. args: [],
  57632. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57633. referencedClasses: [],
  57634. messageSends: ["assert:equals:", "c:", "jsObject"]
  57635. }),
  57636. $globals.JSObjectProxyTest);
  57637. $core.addMethod(
  57638. $core.method({
  57639. selector: "testNull",
  57640. protocol: "tests",
  57641. fn: function (){
  57642. var self=this,$self=this;
  57643. return $core.withContext(function($ctx1) {
  57644. var $2,$1;
  57645. $2=$recv($globals.JSObjectProxy)._null();
  57646. $ctx1.sendIdx["null"]=1;
  57647. $1=$recv($2)._isNil();
  57648. $self._assert_($1);
  57649. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57650. return self;
  57651. }, function($ctx1) {$ctx1.fill(self,"testNull",{},$globals.JSObjectProxyTest)});
  57652. },
  57653. args: [],
  57654. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57655. referencedClasses: ["JSObjectProxy", "JSON"],
  57656. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57657. }),
  57658. $globals.JSObjectProxyTest);
  57659. $core.addMethod(
  57660. $core.method({
  57661. selector: "testPrinting",
  57662. protocol: "tests",
  57663. fn: function (){
  57664. var self=this,$self=this;
  57665. return $core.withContext(function($ctx1) {
  57666. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57667. return self;
  57668. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57669. },
  57670. args: [],
  57671. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57672. referencedClasses: [],
  57673. messageSends: ["assert:equals:", "printString", "jsObject"]
  57674. }),
  57675. $globals.JSObjectProxyTest);
  57676. $core.addMethod(
  57677. $core.method({
  57678. selector: "testPropertyThatReturnsEmptyString",
  57679. protocol: "tests",
  57680. fn: function (){
  57681. var self=this,$self=this;
  57682. var object;
  57683. return $core.withContext(function($ctx1) {
  57684. var $1;
  57685. object=$self._jsObject();
  57686. $1=$recv(object)._d();
  57687. $ctx1.sendIdx["d"]=1;
  57688. $self._assert_equals_($1,"");
  57689. $ctx1.sendIdx["assert:equals:"]=1;
  57690. $recv(object)._d_("hello");
  57691. $self._assert_equals_($recv(object)._d(),"hello");
  57692. return self;
  57693. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57694. },
  57695. args: [],
  57696. 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'",
  57697. referencedClasses: [],
  57698. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57699. }),
  57700. $globals.JSObjectProxyTest);
  57701. $core.addMethod(
  57702. $core.method({
  57703. selector: "testPropertyThatReturnsUndefined",
  57704. protocol: "tests",
  57705. fn: function (){
  57706. var self=this,$self=this;
  57707. var object;
  57708. return $core.withContext(function($ctx1) {
  57709. object=$self._jsObject();
  57710. $self._shouldnt_raise_((function(){
  57711. return $core.withContext(function($ctx2) {
  57712. return $recv(object)._e();
  57713. $ctx2.sendIdx["e"]=1;
  57714. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57715. }),$globals.MessageNotUnderstood);
  57716. $self._assert_($recv($recv(object)._e())._isNil());
  57717. return self;
  57718. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57719. },
  57720. args: [],
  57721. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57722. referencedClasses: ["MessageNotUnderstood"],
  57723. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57724. }),
  57725. $globals.JSObjectProxyTest);
  57726. $core.addMethod(
  57727. $core.method({
  57728. selector: "testSetPropertyWithFalsyValue",
  57729. protocol: "tests",
  57730. fn: function (){
  57731. var self=this,$self=this;
  57732. var jsObject;
  57733. return $core.withContext(function($ctx1) {
  57734. var $1,$2,$3,$4,$5;
  57735. jsObject=$self._jsObject();
  57736. $1=$recv(jsObject)._a();
  57737. $ctx1.sendIdx["a"]=1;
  57738. $self._assert_equals_($1,(1));
  57739. $ctx1.sendIdx["assert:equals:"]=1;
  57740. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  57741. $ctx1.sendIdx["a:"]=1;
  57742. $2=$recv(jsObject)._a();
  57743. $ctx1.sendIdx["a"]=2;
  57744. $self._assert_equals_($2,nil);
  57745. $ctx1.sendIdx["assert:equals:"]=2;
  57746. $recv(jsObject)._a_((0));
  57747. $ctx1.sendIdx["a:"]=2;
  57748. $3=$recv(jsObject)._a();
  57749. $ctx1.sendIdx["a"]=3;
  57750. $self._assert_equals_($3,(0));
  57751. $ctx1.sendIdx["assert:equals:"]=3;
  57752. $recv(jsObject)._a_($self._jsUndefined());
  57753. $ctx1.sendIdx["a:"]=3;
  57754. $4=$recv(jsObject)._a();
  57755. $ctx1.sendIdx["a"]=4;
  57756. $self._assert_equals_($4,nil);
  57757. $ctx1.sendIdx["assert:equals:"]=4;
  57758. $recv(jsObject)._a_("");
  57759. $ctx1.sendIdx["a:"]=4;
  57760. $5=$recv(jsObject)._a();
  57761. $ctx1.sendIdx["a"]=5;
  57762. $self._assert_equals_($5,"");
  57763. $ctx1.sendIdx["assert:equals:"]=5;
  57764. $recv(jsObject)._a_(false);
  57765. $self._assert_equals_($recv(jsObject)._a(),false);
  57766. return self;
  57767. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57768. },
  57769. args: [],
  57770. source: "testSetPropertyWithFalsyValue\x0a\x09| jsObject |\x0a\x09jsObject := self jsObject.\x0a\x09self assert: (jsObject a) equals: 1.\x0a\x0a\x09jsObject a: JSObjectProxy null.\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",
  57771. referencedClasses: ["JSObjectProxy"],
  57772. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  57773. }),
  57774. $globals.JSObjectProxyTest);
  57775. $core.addMethod(
  57776. $core.method({
  57777. selector: "testUndefined",
  57778. protocol: "tests",
  57779. fn: function (){
  57780. var self=this,$self=this;
  57781. return $core.withContext(function($ctx1) {
  57782. var $2,$1;
  57783. $2=$recv($globals.JSObjectProxy)._undefined();
  57784. $ctx1.sendIdx["undefined"]=1;
  57785. $1=$recv($2)._isNil();
  57786. $self._assert_($1);
  57787. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  57788. return self;
  57789. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{},$globals.JSObjectProxyTest)});
  57790. },
  57791. args: [],
  57792. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  57793. referencedClasses: ["JSObjectProxy", "JSON"],
  57794. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  57795. }),
  57796. $globals.JSObjectProxyTest);
  57797. $core.addMethod(
  57798. $core.method({
  57799. selector: "testValue",
  57800. protocol: "tests",
  57801. fn: function (){
  57802. var self=this,$self=this;
  57803. var testObject;
  57804. return $core.withContext(function($ctx1) {
  57805. testObject=$self._jsObject();
  57806. $recv(testObject)._at_put_("value","aValue");
  57807. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57808. return self;
  57809. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57810. },
  57811. args: [],
  57812. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57813. referencedClasses: [],
  57814. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57815. }),
  57816. $globals.JSObjectProxyTest);
  57817. $core.addMethod(
  57818. $core.method({
  57819. selector: "testYourself",
  57820. protocol: "tests",
  57821. fn: function (){
  57822. var self=this,$self=this;
  57823. var object;
  57824. return $core.withContext(function($ctx1) {
  57825. var $1;
  57826. $1=$self._jsObject();
  57827. $recv($1)._d_("test");
  57828. object=$recv($1)._yourself();
  57829. $self._assert_equals_($recv(object)._d(),"test");
  57830. return self;
  57831. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57832. },
  57833. args: [],
  57834. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57835. referencedClasses: [],
  57836. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57837. }),
  57838. $globals.JSObjectProxyTest);
  57839. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57840. $core.addMethod(
  57841. $core.method({
  57842. selector: "testCatchingException",
  57843. protocol: "tests",
  57844. fn: function (){
  57845. var self=this,$self=this;
  57846. return $core.withContext(function($ctx1) {
  57847. $recv((function(){
  57848. return $core.withContext(function($ctx2) {
  57849. return $self._throwException();
  57850. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57851. }))._on_do_($globals.Error,(function(error){
  57852. return $core.withContext(function($ctx2) {
  57853. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57854. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57855. }));
  57856. return self;
  57857. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57858. },
  57859. args: [],
  57860. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57861. referencedClasses: ["Error"],
  57862. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57863. }),
  57864. $globals.JavaScriptExceptionTest);
  57865. $core.addMethod(
  57866. $core.method({
  57867. selector: "testRaisingException",
  57868. protocol: "tests",
  57869. fn: function (){
  57870. var self=this,$self=this;
  57871. return $core.withContext(function($ctx1) {
  57872. $self._should_raise_((function(){
  57873. return $core.withContext(function($ctx2) {
  57874. return $self._throwException();
  57875. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57876. }),$globals.JavaScriptException);
  57877. return self;
  57878. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57879. },
  57880. args: [],
  57881. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57882. referencedClasses: ["JavaScriptException"],
  57883. messageSends: ["should:raise:", "throwException"]
  57884. }),
  57885. $globals.JavaScriptExceptionTest);
  57886. $core.addMethod(
  57887. $core.method({
  57888. selector: "throwException",
  57889. protocol: "helpers",
  57890. fn: function (){
  57891. var self=this,$self=this;
  57892. return $core.withContext(function($ctx1) {
  57893. throw "test";
  57894. return self;
  57895. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57896. },
  57897. args: [],
  57898. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57899. referencedClasses: [],
  57900. messageSends: []
  57901. }),
  57902. $globals.JavaScriptExceptionTest);
  57903. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57904. $core.addMethod(
  57905. $core.method({
  57906. selector: "testValue",
  57907. protocol: "tests",
  57908. fn: function (){
  57909. var self=this,$self=this;
  57910. var messageSend;
  57911. return $core.withContext(function($ctx1) {
  57912. var $1;
  57913. $1=$recv($globals.MessageSend)._new();
  57914. $ctx1.sendIdx["new"]=1;
  57915. $recv($1)._receiver_($recv($globals.Object)._new());
  57916. $recv($1)._selector_("asString");
  57917. messageSend=$recv($1)._yourself();
  57918. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57919. return self;
  57920. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57921. },
  57922. args: [],
  57923. 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'",
  57924. referencedClasses: ["MessageSend", "Object"],
  57925. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57926. }),
  57927. $globals.MessageSendTest);
  57928. $core.addMethod(
  57929. $core.method({
  57930. selector: "testValueWithArguments",
  57931. protocol: "tests",
  57932. fn: function (){
  57933. var self=this,$self=this;
  57934. var messageSend;
  57935. return $core.withContext(function($ctx1) {
  57936. var $1;
  57937. $1=$recv($globals.MessageSend)._new();
  57938. $recv($1)._receiver_((2));
  57939. $recv($1)._selector_("+");
  57940. messageSend=$recv($1)._yourself();
  57941. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57942. $ctx1.sendIdx["assert:equals:"]=1;
  57943. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57944. return self;
  57945. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57946. },
  57947. args: [],
  57948. 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",
  57949. referencedClasses: ["MessageSend"],
  57950. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57951. }),
  57952. $globals.MessageSendTest);
  57953. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57954. $core.addMethod(
  57955. $core.method({
  57956. selector: "codeGeneratorClass",
  57957. protocol: "accessing",
  57958. fn: function (){
  57959. var self=this,$self=this;
  57960. return $globals.CodeGenerator;
  57961. },
  57962. args: [],
  57963. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57964. referencedClasses: ["CodeGenerator"],
  57965. messageSends: []
  57966. }),
  57967. $globals.MethodInheritanceTest);
  57968. $core.addMethod(
  57969. $core.method({
  57970. selector: "compiler",
  57971. protocol: "factory",
  57972. fn: function (){
  57973. var self=this,$self=this;
  57974. return $core.withContext(function($ctx1) {
  57975. var $1;
  57976. $1=$recv($globals.Compiler)._new();
  57977. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  57978. return $recv($1)._yourself();
  57979. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  57980. },
  57981. args: [],
  57982. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  57983. referencedClasses: ["Compiler"],
  57984. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  57985. }),
  57986. $globals.MethodInheritanceTest);
  57987. $core.addMethod(
  57988. $core.method({
  57989. selector: "deinstallBottom",
  57990. protocol: "testing",
  57991. fn: function (){
  57992. var self=this,$self=this;
  57993. return $core.withContext(function($ctx1) {
  57994. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  57995. return self;
  57996. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  57997. },
  57998. args: [],
  57999. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  58000. referencedClasses: [],
  58001. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  58002. }),
  58003. $globals.MethodInheritanceTest);
  58004. $core.addMethod(
  58005. $core.method({
  58006. selector: "deinstallMiddle",
  58007. protocol: "testing",
  58008. fn: function (){
  58009. var self=this,$self=this;
  58010. return $core.withContext(function($ctx1) {
  58011. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  58012. return self;
  58013. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  58014. },
  58015. args: [],
  58016. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  58017. referencedClasses: [],
  58018. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  58019. }),
  58020. $globals.MethodInheritanceTest);
  58021. $core.addMethod(
  58022. $core.method({
  58023. selector: "deinstallTop",
  58024. protocol: "testing",
  58025. fn: function (){
  58026. var self=this,$self=this;
  58027. return $core.withContext(function($ctx1) {
  58028. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  58029. return self;
  58030. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  58031. },
  58032. args: [],
  58033. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  58034. referencedClasses: [],
  58035. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  58036. }),
  58037. $globals.MethodInheritanceTest);
  58038. $core.addMethod(
  58039. $core.method({
  58040. selector: "installBottom:",
  58041. protocol: "testing",
  58042. fn: function (aString){
  58043. var self=this,$self=this;
  58044. return $core.withContext(function($ctx1) {
  58045. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  58046. return self;
  58047. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  58048. },
  58049. args: ["aString"],
  58050. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  58051. referencedClasses: [],
  58052. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  58053. }),
  58054. $globals.MethodInheritanceTest);
  58055. $core.addMethod(
  58056. $core.method({
  58057. selector: "installMiddle:",
  58058. protocol: "testing",
  58059. fn: function (aString){
  58060. var self=this,$self=this;
  58061. return $core.withContext(function($ctx1) {
  58062. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  58063. return self;
  58064. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  58065. },
  58066. args: ["aString"],
  58067. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  58068. referencedClasses: [],
  58069. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  58070. }),
  58071. $globals.MethodInheritanceTest);
  58072. $core.addMethod(
  58073. $core.method({
  58074. selector: "installTop:",
  58075. protocol: "testing",
  58076. fn: function (aString){
  58077. var self=this,$self=this;
  58078. return $core.withContext(function($ctx1) {
  58079. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  58080. return self;
  58081. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  58082. },
  58083. args: ["aString"],
  58084. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  58085. referencedClasses: [],
  58086. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  58087. }),
  58088. $globals.MethodInheritanceTest);
  58089. $core.addMethod(
  58090. $core.method({
  58091. selector: "setUp",
  58092. protocol: "initialization",
  58093. fn: function (){
  58094. var self=this,$self=this;
  58095. return $core.withContext(function($ctx1) {
  58096. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  58097. $ctx1.sendIdx["new"]=1;
  58098. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  58099. $ctx1.sendIdx["new"]=2;
  58100. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  58101. $self["@method"]=nil;
  58102. $self["@performBlock"]=(function(){
  58103. return $core.withContext(function($ctx2) {
  58104. return $self._error_("performBlock not initialized");
  58105. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58106. });
  58107. return self;
  58108. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  58109. },
  58110. args: [],
  58111. 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' ]",
  58112. referencedClasses: [],
  58113. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  58114. }),
  58115. $globals.MethodInheritanceTest);
  58116. $core.addMethod(
  58117. $core.method({
  58118. selector: "shouldMNU",
  58119. protocol: "testing",
  58120. fn: function (){
  58121. var self=this,$self=this;
  58122. return $core.withContext(function($ctx1) {
  58123. $self._shouldMNUTop();
  58124. $self._shouldMNUMiddle();
  58125. $self._shouldMNUBottom();
  58126. return self;
  58127. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  58128. },
  58129. args: [],
  58130. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  58131. referencedClasses: [],
  58132. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  58133. }),
  58134. $globals.MethodInheritanceTest);
  58135. $core.addMethod(
  58136. $core.method({
  58137. selector: "shouldMNUBottom",
  58138. protocol: "testing",
  58139. fn: function (){
  58140. var self=this,$self=this;
  58141. return $core.withContext(function($ctx1) {
  58142. $self._should_raise_((function(){
  58143. return $core.withContext(function($ctx2) {
  58144. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58145. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58146. }),$globals.MessageNotUnderstood);
  58147. return self;
  58148. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  58149. },
  58150. args: [],
  58151. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  58152. referencedClasses: ["MessageNotUnderstood"],
  58153. messageSends: ["should:raise:", "value:"]
  58154. }),
  58155. $globals.MethodInheritanceTest);
  58156. $core.addMethod(
  58157. $core.method({
  58158. selector: "shouldMNUMiddle",
  58159. protocol: "testing",
  58160. fn: function (){
  58161. var self=this,$self=this;
  58162. return $core.withContext(function($ctx1) {
  58163. $self._should_raise_((function(){
  58164. return $core.withContext(function($ctx2) {
  58165. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58167. }),$globals.MessageNotUnderstood);
  58168. return self;
  58169. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  58170. },
  58171. args: [],
  58172. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  58173. referencedClasses: ["MessageNotUnderstood"],
  58174. messageSends: ["should:raise:", "value:"]
  58175. }),
  58176. $globals.MethodInheritanceTest);
  58177. $core.addMethod(
  58178. $core.method({
  58179. selector: "shouldMNUTop",
  58180. protocol: "testing",
  58181. fn: function (){
  58182. var self=this,$self=this;
  58183. return $core.withContext(function($ctx1) {
  58184. $self._should_raise_((function(){
  58185. return $core.withContext(function($ctx2) {
  58186. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58187. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58188. }),$globals.MessageNotUnderstood);
  58189. return self;
  58190. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  58191. },
  58192. args: [],
  58193. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  58194. referencedClasses: ["MessageNotUnderstood"],
  58195. messageSends: ["should:raise:", "value:"]
  58196. }),
  58197. $globals.MethodInheritanceTest);
  58198. $core.addMethod(
  58199. $core.method({
  58200. selector: "shouldReturn:",
  58201. protocol: "testing",
  58202. fn: function (anObject){
  58203. var self=this,$self=this;
  58204. var result;
  58205. return $core.withContext(function($ctx1) {
  58206. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58207. $ctx1.sendIdx["value:"]=1;
  58208. $self._assert_equals_(["top",anObject],["top",result]);
  58209. $ctx1.sendIdx["assert:equals:"]=1;
  58210. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58211. $ctx1.sendIdx["value:"]=2;
  58212. $self._assert_equals_(["middle",anObject],["middle",result]);
  58213. $ctx1.sendIdx["assert:equals:"]=2;
  58214. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58215. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  58216. return self;
  58217. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  58218. },
  58219. args: ["anObject"],
  58220. 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 }",
  58221. referencedClasses: [],
  58222. messageSends: ["value:", "assert:equals:"]
  58223. }),
  58224. $globals.MethodInheritanceTest);
  58225. $core.addMethod(
  58226. $core.method({
  58227. selector: "shouldReturn:and:and:",
  58228. protocol: "testing",
  58229. fn: function (anObject,anObject2,anObject3){
  58230. var self=this,$self=this;
  58231. var result;
  58232. return $core.withContext(function($ctx1) {
  58233. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58234. $ctx1.sendIdx["value:"]=1;
  58235. $self._assert_equals_(["top",anObject],["top",result]);
  58236. $ctx1.sendIdx["assert:equals:"]=1;
  58237. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58238. $ctx1.sendIdx["value:"]=2;
  58239. $self._assert_equals_(["middle",anObject2],["middle",result]);
  58240. $ctx1.sendIdx["assert:equals:"]=2;
  58241. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58242. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  58243. return self;
  58244. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  58245. },
  58246. args: ["anObject", "anObject2", "anObject3"],
  58247. 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 }",
  58248. referencedClasses: [],
  58249. messageSends: ["value:", "assert:equals:"]
  58250. }),
  58251. $globals.MethodInheritanceTest);
  58252. $core.addMethod(
  58253. $core.method({
  58254. selector: "targetClassBottom",
  58255. protocol: "accessing",
  58256. fn: function (){
  58257. var self=this,$self=this;
  58258. return $globals.JavaScriptException;
  58259. },
  58260. args: [],
  58261. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  58262. referencedClasses: ["JavaScriptException"],
  58263. messageSends: []
  58264. }),
  58265. $globals.MethodInheritanceTest);
  58266. $core.addMethod(
  58267. $core.method({
  58268. selector: "targetClassMiddle",
  58269. protocol: "accessing",
  58270. fn: function (){
  58271. var self=this,$self=this;
  58272. return $globals.Error;
  58273. },
  58274. args: [],
  58275. source: "targetClassMiddle\x0a\x09^ Error",
  58276. referencedClasses: ["Error"],
  58277. messageSends: []
  58278. }),
  58279. $globals.MethodInheritanceTest);
  58280. $core.addMethod(
  58281. $core.method({
  58282. selector: "targetClassTop",
  58283. protocol: "accessing",
  58284. fn: function (){
  58285. var self=this,$self=this;
  58286. return $globals.Object;
  58287. },
  58288. args: [],
  58289. source: "targetClassTop\x0a\x09^ Object",
  58290. referencedClasses: ["Object"],
  58291. messageSends: []
  58292. }),
  58293. $globals.MethodInheritanceTest);
  58294. $core.addMethod(
  58295. $core.method({
  58296. selector: "tearDown",
  58297. protocol: "initialization",
  58298. fn: function (){
  58299. var self=this,$self=this;
  58300. return $core.withContext(function($ctx1) {
  58301. $recv((function(){
  58302. return $core.withContext(function($ctx2) {
  58303. return $self._deinstallTop();
  58304. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58305. }))._on_do_($globals.Error,(function(){
  58306. }));
  58307. $ctx1.sendIdx["on:do:"]=1;
  58308. $recv((function(){
  58309. return $core.withContext(function($ctx2) {
  58310. return $self._deinstallMiddle();
  58311. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58312. }))._on_do_($globals.Error,(function(){
  58313. }));
  58314. $ctx1.sendIdx["on:do:"]=2;
  58315. $recv((function(){
  58316. return $core.withContext(function($ctx2) {
  58317. return $self._deinstallBottom();
  58318. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58319. }))._on_do_($globals.Error,(function(){
  58320. }));
  58321. return self;
  58322. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  58323. },
  58324. args: [],
  58325. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  58326. referencedClasses: ["Error"],
  58327. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  58328. }),
  58329. $globals.MethodInheritanceTest);
  58330. $core.addMethod(
  58331. $core.method({
  58332. selector: "testMNU11",
  58333. protocol: "tests",
  58334. fn: function (){
  58335. var self=this,$self=this;
  58336. return $core.withContext(function($ctx1) {
  58337. $self["@performBlock"]=(function(x){
  58338. return $core.withContext(function($ctx2) {
  58339. return $recv(x)._foo();
  58340. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58341. });
  58342. $self._shouldMNU();
  58343. $ctx1.sendIdx["shouldMNU"]=1;
  58344. $self._installTop_("foo ^ false");
  58345. $ctx1.sendIdx["installTop:"]=1;
  58346. $self._installTop_("foo ^ true");
  58347. $self._deinstallTop();
  58348. $self._shouldMNU();
  58349. return self;
  58350. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  58351. },
  58352. args: [],
  58353. 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",
  58354. referencedClasses: [],
  58355. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  58356. }),
  58357. $globals.MethodInheritanceTest);
  58358. $core.addMethod(
  58359. $core.method({
  58360. selector: "testMNU22",
  58361. protocol: "tests",
  58362. fn: function (){
  58363. var self=this,$self=this;
  58364. return $core.withContext(function($ctx1) {
  58365. $self["@performBlock"]=(function(x){
  58366. return $core.withContext(function($ctx2) {
  58367. return $recv(x)._foo();
  58368. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58369. });
  58370. $self._shouldMNU();
  58371. $ctx1.sendIdx["shouldMNU"]=1;
  58372. $self._installMiddle_("foo ^ false");
  58373. $ctx1.sendIdx["installMiddle:"]=1;
  58374. $self._installMiddle_("foo ^ true");
  58375. $self._deinstallMiddle();
  58376. $self._shouldMNU();
  58377. return self;
  58378. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  58379. },
  58380. args: [],
  58381. 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",
  58382. referencedClasses: [],
  58383. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58384. }),
  58385. $globals.MethodInheritanceTest);
  58386. $core.addMethod(
  58387. $core.method({
  58388. selector: "testReturns1",
  58389. protocol: "tests",
  58390. fn: function (){
  58391. var self=this,$self=this;
  58392. return $core.withContext(function($ctx1) {
  58393. $self["@performBlock"]=(function(x){
  58394. return $core.withContext(function($ctx2) {
  58395. return $recv(x)._foo();
  58396. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58397. });
  58398. $self._installTop_("foo ^ false");
  58399. $ctx1.sendIdx["installTop:"]=1;
  58400. $self._shouldReturn_(false);
  58401. $ctx1.sendIdx["shouldReturn:"]=1;
  58402. $self._installTop_("foo ^ true");
  58403. $self._shouldReturn_(true);
  58404. return self;
  58405. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58406. },
  58407. args: [],
  58408. 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",
  58409. referencedClasses: [],
  58410. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58411. }),
  58412. $globals.MethodInheritanceTest);
  58413. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58414. $core.addMethod(
  58415. $core.method({
  58416. selector: "testAbs",
  58417. protocol: "tests",
  58418. fn: function (){
  58419. var self=this,$self=this;
  58420. return $core.withContext(function($ctx1) {
  58421. var $1;
  58422. $1=(4)._abs();
  58423. $ctx1.sendIdx["abs"]=1;
  58424. $self._assert_equals_($1,(4));
  58425. $ctx1.sendIdx["assert:equals:"]=1;
  58426. $self._assert_equals_((-4)._abs(),(4));
  58427. return self;
  58428. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58429. },
  58430. args: [],
  58431. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58432. referencedClasses: [],
  58433. messageSends: ["assert:equals:", "abs"]
  58434. }),
  58435. $globals.NumberTest);
  58436. $core.addMethod(
  58437. $core.method({
  58438. selector: "testArithmetic",
  58439. protocol: "tests",
  58440. fn: function (){
  58441. var self=this,$self=this;
  58442. return $core.withContext(function($ctx1) {
  58443. var $1,$2,$3,$5,$4;
  58444. $1=(1.5).__plus((1));
  58445. $ctx1.sendIdx["+"]=1;
  58446. $self._assert_equals_($1,(2.5));
  58447. $ctx1.sendIdx["assert:equals:"]=1;
  58448. $2=(2).__minus((1));
  58449. $ctx1.sendIdx["-"]=1;
  58450. $self._assert_equals_($2,(1));
  58451. $ctx1.sendIdx["assert:equals:"]=2;
  58452. $self._assert_equals_((-2).__minus((1)),(-3));
  58453. $ctx1.sendIdx["assert:equals:"]=3;
  58454. $self._assert_equals_((12).__slash((2)),(6));
  58455. $ctx1.sendIdx["assert:equals:"]=4;
  58456. $3=(3).__star((4));
  58457. $ctx1.sendIdx["*"]=1;
  58458. $self._assert_equals_($3,(12));
  58459. $ctx1.sendIdx["assert:equals:"]=5;
  58460. $self._assert_equals_((7).__slash_slash((2)),(3));
  58461. $ctx1.sendIdx["assert:equals:"]=6;
  58462. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58463. $ctx1.sendIdx["assert:equals:"]=7;
  58464. $5=(1).__plus((2));
  58465. $ctx1.sendIdx["+"]=2;
  58466. $4=$recv($5).__star((3));
  58467. $ctx1.sendIdx["*"]=2;
  58468. $self._assert_equals_($4,(9));
  58469. $ctx1.sendIdx["assert:equals:"]=8;
  58470. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58471. return self;
  58472. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58473. },
  58474. args: [],
  58475. 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",
  58476. referencedClasses: [],
  58477. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58478. }),
  58479. $globals.NumberTest);
  58480. $core.addMethod(
  58481. $core.method({
  58482. selector: "testAsNumber",
  58483. protocol: "tests",
  58484. fn: function (){
  58485. var self=this,$self=this;
  58486. return $core.withContext(function($ctx1) {
  58487. $self._assert_equals_((3)._asNumber(),(3));
  58488. return self;
  58489. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58490. },
  58491. args: [],
  58492. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58493. referencedClasses: [],
  58494. messageSends: ["assert:equals:", "asNumber"]
  58495. }),
  58496. $globals.NumberTest);
  58497. $core.addMethod(
  58498. $core.method({
  58499. selector: "testBetweenAnd",
  58500. protocol: "tests",
  58501. fn: function (){
  58502. var self=this,$self=this;
  58503. return $core.withContext(function($ctx1) {
  58504. var $1,$3,$2,$5,$4;
  58505. $1=(4)._between_and_((3),(5));
  58506. $ctx1.sendIdx["between:and:"]=1;
  58507. $self._assert_($1);
  58508. $ctx1.sendIdx["assert:"]=1;
  58509. $3=(1)._between_and_((5),(6));
  58510. $ctx1.sendIdx["between:and:"]=2;
  58511. $2=$recv($3)._not();
  58512. $ctx1.sendIdx["not"]=1;
  58513. $self._assert_($2);
  58514. $ctx1.sendIdx["assert:"]=2;
  58515. $5=(90)._between_and_((67),(87));
  58516. $ctx1.sendIdx["between:and:"]=3;
  58517. $4=$recv($5)._not();
  58518. $self._assert_($4);
  58519. $ctx1.sendIdx["assert:"]=3;
  58520. $self._assert_((1)._between_and_((1),(1)));
  58521. return self;
  58522. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58523. },
  58524. args: [],
  58525. source: "testBetweenAnd\x0a\x09self assert: (4 between: 3 and: 5).\x0a\x09self assert: (1 between: 5 and: 6) not.\x0a\x09self assert: (90 between: 67 and: 87) not.\x0a\x09self assert: (1 between: 1 and: 1).",
  58526. referencedClasses: [],
  58527. messageSends: ["assert:", "between:and:", "not"]
  58528. }),
  58529. $globals.NumberTest);
  58530. $core.addMethod(
  58531. $core.method({
  58532. selector: "testBitAnd",
  58533. protocol: "tests",
  58534. fn: function (){
  58535. var self=this,$self=this;
  58536. return $core.withContext(function($ctx1) {
  58537. var $1,$2;
  58538. $1=(15)._bitAnd_((2));
  58539. $ctx1.sendIdx["bitAnd:"]=1;
  58540. $self._assert_equals_($1,(2));
  58541. $ctx1.sendIdx["assert:equals:"]=1;
  58542. $2=(15)._bitAnd_((15));
  58543. $ctx1.sendIdx["bitAnd:"]=2;
  58544. $self._assert_equals_($2,(15));
  58545. $ctx1.sendIdx["assert:equals:"]=2;
  58546. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58547. return self;
  58548. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58549. },
  58550. args: [],
  58551. source: "testBitAnd\x0a\x09self assert: (15 bitAnd: 2) equals: 2.\x0a\x09self assert: (15 bitAnd: 15) equals: 15.\x0a\x09self assert: (-1 bitAnd: 1021) equals: 1021",
  58552. referencedClasses: [],
  58553. messageSends: ["assert:equals:", "bitAnd:"]
  58554. }),
  58555. $globals.NumberTest);
  58556. $core.addMethod(
  58557. $core.method({
  58558. selector: "testBitNot",
  58559. protocol: "tests",
  58560. fn: function (){
  58561. var self=this,$self=this;
  58562. return $core.withContext(function($ctx1) {
  58563. var $1,$2;
  58564. $1=(2)._bitNot();
  58565. $ctx1.sendIdx["bitNot"]=1;
  58566. $self._assert_equals_($1,(-3));
  58567. $ctx1.sendIdx["assert:equals:"]=1;
  58568. $2=(-1)._bitNot();
  58569. $ctx1.sendIdx["bitNot"]=2;
  58570. $self._assert_equals_($2,(0));
  58571. $ctx1.sendIdx["assert:equals:"]=2;
  58572. $self._assert_equals_((-1022)._bitNot(),(1021));
  58573. return self;
  58574. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58575. },
  58576. args: [],
  58577. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58578. referencedClasses: [],
  58579. messageSends: ["assert:equals:", "bitNot"]
  58580. }),
  58581. $globals.NumberTest);
  58582. $core.addMethod(
  58583. $core.method({
  58584. selector: "testBitOr",
  58585. protocol: "tests",
  58586. fn: function (){
  58587. var self=this,$self=this;
  58588. return $core.withContext(function($ctx1) {
  58589. var $1,$2;
  58590. $1=(2)._bitOr_((4));
  58591. $ctx1.sendIdx["bitOr:"]=1;
  58592. $self._assert_equals_($1,(6));
  58593. $ctx1.sendIdx["assert:equals:"]=1;
  58594. $2=(7)._bitOr_((2));
  58595. $ctx1.sendIdx["bitOr:"]=2;
  58596. $self._assert_equals_($2,(7));
  58597. $ctx1.sendIdx["assert:equals:"]=2;
  58598. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58599. return self;
  58600. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58601. },
  58602. args: [],
  58603. source: "testBitOr\x0a\x09self assert: (2 bitOr: 4) equals: 6.\x0a\x09self assert: (7 bitOr: 2) equals: 7.\x0a\x09self assert: (-1 bitOr: 1021) equals: -1",
  58604. referencedClasses: [],
  58605. messageSends: ["assert:equals:", "bitOr:"]
  58606. }),
  58607. $globals.NumberTest);
  58608. $core.addMethod(
  58609. $core.method({
  58610. selector: "testBitXor",
  58611. protocol: "tests",
  58612. fn: function (){
  58613. var self=this,$self=this;
  58614. return $core.withContext(function($ctx1) {
  58615. var $1,$2,$3;
  58616. $1=(2)._bitXor_((4));
  58617. $ctx1.sendIdx["bitXor:"]=1;
  58618. $self._assert_equals_($1,(6));
  58619. $ctx1.sendIdx["assert:equals:"]=1;
  58620. $2=(7)._bitXor_((2));
  58621. $ctx1.sendIdx["bitXor:"]=2;
  58622. $self._assert_equals_($2,(5));
  58623. $ctx1.sendIdx["assert:equals:"]=2;
  58624. $3=(-1)._bitXor_((1021));
  58625. $ctx1.sendIdx["bitXor:"]=3;
  58626. $self._assert_equals_($3,(-1022));
  58627. $ctx1.sendIdx["assert:equals:"]=3;
  58628. $self._assert_equals_((91)._bitXor_((91)),(0));
  58629. return self;
  58630. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58631. },
  58632. args: [],
  58633. source: "testBitXor\x0a\x09self assert: (2 bitXor: 4) equals: 6.\x0a\x09self assert: (7 bitXor: 2) equals: 5.\x0a\x09self assert: (-1 bitXor: 1021) equals: -1022.\x0a\x09self assert: (91 bitXor: 91) equals: 0",
  58634. referencedClasses: [],
  58635. messageSends: ["assert:equals:", "bitXor:"]
  58636. }),
  58637. $globals.NumberTest);
  58638. $core.addMethod(
  58639. $core.method({
  58640. selector: "testCeiling",
  58641. protocol: "tests",
  58642. fn: function (){
  58643. var self=this,$self=this;
  58644. return $core.withContext(function($ctx1) {
  58645. var $1,$2;
  58646. $1=(1.2)._ceiling();
  58647. $ctx1.sendIdx["ceiling"]=1;
  58648. $self._assert_equals_($1,(2));
  58649. $ctx1.sendIdx["assert:equals:"]=1;
  58650. $2=(-1.2)._ceiling();
  58651. $ctx1.sendIdx["ceiling"]=2;
  58652. $self._assert_equals_($2,(-1));
  58653. $ctx1.sendIdx["assert:equals:"]=2;
  58654. $self._assert_equals_((1)._ceiling(),(1));
  58655. return self;
  58656. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58657. },
  58658. args: [],
  58659. 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.",
  58660. referencedClasses: [],
  58661. messageSends: ["assert:equals:", "ceiling"]
  58662. }),
  58663. $globals.NumberTest);
  58664. $core.addMethod(
  58665. $core.method({
  58666. selector: "testComparison",
  58667. protocol: "tests",
  58668. fn: function (){
  58669. var self=this,$self=this;
  58670. return $core.withContext(function($ctx1) {
  58671. var $1,$2,$3,$4;
  58672. $1=(3).__gt((2));
  58673. $ctx1.sendIdx[">"]=1;
  58674. $self._assert_($1);
  58675. $ctx1.sendIdx["assert:"]=1;
  58676. $2=(2).__lt((3));
  58677. $ctx1.sendIdx["<"]=1;
  58678. $self._assert_($2);
  58679. $ctx1.sendIdx["assert:"]=2;
  58680. $self._deny_((3).__lt((2)));
  58681. $ctx1.sendIdx["deny:"]=1;
  58682. $self._deny_((2).__gt((3)));
  58683. $3=(3).__gt_eq((3));
  58684. $ctx1.sendIdx[">="]=1;
  58685. $self._assert_($3);
  58686. $ctx1.sendIdx["assert:"]=3;
  58687. $self._assert_((3.1).__gt_eq((3)));
  58688. $ctx1.sendIdx["assert:"]=4;
  58689. $4=(3).__lt_eq((3));
  58690. $ctx1.sendIdx["<="]=1;
  58691. $self._assert_($4);
  58692. $ctx1.sendIdx["assert:"]=5;
  58693. $self._assert_((3).__lt_eq((3.1)));
  58694. return self;
  58695. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58696. },
  58697. args: [],
  58698. 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",
  58699. referencedClasses: [],
  58700. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58701. }),
  58702. $globals.NumberTest);
  58703. $core.addMethod(
  58704. $core.method({
  58705. selector: "testCopying",
  58706. protocol: "tests",
  58707. fn: function (){
  58708. var self=this,$self=this;
  58709. return $core.withContext(function($ctx1) {
  58710. var $1;
  58711. $1=$recv((1)._copy()).__eq_eq((1));
  58712. $ctx1.sendIdx["=="]=1;
  58713. $self._assert_($1);
  58714. $ctx1.sendIdx["assert:"]=1;
  58715. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58716. return self;
  58717. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58718. },
  58719. args: [],
  58720. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58721. referencedClasses: [],
  58722. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58723. }),
  58724. $globals.NumberTest);
  58725. $core.addMethod(
  58726. $core.method({
  58727. selector: "testDegreesToRadians",
  58728. protocol: "tests",
  58729. fn: function (){
  58730. var self=this,$self=this;
  58731. return $core.withContext(function($ctx1) {
  58732. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58733. return self;
  58734. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58735. },
  58736. args: [],
  58737. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58738. referencedClasses: ["Number"],
  58739. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58740. }),
  58741. $globals.NumberTest);
  58742. $core.addMethod(
  58743. $core.method({
  58744. selector: "testEquality",
  58745. protocol: "tests",
  58746. fn: function (){
  58747. var self=this,$self=this;
  58748. return $core.withContext(function($ctx1) {
  58749. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58750. $1=(1).__eq((1));
  58751. $ctx1.sendIdx["="]=1;
  58752. $self._assert_($1);
  58753. $ctx1.sendIdx["assert:"]=1;
  58754. $2=(0).__eq((0));
  58755. $ctx1.sendIdx["="]=2;
  58756. $self._assert_($2);
  58757. $ctx1.sendIdx["assert:"]=2;
  58758. $3=(1).__eq((0));
  58759. $ctx1.sendIdx["="]=3;
  58760. $self._deny_($3);
  58761. $ctx1.sendIdx["deny:"]=1;
  58762. $5=(1)._yourself();
  58763. $ctx1.sendIdx["yourself"]=1;
  58764. $4=$recv($5).__eq((1));
  58765. $ctx1.sendIdx["="]=4;
  58766. $self._assert_($4);
  58767. $ctx1.sendIdx["assert:"]=3;
  58768. $7=(1)._yourself();
  58769. $ctx1.sendIdx["yourself"]=2;
  58770. $6=(1).__eq($7);
  58771. $ctx1.sendIdx["="]=5;
  58772. $self._assert_($6);
  58773. $ctx1.sendIdx["assert:"]=4;
  58774. $9=(1)._yourself();
  58775. $ctx1.sendIdx["yourself"]=3;
  58776. $8=$recv($9).__eq((1)._yourself());
  58777. $ctx1.sendIdx["="]=6;
  58778. $self._assert_($8);
  58779. $10=(0).__eq(false);
  58780. $ctx1.sendIdx["="]=7;
  58781. $self._deny_($10);
  58782. $ctx1.sendIdx["deny:"]=2;
  58783. $11=false.__eq((0));
  58784. $ctx1.sendIdx["="]=8;
  58785. $self._deny_($11);
  58786. $ctx1.sendIdx["deny:"]=3;
  58787. $12="".__eq((0));
  58788. $ctx1.sendIdx["="]=9;
  58789. $self._deny_($12);
  58790. $ctx1.sendIdx["deny:"]=4;
  58791. $self._deny_((0).__eq(""));
  58792. return self;
  58793. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58794. },
  58795. args: [],
  58796. 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 = ''",
  58797. referencedClasses: [],
  58798. messageSends: ["assert:", "=", "deny:", "yourself"]
  58799. }),
  58800. $globals.NumberTest);
  58801. $core.addMethod(
  58802. $core.method({
  58803. selector: "testFloor",
  58804. protocol: "tests",
  58805. fn: function (){
  58806. var self=this,$self=this;
  58807. return $core.withContext(function($ctx1) {
  58808. var $1,$2;
  58809. $1=(1.2)._floor();
  58810. $ctx1.sendIdx["floor"]=1;
  58811. $self._assert_equals_($1,(1));
  58812. $ctx1.sendIdx["assert:equals:"]=1;
  58813. $2=(-1.2)._floor();
  58814. $ctx1.sendIdx["floor"]=2;
  58815. $self._assert_equals_($2,(-2));
  58816. $ctx1.sendIdx["assert:equals:"]=2;
  58817. $self._assert_equals_((1)._floor(),(1));
  58818. return self;
  58819. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58820. },
  58821. args: [],
  58822. 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.",
  58823. referencedClasses: [],
  58824. messageSends: ["assert:equals:", "floor"]
  58825. }),
  58826. $globals.NumberTest);
  58827. $core.addMethod(
  58828. $core.method({
  58829. selector: "testHexNumbers",
  58830. protocol: "tests",
  58831. fn: function (){
  58832. var self=this,$self=this;
  58833. return $core.withContext(function($ctx1) {
  58834. var $1,$2,$3,$4,$5;
  58835. $self._assert_equals_((9),(9));
  58836. $ctx1.sendIdx["assert:equals:"]=1;
  58837. $1=(10)._truncated();
  58838. $ctx1.sendIdx["truncated"]=1;
  58839. $self._assert_equals_($1,(10));
  58840. $ctx1.sendIdx["assert:equals:"]=2;
  58841. $2=(11)._truncated();
  58842. $ctx1.sendIdx["truncated"]=2;
  58843. $self._assert_equals_($2,(11));
  58844. $ctx1.sendIdx["assert:equals:"]=3;
  58845. $3=(12)._truncated();
  58846. $ctx1.sendIdx["truncated"]=3;
  58847. $self._assert_equals_($3,(12));
  58848. $ctx1.sendIdx["assert:equals:"]=4;
  58849. $4=(13)._truncated();
  58850. $ctx1.sendIdx["truncated"]=4;
  58851. $self._assert_equals_($4,(13));
  58852. $ctx1.sendIdx["assert:equals:"]=5;
  58853. $5=(14)._truncated();
  58854. $ctx1.sendIdx["truncated"]=5;
  58855. $self._assert_equals_($5,(14));
  58856. $ctx1.sendIdx["assert:equals:"]=6;
  58857. $self._assert_equals_((15)._truncated(),(15));
  58858. return self;
  58859. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58860. },
  58861. args: [],
  58862. 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",
  58863. referencedClasses: [],
  58864. messageSends: ["assert:equals:", "truncated"]
  58865. }),
  58866. $globals.NumberTest);
  58867. $core.addMethod(
  58868. $core.method({
  58869. selector: "testIdentity",
  58870. protocol: "tests",
  58871. fn: function (){
  58872. var self=this,$self=this;
  58873. return $core.withContext(function($ctx1) {
  58874. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58875. $1=(1).__eq_eq((1));
  58876. $ctx1.sendIdx["=="]=1;
  58877. $self._assert_($1);
  58878. $ctx1.sendIdx["assert:"]=1;
  58879. $2=(0).__eq_eq((0));
  58880. $ctx1.sendIdx["=="]=2;
  58881. $self._assert_($2);
  58882. $ctx1.sendIdx["assert:"]=2;
  58883. $3=(1).__eq_eq((0));
  58884. $ctx1.sendIdx["=="]=3;
  58885. $self._deny_($3);
  58886. $ctx1.sendIdx["deny:"]=1;
  58887. $5=(1)._yourself();
  58888. $ctx1.sendIdx["yourself"]=1;
  58889. $4=$recv($5).__eq_eq((1));
  58890. $ctx1.sendIdx["=="]=4;
  58891. $self._assert_($4);
  58892. $ctx1.sendIdx["assert:"]=3;
  58893. $7=(1)._yourself();
  58894. $ctx1.sendIdx["yourself"]=2;
  58895. $6=(1).__eq_eq($7);
  58896. $ctx1.sendIdx["=="]=5;
  58897. $self._assert_($6);
  58898. $ctx1.sendIdx["assert:"]=4;
  58899. $9=(1)._yourself();
  58900. $ctx1.sendIdx["yourself"]=3;
  58901. $8=$recv($9).__eq_eq((1)._yourself());
  58902. $ctx1.sendIdx["=="]=6;
  58903. $self._assert_($8);
  58904. $self._deny_((1).__eq_eq((2)));
  58905. return self;
  58906. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58907. },
  58908. args: [],
  58909. 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",
  58910. referencedClasses: [],
  58911. messageSends: ["assert:", "==", "deny:", "yourself"]
  58912. }),
  58913. $globals.NumberTest);
  58914. $core.addMethod(
  58915. $core.method({
  58916. selector: "testInvalidHexNumbers",
  58917. protocol: "tests",
  58918. fn: function (){
  58919. var self=this,$self=this;
  58920. return $core.withContext(function($ctx1) {
  58921. $self._should_raise_((function(){
  58922. return $core.withContext(function($ctx2) {
  58923. return (16)._rG();
  58924. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58925. }),$globals.MessageNotUnderstood);
  58926. $ctx1.sendIdx["should:raise:"]=1;
  58927. $self._should_raise_((function(){
  58928. return $core.withContext(function($ctx2) {
  58929. return (16)._rg();
  58930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58931. }),$globals.MessageNotUnderstood);
  58932. $ctx1.sendIdx["should:raise:"]=2;
  58933. $self._should_raise_((function(){
  58934. return $core.withContext(function($ctx2) {
  58935. return (16)._rH();
  58936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58937. }),$globals.MessageNotUnderstood);
  58938. $ctx1.sendIdx["should:raise:"]=3;
  58939. $self._should_raise_((function(){
  58940. return $core.withContext(function($ctx2) {
  58941. return (16)._rh();
  58942. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58943. }),$globals.MessageNotUnderstood);
  58944. $ctx1.sendIdx["should:raise:"]=4;
  58945. $self._should_raise_((function(){
  58946. return $core.withContext(function($ctx2) {
  58947. return (16)._rI();
  58948. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58949. }),$globals.MessageNotUnderstood);
  58950. $ctx1.sendIdx["should:raise:"]=5;
  58951. $self._should_raise_((function(){
  58952. return $core.withContext(function($ctx2) {
  58953. return (16)._ri();
  58954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58955. }),$globals.MessageNotUnderstood);
  58956. $ctx1.sendIdx["should:raise:"]=6;
  58957. $self._should_raise_((function(){
  58958. return $core.withContext(function($ctx2) {
  58959. return (16)._rJ();
  58960. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58961. }),$globals.MessageNotUnderstood);
  58962. $ctx1.sendIdx["should:raise:"]=7;
  58963. $self._should_raise_((function(){
  58964. return $core.withContext(function($ctx2) {
  58965. return (16)._rj();
  58966. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58967. }),$globals.MessageNotUnderstood);
  58968. $ctx1.sendIdx["should:raise:"]=8;
  58969. $self._should_raise_((function(){
  58970. return $core.withContext(function($ctx2) {
  58971. return (16)._rK();
  58972. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  58973. }),$globals.MessageNotUnderstood);
  58974. $ctx1.sendIdx["should:raise:"]=9;
  58975. $self._should_raise_((function(){
  58976. return $core.withContext(function($ctx2) {
  58977. return (16)._rk();
  58978. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  58979. }),$globals.MessageNotUnderstood);
  58980. $ctx1.sendIdx["should:raise:"]=10;
  58981. $self._should_raise_((function(){
  58982. return $core.withContext(function($ctx2) {
  58983. return (16)._rL();
  58984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  58985. }),$globals.MessageNotUnderstood);
  58986. $ctx1.sendIdx["should:raise:"]=11;
  58987. $self._should_raise_((function(){
  58988. return $core.withContext(function($ctx2) {
  58989. return (16)._rl();
  58990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  58991. }),$globals.MessageNotUnderstood);
  58992. $ctx1.sendIdx["should:raise:"]=12;
  58993. $self._should_raise_((function(){
  58994. return $core.withContext(function($ctx2) {
  58995. return (16)._rM();
  58996. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  58997. }),$globals.MessageNotUnderstood);
  58998. $ctx1.sendIdx["should:raise:"]=13;
  58999. $self._should_raise_((function(){
  59000. return $core.withContext(function($ctx2) {
  59001. return (16)._rm();
  59002. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  59003. }),$globals.MessageNotUnderstood);
  59004. $ctx1.sendIdx["should:raise:"]=14;
  59005. $self._should_raise_((function(){
  59006. return $core.withContext(function($ctx2) {
  59007. return (16)._rN();
  59008. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  59009. }),$globals.MessageNotUnderstood);
  59010. $ctx1.sendIdx["should:raise:"]=15;
  59011. $self._should_raise_((function(){
  59012. return $core.withContext(function($ctx2) {
  59013. return (16)._rn();
  59014. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  59015. }),$globals.MessageNotUnderstood);
  59016. $ctx1.sendIdx["should:raise:"]=16;
  59017. $self._should_raise_((function(){
  59018. return $core.withContext(function($ctx2) {
  59019. return (16)._rO();
  59020. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  59021. }),$globals.MessageNotUnderstood);
  59022. $ctx1.sendIdx["should:raise:"]=17;
  59023. $self._should_raise_((function(){
  59024. return $core.withContext(function($ctx2) {
  59025. return (16)._ro();
  59026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  59027. }),$globals.MessageNotUnderstood);
  59028. $ctx1.sendIdx["should:raise:"]=18;
  59029. $self._should_raise_((function(){
  59030. return $core.withContext(function($ctx2) {
  59031. return (16)._rP();
  59032. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  59033. }),$globals.MessageNotUnderstood);
  59034. $ctx1.sendIdx["should:raise:"]=19;
  59035. $self._should_raise_((function(){
  59036. return $core.withContext(function($ctx2) {
  59037. return (16)._rp();
  59038. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  59039. }),$globals.MessageNotUnderstood);
  59040. $ctx1.sendIdx["should:raise:"]=20;
  59041. $self._should_raise_((function(){
  59042. return $core.withContext(function($ctx2) {
  59043. return (16)._rQ();
  59044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  59045. }),$globals.MessageNotUnderstood);
  59046. $ctx1.sendIdx["should:raise:"]=21;
  59047. $self._should_raise_((function(){
  59048. return $core.withContext(function($ctx2) {
  59049. return (16)._rq();
  59050. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  59051. }),$globals.MessageNotUnderstood);
  59052. $ctx1.sendIdx["should:raise:"]=22;
  59053. $self._should_raise_((function(){
  59054. return $core.withContext(function($ctx2) {
  59055. return (16)._rR();
  59056. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  59057. }),$globals.MessageNotUnderstood);
  59058. $ctx1.sendIdx["should:raise:"]=23;
  59059. $self._should_raise_((function(){
  59060. return $core.withContext(function($ctx2) {
  59061. return (16)._rr();
  59062. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  59063. }),$globals.MessageNotUnderstood);
  59064. $ctx1.sendIdx["should:raise:"]=24;
  59065. $self._should_raise_((function(){
  59066. return $core.withContext(function($ctx2) {
  59067. return (16)._rS();
  59068. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  59069. }),$globals.MessageNotUnderstood);
  59070. $ctx1.sendIdx["should:raise:"]=25;
  59071. $self._should_raise_((function(){
  59072. return $core.withContext(function($ctx2) {
  59073. return (16)._rs();
  59074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  59075. }),$globals.MessageNotUnderstood);
  59076. $ctx1.sendIdx["should:raise:"]=26;
  59077. $self._should_raise_((function(){
  59078. return $core.withContext(function($ctx2) {
  59079. return (16)._rT();
  59080. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  59081. }),$globals.MessageNotUnderstood);
  59082. $ctx1.sendIdx["should:raise:"]=27;
  59083. $self._should_raise_((function(){
  59084. return $core.withContext(function($ctx2) {
  59085. return (16)._rt();
  59086. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  59087. }),$globals.MessageNotUnderstood);
  59088. $ctx1.sendIdx["should:raise:"]=28;
  59089. $self._should_raise_((function(){
  59090. return $core.withContext(function($ctx2) {
  59091. return (16)._rU();
  59092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  59093. }),$globals.MessageNotUnderstood);
  59094. $ctx1.sendIdx["should:raise:"]=29;
  59095. $self._should_raise_((function(){
  59096. return $core.withContext(function($ctx2) {
  59097. return (16)._ru();
  59098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  59099. }),$globals.MessageNotUnderstood);
  59100. $ctx1.sendIdx["should:raise:"]=30;
  59101. $self._should_raise_((function(){
  59102. return $core.withContext(function($ctx2) {
  59103. return (16)._rV();
  59104. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  59105. }),$globals.MessageNotUnderstood);
  59106. $ctx1.sendIdx["should:raise:"]=31;
  59107. $self._should_raise_((function(){
  59108. return $core.withContext(function($ctx2) {
  59109. return (16)._rv();
  59110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  59111. }),$globals.MessageNotUnderstood);
  59112. $ctx1.sendIdx["should:raise:"]=32;
  59113. $self._should_raise_((function(){
  59114. return $core.withContext(function($ctx2) {
  59115. return (16)._rW();
  59116. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  59117. }),$globals.MessageNotUnderstood);
  59118. $ctx1.sendIdx["should:raise:"]=33;
  59119. $self._should_raise_((function(){
  59120. return $core.withContext(function($ctx2) {
  59121. return (16)._rw();
  59122. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  59123. }),$globals.MessageNotUnderstood);
  59124. $ctx1.sendIdx["should:raise:"]=34;
  59125. $self._should_raise_((function(){
  59126. return $core.withContext(function($ctx2) {
  59127. return (16)._rX();
  59128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  59129. }),$globals.MessageNotUnderstood);
  59130. $ctx1.sendIdx["should:raise:"]=35;
  59131. $self._should_raise_((function(){
  59132. return $core.withContext(function($ctx2) {
  59133. return (16)._rx();
  59134. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  59135. }),$globals.MessageNotUnderstood);
  59136. $ctx1.sendIdx["should:raise:"]=36;
  59137. $self._should_raise_((function(){
  59138. return $core.withContext(function($ctx2) {
  59139. return (16)._rY();
  59140. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  59141. }),$globals.MessageNotUnderstood);
  59142. $ctx1.sendIdx["should:raise:"]=37;
  59143. $self._should_raise_((function(){
  59144. return $core.withContext(function($ctx2) {
  59145. return (16)._ry();
  59146. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  59147. }),$globals.MessageNotUnderstood);
  59148. $ctx1.sendIdx["should:raise:"]=38;
  59149. $self._should_raise_((function(){
  59150. return $core.withContext(function($ctx2) {
  59151. return (16)._rZ();
  59152. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  59153. }),$globals.MessageNotUnderstood);
  59154. $ctx1.sendIdx["should:raise:"]=39;
  59155. $self._should_raise_((function(){
  59156. return $core.withContext(function($ctx2) {
  59157. return (16)._rz();
  59158. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  59159. }),$globals.MessageNotUnderstood);
  59160. $ctx1.sendIdx["should:raise:"]=40;
  59161. $self._should_raise_((function(){
  59162. return $core.withContext(function($ctx2) {
  59163. return (11259375)._Z();
  59164. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  59165. }),$globals.MessageNotUnderstood);
  59166. return self;
  59167. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  59168. },
  59169. args: [],
  59170. 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.",
  59171. referencedClasses: ["MessageNotUnderstood"],
  59172. 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"]
  59173. }),
  59174. $globals.NumberTest);
  59175. $core.addMethod(
  59176. $core.method({
  59177. selector: "testLog",
  59178. protocol: "tests",
  59179. fn: function (){
  59180. var self=this,$self=this;
  59181. return $core.withContext(function($ctx1) {
  59182. $self._assert_equals_((10000)._log(),(4));
  59183. $ctx1.sendIdx["assert:equals:"]=1;
  59184. $self._assert_equals_((512)._log_((2)),(9));
  59185. $ctx1.sendIdx["assert:equals:"]=2;
  59186. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  59187. return self;
  59188. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  59189. },
  59190. args: [],
  59191. 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.",
  59192. referencedClasses: ["Number"],
  59193. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  59194. }),
  59195. $globals.NumberTest);
  59196. $core.addMethod(
  59197. $core.method({
  59198. selector: "testMinMax",
  59199. protocol: "tests",
  59200. fn: function (){
  59201. var self=this,$self=this;
  59202. return $core.withContext(function($ctx1) {
  59203. var $1,$2;
  59204. $self._assert_equals_((2)._max_((5)),(5));
  59205. $ctx1.sendIdx["assert:equals:"]=1;
  59206. $self._assert_equals_((2)._min_((5)),(2));
  59207. $ctx1.sendIdx["assert:equals:"]=2;
  59208. $1=(2)._min_max_((5),(3));
  59209. $ctx1.sendIdx["min:max:"]=1;
  59210. $self._assert_equals_($1,(3));
  59211. $ctx1.sendIdx["assert:equals:"]=3;
  59212. $2=(7)._min_max_((5),(3));
  59213. $ctx1.sendIdx["min:max:"]=2;
  59214. $self._assert_equals_($2,(5));
  59215. $ctx1.sendIdx["assert:equals:"]=4;
  59216. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  59217. return self;
  59218. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  59219. },
  59220. args: [],
  59221. source: "testMinMax\x0a\x09\x0a\x09self assert: (2 max: 5) equals: 5.\x0a\x09self assert: (2 min: 5) equals: 2.\x0a\x09self assert: (2 min: 5 max: 3) equals: 3.\x0a\x09self assert: (7 min: 5 max: 3) equals: 5.\x0a\x09self assert: (4 min: 5 max: 3) equals: 4.",
  59222. referencedClasses: [],
  59223. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  59224. }),
  59225. $globals.NumberTest);
  59226. $core.addMethod(
  59227. $core.method({
  59228. selector: "testNegated",
  59229. protocol: "tests",
  59230. fn: function (){
  59231. var self=this,$self=this;
  59232. return $core.withContext(function($ctx1) {
  59233. var $1;
  59234. $1=(3)._negated();
  59235. $ctx1.sendIdx["negated"]=1;
  59236. $self._assert_equals_($1,(-3));
  59237. $ctx1.sendIdx["assert:equals:"]=1;
  59238. $self._assert_equals_((-3)._negated(),(3));
  59239. return self;
  59240. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  59241. },
  59242. args: [],
  59243. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  59244. referencedClasses: [],
  59245. messageSends: ["assert:equals:", "negated"]
  59246. }),
  59247. $globals.NumberTest);
  59248. $core.addMethod(
  59249. $core.method({
  59250. selector: "testPrintShowingDecimalPlaces",
  59251. protocol: "tests",
  59252. fn: function (){
  59253. var self=this,$self=this;
  59254. return $core.withContext(function($ctx1) {
  59255. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  59256. $1=(23)._printShowingDecimalPlaces_((2));
  59257. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  59258. $self._assert_equals_($1,"23.00");
  59259. $ctx1.sendIdx["assert:equals:"]=1;
  59260. $2=(23.5698)._printShowingDecimalPlaces_((2));
  59261. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  59262. $self._assert_equals_($2,"23.57");
  59263. $ctx1.sendIdx["assert:equals:"]=2;
  59264. $4=(234.567)._negated();
  59265. $ctx1.sendIdx["negated"]=1;
  59266. $3=$recv($4)._printShowingDecimalPlaces_((5));
  59267. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  59268. $self._assert_equals_($3,"-234.56700");
  59269. $ctx1.sendIdx["assert:equals:"]=3;
  59270. $5=(23.4567)._printShowingDecimalPlaces_((0));
  59271. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  59272. $self._assert_equals_($5,"23");
  59273. $ctx1.sendIdx["assert:equals:"]=4;
  59274. $6=(23.5567)._printShowingDecimalPlaces_((0));
  59275. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  59276. $self._assert_equals_($6,"24");
  59277. $ctx1.sendIdx["assert:equals:"]=5;
  59278. $8=(23.4567)._negated();
  59279. $ctx1.sendIdx["negated"]=2;
  59280. $7=$recv($8)._printShowingDecimalPlaces_((0));
  59281. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  59282. $self._assert_equals_($7,"-23");
  59283. $ctx1.sendIdx["assert:equals:"]=6;
  59284. $10=(23.5567)._negated();
  59285. $ctx1.sendIdx["negated"]=3;
  59286. $9=$recv($10)._printShowingDecimalPlaces_((0));
  59287. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  59288. $self._assert_equals_($9,"-24");
  59289. $ctx1.sendIdx["assert:equals:"]=7;
  59290. $11=(100000000)._printShowingDecimalPlaces_((1));
  59291. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  59292. $self._assert_equals_($11,"100000000.0");
  59293. $ctx1.sendIdx["assert:equals:"]=8;
  59294. $12=(0.98)._printShowingDecimalPlaces_((5));
  59295. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  59296. $self._assert_equals_($12,"0.98000");
  59297. $ctx1.sendIdx["assert:equals:"]=9;
  59298. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  59299. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  59300. $self._assert_equals_($13,"-0.98");
  59301. $ctx1.sendIdx["assert:equals:"]=10;
  59302. $14=(2.567)._printShowingDecimalPlaces_((2));
  59303. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  59304. $self._assert_equals_($14,"2.57");
  59305. $ctx1.sendIdx["assert:equals:"]=11;
  59306. $15=(-2.567)._printShowingDecimalPlaces_((2));
  59307. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  59308. $self._assert_equals_($15,"-2.57");
  59309. $ctx1.sendIdx["assert:equals:"]=12;
  59310. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  59311. return self;
  59312. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  59313. },
  59314. args: [],
  59315. 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'.",
  59316. referencedClasses: [],
  59317. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  59318. }),
  59319. $globals.NumberTest);
  59320. $core.addMethod(
  59321. $core.method({
  59322. selector: "testPrintStringBase",
  59323. protocol: "tests",
  59324. fn: function (){
  59325. var self=this,$self=this;
  59326. return $core.withContext(function($ctx1) {
  59327. var $1,$2,$3;
  59328. $1=(15)._printStringBase_((2));
  59329. $ctx1.sendIdx["printStringBase:"]=1;
  59330. $self._assert_equals_($1,"1111");
  59331. $ctx1.sendIdx["assert:equals:"]=1;
  59332. $2=(15)._printStringBase_((16));
  59333. $ctx1.sendIdx["printStringBase:"]=2;
  59334. $self._assert_equals_($2,"f");
  59335. $ctx1.sendIdx["assert:equals:"]=2;
  59336. $3=(256)._printStringBase_((16));
  59337. $ctx1.sendIdx["printStringBase:"]=3;
  59338. $self._assert_equals_($3,"100");
  59339. $ctx1.sendIdx["assert:equals:"]=3;
  59340. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59341. return self;
  59342. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  59343. },
  59344. args: [],
  59345. source: "testPrintStringBase\x0a\x09self assert: (15 printStringBase: 2) equals: '1111'.\x0a\x09self assert: (15 printStringBase: 16) equals: 'f'.\x0a\x09self assert: (256 printStringBase: 16) equals: '100'.\x0a\x09self assert: (256 printStringBase: 2) equals: '100000000'",
  59346. referencedClasses: [],
  59347. messageSends: ["assert:equals:", "printStringBase:"]
  59348. }),
  59349. $globals.NumberTest);
  59350. $core.addMethod(
  59351. $core.method({
  59352. selector: "testRadiansToDegrees",
  59353. protocol: "tests",
  59354. fn: function (){
  59355. var self=this,$self=this;
  59356. return $core.withContext(function($ctx1) {
  59357. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59358. return self;
  59359. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  59360. },
  59361. args: [],
  59362. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59363. referencedClasses: ["Number"],
  59364. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59365. }),
  59366. $globals.NumberTest);
  59367. $core.addMethod(
  59368. $core.method({
  59369. selector: "testRaisedTo",
  59370. protocol: "tests",
  59371. fn: function (){
  59372. var self=this,$self=this;
  59373. return $core.withContext(function($ctx1) {
  59374. var $1,$2,$3;
  59375. $1=(2)._raisedTo_((4));
  59376. $ctx1.sendIdx["raisedTo:"]=1;
  59377. $self._assert_equals_($1,(16));
  59378. $ctx1.sendIdx["assert:equals:"]=1;
  59379. $2=(2)._raisedTo_((0));
  59380. $ctx1.sendIdx["raisedTo:"]=2;
  59381. $self._assert_equals_($2,(1));
  59382. $ctx1.sendIdx["assert:equals:"]=2;
  59383. $3=(2)._raisedTo_((-3));
  59384. $ctx1.sendIdx["raisedTo:"]=3;
  59385. $self._assert_equals_($3,(0.125));
  59386. $ctx1.sendIdx["assert:equals:"]=3;
  59387. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  59388. $ctx1.sendIdx["assert:equals:"]=4;
  59389. $self._assert_equals_((2).__star_star((4)),(16));
  59390. return self;
  59391. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59392. },
  59393. args: [],
  59394. 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.",
  59395. referencedClasses: [],
  59396. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59397. }),
  59398. $globals.NumberTest);
  59399. $core.addMethod(
  59400. $core.method({
  59401. selector: "testRounded",
  59402. protocol: "tests",
  59403. fn: function (){
  59404. var self=this,$self=this;
  59405. return $core.withContext(function($ctx1) {
  59406. var $1,$2;
  59407. $1=(3)._rounded();
  59408. $ctx1.sendIdx["rounded"]=1;
  59409. $self._assert_equals_($1,(3));
  59410. $ctx1.sendIdx["assert:equals:"]=1;
  59411. $2=(3.212)._rounded();
  59412. $ctx1.sendIdx["rounded"]=2;
  59413. $self._assert_equals_($2,(3));
  59414. $ctx1.sendIdx["assert:equals:"]=2;
  59415. $self._assert_equals_((3.51)._rounded(),(4));
  59416. return self;
  59417. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59418. },
  59419. args: [],
  59420. 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",
  59421. referencedClasses: [],
  59422. messageSends: ["assert:equals:", "rounded"]
  59423. }),
  59424. $globals.NumberTest);
  59425. $core.addMethod(
  59426. $core.method({
  59427. selector: "testSign",
  59428. protocol: "tests",
  59429. fn: function (){
  59430. var self=this,$self=this;
  59431. return $core.withContext(function($ctx1) {
  59432. var $1,$2;
  59433. $1=(5)._sign();
  59434. $ctx1.sendIdx["sign"]=1;
  59435. $self._assert_equals_($1,(1));
  59436. $ctx1.sendIdx["assert:equals:"]=1;
  59437. $2=(0)._sign();
  59438. $ctx1.sendIdx["sign"]=2;
  59439. $self._assert_equals_($2,(0));
  59440. $ctx1.sendIdx["assert:equals:"]=2;
  59441. $self._assert_equals_((-1.4)._sign(),(-1));
  59442. return self;
  59443. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59444. },
  59445. args: [],
  59446. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59447. referencedClasses: [],
  59448. messageSends: ["assert:equals:", "sign"]
  59449. }),
  59450. $globals.NumberTest);
  59451. $core.addMethod(
  59452. $core.method({
  59453. selector: "testSqrt",
  59454. protocol: "tests",
  59455. fn: function (){
  59456. var self=this,$self=this;
  59457. return $core.withContext(function($ctx1) {
  59458. var $1;
  59459. $1=(4)._sqrt();
  59460. $ctx1.sendIdx["sqrt"]=1;
  59461. $self._assert_equals_($1,(2));
  59462. $ctx1.sendIdx["assert:equals:"]=1;
  59463. $self._assert_equals_((16)._sqrt(),(4));
  59464. return self;
  59465. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59466. },
  59467. args: [],
  59468. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59469. referencedClasses: [],
  59470. messageSends: ["assert:equals:", "sqrt"]
  59471. }),
  59472. $globals.NumberTest);
  59473. $core.addMethod(
  59474. $core.method({
  59475. selector: "testSquared",
  59476. protocol: "tests",
  59477. fn: function (){
  59478. var self=this,$self=this;
  59479. return $core.withContext(function($ctx1) {
  59480. $self._assert_equals_((4)._squared(),(16));
  59481. return self;
  59482. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59483. },
  59484. args: [],
  59485. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59486. referencedClasses: [],
  59487. messageSends: ["assert:equals:", "squared"]
  59488. }),
  59489. $globals.NumberTest);
  59490. $core.addMethod(
  59491. $core.method({
  59492. selector: "testTimesRepeat",
  59493. protocol: "tests",
  59494. fn: function (){
  59495. var self=this,$self=this;
  59496. var i;
  59497. return $core.withContext(function($ctx1) {
  59498. i=(0);
  59499. (0)._timesRepeat_((function(){
  59500. return $core.withContext(function($ctx2) {
  59501. i=$recv(i).__plus((1));
  59502. $ctx2.sendIdx["+"]=1;
  59503. return i;
  59504. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59505. }));
  59506. $ctx1.sendIdx["timesRepeat:"]=1;
  59507. $self._assert_equals_(i,(0));
  59508. $ctx1.sendIdx["assert:equals:"]=1;
  59509. (5)._timesRepeat_((function(){
  59510. return $core.withContext(function($ctx2) {
  59511. i=$recv(i).__plus((1));
  59512. return i;
  59513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59514. }));
  59515. $self._assert_equals_(i,(5));
  59516. return self;
  59517. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59518. },
  59519. args: [],
  59520. 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",
  59521. referencedClasses: [],
  59522. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59523. }),
  59524. $globals.NumberTest);
  59525. $core.addMethod(
  59526. $core.method({
  59527. selector: "testTo",
  59528. protocol: "tests",
  59529. fn: function (){
  59530. var self=this,$self=this;
  59531. return $core.withContext(function($ctx1) {
  59532. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59533. return self;
  59534. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59535. },
  59536. args: [],
  59537. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59538. referencedClasses: [],
  59539. messageSends: ["assert:equals:", "to:"]
  59540. }),
  59541. $globals.NumberTest);
  59542. $core.addMethod(
  59543. $core.method({
  59544. selector: "testToBy",
  59545. protocol: "tests",
  59546. fn: function (){
  59547. var self=this,$self=this;
  59548. return $core.withContext(function($ctx1) {
  59549. var $1;
  59550. $1=(0)._to_by_((6),(2));
  59551. $ctx1.sendIdx["to:by:"]=1;
  59552. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59553. $self._should_raise_((function(){
  59554. return $core.withContext(function($ctx2) {
  59555. return (1)._to_by_((4),(0));
  59556. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59557. }),$globals.Error);
  59558. return self;
  59559. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59560. },
  59561. args: [],
  59562. 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",
  59563. referencedClasses: ["Error"],
  59564. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59565. }),
  59566. $globals.NumberTest);
  59567. $core.addMethod(
  59568. $core.method({
  59569. selector: "testTrigonometry",
  59570. protocol: "tests",
  59571. fn: function (){
  59572. var self=this,$self=this;
  59573. return $core.withContext(function($ctx1) {
  59574. var $1;
  59575. $self._assert_equals_((0)._cos(),(1));
  59576. $ctx1.sendIdx["assert:equals:"]=1;
  59577. $self._assert_equals_((0)._sin(),(0));
  59578. $ctx1.sendIdx["assert:equals:"]=2;
  59579. $self._assert_equals_((0)._tan(),(0));
  59580. $ctx1.sendIdx["assert:equals:"]=3;
  59581. $self._assert_equals_((1)._arcCos(),(0));
  59582. $ctx1.sendIdx["assert:equals:"]=4;
  59583. $self._assert_equals_((0)._arcSin(),(0));
  59584. $ctx1.sendIdx["assert:equals:"]=5;
  59585. $self._assert_equals_((0)._arcTan(),(0));
  59586. $ctx1.sendIdx["assert:equals:"]=6;
  59587. $1=(0)._arcTan_((1));
  59588. $ctx1.sendIdx["arcTan:"]=1;
  59589. $self._assert_equals_($1,(0));
  59590. $ctx1.sendIdx["assert:equals:"]=7;
  59591. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59592. return self;
  59593. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59594. },
  59595. args: [],
  59596. 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.\x0a\x09\x0a\x09self assert: (0 arcTan: 1) equals: 0.\x0a\x09self assert: (1 arcTan: 0) equals: (Number pi / 2)",
  59597. referencedClasses: ["Number"],
  59598. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59599. }),
  59600. $globals.NumberTest);
  59601. $core.addMethod(
  59602. $core.method({
  59603. selector: "testTruncated",
  59604. protocol: "tests",
  59605. fn: function (){
  59606. var self=this,$self=this;
  59607. return $core.withContext(function($ctx1) {
  59608. var $1,$2;
  59609. $1=(3)._truncated();
  59610. $ctx1.sendIdx["truncated"]=1;
  59611. $self._assert_equals_($1,(3));
  59612. $ctx1.sendIdx["assert:equals:"]=1;
  59613. $2=(3.212)._truncated();
  59614. $ctx1.sendIdx["truncated"]=2;
  59615. $self._assert_equals_($2,(3));
  59616. $ctx1.sendIdx["assert:equals:"]=2;
  59617. $self._assert_equals_((3.51)._truncated(),(3));
  59618. return self;
  59619. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59620. },
  59621. args: [],
  59622. 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",
  59623. referencedClasses: [],
  59624. messageSends: ["assert:equals:", "truncated"]
  59625. }),
  59626. $globals.NumberTest);
  59627. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59628. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59629. $core.addMethod(
  59630. $core.method({
  59631. selector: "foo",
  59632. protocol: "not yet classified",
  59633. fn: function (){
  59634. var self=this,$self=this;
  59635. return $self["@foo"];
  59636. },
  59637. args: [],
  59638. source: "foo\x0a\x09^ foo",
  59639. referencedClasses: [],
  59640. messageSends: []
  59641. }),
  59642. $globals.ObjectMock);
  59643. $core.addMethod(
  59644. $core.method({
  59645. selector: "foo:",
  59646. protocol: "not yet classified",
  59647. fn: function (anObject){
  59648. var self=this,$self=this;
  59649. $self["@foo"]=anObject;
  59650. return self;
  59651. },
  59652. args: ["anObject"],
  59653. source: "foo: anObject\x0a\x09foo := anObject",
  59654. referencedClasses: [],
  59655. messageSends: []
  59656. }),
  59657. $globals.ObjectMock);
  59658. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59659. $core.addMethod(
  59660. $core.method({
  59661. selector: "notDefined",
  59662. protocol: "tests",
  59663. fn: function (){
  59664. var self=this,$self=this;
  59665. return $core.withContext(function($ctx1) {
  59666. return void 0;;
  59667. return self;
  59668. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59669. },
  59670. args: [],
  59671. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59672. referencedClasses: [],
  59673. messageSends: []
  59674. }),
  59675. $globals.ObjectTest);
  59676. $core.addMethod(
  59677. $core.method({
  59678. selector: "testBasicAccess",
  59679. protocol: "tests",
  59680. fn: function (){
  59681. var self=this,$self=this;
  59682. var o;
  59683. return $core.withContext(function($ctx1) {
  59684. var $1;
  59685. o=$recv($globals.Object)._new();
  59686. $recv(o)._basicAt_put_("a",(1));
  59687. $1=$recv(o)._basicAt_("a");
  59688. $ctx1.sendIdx["basicAt:"]=1;
  59689. $self._assert_equals_($1,(1));
  59690. $ctx1.sendIdx["assert:equals:"]=1;
  59691. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59692. return self;
  59693. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59694. },
  59695. args: [],
  59696. 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",
  59697. referencedClasses: ["Object"],
  59698. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59699. }),
  59700. $globals.ObjectTest);
  59701. $core.addMethod(
  59702. $core.method({
  59703. selector: "testBasicPerform",
  59704. protocol: "tests",
  59705. fn: function (){
  59706. var self=this,$self=this;
  59707. var o;
  59708. return $core.withContext(function($ctx1) {
  59709. o=$recv($globals.Object)._new();
  59710. $recv(o)._basicAt_put_("func",(function(){
  59711. return "hello";
  59712. }));
  59713. $ctx1.sendIdx["basicAt:put:"]=1;
  59714. $recv(o)._basicAt_put_("func2",(function(a){
  59715. return $core.withContext(function($ctx2) {
  59716. return $recv(a).__plus((1));
  59717. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59718. }));
  59719. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59720. $ctx1.sendIdx["assert:equals:"]=1;
  59721. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59722. return self;
  59723. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59724. },
  59725. args: [],
  59726. 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",
  59727. referencedClasses: ["Object"],
  59728. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59729. }),
  59730. $globals.ObjectTest);
  59731. $core.addMethod(
  59732. $core.method({
  59733. selector: "testDNU",
  59734. protocol: "tests",
  59735. fn: function (){
  59736. var self=this,$self=this;
  59737. return $core.withContext(function($ctx1) {
  59738. $self._should_raise_((function(){
  59739. return $core.withContext(function($ctx2) {
  59740. return $recv($recv($globals.Object)._new())._foo();
  59741. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59742. }),$globals.MessageNotUnderstood);
  59743. return self;
  59744. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59745. },
  59746. args: [],
  59747. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59748. referencedClasses: ["Object", "MessageNotUnderstood"],
  59749. messageSends: ["should:raise:", "foo", "new"]
  59750. }),
  59751. $globals.ObjectTest);
  59752. $core.addMethod(
  59753. $core.method({
  59754. selector: "testEquality",
  59755. protocol: "tests",
  59756. fn: function (){
  59757. var self=this,$self=this;
  59758. var o;
  59759. return $core.withContext(function($ctx1) {
  59760. var $1,$2,$4,$3;
  59761. o=$recv($globals.Object)._new();
  59762. $ctx1.sendIdx["new"]=1;
  59763. $1=$recv(o).__eq($recv($globals.Object)._new());
  59764. $ctx1.sendIdx["="]=1;
  59765. $self._deny_($1);
  59766. $2=$recv(o).__eq(o);
  59767. $ctx1.sendIdx["="]=2;
  59768. $self._assert_($2);
  59769. $ctx1.sendIdx["assert:"]=1;
  59770. $4=$recv(o)._yourself();
  59771. $ctx1.sendIdx["yourself"]=1;
  59772. $3=$recv($4).__eq(o);
  59773. $ctx1.sendIdx["="]=3;
  59774. $self._assert_($3);
  59775. $ctx1.sendIdx["assert:"]=2;
  59776. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59777. return self;
  59778. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59779. },
  59780. args: [],
  59781. 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)",
  59782. referencedClasses: ["Object"],
  59783. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59784. }),
  59785. $globals.ObjectTest);
  59786. $core.addMethod(
  59787. $core.method({
  59788. selector: "testHalt",
  59789. protocol: "tests",
  59790. fn: function (){
  59791. var self=this,$self=this;
  59792. return $core.withContext(function($ctx1) {
  59793. $self._should_raise_((function(){
  59794. return $core.withContext(function($ctx2) {
  59795. return $recv($recv($globals.Object)._new())._halt();
  59796. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59797. }),$globals.Error);
  59798. return self;
  59799. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59800. },
  59801. args: [],
  59802. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59803. referencedClasses: ["Object", "Error"],
  59804. messageSends: ["should:raise:", "halt", "new"]
  59805. }),
  59806. $globals.ObjectTest);
  59807. $core.addMethod(
  59808. $core.method({
  59809. selector: "testIdentity",
  59810. protocol: "tests",
  59811. fn: function (){
  59812. var self=this,$self=this;
  59813. var o;
  59814. return $core.withContext(function($ctx1) {
  59815. var $1,$2,$4,$3;
  59816. o=$recv($globals.Object)._new();
  59817. $ctx1.sendIdx["new"]=1;
  59818. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59819. $ctx1.sendIdx["=="]=1;
  59820. $self._deny_($1);
  59821. $2=$recv(o).__eq_eq(o);
  59822. $ctx1.sendIdx["=="]=2;
  59823. $self._assert_($2);
  59824. $ctx1.sendIdx["assert:"]=1;
  59825. $4=$recv(o)._yourself();
  59826. $ctx1.sendIdx["yourself"]=1;
  59827. $3=$recv($4).__eq_eq(o);
  59828. $ctx1.sendIdx["=="]=3;
  59829. $self._assert_($3);
  59830. $ctx1.sendIdx["assert:"]=2;
  59831. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59832. return self;
  59833. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59834. },
  59835. args: [],
  59836. 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",
  59837. referencedClasses: ["Object"],
  59838. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59839. }),
  59840. $globals.ObjectTest);
  59841. $core.addMethod(
  59842. $core.method({
  59843. selector: "testIfNil",
  59844. protocol: "tests",
  59845. fn: function (){
  59846. var self=this,$self=this;
  59847. return $core.withContext(function($ctx1) {
  59848. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59849. $2=$recv($globals.Object)._new();
  59850. $ctx1.sendIdx["new"]=1;
  59851. $1=$recv($2)._isNil();
  59852. $self._deny_($1);
  59853. $ctx1.sendIdx["deny:"]=1;
  59854. $5=$recv($globals.Object)._new();
  59855. $ctx1.sendIdx["new"]=2;
  59856. if(($receiver = $5) == null || $receiver.a$nil){
  59857. $4=true;
  59858. } else {
  59859. $4=$5;
  59860. }
  59861. $3=$recv($4).__eq(true);
  59862. $self._deny_($3);
  59863. $7=$recv($globals.Object)._new();
  59864. $ctx1.sendIdx["new"]=3;
  59865. if(($receiver = $7) == null || $receiver.a$nil){
  59866. $6=$7;
  59867. } else {
  59868. $6=true;
  59869. }
  59870. $self._assert_equals_($6,true);
  59871. $ctx1.sendIdx["assert:equals:"]=1;
  59872. $9=$recv($globals.Object)._new();
  59873. $ctx1.sendIdx["new"]=4;
  59874. if(($receiver = $9) == null || $receiver.a$nil){
  59875. $8=false;
  59876. } else {
  59877. $8=true;
  59878. }
  59879. $self._assert_equals_($8,true);
  59880. $ctx1.sendIdx["assert:equals:"]=2;
  59881. $11=$recv($globals.Object)._new();
  59882. if(($receiver = $11) == null || $receiver.a$nil){
  59883. $10=false;
  59884. } else {
  59885. $10=true;
  59886. }
  59887. $self._assert_equals_($10,true);
  59888. return self;
  59889. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59890. },
  59891. args: [],
  59892. 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",
  59893. referencedClasses: ["Object"],
  59894. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59895. }),
  59896. $globals.ObjectTest);
  59897. $core.addMethod(
  59898. $core.method({
  59899. selector: "testInstVars",
  59900. protocol: "tests",
  59901. fn: function (){
  59902. var self=this,$self=this;
  59903. var o;
  59904. return $core.withContext(function($ctx1) {
  59905. var $1,$2;
  59906. o=$recv($globals.ObjectMock)._new();
  59907. $1=$recv(o)._instVarAt_("foo");
  59908. $ctx1.sendIdx["instVarAt:"]=1;
  59909. $self._assert_equals_($1,nil);
  59910. $ctx1.sendIdx["assert:equals:"]=1;
  59911. $recv(o)._instVarAt_put_("foo",(1));
  59912. $2=$recv(o)._instVarAt_("foo");
  59913. $ctx1.sendIdx["instVarAt:"]=2;
  59914. $self._assert_equals_($2,(1));
  59915. $ctx1.sendIdx["assert:equals:"]=2;
  59916. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59917. return self;
  59918. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59919. },
  59920. args: [],
  59921. 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",
  59922. referencedClasses: ["ObjectMock"],
  59923. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59924. }),
  59925. $globals.ObjectTest);
  59926. $core.addMethod(
  59927. $core.method({
  59928. selector: "testNilUndefined",
  59929. protocol: "tests",
  59930. fn: function (){
  59931. var self=this,$self=this;
  59932. return $core.withContext(function($ctx1) {
  59933. $self._assert_equals_($self._notDefined(),nil);
  59934. return self;
  59935. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59936. },
  59937. args: [],
  59938. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59939. referencedClasses: [],
  59940. messageSends: ["assert:equals:", "notDefined"]
  59941. }),
  59942. $globals.ObjectTest);
  59943. $core.addMethod(
  59944. $core.method({
  59945. selector: "testYourself",
  59946. protocol: "tests",
  59947. fn: function (){
  59948. var self=this,$self=this;
  59949. var o;
  59950. return $core.withContext(function($ctx1) {
  59951. o=$recv($globals.ObjectMock)._new();
  59952. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59953. return self;
  59954. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59955. },
  59956. args: [],
  59957. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59958. referencedClasses: ["ObjectMock"],
  59959. messageSends: ["new", "assert:", "==", "yourself"]
  59960. }),
  59961. $globals.ObjectTest);
  59962. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59963. $core.addMethod(
  59964. $core.method({
  59965. selector: "testAccessing",
  59966. protocol: "tests",
  59967. fn: function (){
  59968. var self=this,$self=this;
  59969. return $core.withContext(function($ctx1) {
  59970. var $2,$1,$3,$6,$5,$4;
  59971. $2=$recv($globals.Point)._x_y_((3),(4));
  59972. $ctx1.sendIdx["x:y:"]=1;
  59973. $1=$recv($2)._x();
  59974. $ctx1.sendIdx["x"]=1;
  59975. $self._assert_equals_($1,(3));
  59976. $ctx1.sendIdx["assert:equals:"]=1;
  59977. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  59978. $ctx1.sendIdx["y"]=1;
  59979. $self._assert_equals_($3,(4));
  59980. $ctx1.sendIdx["assert:equals:"]=2;
  59981. $6=$recv($globals.Point)._new();
  59982. $ctx1.sendIdx["new"]=1;
  59983. $5=$recv($6)._x_((3));
  59984. $4=$recv($5)._x();
  59985. $self._assert_equals_($4,(3));
  59986. $ctx1.sendIdx["assert:equals:"]=3;
  59987. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  59988. return self;
  59989. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  59990. },
  59991. args: [],
  59992. 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",
  59993. referencedClasses: ["Point"],
  59994. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  59995. }),
  59996. $globals.PointTest);
  59997. $core.addMethod(
  59998. $core.method({
  59999. selector: "testAngle",
  60000. protocol: "tests",
  60001. fn: function (){
  60002. var self=this,$self=this;
  60003. return $core.withContext(function($ctx1) {
  60004. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  60005. return self;
  60006. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  60007. },
  60008. args: [],
  60009. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  60010. referencedClasses: ["Number"],
  60011. messageSends: ["assert:equals:", "angle", "@", "pi"]
  60012. }),
  60013. $globals.PointTest);
  60014. $core.addMethod(
  60015. $core.method({
  60016. selector: "testArithmetic",
  60017. protocol: "tests",
  60018. fn: function (){
  60019. var self=this,$self=this;
  60020. return $core.withContext(function($ctx1) {
  60021. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  60022. $2=(3).__at((4));
  60023. $ctx1.sendIdx["@"]=1;
  60024. $3=(3).__at((4));
  60025. $ctx1.sendIdx["@"]=2;
  60026. $1=$recv($2).__star($3);
  60027. $4=$recv($globals.Point)._x_y_((9),(16));
  60028. $ctx1.sendIdx["x:y:"]=1;
  60029. $self._assert_equals_($1,$4);
  60030. $ctx1.sendIdx["assert:equals:"]=1;
  60031. $6=(3).__at((4));
  60032. $ctx1.sendIdx["@"]=3;
  60033. $7=(3).__at((4));
  60034. $ctx1.sendIdx["@"]=4;
  60035. $5=$recv($6).__plus($7);
  60036. $8=$recv($globals.Point)._x_y_((6),(8));
  60037. $ctx1.sendIdx["x:y:"]=2;
  60038. $self._assert_equals_($5,$8);
  60039. $ctx1.sendIdx["assert:equals:"]=2;
  60040. $10=(3).__at((4));
  60041. $ctx1.sendIdx["@"]=5;
  60042. $11=(3).__at((4));
  60043. $ctx1.sendIdx["@"]=6;
  60044. $9=$recv($10).__minus($11);
  60045. $12=$recv($globals.Point)._x_y_((0),(0));
  60046. $ctx1.sendIdx["x:y:"]=3;
  60047. $self._assert_equals_($9,$12);
  60048. $ctx1.sendIdx["assert:equals:"]=3;
  60049. $14=(6).__at((8));
  60050. $ctx1.sendIdx["@"]=7;
  60051. $13=$recv($14).__slash((3).__at((4)));
  60052. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  60053. return self;
  60054. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  60055. },
  60056. args: [],
  60057. 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)",
  60058. referencedClasses: ["Point"],
  60059. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  60060. }),
  60061. $globals.PointTest);
  60062. $core.addMethod(
  60063. $core.method({
  60064. selector: "testAt",
  60065. protocol: "tests",
  60066. fn: function (){
  60067. var self=this,$self=this;
  60068. return $core.withContext(function($ctx1) {
  60069. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  60070. return self;
  60071. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  60072. },
  60073. args: [],
  60074. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  60075. referencedClasses: ["Point"],
  60076. messageSends: ["assert:equals:", "@", "x:y:"]
  60077. }),
  60078. $globals.PointTest);
  60079. $core.addMethod(
  60080. $core.method({
  60081. selector: "testComparison",
  60082. protocol: "tests",
  60083. fn: function (){
  60084. var self=this,$self=this;
  60085. return $core.withContext(function($ctx1) {
  60086. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  60087. $2=(3).__at((4));
  60088. $ctx1.sendIdx["@"]=1;
  60089. $3=(4).__at((5));
  60090. $ctx1.sendIdx["@"]=2;
  60091. $1=$recv($2).__lt($3);
  60092. $ctx1.sendIdx["<"]=1;
  60093. $self._assert_($1);
  60094. $ctx1.sendIdx["assert:"]=1;
  60095. $5=(3).__at((4));
  60096. $ctx1.sendIdx["@"]=3;
  60097. $6=(4).__at((4));
  60098. $ctx1.sendIdx["@"]=4;
  60099. $4=$recv($5).__lt($6);
  60100. $self._deny_($4);
  60101. $ctx1.sendIdx["deny:"]=1;
  60102. $8=(4).__at((5));
  60103. $ctx1.sendIdx["@"]=5;
  60104. $9=(4).__at((5));
  60105. $ctx1.sendIdx["@"]=6;
  60106. $7=$recv($8).__lt_eq($9);
  60107. $ctx1.sendIdx["<="]=1;
  60108. $self._assert_($7);
  60109. $ctx1.sendIdx["assert:"]=2;
  60110. $11=(4).__at((5));
  60111. $ctx1.sendIdx["@"]=7;
  60112. $12=(3).__at((5));
  60113. $ctx1.sendIdx["@"]=8;
  60114. $10=$recv($11).__lt_eq($12);
  60115. $self._deny_($10);
  60116. $ctx1.sendIdx["deny:"]=2;
  60117. $14=(5).__at((6));
  60118. $ctx1.sendIdx["@"]=9;
  60119. $15=(4).__at((5));
  60120. $ctx1.sendIdx["@"]=10;
  60121. $13=$recv($14).__gt($15);
  60122. $ctx1.sendIdx[">"]=1;
  60123. $self._assert_($13);
  60124. $ctx1.sendIdx["assert:"]=3;
  60125. $17=(5).__at((6));
  60126. $ctx1.sendIdx["@"]=11;
  60127. $18=(6).__at((6));
  60128. $ctx1.sendIdx["@"]=12;
  60129. $16=$recv($17).__gt($18);
  60130. $self._deny_($16);
  60131. $ctx1.sendIdx["deny:"]=3;
  60132. $20=(4).__at((5));
  60133. $ctx1.sendIdx["@"]=13;
  60134. $21=(4).__at((5));
  60135. $ctx1.sendIdx["@"]=14;
  60136. $19=$recv($20).__gt_eq($21);
  60137. $ctx1.sendIdx[">="]=1;
  60138. $self._assert_($19);
  60139. $23=(4).__at((5));
  60140. $ctx1.sendIdx["@"]=15;
  60141. $22=$recv($23).__gt_eq((5).__at((5)));
  60142. $self._deny_($22);
  60143. return self;
  60144. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  60145. },
  60146. args: [],
  60147. 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)",
  60148. referencedClasses: [],
  60149. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  60150. }),
  60151. $globals.PointTest);
  60152. $core.addMethod(
  60153. $core.method({
  60154. selector: "testDotProduct",
  60155. protocol: "tests",
  60156. fn: function (){
  60157. var self=this,$self=this;
  60158. return $core.withContext(function($ctx1) {
  60159. var $2,$1;
  60160. $2=(2).__at((3));
  60161. $ctx1.sendIdx["@"]=1;
  60162. $1=$recv($2)._dotProduct_((3).__at((7)));
  60163. $self._assert_equals_($1,(27));
  60164. return self;
  60165. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  60166. },
  60167. args: [],
  60168. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  60169. referencedClasses: [],
  60170. messageSends: ["assert:equals:", "dotProduct:", "@"]
  60171. }),
  60172. $globals.PointTest);
  60173. $core.addMethod(
  60174. $core.method({
  60175. selector: "testEgality",
  60176. protocol: "tests",
  60177. fn: function (){
  60178. var self=this,$self=this;
  60179. return $core.withContext(function($ctx1) {
  60180. var $2,$3,$1,$5,$4;
  60181. $2=(3).__at((4));
  60182. $ctx1.sendIdx["@"]=1;
  60183. $3=(3).__at((4));
  60184. $ctx1.sendIdx["@"]=2;
  60185. $1=$recv($2).__eq($3);
  60186. $ctx1.sendIdx["="]=1;
  60187. $self._assert_($1);
  60188. $5=(3).__at((5));
  60189. $ctx1.sendIdx["@"]=3;
  60190. $4=$recv($5).__eq((3).__at((6)));
  60191. $self._deny_($4);
  60192. return self;
  60193. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  60194. },
  60195. args: [],
  60196. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  60197. referencedClasses: [],
  60198. messageSends: ["assert:", "=", "@", "deny:"]
  60199. }),
  60200. $globals.PointTest);
  60201. $core.addMethod(
  60202. $core.method({
  60203. selector: "testNew",
  60204. protocol: "tests",
  60205. fn: function (){
  60206. var self=this,$self=this;
  60207. return $core.withContext(function($ctx1) {
  60208. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  60209. $3=$recv($globals.Point)._new();
  60210. $ctx1.sendIdx["new"]=1;
  60211. $2=$recv($3)._x_((3));
  60212. $ctx1.sendIdx["x:"]=1;
  60213. $1=$recv($2)._y();
  60214. $ctx1.sendIdx["y"]=1;
  60215. $self._assert_equals_($1,nil);
  60216. $ctx1.sendIdx["assert:equals:"]=1;
  60217. $7=$recv($globals.Point)._new();
  60218. $ctx1.sendIdx["new"]=2;
  60219. $6=$recv($7)._x_((3));
  60220. $5=$recv($6)._x();
  60221. $ctx1.sendIdx["x"]=1;
  60222. $4=$recv($5).__eq((0));
  60223. $ctx1.sendIdx["="]=1;
  60224. $self._deny_($4);
  60225. $ctx1.sendIdx["deny:"]=1;
  60226. $10=$recv($globals.Point)._new();
  60227. $ctx1.sendIdx["new"]=3;
  60228. $9=$recv($10)._y_((4));
  60229. $ctx1.sendIdx["y:"]=1;
  60230. $8=$recv($9)._x();
  60231. $self._assert_equals_($8,nil);
  60232. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  60233. return self;
  60234. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  60235. },
  60236. args: [],
  60237. 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",
  60238. referencedClasses: ["Point"],
  60239. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  60240. }),
  60241. $globals.PointTest);
  60242. $core.addMethod(
  60243. $core.method({
  60244. selector: "testNormal",
  60245. protocol: "tests",
  60246. fn: function (){
  60247. var self=this,$self=this;
  60248. return $core.withContext(function($ctx1) {
  60249. var $2,$1;
  60250. $2=(1).__at((0));
  60251. $ctx1.sendIdx["@"]=1;
  60252. $1=$recv($2)._normal();
  60253. $self._assert_equals_($1,(0).__at((1)));
  60254. return self;
  60255. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  60256. },
  60257. args: [],
  60258. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  60259. referencedClasses: [],
  60260. messageSends: ["assert:equals:", "normal", "@"]
  60261. }),
  60262. $globals.PointTest);
  60263. $core.addMethod(
  60264. $core.method({
  60265. selector: "testNormalized",
  60266. protocol: "tests",
  60267. fn: function (){
  60268. var self=this,$self=this;
  60269. return $core.withContext(function($ctx1) {
  60270. var $2,$1,$3,$5,$4;
  60271. $2=(0).__at((2));
  60272. $ctx1.sendIdx["@"]=1;
  60273. $1=$recv($2)._normalized();
  60274. $ctx1.sendIdx["normalized"]=1;
  60275. $3=(0).__at((1));
  60276. $ctx1.sendIdx["@"]=2;
  60277. $self._assert_equals_($1,$3);
  60278. $ctx1.sendIdx["assert:equals:"]=1;
  60279. $5=(0).__at((0));
  60280. $ctx1.sendIdx["@"]=3;
  60281. $4=$recv($5)._normalized();
  60282. $self._assert_equals_($4,(0).__at((0)));
  60283. return self;
  60284. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  60285. },
  60286. args: [],
  60287. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  60288. referencedClasses: [],
  60289. messageSends: ["assert:equals:", "normalized", "@"]
  60290. }),
  60291. $globals.PointTest);
  60292. $core.addMethod(
  60293. $core.method({
  60294. selector: "testPolarCoordinates",
  60295. protocol: "tests",
  60296. fn: function (){
  60297. var self=this,$self=this;
  60298. return $core.withContext(function($ctx1) {
  60299. var $2,$1;
  60300. $2=(1).__at((0));
  60301. $ctx1.sendIdx["@"]=1;
  60302. $1=$recv($2)._r();
  60303. $ctx1.sendIdx["r"]=1;
  60304. $self._assert_equals_($1,(1));
  60305. $ctx1.sendIdx["assert:equals:"]=1;
  60306. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  60307. return self;
  60308. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  60309. },
  60310. args: [],
  60311. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  60312. referencedClasses: [],
  60313. messageSends: ["assert:equals:", "r", "@"]
  60314. }),
  60315. $globals.PointTest);
  60316. $core.addMethod(
  60317. $core.method({
  60318. selector: "testRectangleCreation",
  60319. protocol: "tests",
  60320. fn: function (){
  60321. var self=this,$self=this;
  60322. return $core.withContext(function($ctx1) {
  60323. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  60324. $2=(1).__at((1));
  60325. $ctx1.sendIdx["@"]=1;
  60326. $3=(2).__at((2));
  60327. $ctx1.sendIdx["@"]=2;
  60328. $1=$recv($2)._corner_($3);
  60329. $5=(1).__at((1));
  60330. $ctx1.sendIdx["@"]=3;
  60331. $6=(2).__at((2));
  60332. $ctx1.sendIdx["@"]=4;
  60333. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  60334. $self._assert_equals_($1,$4);
  60335. $ctx1.sendIdx["assert:equals:"]=1;
  60336. $8=(1).__at((1));
  60337. $ctx1.sendIdx["@"]=5;
  60338. $9=(2).__at((2));
  60339. $ctx1.sendIdx["@"]=6;
  60340. $7=$recv($8)._rectangle_($9);
  60341. $11=(1).__at((1));
  60342. $ctx1.sendIdx["@"]=7;
  60343. $12=(2).__at((2));
  60344. $ctx1.sendIdx["@"]=8;
  60345. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  60346. $self._assert_equals_($7,$10);
  60347. $ctx1.sendIdx["assert:equals:"]=2;
  60348. $14=(1).__at((1));
  60349. $ctx1.sendIdx["@"]=9;
  60350. $15=(2).__at((2));
  60351. $ctx1.sendIdx["@"]=10;
  60352. $13=$recv($14)._extent_($15);
  60353. $17=(1).__at((1));
  60354. $ctx1.sendIdx["@"]=11;
  60355. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  60356. $self._assert_equals_($13,$16);
  60357. return self;
  60358. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  60359. },
  60360. args: [],
  60361. source: "testRectangleCreation\x0a\x09self assert: (1@1 corner: 2@2) equals: (Rectangle origin: 1@1 corner: 2@2).\x0a\x09self assert: (1@1 rectangle: 2@2) equals: (Rectangle point: 1@1 point: 2@2).\x0a\x09self assert: (1@1 extent: 2@2) equals: (Rectangle origin: 1@1 extent: 2@2)",
  60362. referencedClasses: ["Rectangle"],
  60363. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60364. }),
  60365. $globals.PointTest);
  60366. $core.addMethod(
  60367. $core.method({
  60368. selector: "testTranslateBy",
  60369. protocol: "tests",
  60370. fn: function (){
  60371. var self=this,$self=this;
  60372. return $core.withContext(function($ctx1) {
  60373. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  60374. $2=(3).__at((3));
  60375. $ctx1.sendIdx["@"]=1;
  60376. $3=(0).__at((1));
  60377. $ctx1.sendIdx["@"]=2;
  60378. $1=$recv($2)._translateBy_($3);
  60379. $ctx1.sendIdx["translateBy:"]=1;
  60380. $4=(3).__at((4));
  60381. $ctx1.sendIdx["@"]=3;
  60382. $self._assert_equals_($1,$4);
  60383. $ctx1.sendIdx["assert:equals:"]=1;
  60384. $6=(3).__at((3));
  60385. $ctx1.sendIdx["@"]=4;
  60386. $8=(1)._negated();
  60387. $ctx1.sendIdx["negated"]=1;
  60388. $7=(0).__at($8);
  60389. $ctx1.sendIdx["@"]=5;
  60390. $5=$recv($6)._translateBy_($7);
  60391. $ctx1.sendIdx["translateBy:"]=2;
  60392. $9=(3).__at((2));
  60393. $ctx1.sendIdx["@"]=6;
  60394. $self._assert_equals_($5,$9);
  60395. $ctx1.sendIdx["assert:equals:"]=2;
  60396. $11=(3).__at((3));
  60397. $ctx1.sendIdx["@"]=7;
  60398. $12=(2).__at((3));
  60399. $ctx1.sendIdx["@"]=8;
  60400. $10=$recv($11)._translateBy_($12);
  60401. $ctx1.sendIdx["translateBy:"]=3;
  60402. $13=(5).__at((6));
  60403. $ctx1.sendIdx["@"]=9;
  60404. $self._assert_equals_($10,$13);
  60405. $ctx1.sendIdx["assert:equals:"]=3;
  60406. $15=(3).__at((3));
  60407. $ctx1.sendIdx["@"]=10;
  60408. $16=$recv((3)._negated()).__at((0));
  60409. $ctx1.sendIdx["@"]=11;
  60410. $14=$recv($15)._translateBy_($16);
  60411. $self._assert_equals_($14,(0).__at((3)));
  60412. return self;
  60413. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60414. },
  60415. args: [],
  60416. 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.",
  60417. referencedClasses: [],
  60418. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60419. }),
  60420. $globals.PointTest);
  60421. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60422. $core.addMethod(
  60423. $core.method({
  60424. selector: "testNextIfAbsent",
  60425. protocol: "tests",
  60426. fn: function (){
  60427. var self=this,$self=this;
  60428. var queue;
  60429. return $core.withContext(function($ctx1) {
  60430. var $2,$1;
  60431. queue=$recv($globals.Queue)._new();
  60432. $recv(queue)._nextPut_("index1");
  60433. $2=$recv(queue)._nextIfAbsent_("empty");
  60434. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60435. $1=$recv($2).__eq("index1");
  60436. $ctx1.sendIdx["="]=1;
  60437. $self._assert_($1);
  60438. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60439. return self;
  60440. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60441. },
  60442. args: [],
  60443. 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'",
  60444. referencedClasses: ["Queue"],
  60445. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60446. }),
  60447. $globals.QueueTest);
  60448. $core.addMethod(
  60449. $core.method({
  60450. selector: "testQueueNext",
  60451. protocol: "tests",
  60452. fn: function (){
  60453. var self=this,$self=this;
  60454. var queue;
  60455. return $core.withContext(function($ctx1) {
  60456. var $1,$3,$2,$5,$4;
  60457. queue=$recv($globals.Queue)._new();
  60458. $1=queue;
  60459. $recv($1)._nextPut_("index1");
  60460. $ctx1.sendIdx["nextPut:"]=1;
  60461. $recv($1)._nextPut_("index2");
  60462. $3=$recv(queue)._next();
  60463. $ctx1.sendIdx["next"]=1;
  60464. $2=$recv($3).__eq("index1");
  60465. $ctx1.sendIdx["="]=1;
  60466. $self._assert_($2);
  60467. $5=$recv(queue)._next();
  60468. $ctx1.sendIdx["next"]=2;
  60469. $4=$recv($5).__eq("index");
  60470. $self._deny_($4);
  60471. $self._should_raise_((function(){
  60472. return $core.withContext(function($ctx2) {
  60473. return $recv(queue)._next();
  60474. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60475. }),$globals.Error);
  60476. return self;
  60477. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60478. },
  60479. args: [],
  60480. 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",
  60481. referencedClasses: ["Queue", "Error"],
  60482. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60483. }),
  60484. $globals.QueueTest);
  60485. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60486. $core.addMethod(
  60487. $core.method({
  60488. selector: "testAtRandomNumber",
  60489. protocol: "tests",
  60490. fn: function (){
  60491. var self=this,$self=this;
  60492. var val;
  60493. return $core.withContext(function($ctx1) {
  60494. (100)._timesRepeat_((function(){
  60495. return $core.withContext(function($ctx2) {
  60496. val=(10)._atRandom();
  60497. $self._assert_($recv(val).__gt((0)));
  60498. $ctx2.sendIdx["assert:"]=1;
  60499. return $self._assert_($recv(val).__lt((11)));
  60500. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60501. }));
  60502. return self;
  60503. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60504. },
  60505. args: [],
  60506. 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]",
  60507. referencedClasses: [],
  60508. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60509. }),
  60510. $globals.RandomTest);
  60511. $core.addMethod(
  60512. $core.method({
  60513. selector: "testAtRandomSequenceableCollection",
  60514. protocol: "tests",
  60515. fn: function (){
  60516. var self=this,$self=this;
  60517. var val;
  60518. return $core.withContext(function($ctx1) {
  60519. var $3,$4,$2,$1;
  60520. (100)._timesRepeat_((function(){
  60521. return $core.withContext(function($ctx2) {
  60522. val="abc"._atRandom();
  60523. $3=$recv(val).__eq("a");
  60524. $ctx2.sendIdx["="]=1;
  60525. $4=$recv(val).__eq("b");
  60526. $ctx2.sendIdx["="]=2;
  60527. $2=$recv($3).__or($4);
  60528. $1=$recv($2).__or($recv(val).__eq("c"));
  60529. $ctx2.sendIdx["|"]=1;
  60530. return $self._assert_($1);
  60531. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60532. }));
  60533. return self;
  60534. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60535. },
  60536. args: [],
  60537. 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].",
  60538. referencedClasses: [],
  60539. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60540. }),
  60541. $globals.RandomTest);
  60542. $core.addMethod(
  60543. $core.method({
  60544. selector: "textNext",
  60545. protocol: "tests",
  60546. fn: function (){
  60547. var self=this,$self=this;
  60548. return $core.withContext(function($ctx1) {
  60549. var $1;
  60550. (10000)._timesRepeat_((function(){
  60551. var current,next;
  60552. return $core.withContext(function($ctx2) {
  60553. next=$recv($recv($globals.Random)._new())._next();
  60554. $self._assert_($recv(next).__gt_eq((0)));
  60555. $ctx2.sendIdx["assert:"]=1;
  60556. $self._assert_($recv(next).__lt((1)));
  60557. $1=$recv(current).__eq(next);
  60558. $ctx2.sendIdx["="]=1;
  60559. $self._deny_($1);
  60560. return $recv(next).__eq(current);
  60561. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60562. }));
  60563. return self;
  60564. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60565. },
  60566. args: [],
  60567. 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 ]",
  60568. referencedClasses: ["Random"],
  60569. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60570. }),
  60571. $globals.RandomTest);
  60572. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60573. $core.addMethod(
  60574. $core.method({
  60575. selector: "testContainsPoint",
  60576. protocol: "tests",
  60577. fn: function (){
  60578. var self=this,$self=this;
  60579. var rect;
  60580. return $core.withContext(function($ctx1) {
  60581. var $1,$2,$4,$5,$3;
  60582. $1=(0).__at((0));
  60583. $ctx1.sendIdx["@"]=1;
  60584. $2=(4).__at((4));
  60585. $ctx1.sendIdx["@"]=2;
  60586. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60587. $4=rect;
  60588. $5=(1).__at((2));
  60589. $ctx1.sendIdx["@"]=3;
  60590. $3=$recv($4)._containsPoint_($5);
  60591. $ctx1.sendIdx["containsPoint:"]=1;
  60592. $self._assert_($3);
  60593. $ctx1.sendIdx["assert:"]=1;
  60594. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60595. return self;
  60596. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60597. },
  60598. args: [],
  60599. source: "testContainsPoint\x0a\x09| rect |\x0a\x09rect := Rectangle origin: 0@0 corner: 4@4.\x0a\x09\x0a\x09self assert: (rect containsPoint: 1@2).\x0a\x09self assert: (rect containsPoint: 5@4) not.",
  60600. referencedClasses: ["Rectangle"],
  60601. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60602. }),
  60603. $globals.RectangleTest);
  60604. $core.addMethod(
  60605. $core.method({
  60606. selector: "testContainsRect",
  60607. protocol: "tests",
  60608. fn: function (){
  60609. var self=this,$self=this;
  60610. return $core.withContext(function($ctx1) {
  60611. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60612. $3=(0).__at((0));
  60613. $ctx1.sendIdx["@"]=1;
  60614. $4=(6).__at((6));
  60615. $ctx1.sendIdx["@"]=2;
  60616. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60617. $ctx1.sendIdx["origin:corner:"]=1;
  60618. $6=(1).__at((1));
  60619. $ctx1.sendIdx["@"]=3;
  60620. $7=(5).__at((5));
  60621. $ctx1.sendIdx["@"]=4;
  60622. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60623. $ctx1.sendIdx["origin:corner:"]=2;
  60624. $1=$recv($2)._containsRect_($5);
  60625. $ctx1.sendIdx["containsRect:"]=1;
  60626. $self._assert_($1);
  60627. $ctx1.sendIdx["assert:"]=1;
  60628. $11=(0).__at((0));
  60629. $ctx1.sendIdx["@"]=5;
  60630. $12=(6).__at((6));
  60631. $ctx1.sendIdx["@"]=6;
  60632. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60633. $ctx1.sendIdx["origin:corner:"]=3;
  60634. $14=(1).__at((-1));
  60635. $ctx1.sendIdx["@"]=7;
  60636. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60637. $9=$recv($10)._containsRect_($13);
  60638. $8=$recv($9)._not();
  60639. $self._assert_($8);
  60640. return self;
  60641. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60642. },
  60643. args: [],
  60644. source: "testContainsRect\x0a\x09self assert: ((Rectangle origin: 0@0 corner: 6@6) containsRect: (Rectangle origin: 1@1 corner: 5@5)).\x0a\x09self assert: ((Rectangle origin: 0@0 corner: 6@6) containsRect: (Rectangle origin: 1@(-1) corner: 5@5)) not.",
  60645. referencedClasses: ["Rectangle"],
  60646. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60647. }),
  60648. $globals.RectangleTest);
  60649. $core.addMethod(
  60650. $core.method({
  60651. selector: "testOriginExtent",
  60652. protocol: "tests",
  60653. fn: function (){
  60654. var self=this,$self=this;
  60655. var rectangle;
  60656. return $core.withContext(function($ctx1) {
  60657. var $1,$2,$3,$4;
  60658. $1=(3).__at((4));
  60659. $ctx1.sendIdx["@"]=1;
  60660. $2=(7).__at((8));
  60661. $ctx1.sendIdx["@"]=2;
  60662. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60663. $3=$recv(rectangle)._origin();
  60664. $4=(3).__at((4));
  60665. $ctx1.sendIdx["@"]=3;
  60666. $self._assert_equals_($3,$4);
  60667. $ctx1.sendIdx["assert:equals:"]=1;
  60668. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60669. return self;
  60670. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60671. },
  60672. args: [],
  60673. source: "testOriginExtent\x0a\x09| rectangle |\x0a\x09rectangle := Rectangle origin: 3@4 extent: 7@8.\x0a\x09\x0a\x09self assert: rectangle origin equals: 3@4.\x0a\x09self assert: rectangle corner equals: 10@12.",
  60674. referencedClasses: ["Rectangle"],
  60675. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60676. }),
  60677. $globals.RectangleTest);
  60678. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60679. $core.addMethod(
  60680. $core.method({
  60681. selector: "collectionClass",
  60682. protocol: "accessing",
  60683. fn: function (){
  60684. var self=this,$self=this;
  60685. return $core.withContext(function($ctx1) {
  60686. return $recv($self._class())._collectionClass();
  60687. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60688. },
  60689. args: [],
  60690. source: "collectionClass\x0a\x09^ self class collectionClass",
  60691. referencedClasses: [],
  60692. messageSends: ["collectionClass", "class"]
  60693. }),
  60694. $globals.StreamTest);
  60695. $core.addMethod(
  60696. $core.method({
  60697. selector: "newCollection",
  60698. protocol: "accessing",
  60699. fn: function (){
  60700. var self=this,$self=this;
  60701. return $core.withContext(function($ctx1) {
  60702. return $recv($self._collectionClass())._new();
  60703. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60704. },
  60705. args: [],
  60706. source: "newCollection\x0a\x09^ self collectionClass new",
  60707. referencedClasses: [],
  60708. messageSends: ["new", "collectionClass"]
  60709. }),
  60710. $globals.StreamTest);
  60711. $core.addMethod(
  60712. $core.method({
  60713. selector: "newStream",
  60714. protocol: "accessing",
  60715. fn: function (){
  60716. var self=this,$self=this;
  60717. return $core.withContext(function($ctx1) {
  60718. return $recv($recv($self._collectionClass())._new())._stream();
  60719. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60720. },
  60721. args: [],
  60722. source: "newStream\x0a\x09^ self collectionClass new stream",
  60723. referencedClasses: [],
  60724. messageSends: ["stream", "new", "collectionClass"]
  60725. }),
  60726. $globals.StreamTest);
  60727. $core.addMethod(
  60728. $core.method({
  60729. selector: "testAtStartAtEnd",
  60730. protocol: "tests",
  60731. fn: function (){
  60732. var self=this,$self=this;
  60733. var stream;
  60734. return $core.withContext(function($ctx1) {
  60735. var $1,$2,$3,$4;
  60736. stream=$self._newStream();
  60737. $1=$recv(stream)._atStart();
  60738. $ctx1.sendIdx["atStart"]=1;
  60739. $self._assert_($1);
  60740. $ctx1.sendIdx["assert:"]=1;
  60741. $2=$recv(stream)._atEnd();
  60742. $ctx1.sendIdx["atEnd"]=1;
  60743. $self._assert_($2);
  60744. $ctx1.sendIdx["assert:"]=2;
  60745. $recv(stream)._nextPutAll_($self._newCollection());
  60746. $3=$recv(stream)._atEnd();
  60747. $ctx1.sendIdx["atEnd"]=2;
  60748. $self._assert_($3);
  60749. $4=$recv(stream)._atStart();
  60750. $ctx1.sendIdx["atStart"]=2;
  60751. $self._deny_($4);
  60752. $ctx1.sendIdx["deny:"]=1;
  60753. $recv(stream)._position_((1));
  60754. $self._deny_($recv(stream)._atEnd());
  60755. $ctx1.sendIdx["deny:"]=2;
  60756. $self._deny_($recv(stream)._atStart());
  60757. return self;
  60758. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60759. },
  60760. args: [],
  60761. 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",
  60762. referencedClasses: [],
  60763. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60764. }),
  60765. $globals.StreamTest);
  60766. $core.addMethod(
  60767. $core.method({
  60768. selector: "testContents",
  60769. protocol: "tests",
  60770. fn: function (){
  60771. var self=this,$self=this;
  60772. var stream;
  60773. return $core.withContext(function($ctx1) {
  60774. var $1,$2;
  60775. stream=$self._newStream();
  60776. $1=stream;
  60777. $2=$self._newCollection();
  60778. $ctx1.sendIdx["newCollection"]=1;
  60779. $recv($1)._nextPutAll_($2);
  60780. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60781. return self;
  60782. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60783. },
  60784. args: [],
  60785. 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",
  60786. referencedClasses: [],
  60787. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60788. }),
  60789. $globals.StreamTest);
  60790. $core.addMethod(
  60791. $core.method({
  60792. selector: "testIsEmpty",
  60793. protocol: "tests",
  60794. fn: function (){
  60795. var self=this,$self=this;
  60796. var stream;
  60797. return $core.withContext(function($ctx1) {
  60798. var $1;
  60799. stream=$self._newStream();
  60800. $1=$recv(stream)._isEmpty();
  60801. $ctx1.sendIdx["isEmpty"]=1;
  60802. $self._assert_($1);
  60803. $recv(stream)._nextPutAll_($self._newCollection());
  60804. $self._deny_($recv(stream)._isEmpty());
  60805. return self;
  60806. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60807. },
  60808. args: [],
  60809. 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",
  60810. referencedClasses: [],
  60811. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60812. }),
  60813. $globals.StreamTest);
  60814. $core.addMethod(
  60815. $core.method({
  60816. selector: "testPosition",
  60817. protocol: "tests",
  60818. fn: function (){
  60819. var self=this,$self=this;
  60820. var collection,stream;
  60821. return $core.withContext(function($ctx1) {
  60822. var $1,$2,$3;
  60823. collection=$self._newCollection();
  60824. stream=$self._newStream();
  60825. $recv(stream)._nextPutAll_(collection);
  60826. $1=$recv(stream)._position();
  60827. $ctx1.sendIdx["position"]=1;
  60828. $self._assert_equals_($1,$recv(collection)._size());
  60829. $ctx1.sendIdx["assert:equals:"]=1;
  60830. $recv(stream)._position_((0));
  60831. $2=$recv(stream)._position();
  60832. $ctx1.sendIdx["position"]=2;
  60833. $self._assert_equals_($2,(0));
  60834. $ctx1.sendIdx["assert:equals:"]=2;
  60835. $recv(stream)._next();
  60836. $ctx1.sendIdx["next"]=1;
  60837. $3=$recv(stream)._position();
  60838. $ctx1.sendIdx["position"]=3;
  60839. $self._assert_equals_($3,(1));
  60840. $ctx1.sendIdx["assert:equals:"]=3;
  60841. $recv(stream)._next();
  60842. $self._assert_equals_($recv(stream)._position(),(2));
  60843. return self;
  60844. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60845. },
  60846. args: [],
  60847. 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",
  60848. referencedClasses: [],
  60849. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60850. }),
  60851. $globals.StreamTest);
  60852. $core.addMethod(
  60853. $core.method({
  60854. selector: "testReading",
  60855. protocol: "tests",
  60856. fn: function (){
  60857. var self=this,$self=this;
  60858. var stream,collection;
  60859. return $core.withContext(function($ctx1) {
  60860. var $1,$2;
  60861. collection=$self._newCollection();
  60862. stream=$self._newStream();
  60863. $1=stream;
  60864. $recv($1)._nextPutAll_(collection);
  60865. $recv($1)._position_((0));
  60866. $recv(collection)._do_((function(each){
  60867. return $core.withContext(function($ctx2) {
  60868. $2=$recv(stream)._next();
  60869. $ctx2.sendIdx["next"]=1;
  60870. return $self._assert_equals_($2,each);
  60871. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60872. }));
  60873. $self._assert_($recv($recv(stream)._next())._isNil());
  60874. return self;
  60875. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60876. },
  60877. args: [],
  60878. 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",
  60879. referencedClasses: [],
  60880. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60881. }),
  60882. $globals.StreamTest);
  60883. $core.addMethod(
  60884. $core.method({
  60885. selector: "testStreamContents",
  60886. protocol: "tests",
  60887. fn: function (){
  60888. var self=this,$self=this;
  60889. return self;
  60890. },
  60891. args: [],
  60892. source: "testStreamContents",
  60893. referencedClasses: [],
  60894. messageSends: []
  60895. }),
  60896. $globals.StreamTest);
  60897. $core.addMethod(
  60898. $core.method({
  60899. selector: "testWrite",
  60900. protocol: "tests",
  60901. fn: function (){
  60902. var self=this,$self=this;
  60903. var stream,collection;
  60904. return $core.withContext(function($ctx1) {
  60905. collection=$self._newCollection();
  60906. stream=$self._newStream();
  60907. $recv(collection)._do_((function(each){
  60908. return $core.withContext(function($ctx2) {
  60909. return $recv(stream).__lt_lt(each);
  60910. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60911. }));
  60912. $self._assert_equals_($recv(stream)._contents(),collection);
  60913. return self;
  60914. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60915. },
  60916. args: [],
  60917. 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",
  60918. referencedClasses: [],
  60919. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60920. }),
  60921. $globals.StreamTest);
  60922. $core.addMethod(
  60923. $core.method({
  60924. selector: "testWriting",
  60925. protocol: "tests",
  60926. fn: function (){
  60927. var self=this,$self=this;
  60928. var stream,collection;
  60929. return $core.withContext(function($ctx1) {
  60930. var $1;
  60931. collection=$self._newCollection();
  60932. stream=$self._newStream();
  60933. $ctx1.sendIdx["newStream"]=1;
  60934. $recv(collection)._do_((function(each){
  60935. return $core.withContext(function($ctx2) {
  60936. return $recv(stream)._nextPut_(each);
  60937. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60938. }));
  60939. $1=$recv(stream)._contents();
  60940. $ctx1.sendIdx["contents"]=1;
  60941. $self._assert_equals_($1,collection);
  60942. $ctx1.sendIdx["assert:equals:"]=1;
  60943. stream=$self._newStream();
  60944. $recv(stream)._nextPutAll_(collection);
  60945. $self._assert_equals_($recv(stream)._contents(),collection);
  60946. return self;
  60947. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60948. },
  60949. args: [],
  60950. 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",
  60951. referencedClasses: [],
  60952. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60953. }),
  60954. $globals.StreamTest);
  60955. $core.addMethod(
  60956. $core.method({
  60957. selector: "collectionClass",
  60958. protocol: "accessing",
  60959. fn: function (){
  60960. var self=this,$self=this;
  60961. return nil;
  60962. },
  60963. args: [],
  60964. source: "collectionClass\x0a\x09^ nil",
  60965. referencedClasses: [],
  60966. messageSends: []
  60967. }),
  60968. $globals.StreamTest.a$cls);
  60969. $core.addMethod(
  60970. $core.method({
  60971. selector: "isAbstract",
  60972. protocol: "testing",
  60973. fn: function (){
  60974. var self=this,$self=this;
  60975. return $core.withContext(function($ctx1) {
  60976. return $recv($self._collectionClass())._isNil();
  60977. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  60978. },
  60979. args: [],
  60980. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  60981. referencedClasses: [],
  60982. messageSends: ["isNil", "collectionClass"]
  60983. }),
  60984. $globals.StreamTest.a$cls);
  60985. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  60986. $core.addMethod(
  60987. $core.method({
  60988. selector: "newCollection",
  60989. protocol: "accessing",
  60990. fn: function (){
  60991. var self=this,$self=this;
  60992. return $core.withContext(function($ctx1) {
  60993. return [true,(1),(3).__at((4)),"foo"];
  60994. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  60995. },
  60996. args: [],
  60997. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  60998. referencedClasses: [],
  60999. messageSends: ["@"]
  61000. }),
  61001. $globals.ArrayStreamTest);
  61002. $core.addMethod(
  61003. $core.method({
  61004. selector: "collectionClass",
  61005. protocol: "accessing",
  61006. fn: function (){
  61007. var self=this,$self=this;
  61008. return $globals.Array;
  61009. },
  61010. args: [],
  61011. source: "collectionClass\x0a\x09^ Array",
  61012. referencedClasses: ["Array"],
  61013. messageSends: []
  61014. }),
  61015. $globals.ArrayStreamTest.a$cls);
  61016. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61017. $core.addMethod(
  61018. $core.method({
  61019. selector: "newCollection",
  61020. protocol: "accessing",
  61021. fn: function (){
  61022. var self=this,$self=this;
  61023. return "hello world";
  61024. },
  61025. args: [],
  61026. source: "newCollection\x0a\x09^ 'hello world'",
  61027. referencedClasses: [],
  61028. messageSends: []
  61029. }),
  61030. $globals.StringStreamTest);
  61031. $core.addMethod(
  61032. $core.method({
  61033. selector: "collectionClass",
  61034. protocol: "accessing",
  61035. fn: function (){
  61036. var self=this,$self=this;
  61037. return $globals.String;
  61038. },
  61039. args: [],
  61040. source: "collectionClass\x0a\x09^ String",
  61041. referencedClasses: ["String"],
  61042. messageSends: []
  61043. }),
  61044. $globals.StringStreamTest.a$cls);
  61045. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  61046. $core.addMethod(
  61047. $core.method({
  61048. selector: "testCopying",
  61049. protocol: "tests",
  61050. fn: function (){
  61051. var self=this,$self=this;
  61052. return $core.withContext(function($ctx1) {
  61053. $self._assert_equals_(nil._copy(),nil);
  61054. return self;
  61055. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  61056. },
  61057. args: [],
  61058. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  61059. referencedClasses: [],
  61060. messageSends: ["assert:equals:", "copy"]
  61061. }),
  61062. $globals.UndefinedTest);
  61063. $core.addMethod(
  61064. $core.method({
  61065. selector: "testDeepCopy",
  61066. protocol: "tests",
  61067. fn: function (){
  61068. var self=this,$self=this;
  61069. return $core.withContext(function($ctx1) {
  61070. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  61071. return self;
  61072. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  61073. },
  61074. args: [],
  61075. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  61076. referencedClasses: [],
  61077. messageSends: ["assert:", "=", "deepCopy"]
  61078. }),
  61079. $globals.UndefinedTest);
  61080. $core.addMethod(
  61081. $core.method({
  61082. selector: "testIfNil",
  61083. protocol: "tests",
  61084. fn: function (){
  61085. var self=this,$self=this;
  61086. return $core.withContext(function($ctx1) {
  61087. var $1,$3,$2,$4,$6,$5,$receiver;
  61088. if(($receiver = nil) == null || $receiver.a$nil){
  61089. $1=true;
  61090. } else {
  61091. $1=nil;
  61092. }
  61093. $self._assert_equals_($1,true);
  61094. $ctx1.sendIdx["assert:equals:"]=1;
  61095. if(($receiver = nil) == null || $receiver.a$nil){
  61096. $3=nil;
  61097. } else {
  61098. $3=true;
  61099. }
  61100. $2=$recv($3).__eq(true);
  61101. $ctx1.sendIdx["="]=1;
  61102. $self._deny_($2);
  61103. $ctx1.sendIdx["deny:"]=1;
  61104. if(($receiver = nil) == null || $receiver.a$nil){
  61105. $4=true;
  61106. } else {
  61107. $4=false;
  61108. }
  61109. $self._assert_equals_($4,true);
  61110. if(($receiver = nil) == null || $receiver.a$nil){
  61111. $6=false;
  61112. } else {
  61113. $6=true;
  61114. }
  61115. $5=$recv($6).__eq(true);
  61116. $self._deny_($5);
  61117. return self;
  61118. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  61119. },
  61120. args: [],
  61121. 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",
  61122. referencedClasses: [],
  61123. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  61124. }),
  61125. $globals.UndefinedTest);
  61126. $core.addMethod(
  61127. $core.method({
  61128. selector: "testIsNil",
  61129. protocol: "tests",
  61130. fn: function (){
  61131. var self=this,$self=this;
  61132. return $core.withContext(function($ctx1) {
  61133. $self._assert_(nil._isNil());
  61134. $self._deny_(nil._notNil());
  61135. return self;
  61136. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  61137. },
  61138. args: [],
  61139. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  61140. referencedClasses: [],
  61141. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  61142. }),
  61143. $globals.UndefinedTest);
  61144. });
  61145. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61146. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61147. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61148. $core.addPackage("Platform-DOM-Tests");
  61149. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  61150. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61151. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  61152. $core.addMethod(
  61153. $core.method({
  61154. selector: "testEntityConversion",
  61155. protocol: "testing",
  61156. fn: function (){
  61157. var self=this,$self=this;
  61158. return $core.withContext(function($ctx1) {
  61159. var $1;
  61160. $1=$recv($globals.PlatformDom)._isFeasible();
  61161. if($core.assert($1)){
  61162. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  61163. }
  61164. return self;
  61165. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  61166. },
  61167. args: [],
  61168. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  61169. referencedClasses: ["PlatformDom"],
  61170. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  61171. }),
  61172. $globals.PlatformDomTest);
  61173. $core.addMethod(
  61174. $core.method({
  61175. selector: "testTextContentDoesNotRunScript",
  61176. protocol: "testing",
  61177. fn: function (){
  61178. var self=this,$self=this;
  61179. return $core.withContext(function($ctx1) {
  61180. var $1;
  61181. $1=$recv($globals.PlatformDom)._isFeasible();
  61182. if($core.assert($1)){
  61183. $self._shouldnt_raise_((function(){
  61184. return $core.withContext(function($ctx2) {
  61185. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  61186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61187. }),$globals.Error);
  61188. }
  61189. return self;
  61190. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  61191. },
  61192. args: [],
  61193. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  61194. referencedClasses: ["PlatformDom", "Error"],
  61195. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  61196. }),
  61197. $globals.PlatformDomTest);
  61198. });
  61199. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61200. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61201. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61202. $core.addPackage("SUnit-Tests");
  61203. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  61204. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61205. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  61206. $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.";
  61207. $core.addMethod(
  61208. $core.method({
  61209. selector: "setUp",
  61210. protocol: "running",
  61211. fn: function (){
  61212. var self=this,$self=this;
  61213. return $core.withContext(function($ctx1) {
  61214. $self["@empty"]=$recv($globals.Set)._new();
  61215. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  61216. return self;
  61217. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  61218. },
  61219. args: [],
  61220. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  61221. referencedClasses: ["Set"],
  61222. messageSends: ["new", "with:with:"]
  61223. }),
  61224. $globals.ExampleSetTest);
  61225. $core.addMethod(
  61226. $core.method({
  61227. selector: "testAdd",
  61228. protocol: "tests",
  61229. fn: function (){
  61230. var self=this,$self=this;
  61231. return $core.withContext(function($ctx1) {
  61232. $recv($self["@empty"])._add_((5));
  61233. $self._assert_($recv($self["@empty"])._includes_((5)));
  61234. return self;
  61235. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  61236. },
  61237. args: [],
  61238. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  61239. referencedClasses: [],
  61240. messageSends: ["add:", "assert:", "includes:"]
  61241. }),
  61242. $globals.ExampleSetTest);
  61243. $core.addMethod(
  61244. $core.method({
  61245. selector: "testGrow",
  61246. protocol: "tests",
  61247. fn: function (){
  61248. var self=this,$self=this;
  61249. return $core.withContext(function($ctx1) {
  61250. $recv($self["@empty"])._addAll_((1)._to_((100)));
  61251. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  61252. return self;
  61253. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  61254. },
  61255. args: [],
  61256. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  61257. referencedClasses: [],
  61258. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  61259. }),
  61260. $globals.ExampleSetTest);
  61261. $core.addMethod(
  61262. $core.method({
  61263. selector: "testIllegal",
  61264. protocol: "tests",
  61265. fn: function (){
  61266. var self=this,$self=this;
  61267. return $core.withContext(function($ctx1) {
  61268. $self._should_raise_((function(){
  61269. return $core.withContext(function($ctx2) {
  61270. return $recv($self["@empty"])._at_((5));
  61271. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61272. }),$globals.Error);
  61273. $ctx1.sendIdx["should:raise:"]=1;
  61274. $self._should_raise_((function(){
  61275. return $core.withContext(function($ctx2) {
  61276. return $recv($self["@empty"])._at_put_((5),"abc");
  61277. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61278. }),$globals.Error);
  61279. return self;
  61280. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  61281. },
  61282. args: [],
  61283. 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",
  61284. referencedClasses: ["Error"],
  61285. messageSends: ["should:raise:", "at:", "at:put:"]
  61286. }),
  61287. $globals.ExampleSetTest);
  61288. $core.addMethod(
  61289. $core.method({
  61290. selector: "testIncludes",
  61291. protocol: "tests",
  61292. fn: function (){
  61293. var self=this,$self=this;
  61294. return $core.withContext(function($ctx1) {
  61295. var $1;
  61296. $1=$recv($self["@full"])._includes_((5));
  61297. $ctx1.sendIdx["includes:"]=1;
  61298. $self._assert_($1);
  61299. $ctx1.sendIdx["assert:"]=1;
  61300. $self._assert_($recv($self["@full"])._includes_("abc"));
  61301. return self;
  61302. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  61303. },
  61304. args: [],
  61305. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  61306. referencedClasses: [],
  61307. messageSends: ["assert:", "includes:"]
  61308. }),
  61309. $globals.ExampleSetTest);
  61310. $core.addMethod(
  61311. $core.method({
  61312. selector: "testOccurrences",
  61313. protocol: "tests",
  61314. fn: function (){
  61315. var self=this,$self=this;
  61316. return $core.withContext(function($ctx1) {
  61317. var $1,$2;
  61318. $1=$recv($self["@empty"])._occurrencesOf_((0));
  61319. $ctx1.sendIdx["occurrencesOf:"]=1;
  61320. $self._assert_equals_($1,(0));
  61321. $ctx1.sendIdx["assert:equals:"]=1;
  61322. $2=$recv($self["@full"])._occurrencesOf_((5));
  61323. $ctx1.sendIdx["occurrencesOf:"]=2;
  61324. $self._assert_equals_($2,(1));
  61325. $ctx1.sendIdx["assert:equals:"]=2;
  61326. $recv($self["@full"])._add_((5));
  61327. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  61328. return self;
  61329. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  61330. },
  61331. args: [],
  61332. 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",
  61333. referencedClasses: [],
  61334. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  61335. }),
  61336. $globals.ExampleSetTest);
  61337. $core.addMethod(
  61338. $core.method({
  61339. selector: "testRemove",
  61340. protocol: "tests",
  61341. fn: function (){
  61342. var self=this,$self=this;
  61343. return $core.withContext(function($ctx1) {
  61344. var $1;
  61345. $recv($self["@full"])._remove_((5));
  61346. $1=$recv($self["@full"])._includes_("abc");
  61347. $ctx1.sendIdx["includes:"]=1;
  61348. $self._assert_($1);
  61349. $self._deny_($recv($self["@full"])._includes_((5)));
  61350. return self;
  61351. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  61352. },
  61353. args: [],
  61354. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  61355. referencedClasses: [],
  61356. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  61357. }),
  61358. $globals.ExampleSetTest);
  61359. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  61360. $core.addMethod(
  61361. $core.method({
  61362. selector: "fakeError",
  61363. protocol: "helpers",
  61364. fn: function (){
  61365. var self=this,$self=this;
  61366. return $core.withContext(function($ctx1) {
  61367. $self["@flag"]="bad";
  61368. $self._timeout_((30));
  61369. $self["@flag"]=$recv($self._async_((function(){
  61370. return $core.withContext(function($ctx2) {
  61371. $self["@flag"]="ok";
  61372. return $self._error_("Intentional");
  61373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61374. })))._valueWithTimeout_((20));
  61375. return self;
  61376. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  61377. },
  61378. args: [],
  61379. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  61380. referencedClasses: [],
  61381. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61382. }),
  61383. $globals.SUnitAsyncTest);
  61384. $core.addMethod(
  61385. $core.method({
  61386. selector: "fakeErrorFailingInTearDown",
  61387. protocol: "helpers",
  61388. fn: function (){
  61389. var self=this,$self=this;
  61390. return $core.withContext(function($ctx1) {
  61391. $self["@flag"]="bad";
  61392. $self._timeout_((30));
  61393. $self["@flag"]=$recv($self._async_((function(){
  61394. return $core.withContext(function($ctx2) {
  61395. return $self._error_("Intentional");
  61396. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61397. })))._valueWithTimeout_((20));
  61398. return self;
  61399. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61400. },
  61401. args: [],
  61402. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61403. referencedClasses: [],
  61404. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61405. }),
  61406. $globals.SUnitAsyncTest);
  61407. $core.addMethod(
  61408. $core.method({
  61409. selector: "fakeFailure",
  61410. protocol: "helpers",
  61411. fn: function (){
  61412. var self=this,$self=this;
  61413. return $core.withContext(function($ctx1) {
  61414. $self["@flag"]="bad";
  61415. $self._timeout_((30));
  61416. $self["@flag"]=$recv($self._async_((function(){
  61417. return $core.withContext(function($ctx2) {
  61418. $self["@flag"]="ok";
  61419. return $self._assert_(false);
  61420. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61421. })))._valueWithTimeout_((20));
  61422. return self;
  61423. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61424. },
  61425. args: [],
  61426. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61427. referencedClasses: [],
  61428. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61429. }),
  61430. $globals.SUnitAsyncTest);
  61431. $core.addMethod(
  61432. $core.method({
  61433. selector: "fakeMultipleTimeoutFailing",
  61434. protocol: "helpers",
  61435. fn: function (){
  61436. var self=this,$self=this;
  61437. return $core.withContext(function($ctx1) {
  61438. var $1;
  61439. $self._timeout_((100));
  61440. $ctx1.sendIdx["timeout:"]=1;
  61441. $1=$self._async_((function(){
  61442. return $core.withContext(function($ctx2) {
  61443. $self._timeout_((20));
  61444. return $recv($self._async_((function(){
  61445. return $core.withContext(function($ctx3) {
  61446. return $self._finished();
  61447. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61448. })))._valueWithTimeout_((30));
  61449. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61450. }));
  61451. $ctx1.sendIdx["async:"]=1;
  61452. $recv($1)._valueWithTimeout_((20));
  61453. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61454. return self;
  61455. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61456. },
  61457. args: [],
  61458. 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",
  61459. referencedClasses: [],
  61460. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61461. }),
  61462. $globals.SUnitAsyncTest);
  61463. $core.addMethod(
  61464. $core.method({
  61465. selector: "fakeMultipleTimeoutPassing",
  61466. protocol: "helpers",
  61467. fn: function (){
  61468. var self=this,$self=this;
  61469. return $core.withContext(function($ctx1) {
  61470. var $1;
  61471. $self._timeout_((20));
  61472. $ctx1.sendIdx["timeout:"]=1;
  61473. $1=$self._async_((function(){
  61474. return $core.withContext(function($ctx2) {
  61475. $self._timeout_((40));
  61476. return $recv($self._async_((function(){
  61477. return $core.withContext(function($ctx3) {
  61478. return $self._finished();
  61479. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61480. })))._valueWithTimeout_((20));
  61481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61482. }));
  61483. $ctx1.sendIdx["async:"]=1;
  61484. $recv($1)._valueWithTimeout_((10));
  61485. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61486. return self;
  61487. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61488. },
  61489. args: [],
  61490. 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",
  61491. referencedClasses: [],
  61492. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61493. }),
  61494. $globals.SUnitAsyncTest);
  61495. $core.addMethod(
  61496. $core.method({
  61497. selector: "fakeTimeout",
  61498. protocol: "helpers",
  61499. fn: function (){
  61500. var self=this,$self=this;
  61501. return $core.withContext(function($ctx1) {
  61502. $self._timeout_((10));
  61503. $recv($self._async_((function(){
  61504. return $core.withContext(function($ctx2) {
  61505. return $self._finished();
  61506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61507. })))._valueWithTimeout_((20));
  61508. return self;
  61509. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61510. },
  61511. args: [],
  61512. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61513. referencedClasses: [],
  61514. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61515. }),
  61516. $globals.SUnitAsyncTest);
  61517. $core.addMethod(
  61518. $core.method({
  61519. selector: "selectorSetOf:",
  61520. protocol: "private",
  61521. fn: function (aCollection){
  61522. var self=this,$self=this;
  61523. return $core.withContext(function($ctx1) {
  61524. return $recv($recv(aCollection)._collect_((function(each){
  61525. return $core.withContext(function($ctx2) {
  61526. return $recv(each)._selector();
  61527. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61528. })))._asSet();
  61529. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61530. },
  61531. args: ["aCollection"],
  61532. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61533. referencedClasses: [],
  61534. messageSends: ["asSet", "collect:", "selector"]
  61535. }),
  61536. $globals.SUnitAsyncTest);
  61537. $core.addMethod(
  61538. $core.method({
  61539. selector: "setUp",
  61540. protocol: "running",
  61541. fn: function (){
  61542. var self=this,$self=this;
  61543. $self["@flag"]="ok";
  61544. return self;
  61545. },
  61546. args: [],
  61547. source: "setUp\x0a\x09flag := 'ok'",
  61548. referencedClasses: [],
  61549. messageSends: []
  61550. }),
  61551. $globals.SUnitAsyncTest);
  61552. $core.addMethod(
  61553. $core.method({
  61554. selector: "tearDown",
  61555. protocol: "running",
  61556. fn: function (){
  61557. var self=this,$self=this;
  61558. return $core.withContext(function($ctx1) {
  61559. $self._assert_equals_("ok",$self["@flag"]);
  61560. return self;
  61561. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61562. },
  61563. args: [],
  61564. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61565. referencedClasses: [],
  61566. messageSends: ["assert:equals:"]
  61567. }),
  61568. $globals.SUnitAsyncTest);
  61569. $core.addMethod(
  61570. $core.method({
  61571. selector: "testAsyncErrorsAndFailures",
  61572. protocol: "tests",
  61573. fn: function (){
  61574. var self=this,$self=this;
  61575. var suite,runner,result,assertBlock;
  61576. return $core.withContext(function($ctx1) {
  61577. var $1,$2,$3,$4;
  61578. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61579. return $core.withContext(function($ctx2) {
  61580. return $recv($self._class())._selector_(each);
  61581. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61582. }));
  61583. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61584. $self._timeout_((200));
  61585. result=$recv(runner)._result();
  61586. $ctx1.sendIdx["result"]=1;
  61587. assertBlock=$self._async_((function(){
  61588. return $core.withContext(function($ctx2) {
  61589. $1=$self._selectorSetOf_($recv(result)._errors());
  61590. $ctx2.sendIdx["selectorSetOf:"]=1;
  61591. $2=["fakeError"]._asSet();
  61592. $ctx2.sendIdx["asSet"]=1;
  61593. $self._assert_equals_($1,$2);
  61594. $ctx2.sendIdx["assert:equals:"]=1;
  61595. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61596. return $self._finished();
  61597. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61598. }));
  61599. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61600. return $core.withContext(function($ctx2) {
  61601. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61602. if($core.assert($3)){
  61603. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61604. return $recv($4)._ifTrue_(assertBlock);
  61605. }
  61606. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61607. }));
  61608. $recv(runner)._run();
  61609. return self;
  61610. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61611. },
  61612. args: [],
  61613. 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",
  61614. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61615. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61616. }),
  61617. $globals.SUnitAsyncTest);
  61618. $core.addMethod(
  61619. $core.method({
  61620. selector: "testAsyncNeedsTimeout",
  61621. protocol: "tests",
  61622. fn: function (){
  61623. var self=this,$self=this;
  61624. return $core.withContext(function($ctx1) {
  61625. $self._should_raise_((function(){
  61626. return $core.withContext(function($ctx2) {
  61627. return $self._async_((function(){
  61628. }));
  61629. $ctx2.sendIdx["async:"]=1;
  61630. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61631. }),$globals.Error);
  61632. $self._timeout_((0));
  61633. $self._shouldnt_raise_((function(){
  61634. return $core.withContext(function($ctx2) {
  61635. return $self._async_((function(){
  61636. }));
  61637. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61638. }),$globals.Error);
  61639. $self._finished();
  61640. return self;
  61641. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61642. },
  61643. args: [],
  61644. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61645. referencedClasses: ["Error"],
  61646. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61647. }),
  61648. $globals.SUnitAsyncTest);
  61649. $core.addMethod(
  61650. $core.method({
  61651. selector: "testFinishedNeedsTimeout",
  61652. protocol: "tests",
  61653. fn: function (){
  61654. var self=this,$self=this;
  61655. return $core.withContext(function($ctx1) {
  61656. $self._should_raise_((function(){
  61657. return $core.withContext(function($ctx2) {
  61658. return $self._finished();
  61659. $ctx2.sendIdx["finished"]=1;
  61660. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61661. }),$globals.Error);
  61662. $self._timeout_((0));
  61663. $self._shouldnt_raise_((function(){
  61664. return $core.withContext(function($ctx2) {
  61665. return $self._finished();
  61666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61667. }),$globals.Error);
  61668. return self;
  61669. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61670. },
  61671. args: [],
  61672. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61673. referencedClasses: ["Error"],
  61674. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61675. }),
  61676. $globals.SUnitAsyncTest);
  61677. $core.addMethod(
  61678. $core.method({
  61679. selector: "testIsAsyncReturnsCorrectValues",
  61680. protocol: "tests",
  61681. fn: function (){
  61682. var self=this,$self=this;
  61683. return $core.withContext(function($ctx1) {
  61684. var $1,$2;
  61685. $1=$self._isAsync();
  61686. $ctx1.sendIdx["isAsync"]=1;
  61687. $self._deny_($1);
  61688. $ctx1.sendIdx["deny:"]=1;
  61689. $self._timeout_((0));
  61690. $2=$self._isAsync();
  61691. $ctx1.sendIdx["isAsync"]=2;
  61692. $self._assert_($2);
  61693. $self._finished();
  61694. $self._deny_($self._isAsync());
  61695. return self;
  61696. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61697. },
  61698. args: [],
  61699. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61700. referencedClasses: [],
  61701. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61702. }),
  61703. $globals.SUnitAsyncTest);
  61704. $core.addMethod(
  61705. $core.method({
  61706. selector: "testPass",
  61707. protocol: "tests",
  61708. fn: function (){
  61709. var self=this,$self=this;
  61710. return $core.withContext(function($ctx1) {
  61711. $self["@flag"]="bad";
  61712. $self._timeout_((10));
  61713. $self["@flag"]=$recv($self._async_((function(){
  61714. return $core.withContext(function($ctx2) {
  61715. $self._assert_(true);
  61716. $self._finished();
  61717. $self["@flag"]="ok";
  61718. return $self["@flag"];
  61719. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61720. })))._valueWithTimeout_((5));
  61721. return self;
  61722. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61723. },
  61724. args: [],
  61725. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61726. referencedClasses: [],
  61727. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61728. }),
  61729. $globals.SUnitAsyncTest);
  61730. $core.addMethod(
  61731. $core.method({
  61732. selector: "testTimeouts",
  61733. protocol: "tests",
  61734. fn: function (){
  61735. var self=this,$self=this;
  61736. var suite,runner,result,assertBlock;
  61737. return $core.withContext(function($ctx1) {
  61738. var $1,$2,$3;
  61739. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61740. return $core.withContext(function($ctx2) {
  61741. return $recv($self._class())._selector_(each);
  61742. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61743. }));
  61744. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61745. $self._timeout_((200));
  61746. result=$recv(runner)._result();
  61747. $ctx1.sendIdx["result"]=1;
  61748. assertBlock=$self._async_((function(){
  61749. return $core.withContext(function($ctx2) {
  61750. $1=$self._selectorSetOf_($recv(result)._errors());
  61751. $ctx2.sendIdx["selectorSetOf:"]=1;
  61752. $self._assert_equals_($1,$recv($globals.Set)._new());
  61753. $ctx2.sendIdx["assert:equals:"]=1;
  61754. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61755. return $self._finished();
  61756. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61757. }));
  61758. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61759. return $core.withContext(function($ctx2) {
  61760. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61761. if($core.assert($2)){
  61762. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61763. return $recv($3)._ifTrue_(assertBlock);
  61764. }
  61765. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61766. }));
  61767. $recv(runner)._run();
  61768. return self;
  61769. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61770. },
  61771. args: [],
  61772. 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",
  61773. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61774. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61775. }),
  61776. $globals.SUnitAsyncTest);
  61777. $core.addMethod(
  61778. $core.method({
  61779. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61780. protocol: "tests",
  61781. fn: function (){
  61782. var self=this,$self=this;
  61783. var x;
  61784. return $core.withContext(function($ctx1) {
  61785. var $1;
  61786. $self["@flag"]="bad";
  61787. $self._timeout_((10));
  61788. x=(0);
  61789. $1=$self._async_((function(){
  61790. return $core.withContext(function($ctx2) {
  61791. $self._finished();
  61792. $ctx2.sendIdx["finished"]=1;
  61793. $self["@flag"]="ok";
  61794. x=$recv(x).__plus((1));
  61795. $ctx2.sendIdx["+"]=1;
  61796. return $self._assert_equals_(x,(1));
  61797. $ctx2.sendIdx["assert:equals:"]=1;
  61798. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61799. }));
  61800. $ctx1.sendIdx["async:"]=1;
  61801. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61802. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61803. $self["@flag"]=$recv($self._async_((function(){
  61804. return $core.withContext(function($ctx2) {
  61805. $self._finished();
  61806. $self["@flag"]="ok";
  61807. x=$recv(x).__plus((1));
  61808. return $self._assert_equals_(x,(1));
  61809. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61810. })))._valueWithTimeout_((0));
  61811. return self;
  61812. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61813. },
  61814. args: [],
  61815. 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.",
  61816. referencedClasses: [],
  61817. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61818. }),
  61819. $globals.SUnitAsyncTest);
  61820. });
  61821. define('amber/devel',[
  61822. './lang',
  61823. './brikz', // pre-fetch, dep of ./boot
  61824. './kernel-checks', // pre-fetch, dep of ./boot
  61825. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61826. './kernel-language', // pre-fetch, dep of ./boot
  61827. './boot', // pre-fetch, class loader
  61828. './deploy', // pre-fetch, dep of ./lang
  61829. // --- packages of the development only Amber begin here ---
  61830. 'amber_core/Platform-DOM',
  61831. 'amber_core/SUnit',
  61832. 'amber_core/Compiler-Tests',
  61833. 'amber_core/Kernel-Tests',
  61834. 'amber_core/Platform-DOM-Tests',
  61835. 'amber_core/SUnit-Tests'
  61836. // --- packages of the development only Amber end here ---
  61837. ], function (amber) {
  61838. return amber;
  61839. });
  61840. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61841. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61842. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61843. $core.addPackage("Platform-Node");
  61844. ($core.packageDescriptors||$core.packages)["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  61845. ($core.packageDescriptors||$core.packages)["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61846. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61847. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61848. $core.addMethod(
  61849. $core.method({
  61850. selector: "globals",
  61851. protocol: "accessing",
  61852. fn: function (){
  61853. var self=this,$self=this;
  61854. return global;
  61855. },
  61856. args: [],
  61857. source: "globals\x0a\x09^ global",
  61858. referencedClasses: [],
  61859. messageSends: []
  61860. }),
  61861. $globals.NodePlatform);
  61862. $core.addMethod(
  61863. $core.method({
  61864. selector: "newXhr",
  61865. protocol: "accessing",
  61866. fn: function (){
  61867. var self=this,$self=this;
  61868. return $core.withContext(function($ctx1) {
  61869. var $receiver;
  61870. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61871. $self._error_("XMLHttpRequest not available.");
  61872. } else {
  61873. return $recv($globals.XMLHttpRequest)._new();
  61874. }
  61875. return self;
  61876. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61877. },
  61878. args: [],
  61879. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61880. referencedClasses: ["XMLHttpRequest"],
  61881. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61882. }),
  61883. $globals.NodePlatform);
  61884. $core.addMethod(
  61885. $core.method({
  61886. selector: "initialize",
  61887. protocol: "testing",
  61888. fn: function (){
  61889. var self=this,$self=this;
  61890. return $core.withContext(function($ctx1) {
  61891. var $1;
  61892. $1=$self._isFeasible();
  61893. if($core.assert($1)){
  61894. $recv($globals.Platform)._registerIfNone_($self._new());
  61895. }
  61896. return self;
  61897. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61898. },
  61899. args: [],
  61900. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61901. referencedClasses: ["Platform"],
  61902. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61903. }),
  61904. $globals.NodePlatform.a$cls);
  61905. $core.addMethod(
  61906. $core.method({
  61907. selector: "isFeasible",
  61908. protocol: "testing",
  61909. fn: function (){
  61910. var self=this,$self=this;
  61911. return $core.withContext(function($ctx1) {
  61912. return typeof global !== "undefined";
  61913. return self;
  61914. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61915. },
  61916. args: [],
  61917. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  61918. referencedClasses: [],
  61919. messageSends: []
  61920. }),
  61921. $globals.NodePlatform.a$cls);
  61922. });
  61923. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61924. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61925. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61926. $core.addPackage("AmberCli");
  61927. ($core.packageDescriptors||$core.packages)["AmberCli"].innerEval = function (expr) { return eval(expr); };
  61928. ($core.packageDescriptors||$core.packages)["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  61929. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61930. $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.";
  61931. $core.addMethod(
  61932. $core.method({
  61933. selector: "commandLineSwitches",
  61934. protocol: "commandline",
  61935. fn: function (){
  61936. var self=this,$self=this;
  61937. var switches;
  61938. return $core.withContext(function($ctx1) {
  61939. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61940. return $core.withContext(function($ctx2) {
  61941. return $recv(each)._selector();
  61942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61943. }));
  61944. $ctx1.sendIdx["collect:"]=1;
  61945. switches=$recv(switches)._select_((function(each){
  61946. return $core.withContext(function($ctx2) {
  61947. return $recv(each)._match_("^[^:]*:$");
  61948. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61949. }));
  61950. switches=$recv(switches)._collect_((function(each){
  61951. return $core.withContext(function($ctx2) {
  61952. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61954. }));
  61955. return switches;
  61956. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61957. },
  61958. args: [],
  61959. 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",
  61960. referencedClasses: [],
  61961. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61962. }),
  61963. $globals.AmberCli.a$cls);
  61964. $core.addMethod(
  61965. $core.method({
  61966. selector: "config:",
  61967. protocol: "commands",
  61968. fn: function (args){
  61969. var self=this,$self=this;
  61970. return $core.withContext(function($ctx1) {
  61971. $recv($recv($globals.Configurator)._new())._start();
  61972. return self;
  61973. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  61974. },
  61975. args: ["args"],
  61976. source: "config: args\x0a\x09Configurator new start",
  61977. referencedClasses: ["Configurator"],
  61978. messageSends: ["start", "new"]
  61979. }),
  61980. $globals.AmberCli.a$cls);
  61981. $core.addMethod(
  61982. $core.method({
  61983. selector: "handleArguments:",
  61984. protocol: "commandline",
  61985. fn: function (args){
  61986. var self=this,$self=this;
  61987. var selector;
  61988. return $core.withContext(function($ctx1) {
  61989. var $1;
  61990. $1=$recv(args)._first();
  61991. $ctx1.sendIdx["first"]=1;
  61992. selector=$self._selectorForCommandLineSwitch_($1);
  61993. $recv(args)._remove_($recv(args)._first());
  61994. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  61995. return self;
  61996. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  61997. },
  61998. args: ["args"],
  61999. 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)",
  62000. referencedClasses: ["Array"],
  62001. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  62002. }),
  62003. $globals.AmberCli.a$cls);
  62004. $core.addMethod(
  62005. $core.method({
  62006. selector: "help:",
  62007. protocol: "commands",
  62008. fn: function (args){
  62009. var self=this,$self=this;
  62010. return $core.withContext(function($ctx1) {
  62011. $recv($globals.Transcript)._show_("Available commands");
  62012. $recv($self._commandLineSwitches())._do_((function(each){
  62013. return $core.withContext(function($ctx2) {
  62014. return $recv(console)._log_(each);
  62015. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62016. }));
  62017. return self;
  62018. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  62019. },
  62020. args: ["args"],
  62021. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  62022. referencedClasses: ["Transcript"],
  62023. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  62024. }),
  62025. $globals.AmberCli.a$cls);
  62026. $core.addMethod(
  62027. $core.method({
  62028. selector: "init:",
  62029. protocol: "commands",
  62030. fn: function (args){
  62031. var self=this,$self=this;
  62032. return $core.withContext(function($ctx1) {
  62033. $recv($recv($globals.Initer)._new())._start();
  62034. return self;
  62035. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  62036. },
  62037. args: ["args"],
  62038. source: "init: args\x0a\x09Initer new start",
  62039. referencedClasses: ["Initer"],
  62040. messageSends: ["start", "new"]
  62041. }),
  62042. $globals.AmberCli.a$cls);
  62043. $core.addMethod(
  62044. $core.method({
  62045. selector: "main",
  62046. protocol: "startup",
  62047. fn: function (){
  62048. var self=this,$self=this;
  62049. var args,packageJSON;
  62050. return $core.withContext(function($ctx1) {
  62051. var $7,$6,$5,$4,$3,$2,$1;
  62052. var $early={};
  62053. try {
  62054. packageJSON=$recv(require)._value_("../package.json");
  62055. $7=$recv(packageJSON)._version();
  62056. $ctx1.sendIdx["version"]=1;
  62057. $6="Welcome to Amber CLI version ".__comma($7);
  62058. $5=$recv($6).__comma(" (Amber ");
  62059. $ctx1.sendIdx[","]=5;
  62060. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  62061. $ctx1.sendIdx[","]=4;
  62062. $3=$recv($4).__comma(", NodeJS ");
  62063. $ctx1.sendIdx[","]=3;
  62064. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  62065. $ctx1.sendIdx[","]=2;
  62066. $1=$recv($2).__comma(").");
  62067. $ctx1.sendIdx[","]=1;
  62068. $recv($globals.Transcript)._show_($1);
  62069. args=$recv(process)._argv();
  62070. $recv(args)._removeFrom_to_((1),(2));
  62071. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  62072. return $core.withContext(function($ctx2) {
  62073. return $self._help_(nil);
  62074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62075. }),(function(){
  62076. return $core.withContext(function($ctx2) {
  62077. throw $early=[$self._handleArguments_(args)];
  62078. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62079. }));
  62080. return self;
  62081. }
  62082. catch(e) {if(e===$early)return e[0]; throw e}
  62083. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  62084. },
  62085. args: [],
  62086. 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]",
  62087. referencedClasses: ["Transcript", "Smalltalk"],
  62088. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  62089. }),
  62090. $globals.AmberCli.a$cls);
  62091. $core.addMethod(
  62092. $core.method({
  62093. selector: "repl:",
  62094. protocol: "commands",
  62095. fn: function (args){
  62096. var self=this,$self=this;
  62097. return $core.withContext(function($ctx1) {
  62098. return $recv($recv($globals.Repl)._new())._createInterface();
  62099. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  62100. },
  62101. args: ["args"],
  62102. source: "repl: args\x0a\x09^ Repl new createInterface",
  62103. referencedClasses: ["Repl"],
  62104. messageSends: ["createInterface", "new"]
  62105. }),
  62106. $globals.AmberCli.a$cls);
  62107. $core.addMethod(
  62108. $core.method({
  62109. selector: "selectorForCommandLineSwitch:",
  62110. protocol: "commandline",
  62111. fn: function (aSwitch){
  62112. var self=this,$self=this;
  62113. var command,selector;
  62114. return $core.withContext(function($ctx1) {
  62115. var $1;
  62116. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  62117. if($core.assert($1)){
  62118. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  62119. return $core.withContext(function($ctx2) {
  62120. return $recv($recv(each)._second())._asUppercase();
  62121. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62122. }))).__comma(":");
  62123. selector;
  62124. } else {
  62125. selector="help:";
  62126. selector;
  62127. }
  62128. return selector;
  62129. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  62130. },
  62131. args: ["aSwitch"],
  62132. 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",
  62133. referencedClasses: [],
  62134. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  62135. }),
  62136. $globals.AmberCli.a$cls);
  62137. $core.addMethod(
  62138. $core.method({
  62139. selector: "serve:",
  62140. protocol: "commands",
  62141. fn: function (args){
  62142. var self=this,$self=this;
  62143. return $core.withContext(function($ctx1) {
  62144. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  62145. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  62146. },
  62147. args: ["args"],
  62148. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  62149. referencedClasses: ["FileServer"],
  62150. messageSends: ["start", "createServerWithArguments:"]
  62151. }),
  62152. $globals.AmberCli.a$cls);
  62153. $core.addMethod(
  62154. $core.method({
  62155. selector: "version:",
  62156. protocol: "commands",
  62157. fn: function (arguments_){
  62158. var self=this,$self=this;
  62159. return self;
  62160. },
  62161. args: ["arguments"],
  62162. source: "version: arguments",
  62163. referencedClasses: [],
  62164. messageSends: []
  62165. }),
  62166. $globals.AmberCli.a$cls);
  62167. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  62168. $core.addMethod(
  62169. $core.method({
  62170. selector: "dirname",
  62171. protocol: "private",
  62172. fn: function (){
  62173. var self=this,$self=this;
  62174. return $core.withContext(function($ctx1) {
  62175. return __dirname;
  62176. return self;
  62177. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  62178. },
  62179. args: [],
  62180. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  62181. referencedClasses: [],
  62182. messageSends: []
  62183. }),
  62184. $globals.BaseFileManipulator);
  62185. $core.addMethod(
  62186. $core.method({
  62187. selector: "initialize",
  62188. protocol: "initialization",
  62189. fn: function (){
  62190. var self=this,$self=this;
  62191. return $core.withContext(function($ctx1) {
  62192. (
  62193. $ctx1.supercall = true,
  62194. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62195. $ctx1.supercall = false;
  62196. $self["@path"]=$recv(require)._value_("path");
  62197. $ctx1.sendIdx["value:"]=1;
  62198. $self["@fs"]=$recv(require)._value_("fs");
  62199. return self;
  62200. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  62201. },
  62202. args: [],
  62203. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  62204. referencedClasses: [],
  62205. messageSends: ["initialize", "value:"]
  62206. }),
  62207. $globals.BaseFileManipulator);
  62208. $core.addMethod(
  62209. $core.method({
  62210. selector: "rootDirname",
  62211. protocol: "private",
  62212. fn: function (){
  62213. var self=this,$self=this;
  62214. return $core.withContext(function($ctx1) {
  62215. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  62216. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  62217. },
  62218. args: [],
  62219. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  62220. referencedClasses: [],
  62221. messageSends: ["join:with:", "dirname"]
  62222. }),
  62223. $globals.BaseFileManipulator);
  62224. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  62225. $core.addMethod(
  62226. $core.method({
  62227. selector: "initialize",
  62228. protocol: "initialization",
  62229. fn: function (){
  62230. var self=this,$self=this;
  62231. return $core.withContext(function($ctx1) {
  62232. (
  62233. $ctx1.supercall = true,
  62234. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62235. $ctx1.supercall = false;
  62236. return self;
  62237. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  62238. },
  62239. args: [],
  62240. source: "initialize\x0a\x09super initialize",
  62241. referencedClasses: [],
  62242. messageSends: ["initialize"]
  62243. }),
  62244. $globals.Configurator);
  62245. $core.addMethod(
  62246. $core.method({
  62247. selector: "start",
  62248. protocol: "action",
  62249. fn: function (){
  62250. var self=this,$self=this;
  62251. return $core.withContext(function($ctx1) {
  62252. var $receiver;
  62253. $self._writeConfigThenDo_((function(err){
  62254. return $core.withContext(function($ctx2) {
  62255. if(($receiver = err) == null || $receiver.a$nil){
  62256. return $recv(process)._exit();
  62257. } else {
  62258. return $recv(process)._exit_((111));
  62259. }
  62260. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  62261. }));
  62262. return self;
  62263. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  62264. },
  62265. args: [],
  62266. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  62267. referencedClasses: [],
  62268. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  62269. }),
  62270. $globals.Configurator);
  62271. $core.addMethod(
  62272. $core.method({
  62273. selector: "writeConfigThenDo:",
  62274. protocol: "action",
  62275. fn: function (aBlock){
  62276. var self=this,$self=this;
  62277. return $core.withContext(function($ctx1) {
  62278. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  62279. return self;
  62280. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  62281. },
  62282. args: ["aBlock"],
  62283. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  62284. referencedClasses: [],
  62285. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  62286. }),
  62287. $globals.Configurator);
  62288. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  62289. $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.";
  62290. $core.addMethod(
  62291. $core.method({
  62292. selector: "base64Decode:",
  62293. protocol: "private",
  62294. fn: function (aString){
  62295. var self=this,$self=this;
  62296. return $core.withContext(function($ctx1) {
  62297. return (new Buffer(aString, "base64").toString());
  62298. return self;
  62299. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  62300. },
  62301. args: ["aString"],
  62302. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  62303. referencedClasses: [],
  62304. messageSends: []
  62305. }),
  62306. $globals.FileServer);
  62307. $core.addMethod(
  62308. $core.method({
  62309. selector: "basePath",
  62310. protocol: "accessing",
  62311. fn: function (){
  62312. var self=this,$self=this;
  62313. return $core.withContext(function($ctx1) {
  62314. var $1,$receiver;
  62315. $1=$self["@basePath"];
  62316. if(($receiver = $1) == null || $receiver.a$nil){
  62317. return $recv($self._class())._defaultBasePath();
  62318. } else {
  62319. return $1;
  62320. }
  62321. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  62322. },
  62323. args: [],
  62324. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  62325. referencedClasses: [],
  62326. messageSends: ["ifNil:", "defaultBasePath", "class"]
  62327. }),
  62328. $globals.FileServer);
  62329. $core.addMethod(
  62330. $core.method({
  62331. selector: "basePath:",
  62332. protocol: "accessing",
  62333. fn: function (aString){
  62334. var self=this,$self=this;
  62335. return $core.withContext(function($ctx1) {
  62336. $self["@basePath"]=aString;
  62337. $self._validateBasePath();
  62338. return self;
  62339. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  62340. },
  62341. args: ["aString"],
  62342. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  62343. referencedClasses: [],
  62344. messageSends: ["validateBasePath"]
  62345. }),
  62346. $globals.FileServer);
  62347. $core.addMethod(
  62348. $core.method({
  62349. selector: "checkDirectoryLayout",
  62350. protocol: "initialization",
  62351. fn: function (){
  62352. var self=this,$self=this;
  62353. return $core.withContext(function($ctx1) {
  62354. var $1;
  62355. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  62356. if(!$core.assert($1)){
  62357. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  62358. $ctx1.sendIdx["warn:"]=1;
  62359. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  62360. $ctx1.sendIdx["warn:"]=2;
  62361. $recv(console)._warn_(" You can also specify a page to be served by default,");
  62362. $ctx1.sendIdx["warn:"]=3;
  62363. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  62364. }
  62365. return self;
  62366. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  62367. },
  62368. args: [],
  62369. 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.'].",
  62370. referencedClasses: [],
  62371. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  62372. }),
  62373. $globals.FileServer);
  62374. $core.addMethod(
  62375. $core.method({
  62376. selector: "fallbackPage",
  62377. protocol: "accessing",
  62378. fn: function (){
  62379. var self=this,$self=this;
  62380. return $self["@fallbackPage"];
  62381. },
  62382. args: [],
  62383. source: "fallbackPage\x0a\x09^ fallbackPage",
  62384. referencedClasses: [],
  62385. messageSends: []
  62386. }),
  62387. $globals.FileServer);
  62388. $core.addMethod(
  62389. $core.method({
  62390. selector: "fallbackPage:",
  62391. protocol: "accessing",
  62392. fn: function (aString){
  62393. var self=this,$self=this;
  62394. $self["@fallbackPage"]=aString;
  62395. return self;
  62396. },
  62397. args: ["aString"],
  62398. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62399. referencedClasses: [],
  62400. messageSends: []
  62401. }),
  62402. $globals.FileServer);
  62403. $core.addMethod(
  62404. $core.method({
  62405. selector: "handleGETRequest:respondTo:",
  62406. protocol: "request handling",
  62407. fn: function (aRequest,aResponse){
  62408. var self=this,$self=this;
  62409. var uri,filename;
  62410. return $core.withContext(function($ctx1) {
  62411. var $1;
  62412. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  62413. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  62414. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  62415. return $core.withContext(function($ctx2) {
  62416. if($core.assert(aBoolean)){
  62417. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  62418. if($core.assert($1)){
  62419. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62420. } else {
  62421. return $self._respondFileNamed_to_(filename,aResponse);
  62422. }
  62423. } else {
  62424. return $self._respondNotFoundTo_(aResponse);
  62425. }
  62426. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62427. }));
  62428. return self;
  62429. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62430. },
  62431. args: ["aRequest", "aResponse"],
  62432. 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]]]",
  62433. referencedClasses: [],
  62434. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62435. }),
  62436. $globals.FileServer);
  62437. $core.addMethod(
  62438. $core.method({
  62439. selector: "handleOPTIONSRequest:respondTo:",
  62440. protocol: "request handling",
  62441. fn: function (aRequest,aResponse){
  62442. var self=this,$self=this;
  62443. return $core.withContext(function($ctx1) {
  62444. $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)]));
  62445. $recv(aResponse)._end();
  62446. return self;
  62447. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62448. },
  62449. args: ["aRequest", "aResponse"],
  62450. 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",
  62451. referencedClasses: [],
  62452. messageSends: ["writeHead:options:", "end"]
  62453. }),
  62454. $globals.FileServer);
  62455. $core.addMethod(
  62456. $core.method({
  62457. selector: "handlePUTRequest:respondTo:",
  62458. protocol: "request handling",
  62459. fn: function (aRequest,aResponse){
  62460. var self=this,$self=this;
  62461. var file,stream;
  62462. return $core.withContext(function($ctx1) {
  62463. var $1,$2,$3,$4;
  62464. $1=$self._isAuthenticated_(aRequest);
  62465. if(!$core.assert($1)){
  62466. $self._respondAuthenticationRequiredTo_(aResponse);
  62467. return nil;
  62468. }
  62469. file=".".__comma($recv(aRequest)._url());
  62470. $ctx1.sendIdx[","]=1;
  62471. stream=$recv($self["@fs"])._createWriteStream_(file);
  62472. $recv(stream)._on_do_("error",(function(error){
  62473. return $core.withContext(function($ctx2) {
  62474. $2=console;
  62475. $3="Error creating WriteStream for file ".__comma(file);
  62476. $ctx2.sendIdx[","]=2;
  62477. $recv($2)._warn_($3);
  62478. $ctx2.sendIdx["warn:"]=1;
  62479. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62480. $ctx2.sendIdx["warn:"]=2;
  62481. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62482. return $self._respondNotCreatedTo_(aResponse);
  62483. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62484. }));
  62485. $ctx1.sendIdx["on:do:"]=1;
  62486. $recv(stream)._on_do_("close",(function(){
  62487. return $core.withContext(function($ctx2) {
  62488. return $self._respondCreatedTo_(aResponse);
  62489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62490. }));
  62491. $ctx1.sendIdx["on:do:"]=2;
  62492. $recv(aRequest)._setEncoding_("utf8");
  62493. $recv(aRequest)._on_do_("data",(function(data){
  62494. return $core.withContext(function($ctx2) {
  62495. return $recv(stream)._write_(data);
  62496. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62497. }));
  62498. $ctx1.sendIdx["on:do:"]=3;
  62499. $recv(aRequest)._on_do_("end",(function(){
  62500. return $core.withContext(function($ctx2) {
  62501. $4=$recv(stream)._writable();
  62502. if($core.assert($4)){
  62503. return $recv(stream)._end();
  62504. }
  62505. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62506. }));
  62507. return self;
  62508. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62509. },
  62510. args: ["aRequest", "aResponse"],
  62511. 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]]",
  62512. referencedClasses: [],
  62513. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62514. }),
  62515. $globals.FileServer);
  62516. $core.addMethod(
  62517. $core.method({
  62518. selector: "handleRequest:respondTo:",
  62519. protocol: "request handling",
  62520. fn: function (aRequest,aResponse){
  62521. var self=this,$self=this;
  62522. return $core.withContext(function($ctx1) {
  62523. var $2,$1,$4,$3,$5;
  62524. $2=$recv(aRequest)._method();
  62525. $ctx1.sendIdx["method"]=1;
  62526. $1=$recv($2).__eq("PUT");
  62527. $ctx1.sendIdx["="]=1;
  62528. if($core.assert($1)){
  62529. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62530. }
  62531. $4=$recv(aRequest)._method();
  62532. $ctx1.sendIdx["method"]=2;
  62533. $3=$recv($4).__eq("GET");
  62534. $ctx1.sendIdx["="]=2;
  62535. if($core.assert($3)){
  62536. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62537. }
  62538. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62539. if($core.assert($5)){
  62540. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62541. }
  62542. return self;
  62543. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62544. },
  62545. args: ["aRequest", "aResponse"],
  62546. 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]",
  62547. referencedClasses: [],
  62548. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62549. }),
  62550. $globals.FileServer);
  62551. $core.addMethod(
  62552. $core.method({
  62553. selector: "host",
  62554. protocol: "accessing",
  62555. fn: function (){
  62556. var self=this,$self=this;
  62557. return $self["@host"];
  62558. },
  62559. args: [],
  62560. source: "host\x0a\x09^ host",
  62561. referencedClasses: [],
  62562. messageSends: []
  62563. }),
  62564. $globals.FileServer);
  62565. $core.addMethod(
  62566. $core.method({
  62567. selector: "host:",
  62568. protocol: "accessing",
  62569. fn: function (hostname){
  62570. var self=this,$self=this;
  62571. $self["@host"]=hostname;
  62572. return self;
  62573. },
  62574. args: ["hostname"],
  62575. source: "host: hostname\x0a\x09host := hostname",
  62576. referencedClasses: [],
  62577. messageSends: []
  62578. }),
  62579. $globals.FileServer);
  62580. $core.addMethod(
  62581. $core.method({
  62582. selector: "initialize",
  62583. protocol: "initialization",
  62584. fn: function (){
  62585. var self=this,$self=this;
  62586. return $core.withContext(function($ctx1) {
  62587. var $1;
  62588. (
  62589. $ctx1.supercall = true,
  62590. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62591. $ctx1.supercall = false;
  62592. $self["@http"]=$self._require_("http");
  62593. $ctx1.sendIdx["require:"]=1;
  62594. $self["@util"]=$self._require_("util");
  62595. $ctx1.sendIdx["require:"]=2;
  62596. $self["@url"]=$self._require_("url");
  62597. $1=$self._class();
  62598. $ctx1.sendIdx["class"]=1;
  62599. $self["@host"]=$recv($1)._defaultHost();
  62600. $self["@port"]=$recv($self._class())._defaultPort();
  62601. $self["@username"]=nil;
  62602. $self["@password"]=nil;
  62603. $self["@fallbackPage"]=nil;
  62604. return self;
  62605. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62606. },
  62607. args: [],
  62608. 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.",
  62609. referencedClasses: [],
  62610. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62611. }),
  62612. $globals.FileServer);
  62613. $core.addMethod(
  62614. $core.method({
  62615. selector: "isAuthenticated:",
  62616. protocol: "private",
  62617. fn: function (aRequest){
  62618. var self=this,$self=this;
  62619. var header,token,auth,parts;
  62620. return $core.withContext(function($ctx1) {
  62621. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62622. var $early={};
  62623. try {
  62624. $2=$recv($self["@username"])._isNil();
  62625. $ctx1.sendIdx["isNil"]=1;
  62626. $1=$recv($2)._and_((function(){
  62627. return $core.withContext(function($ctx2) {
  62628. return $recv($self["@password"])._isNil();
  62629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62630. }));
  62631. $ctx1.sendIdx["and:"]=1;
  62632. if($core.assert($1)){
  62633. return true;
  62634. }
  62635. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62636. $ctx1.sendIdx["at:"]=1;
  62637. if(($receiver = $3) == null || $receiver.a$nil){
  62638. header="";
  62639. } else {
  62640. header=$3;
  62641. }
  62642. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62643. throw $early=[false];
  62644. }),(function(){
  62645. return $core.withContext(function($ctx2) {
  62646. $4=$recv(header)._tokenize_(" ");
  62647. $ctx2.sendIdx["tokenize:"]=1;
  62648. if(($receiver = $4) == null || $receiver.a$nil){
  62649. token="";
  62650. } else {
  62651. token=$4;
  62652. }
  62653. $5=$recv(token)._at_((2));
  62654. $ctx2.sendIdx["at:"]=2;
  62655. auth=$self._base64Decode_($5);
  62656. parts=$recv(auth)._tokenize_(":");
  62657. $8=$self["@username"];
  62658. $9=$recv(parts)._at_((1));
  62659. $ctx2.sendIdx["at:"]=3;
  62660. $7=$recv($8).__eq($9);
  62661. $ctx2.sendIdx["="]=1;
  62662. $6=$recv($7)._and_((function(){
  62663. return $core.withContext(function($ctx3) {
  62664. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62665. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62666. }));
  62667. if($core.assert($6)){
  62668. throw $early=[true];
  62669. } else {
  62670. throw $early=[false];
  62671. }
  62672. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62673. }));
  62674. return self;
  62675. }
  62676. catch(e) {if(e===$early)return e[0]; throw e}
  62677. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62678. },
  62679. args: ["aRequest"],
  62680. 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].",
  62681. referencedClasses: [],
  62682. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62683. }),
  62684. $globals.FileServer);
  62685. $core.addMethod(
  62686. $core.method({
  62687. selector: "password:",
  62688. protocol: "accessing",
  62689. fn: function (aPassword){
  62690. var self=this,$self=this;
  62691. $self["@password"]=aPassword;
  62692. return self;
  62693. },
  62694. args: ["aPassword"],
  62695. source: "password: aPassword\x0a\x09password := aPassword.",
  62696. referencedClasses: [],
  62697. messageSends: []
  62698. }),
  62699. $globals.FileServer);
  62700. $core.addMethod(
  62701. $core.method({
  62702. selector: "port",
  62703. protocol: "accessing",
  62704. fn: function (){
  62705. var self=this,$self=this;
  62706. return $self["@port"];
  62707. },
  62708. args: [],
  62709. source: "port\x0a\x09^ port",
  62710. referencedClasses: [],
  62711. messageSends: []
  62712. }),
  62713. $globals.FileServer);
  62714. $core.addMethod(
  62715. $core.method({
  62716. selector: "port:",
  62717. protocol: "accessing",
  62718. fn: function (aNumber){
  62719. var self=this,$self=this;
  62720. $self["@port"]=aNumber;
  62721. return self;
  62722. },
  62723. args: ["aNumber"],
  62724. source: "port: aNumber\x0a\x09port := aNumber",
  62725. referencedClasses: [],
  62726. messageSends: []
  62727. }),
  62728. $globals.FileServer);
  62729. $core.addMethod(
  62730. $core.method({
  62731. selector: "require:",
  62732. protocol: "private",
  62733. fn: function (aModuleString){
  62734. var self=this,$self=this;
  62735. return $core.withContext(function($ctx1) {
  62736. return $recv(require)._value_(aModuleString);
  62737. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62738. },
  62739. args: ["aModuleString"],
  62740. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62741. referencedClasses: [],
  62742. messageSends: ["value:"]
  62743. }),
  62744. $globals.FileServer);
  62745. $core.addMethod(
  62746. $core.method({
  62747. selector: "respondAuthenticationRequiredTo:",
  62748. protocol: "request handling",
  62749. fn: function (aResponse){
  62750. var self=this,$self=this;
  62751. return $core.withContext(function($ctx1) {
  62752. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62753. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62754. $recv(aResponse)._end();
  62755. return self;
  62756. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62757. },
  62758. args: ["aResponse"],
  62759. 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.",
  62760. referencedClasses: [],
  62761. messageSends: ["writeHead:options:", "write:", "end"]
  62762. }),
  62763. $globals.FileServer);
  62764. $core.addMethod(
  62765. $core.method({
  62766. selector: "respondCreatedTo:",
  62767. protocol: "request handling",
  62768. fn: function (aResponse){
  62769. var self=this,$self=this;
  62770. return $core.withContext(function($ctx1) {
  62771. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62772. $recv(aResponse)._end();
  62773. return self;
  62774. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62775. },
  62776. args: ["aResponse"],
  62777. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62778. referencedClasses: [],
  62779. messageSends: ["writeHead:options:", "end"]
  62780. }),
  62781. $globals.FileServer);
  62782. $core.addMethod(
  62783. $core.method({
  62784. selector: "respondDirectoryNamed:from:to:",
  62785. protocol: "request handling",
  62786. fn: function (aDirname,aUrl,aResponse){
  62787. var self=this,$self=this;
  62788. return $core.withContext(function($ctx1) {
  62789. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62790. $2=$recv(aUrl)._pathname();
  62791. $ctx1.sendIdx["pathname"]=1;
  62792. $1=$recv($2)._endsWith_("/");
  62793. if($core.assert($1)){
  62794. $3=$recv(aDirname).__comma("index.html");
  62795. $ctx1.sendIdx[","]=1;
  62796. $self._respondFileNamed_to_($3,aResponse);
  62797. } else {
  62798. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62799. $7=$recv(aUrl)._search();
  62800. if(($receiver = $7) == null || $receiver.a$nil){
  62801. $6="";
  62802. } else {
  62803. $6=$7;
  62804. }
  62805. $4=$recv($5).__comma($6);
  62806. $ctx1.sendIdx[","]=2;
  62807. $self._respondRedirect_to_($4,aResponse);
  62808. }
  62809. return self;
  62810. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62811. },
  62812. args: ["aDirname", "aUrl", "aResponse"],
  62813. 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]",
  62814. referencedClasses: [],
  62815. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62816. }),
  62817. $globals.FileServer);
  62818. $core.addMethod(
  62819. $core.method({
  62820. selector: "respondFileNamed:to:",
  62821. protocol: "request handling",
  62822. fn: function (aFilename,aResponse){
  62823. var self=this,$self=this;
  62824. var type,filename;
  62825. return $core.withContext(function($ctx1) {
  62826. var $1,$2,$3,$4;
  62827. filename=aFilename;
  62828. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62829. return $core.withContext(function($ctx2) {
  62830. $1=$recv(ex)._notNil();
  62831. if($core.assert($1)){
  62832. $2=console;
  62833. $3=$recv(filename).__comma(" does not exist");
  62834. $ctx2.sendIdx[","]=1;
  62835. $recv($2)._log_($3);
  62836. return $self._respondNotFoundTo_(aResponse);
  62837. } else {
  62838. type=$recv($self._class())._mimeTypeFor_(filename);
  62839. $4=$recv(type).__eq("application/javascript");
  62840. if($core.assert($4)){
  62841. type=$recv(type).__comma(";charset=utf-8");
  62842. type;
  62843. }
  62844. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62845. $recv(aResponse)._write_encoding_(file,"binary");
  62846. return $recv(aResponse)._end();
  62847. }
  62848. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62849. }));
  62850. return self;
  62851. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62852. },
  62853. args: ["aFilename", "aResponse"],
  62854. 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]]",
  62855. referencedClasses: [],
  62856. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62857. }),
  62858. $globals.FileServer);
  62859. $core.addMethod(
  62860. $core.method({
  62861. selector: "respondInternalErrorTo:",
  62862. protocol: "request handling",
  62863. fn: function (aResponse){
  62864. var self=this,$self=this;
  62865. return $core.withContext(function($ctx1) {
  62866. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62867. $recv(aResponse)._write_("500 Internal server error");
  62868. $recv(aResponse)._end();
  62869. return self;
  62870. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62871. },
  62872. args: ["aResponse"],
  62873. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62874. referencedClasses: [],
  62875. messageSends: ["writeHead:options:", "write:", "end"]
  62876. }),
  62877. $globals.FileServer);
  62878. $core.addMethod(
  62879. $core.method({
  62880. selector: "respondNotCreatedTo:",
  62881. protocol: "request handling",
  62882. fn: function (aResponse){
  62883. var self=this,$self=this;
  62884. return $core.withContext(function($ctx1) {
  62885. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62886. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62887. $recv(aResponse)._end();
  62888. return self;
  62889. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62890. },
  62891. args: ["aResponse"],
  62892. 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.",
  62893. referencedClasses: [],
  62894. messageSends: ["writeHead:options:", "write:", "end"]
  62895. }),
  62896. $globals.FileServer);
  62897. $core.addMethod(
  62898. $core.method({
  62899. selector: "respondNotFoundTo:",
  62900. protocol: "request handling",
  62901. fn: function (aResponse){
  62902. var self=this,$self=this;
  62903. return $core.withContext(function($ctx1) {
  62904. var $2,$1;
  62905. $2=$self._fallbackPage();
  62906. $ctx1.sendIdx["fallbackPage"]=1;
  62907. $1=$recv($2)._isNil();
  62908. if(!$core.assert($1)){
  62909. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62910. }
  62911. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62912. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62913. $ctx1.sendIdx["write:"]=1;
  62914. $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>");
  62915. $ctx1.sendIdx["write:"]=2;
  62916. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62917. $ctx1.sendIdx["write:"]=3;
  62918. $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>");
  62919. $ctx1.sendIdx["write:"]=4;
  62920. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62921. $ctx1.sendIdx["write:"]=5;
  62922. $recv(aResponse)._write_("</ul></p></body></html>");
  62923. $recv(aResponse)._end();
  62924. return self;
  62925. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62926. },
  62927. args: ["aResponse"],
  62928. 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",
  62929. referencedClasses: [],
  62930. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62931. }),
  62932. $globals.FileServer);
  62933. $core.addMethod(
  62934. $core.method({
  62935. selector: "respondOKTo:",
  62936. protocol: "request handling",
  62937. fn: function (aResponse){
  62938. var self=this,$self=this;
  62939. return $core.withContext(function($ctx1) {
  62940. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62941. $recv(aResponse)._end();
  62942. return self;
  62943. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62944. },
  62945. args: ["aResponse"],
  62946. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62947. referencedClasses: [],
  62948. messageSends: ["writeHead:options:", "end"]
  62949. }),
  62950. $globals.FileServer);
  62951. $core.addMethod(
  62952. $core.method({
  62953. selector: "respondRedirect:to:",
  62954. protocol: "request handling",
  62955. fn: function (aString,aResponse){
  62956. var self=this,$self=this;
  62957. return $core.withContext(function($ctx1) {
  62958. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62959. $recv(aResponse)._end();
  62960. return self;
  62961. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62962. },
  62963. args: ["aString", "aResponse"],
  62964. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62965. referencedClasses: [],
  62966. messageSends: ["writeHead:options:", "end"]
  62967. }),
  62968. $globals.FileServer);
  62969. $core.addMethod(
  62970. $core.method({
  62971. selector: "start",
  62972. protocol: "starting",
  62973. fn: function (){
  62974. var self=this,$self=this;
  62975. return $core.withContext(function($ctx1) {
  62976. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  62977. $self._checkDirectoryLayout();
  62978. $1=$recv($self["@http"])._createServer_((function(request,response){
  62979. return $core.withContext(function($ctx2) {
  62980. return $self._handleRequest_respondTo_(request,response);
  62981. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  62982. }));
  62983. $recv($1)._on_do_("error",(function(error){
  62984. return $core.withContext(function($ctx2) {
  62985. $2=console;
  62986. $3="Error starting server: ".__comma(error);
  62987. $ctx2.sendIdx[","]=1;
  62988. return $recv($2)._log_($3);
  62989. $ctx2.sendIdx["log:"]=1;
  62990. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62991. }));
  62992. $ctx1.sendIdx["on:do:"]=1;
  62993. $recv($1)._on_do_("listening",(function(){
  62994. return $core.withContext(function($ctx2) {
  62995. $4=console;
  62996. $8=$self._host();
  62997. $ctx2.sendIdx["host"]=1;
  62998. $7="Starting file server on http://".__comma($8);
  62999. $6=$recv($7).__comma(":");
  63000. $ctx2.sendIdx[","]=3;
  63001. $10=$self._port();
  63002. $ctx2.sendIdx["port"]=1;
  63003. $9=$recv($10)._asString();
  63004. $5=$recv($6).__comma($9);
  63005. $ctx2.sendIdx[","]=2;
  63006. return $recv($4)._log_($5);
  63007. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63008. }));
  63009. $recv($1)._listen_host_($self._port(),$self._host());
  63010. return self;
  63011. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  63012. },
  63013. args: [],
  63014. 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.",
  63015. referencedClasses: [],
  63016. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  63017. }),
  63018. $globals.FileServer);
  63019. $core.addMethod(
  63020. $core.method({
  63021. selector: "startOn:",
  63022. protocol: "starting",
  63023. fn: function (aPort){
  63024. var self=this,$self=this;
  63025. return $core.withContext(function($ctx1) {
  63026. $self._port_(aPort);
  63027. $self._start();
  63028. return self;
  63029. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  63030. },
  63031. args: ["aPort"],
  63032. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  63033. referencedClasses: [],
  63034. messageSends: ["port:", "start"]
  63035. }),
  63036. $globals.FileServer);
  63037. $core.addMethod(
  63038. $core.method({
  63039. selector: "username:",
  63040. protocol: "accessing",
  63041. fn: function (aUsername){
  63042. var self=this,$self=this;
  63043. $self["@username"]=aUsername;
  63044. return self;
  63045. },
  63046. args: ["aUsername"],
  63047. source: "username: aUsername\x0a\x09username := aUsername.",
  63048. referencedClasses: [],
  63049. messageSends: []
  63050. }),
  63051. $globals.FileServer);
  63052. $core.addMethod(
  63053. $core.method({
  63054. selector: "validateBasePath",
  63055. protocol: "private",
  63056. fn: function (){
  63057. var self=this,$self=this;
  63058. return $core.withContext(function($ctx1) {
  63059. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  63060. $1=$self["@fs"];
  63061. $2=$self._basePath();
  63062. $ctx1.sendIdx["basePath"]=1;
  63063. $recv($1)._stat_then_($2,(function(err,stat){
  63064. return $core.withContext(function($ctx2) {
  63065. if(($receiver = err) == null || $receiver.a$nil){
  63066. $3=$recv(stat)._isDirectory();
  63067. if(!$core.assert($3)){
  63068. $4=console;
  63069. $7=$self._basePath();
  63070. $ctx2.sendIdx["basePath"]=2;
  63071. $6="Warning: --base-path parameter ".__comma($7);
  63072. $ctx2.sendIdx[","]=2;
  63073. $5=$recv($6).__comma(" is not a directory.");
  63074. $ctx2.sendIdx[","]=1;
  63075. return $recv($4)._warn_($5);
  63076. $ctx2.sendIdx["warn:"]=1;
  63077. }
  63078. } else {
  63079. $8=console;
  63080. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  63081. $ctx2.sendIdx[","]=3;
  63082. return $recv($8)._warn_($9);
  63083. }
  63084. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  63085. }));
  63086. return self;
  63087. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  63088. },
  63089. args: [],
  63090. 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.' ]].",
  63091. referencedClasses: [],
  63092. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  63093. }),
  63094. $globals.FileServer);
  63095. $core.addMethod(
  63096. $core.method({
  63097. selector: "withBasePath:",
  63098. protocol: "private",
  63099. fn: function (aBaseRelativePath){
  63100. var self=this,$self=this;
  63101. return $core.withContext(function($ctx1) {
  63102. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  63103. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  63104. },
  63105. args: ["aBaseRelativePath"],
  63106. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  63107. referencedClasses: [],
  63108. messageSends: ["join:with:", "basePath"]
  63109. }),
  63110. $globals.FileServer);
  63111. $core.addMethod(
  63112. $core.method({
  63113. selector: "writeData:toFileNamed:",
  63114. protocol: "private",
  63115. fn: function (data,aFilename){
  63116. var self=this,$self=this;
  63117. return $core.withContext(function($ctx1) {
  63118. $recv(console)._log_(aFilename);
  63119. return self;
  63120. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  63121. },
  63122. args: ["data", "aFilename"],
  63123. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  63124. referencedClasses: [],
  63125. messageSends: ["log:"]
  63126. }),
  63127. $globals.FileServer);
  63128. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  63129. $core.addMethod(
  63130. $core.method({
  63131. selector: "commandLineSwitches",
  63132. protocol: "accessing",
  63133. fn: function (){
  63134. var self=this,$self=this;
  63135. var switches;
  63136. return $core.withContext(function($ctx1) {
  63137. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  63138. return $core.withContext(function($ctx2) {
  63139. return $recv(each)._selector();
  63140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63141. }));
  63142. $ctx1.sendIdx["collect:"]=1;
  63143. switches=$recv(switches)._select_((function(each){
  63144. return $core.withContext(function($ctx2) {
  63145. return $recv(each)._match_("^[^:]*:$");
  63146. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  63147. }));
  63148. switches=$recv(switches)._collect_((function(each){
  63149. return $core.withContext(function($ctx2) {
  63150. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  63151. $ctx2.sendIdx["replace:with:"]=1;
  63152. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  63153. }));
  63154. return switches;
  63155. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  63156. },
  63157. args: [],
  63158. 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",
  63159. referencedClasses: [],
  63160. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  63161. }),
  63162. $globals.FileServer.a$cls);
  63163. $core.addMethod(
  63164. $core.method({
  63165. selector: "createServerWithArguments:",
  63166. protocol: "initialization",
  63167. fn: function (options){
  63168. var self=this,$self=this;
  63169. var server,popFront,front,optionName,optionValue,switches;
  63170. return $core.withContext(function($ctx1) {
  63171. var $1,$2,$3,$4,$5,$6,$7,$8;
  63172. var $early={};
  63173. try {
  63174. switches=$self._commandLineSwitches();
  63175. server=$self._new();
  63176. $recv(options)._ifEmpty_((function(){
  63177. throw $early=[server];
  63178. }));
  63179. $1=$recv($recv(options)._size())._even();
  63180. if(!$core.assert($1)){
  63181. $recv(console)._log_("Using default parameters.");
  63182. $ctx1.sendIdx["log:"]=1;
  63183. $2=console;
  63184. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  63185. $ctx1.sendIdx[","]=1;
  63186. $recv($2)._log_($3);
  63187. $ctx1.sendIdx["log:"]=2;
  63188. $4=console;
  63189. $5="Use any of the following ones: ".__comma(switches);
  63190. $ctx1.sendIdx[","]=2;
  63191. $recv($4)._log_($5);
  63192. $ctx1.sendIdx["log:"]=3;
  63193. return server;
  63194. }
  63195. popFront=(function(args){
  63196. return $core.withContext(function($ctx2) {
  63197. front=$recv(args)._first();
  63198. $recv(args)._remove_(front);
  63199. return front;
  63200. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  63201. });
  63202. $recv((function(){
  63203. return $core.withContext(function($ctx2) {
  63204. return $recv(options)._notEmpty();
  63205. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  63206. }))._whileTrue_((function(){
  63207. return $core.withContext(function($ctx2) {
  63208. optionName=$recv(popFront)._value_(options);
  63209. $ctx2.sendIdx["value:"]=1;
  63210. optionValue=$recv(popFront)._value_(options);
  63211. $6=$recv(switches)._includes_(optionName);
  63212. if($core.assert($6)){
  63213. optionName=$self._selectorForCommandLineSwitch_(optionName);
  63214. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  63215. } else {
  63216. $7=console;
  63217. $8=$recv(optionName).__comma(" is not a valid commandline option");
  63218. $ctx2.sendIdx[","]=3;
  63219. $recv($7)._log_($8);
  63220. $ctx2.sendIdx["log:"]=4;
  63221. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  63222. }
  63223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63224. }));
  63225. return server;
  63226. }
  63227. catch(e) {if(e===$early)return e[0]; throw e}
  63228. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  63229. },
  63230. args: ["options"],
  63231. 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.",
  63232. referencedClasses: ["Array"],
  63233. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  63234. }),
  63235. $globals.FileServer.a$cls);
  63236. $core.addMethod(
  63237. $core.method({
  63238. selector: "defaultBasePath",
  63239. protocol: "accessing",
  63240. fn: function (){
  63241. var self=this,$self=this;
  63242. return "./";
  63243. },
  63244. args: [],
  63245. source: "defaultBasePath\x0a\x09^ './'",
  63246. referencedClasses: [],
  63247. messageSends: []
  63248. }),
  63249. $globals.FileServer.a$cls);
  63250. $core.addMethod(
  63251. $core.method({
  63252. selector: "defaultHost",
  63253. protocol: "accessing",
  63254. fn: function (){
  63255. var self=this,$self=this;
  63256. return "127.0.0.1";
  63257. },
  63258. args: [],
  63259. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  63260. referencedClasses: [],
  63261. messageSends: []
  63262. }),
  63263. $globals.FileServer.a$cls);
  63264. $core.addMethod(
  63265. $core.method({
  63266. selector: "defaultMimeTypes",
  63267. protocol: "accessing",
  63268. fn: function (){
  63269. var self=this,$self=this;
  63270. 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"]);
  63271. },
  63272. args: [],
  63273. 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}",
  63274. referencedClasses: [],
  63275. messageSends: []
  63276. }),
  63277. $globals.FileServer.a$cls);
  63278. $core.addMethod(
  63279. $core.method({
  63280. selector: "defaultPort",
  63281. protocol: "accessing",
  63282. fn: function (){
  63283. var self=this,$self=this;
  63284. return (4000);
  63285. },
  63286. args: [],
  63287. source: "defaultPort\x0a\x09^ 4000",
  63288. referencedClasses: [],
  63289. messageSends: []
  63290. }),
  63291. $globals.FileServer.a$cls);
  63292. $core.addMethod(
  63293. $core.method({
  63294. selector: "main",
  63295. protocol: "initialization",
  63296. fn: function (){
  63297. var self=this,$self=this;
  63298. var fileServer,args;
  63299. return $core.withContext(function($ctx1) {
  63300. var $1;
  63301. var $early={};
  63302. try {
  63303. args=$recv(process)._argv();
  63304. $recv(args)._removeFrom_to_((1),(3));
  63305. $recv(args)._detect_ifNone_((function(each){
  63306. return $core.withContext(function($ctx2) {
  63307. $1=$recv(each).__eq("--help");
  63308. if($core.assert($1)){
  63309. return $recv($globals.FileServer)._printHelp();
  63310. }
  63311. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63312. }),(function(){
  63313. return $core.withContext(function($ctx2) {
  63314. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  63315. throw $early=[$recv(fileServer)._start()];
  63316. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63317. }));
  63318. return self;
  63319. }
  63320. catch(e) {if(e===$early)return e[0]; throw e}
  63321. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  63322. },
  63323. args: [],
  63324. 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]",
  63325. referencedClasses: ["FileServer"],
  63326. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  63327. }),
  63328. $globals.FileServer.a$cls);
  63329. $core.addMethod(
  63330. $core.method({
  63331. selector: "mimeTypeFor:",
  63332. protocol: "accessing",
  63333. fn: function (aString){
  63334. var self=this,$self=this;
  63335. return $core.withContext(function($ctx1) {
  63336. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  63337. return "text/plain";
  63338. }));
  63339. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  63340. },
  63341. args: ["aString"],
  63342. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  63343. referencedClasses: [],
  63344. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  63345. }),
  63346. $globals.FileServer.a$cls);
  63347. $core.addMethod(
  63348. $core.method({
  63349. selector: "mimeTypes",
  63350. protocol: "accessing",
  63351. fn: function (){
  63352. var self=this,$self=this;
  63353. return $core.withContext(function($ctx1) {
  63354. var $1,$receiver;
  63355. $1=$self["@mimeTypes"];
  63356. if(($receiver = $1) == null || $receiver.a$nil){
  63357. $self["@mimeTypes"]=$self._defaultMimeTypes();
  63358. return $self["@mimeTypes"];
  63359. } else {
  63360. return $1;
  63361. }
  63362. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  63363. },
  63364. args: [],
  63365. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  63366. referencedClasses: [],
  63367. messageSends: ["ifNil:", "defaultMimeTypes"]
  63368. }),
  63369. $globals.FileServer.a$cls);
  63370. $core.addMethod(
  63371. $core.method({
  63372. selector: "printHelp",
  63373. protocol: "accessing",
  63374. fn: function (){
  63375. var self=this,$self=this;
  63376. return $core.withContext(function($ctx1) {
  63377. $recv(console)._log_("Available commandline options are:");
  63378. $ctx1.sendIdx["log:"]=1;
  63379. $recv(console)._log_("--help");
  63380. $ctx1.sendIdx["log:"]=2;
  63381. $recv($self._commandLineSwitches())._do_((function(each){
  63382. return $core.withContext(function($ctx2) {
  63383. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63384. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63385. }));
  63386. return self;
  63387. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63388. },
  63389. args: [],
  63390. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63391. referencedClasses: [],
  63392. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63393. }),
  63394. $globals.FileServer.a$cls);
  63395. $core.addMethod(
  63396. $core.method({
  63397. selector: "selectorForCommandLineSwitch:",
  63398. protocol: "accessing",
  63399. fn: function (aSwitch){
  63400. var self=this,$self=this;
  63401. return $core.withContext(function($ctx1) {
  63402. var $1;
  63403. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63404. return $core.withContext(function($ctx2) {
  63405. return $recv($recv(each)._second())._asUppercase();
  63406. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63407. }));
  63408. $ctx1.sendIdx["replace:with:"]=1;
  63409. return $recv($1).__comma(":");
  63410. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63411. },
  63412. args: ["aSwitch"],
  63413. 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 ]), ':'",
  63414. referencedClasses: [],
  63415. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63416. }),
  63417. $globals.FileServer.a$cls);
  63418. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63419. $core.addMethod(
  63420. $core.method({
  63421. selector: "bowerInstallThenDo:",
  63422. protocol: "action",
  63423. fn: function (aBlock){
  63424. var self=this,$self=this;
  63425. var child;
  63426. return $core.withContext(function($ctx1) {
  63427. var $1,$3,$2;
  63428. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("bower","bower"),["install"]);
  63429. $1=child;
  63430. $recv($1)._on_do_("error",aBlock);
  63431. $ctx1.sendIdx["on:do:"]=1;
  63432. $recv($1)._on_do_("close",(function(code){
  63433. return $core.withContext(function($ctx2) {
  63434. $3=$recv(code).__eq((0));
  63435. if($core.assert($3)){
  63436. $2=nil;
  63437. } else {
  63438. $2=code;
  63439. }
  63440. return $recv(aBlock)._value_($2);
  63441. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63442. }));
  63443. return self;
  63444. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63445. },
  63446. args: ["aBlock"],
  63447. 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 ]) ]",
  63448. referencedClasses: [],
  63449. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63450. }),
  63451. $globals.Initer);
  63452. $core.addMethod(
  63453. $core.method({
  63454. selector: "finishMessage",
  63455. protocol: "action",
  63456. fn: function (){
  63457. var self=this,$self=this;
  63458. return $core.withContext(function($ctx1) {
  63459. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63460. $recv((function(){
  63461. }))._valueWithTimeout_((600));
  63462. return self;
  63463. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63464. },
  63465. args: [],
  63466. 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",
  63467. referencedClasses: ["String"],
  63468. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63469. }),
  63470. $globals.Initer);
  63471. $core.addMethod(
  63472. $core.method({
  63473. selector: "gruntInitThenDo:",
  63474. protocol: "action",
  63475. fn: function (aBlock){
  63476. var self=this,$self=this;
  63477. var child,sanitizedTemplatePath;
  63478. return $core.withContext(function($ctx1) {
  63479. var $1,$3,$2;
  63480. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63481. $ctx1.sendIdx["replace:with:"]=1;
  63482. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63483. $1=child;
  63484. $recv($1)._on_do_("error",aBlock);
  63485. $ctx1.sendIdx["on:do:"]=1;
  63486. $recv($1)._on_do_("close",(function(code){
  63487. return $core.withContext(function($ctx2) {
  63488. $3=$recv(code).__eq((0));
  63489. if($core.assert($3)){
  63490. $2=nil;
  63491. } else {
  63492. $2=code;
  63493. }
  63494. return $recv(aBlock)._value_($2);
  63495. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63496. }));
  63497. return self;
  63498. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63499. },
  63500. args: ["aBlock"],
  63501. source: "gruntInitThenDo: aBlock\x0a\x09| child sanitizedTemplatePath |\x0a\x09sanitizedTemplatePath := ((path join: nmPath with: '@ambers/grunt-init-amber-project')\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 ]) ]",
  63502. referencedClasses: [],
  63503. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63504. }),
  63505. $globals.Initer);
  63506. $core.addMethod(
  63507. $core.method({
  63508. selector: "gruntThenDo:",
  63509. protocol: "action",
  63510. fn: function (aBlock){
  63511. var self=this,$self=this;
  63512. var child;
  63513. return $core.withContext(function($ctx1) {
  63514. var $1,$3,$2;
  63515. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  63516. $1=child;
  63517. $recv($1)._on_do_("error",aBlock);
  63518. $ctx1.sendIdx["on:do:"]=1;
  63519. $recv($1)._on_do_("close",(function(code){
  63520. return $core.withContext(function($ctx2) {
  63521. $3=$recv(code).__eq((0));
  63522. if($core.assert($3)){
  63523. $2=nil;
  63524. } else {
  63525. $2=code;
  63526. }
  63527. return $recv(aBlock)._value_($2);
  63528. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63529. }));
  63530. return self;
  63531. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63532. },
  63533. args: ["aBlock"],
  63534. 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 ]) ]",
  63535. referencedClasses: [],
  63536. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63537. }),
  63538. $globals.Initer);
  63539. $core.addMethod(
  63540. $core.method({
  63541. selector: "initialize",
  63542. protocol: "initialization",
  63543. fn: function (){
  63544. var self=this,$self=this;
  63545. return $core.withContext(function($ctx1) {
  63546. (
  63547. $ctx1.supercall = true,
  63548. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63549. $ctx1.supercall = false;
  63550. $self["@childProcess"]=$recv(require)._value_("child_process");
  63551. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  63552. return self;
  63553. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63554. },
  63555. args: [],
  63556. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63557. referencedClasses: [],
  63558. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63559. }),
  63560. $globals.Initer);
  63561. $core.addMethod(
  63562. $core.method({
  63563. selector: "npmInstallThenDo:",
  63564. protocol: "action",
  63565. fn: function (aBlock){
  63566. var self=this,$self=this;
  63567. var child;
  63568. return $core.withContext(function($ctx1) {
  63569. var $1;
  63570. child=$recv($self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  63571. $1=$recv(child)._stdout();
  63572. $ctx1.sendIdx["stdout"]=1;
  63573. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63574. return self;
  63575. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63576. },
  63577. args: ["aBlock"],
  63578. 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 }",
  63579. referencedClasses: [],
  63580. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63581. }),
  63582. $globals.Initer);
  63583. $core.addMethod(
  63584. $core.method({
  63585. selector: "npmScriptForModule:named:",
  63586. protocol: "npm",
  63587. fn: function (aString,anotherString){
  63588. var self=this,$self=this;
  63589. var modulePath,packageJson,binSection,scriptPath;
  63590. return $core.withContext(function($ctx1) {
  63591. var $1,$3,$4,$2,$5;
  63592. $1=$self["@path"];
  63593. $3=$recv($globals.JSObjectProxy)._on_(require);
  63594. $4=$recv(aString).__comma("/package.json");
  63595. $ctx1.sendIdx[","]=1;
  63596. $2=$recv($3)._resolve_($4);
  63597. modulePath=$recv($1)._dirname_($2);
  63598. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63599. binSection=$recv(packageJson)._at_("bin");
  63600. $ctx1.sendIdx["at:"]=1;
  63601. $5=$recv(binSection)._isString();
  63602. if($core.assert($5)){
  63603. scriptPath=binSection;
  63604. } else {
  63605. scriptPath=$recv(binSection)._at_(anotherString);
  63606. }
  63607. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63608. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63609. },
  63610. args: ["aString", "anotherString"],
  63611. 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",
  63612. referencedClasses: ["JSObjectProxy", "Smalltalk"],
  63613. messageSends: ["dirname:", "resolve:", "on:", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63614. }),
  63615. $globals.Initer);
  63616. $core.addMethod(
  63617. $core.method({
  63618. selector: "start",
  63619. protocol: "action",
  63620. fn: function (){
  63621. var self=this,$self=this;
  63622. return $core.withContext(function($ctx1) {
  63623. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  63624. $self._gruntInitThenDo_((function(error){
  63625. return $core.withContext(function($ctx2) {
  63626. if(($receiver = error) == null || $receiver.a$nil){
  63627. return $self._bowerInstallThenDo_((function(error2){
  63628. return $core.withContext(function($ctx3) {
  63629. if(($receiver = error2) == null || $receiver.a$nil){
  63630. return $self._npmInstallThenDo_((function(error3){
  63631. return $core.withContext(function($ctx4) {
  63632. if(($receiver = error3) == null || $receiver.a$nil){
  63633. return $self._gruntThenDo_((function(error4){
  63634. return $core.withContext(function($ctx5) {
  63635. if(($receiver = error4) == null || $receiver.a$nil){
  63636. $self._finishMessage();
  63637. return $recv(process)._exit();
  63638. } else {
  63639. $7=console;
  63640. $recv($7)._log_("grunt exec error:");
  63641. $ctx5.sendIdx["log:"]=7;
  63642. $recv($7)._log_(error4);
  63643. return $recv(process)._exit_((104));
  63644. }
  63645. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  63646. }));
  63647. } else {
  63648. $5=console;
  63649. $recv($5)._log_("npm install exec error:");
  63650. $ctx4.sendIdx["log:"]=5;
  63651. $6=$recv($5)._log_(error3);
  63652. $ctx4.sendIdx["log:"]=6;
  63653. return $recv(process)._exit_((103));
  63654. $ctx4.sendIdx["exit:"]=3;
  63655. }
  63656. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  63657. }));
  63658. } else {
  63659. $3=console;
  63660. $recv($3)._log_("bower install exec error:");
  63661. $ctx3.sendIdx["log:"]=3;
  63662. $4=$recv($3)._log_(error2);
  63663. $ctx3.sendIdx["log:"]=4;
  63664. return $recv(process)._exit_((102));
  63665. $ctx3.sendIdx["exit:"]=2;
  63666. }
  63667. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63668. }));
  63669. } else {
  63670. $1=console;
  63671. $recv($1)._log_("grunt-init exec error:");
  63672. $ctx2.sendIdx["log:"]=1;
  63673. $2=$recv($1)._log_(error);
  63674. $ctx2.sendIdx["log:"]=2;
  63675. return $recv(process)._exit_((101));
  63676. $ctx2.sendIdx["exit:"]=1;
  63677. }
  63678. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63679. }));
  63680. return self;
  63681. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63682. },
  63683. args: [],
  63684. 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 ]]]]]]]]",
  63685. referencedClasses: [],
  63686. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  63687. }),
  63688. $globals.Initer);
  63689. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63690. $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.";
  63691. $core.addMethod(
  63692. $core.method({
  63693. selector: "addVariableNamed:to:",
  63694. protocol: "private",
  63695. fn: function (aString,anObject){
  63696. var self=this,$self=this;
  63697. var newClass,newObject;
  63698. return $core.withContext(function($ctx1) {
  63699. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63700. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63701. newObject=$recv(newClass)._new();
  63702. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63703. return newObject;
  63704. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63705. },
  63706. args: ["aString", "anObject"],
  63707. 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",
  63708. referencedClasses: [],
  63709. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63710. }),
  63711. $globals.Repl);
  63712. $core.addMethod(
  63713. $core.method({
  63714. selector: "assignNewVariable:do:",
  63715. protocol: "private",
  63716. fn: function (buffer,aBlock){
  63717. var self=this,$self=this;
  63718. return $core.withContext(function($ctx1) {
  63719. var $2,$3,$1,$receiver;
  63720. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63721. var varName,value;
  63722. return $core.withContext(function($ctx2) {
  63723. if(($receiver = name) == null || $receiver.a$nil){
  63724. varName=$self._nextResultName();
  63725. } else {
  63726. varName=name;
  63727. }
  63728. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63729. $recv((function(){
  63730. return $core.withContext(function($ctx3) {
  63731. $2=$recv(varName).__comma(" := ");
  63732. if(($receiver = expr) == null || $receiver.a$nil){
  63733. $3=buffer;
  63734. } else {
  63735. $3=expr;
  63736. }
  63737. $1=$recv($2).__comma($3);
  63738. $ctx3.sendIdx[","]=1;
  63739. value=$self._eval_on_($1,$self["@session"]);
  63740. return value;
  63741. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63742. }))._on_do_($globals.Error,(function(e){
  63743. return $core.withContext(function($ctx3) {
  63744. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63745. value=nil;
  63746. return value;
  63747. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63748. }));
  63749. return $recv(aBlock)._value_value_(varName,value);
  63750. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63751. }));
  63752. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63753. },
  63754. args: ["buffer", "aBlock"],
  63755. 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]",
  63756. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63757. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63758. }),
  63759. $globals.Repl);
  63760. $core.addMethod(
  63761. $core.method({
  63762. selector: "clearScreen",
  63763. protocol: "actions",
  63764. fn: function (){
  63765. var self=this,$self=this;
  63766. var esc,cls;
  63767. return $core.withContext(function($ctx1) {
  63768. var $1;
  63769. esc=$recv($globals.String)._fromCharCode_((27));
  63770. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63771. $ctx1.sendIdx[","]=2;
  63772. cls=$recv($1).__comma("[0;0f");
  63773. $ctx1.sendIdx[","]=1;
  63774. $recv($recv(process)._stdout())._write_(cls);
  63775. $recv($self["@interface"])._prompt();
  63776. return self;
  63777. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63778. },
  63779. args: [],
  63780. 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",
  63781. referencedClasses: ["String"],
  63782. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63783. }),
  63784. $globals.Repl);
  63785. $core.addMethod(
  63786. $core.method({
  63787. selector: "close",
  63788. protocol: "actions",
  63789. fn: function (){
  63790. var self=this,$self=this;
  63791. return $core.withContext(function($ctx1) {
  63792. $recv($recv(process)._stdin())._destroy();
  63793. return self;
  63794. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63795. },
  63796. args: [],
  63797. source: "close\x0a\x09process stdin destroy",
  63798. referencedClasses: [],
  63799. messageSends: ["destroy", "stdin"]
  63800. }),
  63801. $globals.Repl);
  63802. $core.addMethod(
  63803. $core.method({
  63804. selector: "commands",
  63805. protocol: "accessing",
  63806. fn: function (){
  63807. var self=this,$self=this;
  63808. return $self["@commands"];
  63809. },
  63810. args: [],
  63811. source: "commands\x0a\x09^ commands",
  63812. referencedClasses: [],
  63813. messageSends: []
  63814. }),
  63815. $globals.Repl);
  63816. $core.addMethod(
  63817. $core.method({
  63818. selector: "createInterface",
  63819. protocol: "actions",
  63820. fn: function (){
  63821. var self=this,$self=this;
  63822. return $core.withContext(function($ctx1) {
  63823. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63824. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63825. return $core.withContext(function($ctx2) {
  63826. return $self._processLine_(buffer);
  63827. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63828. }));
  63829. $ctx1.sendIdx["on:do:"]=1;
  63830. $recv($self["@interface"])._on_do_("close",(function(){
  63831. return $core.withContext(function($ctx2) {
  63832. return $self._close();
  63833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63834. }));
  63835. $self._printWelcome();
  63836. $self._setupHotkeys();
  63837. $self._setPrompt();
  63838. $recv($self["@interface"])._prompt();
  63839. return self;
  63840. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63841. },
  63842. args: [],
  63843. 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",
  63844. referencedClasses: [],
  63845. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63846. }),
  63847. $globals.Repl);
  63848. $core.addMethod(
  63849. $core.method({
  63850. selector: "encapsulateVariable:withValue:in:",
  63851. protocol: "private",
  63852. fn: function (aString,anObject,aClass){
  63853. var self=this,$self=this;
  63854. var compiler;
  63855. return $core.withContext(function($ctx1) {
  63856. var $1,$4,$3,$2,$5,$6;
  63857. compiler=$recv($globals.Compiler)._new();
  63858. $1=compiler;
  63859. $4=$recv(aString).__comma(": anObject ^ ");
  63860. $ctx1.sendIdx[","]=3;
  63861. $3=$recv($4).__comma(aString);
  63862. $ctx1.sendIdx[","]=2;
  63863. $2=$recv($3).__comma(" := anObject");
  63864. $ctx1.sendIdx[","]=1;
  63865. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63866. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63867. $5=compiler;
  63868. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63869. $ctx1.sendIdx[","]=4;
  63870. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63871. return self;
  63872. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63873. },
  63874. args: ["aString", "anObject", "aClass"],
  63875. 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'.",
  63876. referencedClasses: ["Compiler"],
  63877. messageSends: ["new", "install:forClass:protocol:", ","]
  63878. }),
  63879. $globals.Repl);
  63880. $core.addMethod(
  63881. $core.method({
  63882. selector: "eval:",
  63883. protocol: "actions",
  63884. fn: function (buffer){
  63885. var self=this,$self=this;
  63886. return $core.withContext(function($ctx1) {
  63887. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63888. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63889. },
  63890. args: ["buffer"],
  63891. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63892. referencedClasses: ["DoIt"],
  63893. messageSends: ["eval:on:", "new"]
  63894. }),
  63895. $globals.Repl);
  63896. $core.addMethod(
  63897. $core.method({
  63898. selector: "eval:on:",
  63899. protocol: "actions",
  63900. fn: function (buffer,anObject){
  63901. var self=this,$self=this;
  63902. var result;
  63903. return $core.withContext(function($ctx1) {
  63904. var $1;
  63905. $recv(buffer)._ifNotEmpty_((function(){
  63906. return $core.withContext(function($ctx2) {
  63907. return $recv((function(){
  63908. return $core.withContext(function($ctx3) {
  63909. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63910. return result;
  63911. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63912. }))._tryCatch_((function(e){
  63913. return $core.withContext(function($ctx3) {
  63914. $1=$recv(e)._isSmalltalkError();
  63915. if($core.assert($1)){
  63916. return $recv(e)._pass();
  63917. } else {
  63918. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63919. }
  63920. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63921. }));
  63922. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63923. }));
  63924. return result;
  63925. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63926. },
  63927. args: ["buffer", "anObject"],
  63928. 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 pass ]\x0a\x09\x09\x09\x09\x09ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  63929. referencedClasses: ["Compiler"],
  63930. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "pass", "write:", "stdout", "jsStack"]
  63931. }),
  63932. $globals.Repl);
  63933. $core.addMethod(
  63934. $core.method({
  63935. selector: "executeCommand:",
  63936. protocol: "private",
  63937. fn: function (aString){
  63938. var self=this,$self=this;
  63939. return $core.withContext(function($ctx1) {
  63940. var $1;
  63941. var $early={};
  63942. try {
  63943. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63944. return $core.withContext(function($ctx2) {
  63945. $1=$recv(names)._includes_(aString);
  63946. if($core.assert($1)){
  63947. $recv(cmd)._value();
  63948. throw $early=[true];
  63949. }
  63950. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63951. }));
  63952. return false;
  63953. }
  63954. catch(e) {if(e===$early)return e[0]; throw e}
  63955. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63956. },
  63957. args: ["aString"],
  63958. 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",
  63959. referencedClasses: [],
  63960. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63961. }),
  63962. $globals.Repl);
  63963. $core.addMethod(
  63964. $core.method({
  63965. selector: "initialize",
  63966. protocol: "initialization",
  63967. fn: function (){
  63968. var self=this,$self=this;
  63969. return $core.withContext(function($ctx1) {
  63970. (
  63971. $ctx1.supercall = true,
  63972. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63973. $ctx1.supercall = false;
  63974. $self["@session"]=$recv($globals.DoIt)._new();
  63975. $self["@readline"]=$recv(require)._value_("readline");
  63976. $ctx1.sendIdx["value:"]=1;
  63977. $self["@util"]=$recv(require)._value_("util");
  63978. $self._setupCommands();
  63979. return self;
  63980. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  63981. },
  63982. args: [],
  63983. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  63984. referencedClasses: ["DoIt"],
  63985. messageSends: ["initialize", "new", "value:", "setupCommands"]
  63986. }),
  63987. $globals.Repl);
  63988. $core.addMethod(
  63989. $core.method({
  63990. selector: "instanceVariableNamesFor:",
  63991. protocol: "private",
  63992. fn: function (aClass){
  63993. var self=this,$self=this;
  63994. return $core.withContext(function($ctx1) {
  63995. var $1,$2,$receiver;
  63996. $1=$recv(aClass)._superclass();
  63997. $ctx1.sendIdx["superclass"]=1;
  63998. if(($receiver = $1) == null || $receiver.a$nil){
  63999. return $recv(aClass)._instanceVariableNames();
  64000. } else {
  64001. $2=$recv(aClass)._instanceVariableNames();
  64002. $ctx1.sendIdx["instanceVariableNames"]=1;
  64003. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  64004. }
  64005. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  64006. },
  64007. args: ["aClass"],
  64008. 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]",
  64009. referencedClasses: [],
  64010. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  64011. }),
  64012. $globals.Repl);
  64013. $core.addMethod(
  64014. $core.method({
  64015. selector: "isIdentifier:",
  64016. protocol: "private",
  64017. fn: function (aString){
  64018. var self=this,$self=this;
  64019. return $core.withContext(function($ctx1) {
  64020. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  64021. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  64022. },
  64023. args: ["aString"],
  64024. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  64025. referencedClasses: [],
  64026. messageSends: ["match:", "asRegexp"]
  64027. }),
  64028. $globals.Repl);
  64029. $core.addMethod(
  64030. $core.method({
  64031. selector: "isVariableDefined:",
  64032. protocol: "private",
  64033. fn: function (aString){
  64034. var self=this,$self=this;
  64035. return $core.withContext(function($ctx1) {
  64036. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  64037. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  64038. },
  64039. args: ["aString"],
  64040. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  64041. referencedClasses: [],
  64042. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  64043. }),
  64044. $globals.Repl);
  64045. $core.addMethod(
  64046. $core.method({
  64047. selector: "nextResultName",
  64048. protocol: "private",
  64049. fn: function (){
  64050. var self=this,$self=this;
  64051. return $core.withContext(function($ctx1) {
  64052. var $1,$receiver;
  64053. $1=$self["@resultCount"];
  64054. if(($receiver = $1) == null || $receiver.a$nil){
  64055. $self["@resultCount"]=(1);
  64056. } else {
  64057. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  64058. }
  64059. return "res".__comma($recv($self["@resultCount"])._asString());
  64060. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  64061. },
  64062. args: [],
  64063. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  64064. referencedClasses: [],
  64065. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  64066. }),
  64067. $globals.Repl);
  64068. $core.addMethod(
  64069. $core.method({
  64070. selector: "onKeyPress:",
  64071. protocol: "private",
  64072. fn: function (key){
  64073. var self=this,$self=this;
  64074. return $core.withContext(function($ctx1) {
  64075. var $1;
  64076. $1=$recv($recv(key)._ctrl())._and_((function(){
  64077. return $core.withContext(function($ctx2) {
  64078. return $recv($recv(key)._name()).__eq("l");
  64079. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64080. }));
  64081. if($core.assert($1)){
  64082. $self._clearScreen();
  64083. }
  64084. return self;
  64085. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  64086. },
  64087. args: ["key"],
  64088. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  64089. referencedClasses: [],
  64090. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  64091. }),
  64092. $globals.Repl);
  64093. $core.addMethod(
  64094. $core.method({
  64095. selector: "parseAssignment:do:",
  64096. protocol: "private",
  64097. fn: function (aString,aBlock){
  64098. var self=this,$self=this;
  64099. var assignment;
  64100. return $core.withContext(function($ctx1) {
  64101. var $2,$1;
  64102. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  64103. return $core.withContext(function($ctx2) {
  64104. return $recv(s)._trimBoth();
  64105. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  64106. }));
  64107. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  64108. return $core.withContext(function($ctx2) {
  64109. $2=$recv(assignment)._first();
  64110. $ctx2.sendIdx["first"]=1;
  64111. return $self._isIdentifier_($2);
  64112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64113. }));
  64114. if($core.assert($1)){
  64115. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  64116. $ctx1.sendIdx["value:value:"]=1;
  64117. } else {
  64118. return $recv(aBlock)._value_value_(nil,nil);
  64119. }
  64120. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  64121. },
  64122. args: ["aString", "aBlock"],
  64123. 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 ]",
  64124. referencedClasses: [],
  64125. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  64126. }),
  64127. $globals.Repl);
  64128. $core.addMethod(
  64129. $core.method({
  64130. selector: "presentResultNamed:withValue:",
  64131. protocol: "private",
  64132. fn: function (varName,value){
  64133. var self=this,$self=this;
  64134. return $core.withContext(function($ctx1) {
  64135. var $3,$2,$1;
  64136. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  64137. $ctx1.sendIdx[","]=3;
  64138. $2=$recv($3).__comma(" = ");
  64139. $ctx1.sendIdx[","]=2;
  64140. $1=$recv($2).__comma($recv(value)._asString());
  64141. $ctx1.sendIdx[","]=1;
  64142. $recv($globals.Transcript)._show_($1);
  64143. $recv($globals.Transcript)._cr();
  64144. $recv($self["@interface"])._prompt();
  64145. return self;
  64146. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  64147. },
  64148. args: ["varName", "value"],
  64149. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  64150. referencedClasses: ["Transcript"],
  64151. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  64152. }),
  64153. $globals.Repl);
  64154. $core.addMethod(
  64155. $core.method({
  64156. selector: "printWelcome",
  64157. protocol: "actions",
  64158. fn: function (){
  64159. var self=this,$self=this;
  64160. return $core.withContext(function($ctx1) {
  64161. $recv($globals.Transcript)._show_("Type :q to exit.");
  64162. $recv($globals.Transcript)._cr();
  64163. return self;
  64164. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  64165. },
  64166. args: [],
  64167. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  64168. referencedClasses: ["Transcript"],
  64169. messageSends: ["show:", "cr"]
  64170. }),
  64171. $globals.Repl);
  64172. $core.addMethod(
  64173. $core.method({
  64174. selector: "processLine:",
  64175. protocol: "private",
  64176. fn: function (buffer){
  64177. var self=this,$self=this;
  64178. var show;
  64179. return $core.withContext(function($ctx1) {
  64180. var $1,$2;
  64181. show=(function(varName,value){
  64182. return $core.withContext(function($ctx2) {
  64183. return $self._presentResultNamed_withValue_(varName,value);
  64184. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  64185. });
  64186. $1=$self._executeCommand_(buffer);
  64187. if(!$core.assert($1)){
  64188. $2=$self._isVariableDefined_(buffer);
  64189. if($core.assert($2)){
  64190. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  64191. } else {
  64192. $self._assignNewVariable_do_(buffer,show);
  64193. }
  64194. }
  64195. return self;
  64196. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  64197. },
  64198. args: ["buffer"],
  64199. 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]]",
  64200. referencedClasses: [],
  64201. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  64202. }),
  64203. $globals.Repl);
  64204. $core.addMethod(
  64205. $core.method({
  64206. selector: "prompt",
  64207. protocol: "accessing",
  64208. fn: function (){
  64209. var self=this,$self=this;
  64210. return "amber >> ";
  64211. },
  64212. args: [],
  64213. source: "prompt\x0a\x09^ 'amber >> '",
  64214. referencedClasses: [],
  64215. messageSends: []
  64216. }),
  64217. $globals.Repl);
  64218. $core.addMethod(
  64219. $core.method({
  64220. selector: "setPreviousVariablesFor:from:",
  64221. protocol: "private",
  64222. fn: function (newObject,oldObject){
  64223. var self=this,$self=this;
  64224. return $core.withContext(function($ctx1) {
  64225. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  64226. return $core.withContext(function($ctx2) {
  64227. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  64228. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64229. }));
  64230. return self;
  64231. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  64232. },
  64233. args: ["newObject", "oldObject"],
  64234. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  64235. referencedClasses: [],
  64236. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  64237. }),
  64238. $globals.Repl);
  64239. $core.addMethod(
  64240. $core.method({
  64241. selector: "setPrompt",
  64242. protocol: "actions",
  64243. fn: function (){
  64244. var self=this,$self=this;
  64245. return $core.withContext(function($ctx1) {
  64246. $recv($self["@interface"])._setPrompt_($self._prompt());
  64247. return self;
  64248. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  64249. },
  64250. args: [],
  64251. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  64252. referencedClasses: [],
  64253. messageSends: ["setPrompt:", "prompt"]
  64254. }),
  64255. $globals.Repl);
  64256. $core.addMethod(
  64257. $core.method({
  64258. selector: "setupCommands",
  64259. protocol: "initialization",
  64260. fn: function (){
  64261. var self=this,$self=this;
  64262. return $core.withContext(function($ctx1) {
  64263. var $2,$1;
  64264. $2=$recv([":q"]).__minus_gt((function(){
  64265. return $core.withContext(function($ctx2) {
  64266. return $recv(process)._exit();
  64267. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64268. }));
  64269. $ctx1.sendIdx["->"]=1;
  64270. $1=[$2,$recv([""]).__minus_gt((function(){
  64271. return $core.withContext(function($ctx2) {
  64272. return $recv($self["@interface"])._prompt();
  64273. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64274. }))];
  64275. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  64276. return self;
  64277. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  64278. },
  64279. args: [],
  64280. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  64281. referencedClasses: ["Dictionary"],
  64282. messageSends: ["from:", "->", "exit", "prompt"]
  64283. }),
  64284. $globals.Repl);
  64285. $core.addMethod(
  64286. $core.method({
  64287. selector: "setupHotkeys",
  64288. protocol: "initialization",
  64289. fn: function (){
  64290. var self=this,$self=this;
  64291. return $core.withContext(function($ctx1) {
  64292. var $receiver;
  64293. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  64294. return $core.withContext(function($ctx2) {
  64295. if(($receiver = key) == null || $receiver.a$nil){
  64296. return key;
  64297. } else {
  64298. return $self._onKeyPress_(key);
  64299. }
  64300. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  64301. }));
  64302. return self;
  64303. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  64304. },
  64305. args: [],
  64306. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  64307. referencedClasses: [],
  64308. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  64309. }),
  64310. $globals.Repl);
  64311. $core.addMethod(
  64312. $core.method({
  64313. selector: "subclass:withVariable:",
  64314. protocol: "private",
  64315. fn: function (aClass,varName){
  64316. var self=this,$self=this;
  64317. return $core.withContext(function($ctx1) {
  64318. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  64319. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  64320. },
  64321. args: ["aClass", "varName"],
  64322. 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'",
  64323. referencedClasses: ["ClassBuilder"],
  64324. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  64325. }),
  64326. $globals.Repl);
  64327. $core.addMethod(
  64328. $core.method({
  64329. selector: "subclassNameFor:",
  64330. protocol: "private",
  64331. fn: function (aClass){
  64332. var self=this,$self=this;
  64333. return $core.withContext(function($ctx1) {
  64334. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  64335. $2=$recv(aClass)._name();
  64336. $ctx1.sendIdx["name"]=1;
  64337. $1=$recv($2)._matchesOf_("\x5cd+$");
  64338. $ctx1.sendIdx["matchesOf:"]=1;
  64339. if(($receiver = $1) == null || $receiver.a$nil){
  64340. return $recv($recv(aClass)._name()).__comma("2");
  64341. } else {
  64342. var counter;
  64343. $6=$recv(aClass)._name();
  64344. $ctx1.sendIdx["name"]=2;
  64345. $5=$recv($6)._matchesOf_("\x5cd+$");
  64346. $4=$recv($5)._first();
  64347. $3=$recv($4)._asNumber();
  64348. counter=$recv($3).__plus((1));
  64349. $7=$recv(aClass)._name();
  64350. $ctx1.sendIdx["name"]=3;
  64351. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  64352. }
  64353. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  64354. },
  64355. args: ["aClass"],
  64356. 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'].",
  64357. referencedClasses: [],
  64358. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  64359. }),
  64360. $globals.Repl);
  64361. $core.addMethod(
  64362. $core.method({
  64363. selector: "main",
  64364. protocol: "initialization",
  64365. fn: function (){
  64366. var self=this,$self=this;
  64367. return $core.withContext(function($ctx1) {
  64368. $recv($self._new())._createInterface();
  64369. return self;
  64370. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64371. },
  64372. args: [],
  64373. source: "main\x0a\x09self new createInterface",
  64374. referencedClasses: [],
  64375. messageSends: ["createInterface", "new"]
  64376. }),
  64377. $globals.Repl.a$cls);
  64378. });
  64379. (function () {
  64380. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64381. amber.initialize().then(function () {
  64382. amber.globals.AmberCli._main();
  64383. });
  64384. });
  64385. }());
  64386. require(["app"]);
  64387. });
  64388. define.require('__wrap__');
  64389. }((function amdefine(module, requireFn) {
  64390. 'use strict';
  64391. var defineCache = {},
  64392. loaderCache = {},
  64393. alreadyCalled = false,
  64394. path = require('path'),
  64395. makeRequire, stringRequire;
  64396. /**
  64397. * Trims the . and .. from an array of path segments.
  64398. * It will keep a leading path segment if a .. will become
  64399. * the first path segment, to help with module name lookups,
  64400. * which act like paths, but can be remapped. But the end result,
  64401. * all paths that use this function should look normalized.
  64402. * NOTE: this method MODIFIES the input array.
  64403. * @param {Array} ary the array of path segments.
  64404. */
  64405. function trimDots(ary) {
  64406. var i, part;
  64407. for (i = 0; ary[i]; i+= 1) {
  64408. part = ary[i];
  64409. if (part === '.') {
  64410. ary.splice(i, 1);
  64411. i -= 1;
  64412. } else if (part === '..') {
  64413. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64414. //End of the line. Keep at least one non-dot
  64415. //path segment at the front so it can be mapped
  64416. //correctly to disk. Otherwise, there is likely
  64417. //no path mapping for a path starting with '..'.
  64418. //This can still fail, but catches the most reasonable
  64419. //uses of ..
  64420. break;
  64421. } else if (i > 0) {
  64422. ary.splice(i - 1, 2);
  64423. i -= 2;
  64424. }
  64425. }
  64426. }
  64427. }
  64428. function normalize(name, baseName) {
  64429. var baseParts;
  64430. //Adjust any relative paths.
  64431. if (name && name.charAt(0) === '.') {
  64432. //If have a base name, try to normalize against it,
  64433. //otherwise, assume it is a top-level require that will
  64434. //be relative to baseUrl in the end.
  64435. if (baseName) {
  64436. baseParts = baseName.split('/');
  64437. baseParts = baseParts.slice(0, baseParts.length - 1);
  64438. baseParts = baseParts.concat(name.split('/'));
  64439. trimDots(baseParts);
  64440. name = baseParts.join('/');
  64441. }
  64442. }
  64443. return name;
  64444. }
  64445. /**
  64446. * Create the normalize() function passed to a loader plugin's
  64447. * normalize method.
  64448. */
  64449. function makeNormalize(relName) {
  64450. return function (name) {
  64451. return normalize(name, relName);
  64452. };
  64453. }
  64454. function makeLoad(id) {
  64455. function load(value) {
  64456. loaderCache[id] = value;
  64457. }
  64458. load.fromText = function (id, text) {
  64459. //This one is difficult because the text can/probably uses
  64460. //define, and any relative paths and requires should be relative
  64461. //to that id was it would be found on disk. But this would require
  64462. //bootstrapping a module/require fairly deeply from node core.
  64463. //Not sure how best to go about that yet.
  64464. throw new Error('amdefine does not implement load.fromText');
  64465. };
  64466. return load;
  64467. }
  64468. makeRequire = function (systemRequire, exports, module, relId) {
  64469. function amdRequire(deps, callback) {
  64470. if (typeof deps === 'string') {
  64471. //Synchronous, single module require('')
  64472. return stringRequire(systemRequire, exports, module, deps, relId);
  64473. } else {
  64474. //Array of dependencies with a callback.
  64475. //Convert the dependencies to modules.
  64476. deps = deps.map(function (depName) {
  64477. return stringRequire(systemRequire, exports, module, depName, relId);
  64478. });
  64479. //Wait for next tick to call back the require call.
  64480. if (callback) {
  64481. process.nextTick(function () {
  64482. callback.apply(null, deps);
  64483. });
  64484. }
  64485. }
  64486. }
  64487. amdRequire.toUrl = function (filePath) {
  64488. if (filePath.indexOf('.') === 0) {
  64489. return normalize(filePath, path.dirname(module.filename));
  64490. } else {
  64491. return filePath;
  64492. }
  64493. };
  64494. return amdRequire;
  64495. };
  64496. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64497. requireFn = requireFn || function req() {
  64498. return module.require.apply(module, arguments);
  64499. };
  64500. function runFactory(id, deps, factory) {
  64501. var r, e, m, result;
  64502. if (id) {
  64503. e = loaderCache[id] = {};
  64504. m = {
  64505. id: id,
  64506. uri: __filename,
  64507. exports: e
  64508. };
  64509. r = makeRequire(requireFn, e, m, id);
  64510. } else {
  64511. //Only support one define call per file
  64512. if (alreadyCalled) {
  64513. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64514. }
  64515. alreadyCalled = true;
  64516. //Use the real variables from node
  64517. //Use module.exports for exports, since
  64518. //the exports in here is amdefine exports.
  64519. e = module.exports;
  64520. m = module;
  64521. r = makeRequire(requireFn, e, m, module.id);
  64522. }
  64523. //If there are dependencies, they are strings, so need
  64524. //to convert them to dependency values.
  64525. if (deps) {
  64526. deps = deps.map(function (depName) {
  64527. return r(depName);
  64528. });
  64529. }
  64530. //Call the factory with the right dependencies.
  64531. if (typeof factory === 'function') {
  64532. result = factory.apply(m.exports, deps);
  64533. } else {
  64534. result = factory;
  64535. }
  64536. if (result !== undefined) {
  64537. m.exports = result;
  64538. if (id) {
  64539. loaderCache[id] = m.exports;
  64540. }
  64541. }
  64542. }
  64543. stringRequire = function (systemRequire, exports, module, id, relId) {
  64544. //Split the ID by a ! so that
  64545. var index = id.indexOf('!'),
  64546. originalId = id,
  64547. prefix, plugin;
  64548. if (index === -1) {
  64549. id = normalize(id, relId);
  64550. //Straight module lookup. If it is one of the special dependencies,
  64551. //deal with it, otherwise, delegate to node.
  64552. if (id === 'require') {
  64553. return makeRequire(systemRequire, exports, module, relId);
  64554. } else if (id === 'exports') {
  64555. return exports;
  64556. } else if (id === 'module') {
  64557. return module;
  64558. } else if (loaderCache.hasOwnProperty(id)) {
  64559. return loaderCache[id];
  64560. } else if (defineCache[id]) {
  64561. runFactory.apply(null, defineCache[id]);
  64562. return loaderCache[id];
  64563. } else {
  64564. if(systemRequire) {
  64565. return systemRequire(originalId);
  64566. } else {
  64567. throw new Error('No module with ID: ' + id);
  64568. }
  64569. }
  64570. } else {
  64571. //There is a plugin in play.
  64572. prefix = id.substring(0, index);
  64573. id = id.substring(index + 1, id.length);
  64574. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64575. if (plugin.normalize) {
  64576. id = plugin.normalize(id, makeNormalize(relId));
  64577. } else {
  64578. //Normalize the ID normally.
  64579. id = normalize(id, relId);
  64580. }
  64581. if (loaderCache[id]) {
  64582. return loaderCache[id];
  64583. } else {
  64584. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64585. return loaderCache[id];
  64586. }
  64587. }
  64588. };
  64589. //Create a define function specific to the module asking for amdefine.
  64590. function define(id, deps, factory) {
  64591. if (Array.isArray(id)) {
  64592. factory = deps;
  64593. deps = id;
  64594. id = undefined;
  64595. } else if (typeof id !== 'string') {
  64596. factory = id;
  64597. id = deps = undefined;
  64598. }
  64599. if (deps && !Array.isArray(deps)) {
  64600. factory = deps;
  64601. deps = undefined;
  64602. }
  64603. if (!deps) {
  64604. deps = ['require', 'exports', 'module'];
  64605. }
  64606. //Set up properties for this module. If an ID, then use
  64607. //internal cache. If no ID, then use the external variables
  64608. //for this node module.
  64609. if (id) {
  64610. //Put the module in deep freeze until there is a
  64611. //require call for it.
  64612. defineCache[id] = [id, deps, factory];
  64613. } else {
  64614. runFactory(id, deps, factory);
  64615. }
  64616. }
  64617. //define.require, which has access to all the values in the
  64618. //cache. Useful for AMD modules that all have IDs in the file,
  64619. //but need to finally export a value to node based on one of those
  64620. //IDs.
  64621. define.require = function (id) {
  64622. if (loaderCache[id]) {
  64623. return loaderCache[id];
  64624. }
  64625. if (defineCache[id]) {
  64626. runFactory.apply(null, defineCache[id]);
  64627. return loaderCache[id];
  64628. }
  64629. };
  64630. define.amd = {};
  64631. return define;
  64632. }(module)), require));