amber-cli.js 2.2 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683
  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: "provided",
  15005. protocol: "converting",
  15006. fn: function (){
  15007. var self=this,$self=this;
  15008. return $core.withContext(function($ctx1) {
  15009. return $recv($self._javascriptConstructor())._provided();
  15010. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.Class)});
  15011. },
  15012. args: [],
  15013. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 Number provided EPSILON\x0a\x09that forwards to (wrapped JS) constructor function.\x22\x0a\x09\x0a\x09^ self javascriptConstructor provided",
  15014. referencedClasses: [],
  15015. messageSends: ["provided", "javascriptConstructor"]
  15016. }),
  15017. $globals.Class);
  15018. $core.addMethod(
  15019. $core.method({
  15020. selector: "rename:",
  15021. protocol: "accessing",
  15022. fn: function (aString){
  15023. var self=this,$self=this;
  15024. return $core.withContext(function($ctx1) {
  15025. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(self,aString);
  15026. return self;
  15027. }, function($ctx1) {$ctx1.fill(self,"rename:",{aString:aString},$globals.Class)});
  15028. },
  15029. args: ["aString"],
  15030. source: "rename: aString\x0a\x09ClassBuilder new renameClass: self to: aString",
  15031. referencedClasses: ["ClassBuilder"],
  15032. messageSends: ["renameClass:to:", "new"]
  15033. }),
  15034. $globals.Class);
  15035. $core.addMethod(
  15036. $core.method({
  15037. selector: "subclasses",
  15038. protocol: "accessing",
  15039. fn: function (){
  15040. var self=this,$self=this;
  15041. return $core.withContext(function($ctx1) {
  15042. return self.subclasses._copy();
  15043. return self;
  15044. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Class)});
  15045. },
  15046. args: [],
  15047. source: "subclasses\x0a\x09<inlineJS: 'return self.subclasses._copy()'>",
  15048. referencedClasses: [],
  15049. messageSends: []
  15050. }),
  15051. $globals.Class);
  15052. $core.addMethod(
  15053. $core.method({
  15054. selector: "theMetaClass",
  15055. protocol: "accessing",
  15056. fn: function (){
  15057. var self=this,$self=this;
  15058. return $core.withContext(function($ctx1) {
  15059. return $self._class();
  15060. }, function($ctx1) {$ctx1.fill(self,"theMetaClass",{},$globals.Class)});
  15061. },
  15062. args: [],
  15063. source: "theMetaClass\x0a\x09^ self class",
  15064. referencedClasses: [],
  15065. messageSends: ["class"]
  15066. }),
  15067. $globals.Class);
  15068. $core.addClass("Metaclass", $globals.Behavior, [], "Kernel-Classes");
  15069. $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.";
  15070. $core.addMethod(
  15071. $core.method({
  15072. selector: "asJavaScriptSource",
  15073. protocol: "converting",
  15074. fn: function (){
  15075. var self=this,$self=this;
  15076. return $core.withContext(function($ctx1) {
  15077. var $1;
  15078. $1=$recv("$globals.".__comma($recv($self._instanceClass())._name())).__comma(".a$cls");
  15079. $ctx1.sendIdx[","]=1;
  15080. return $1;
  15081. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.Metaclass)});
  15082. },
  15083. args: [],
  15084. source: "asJavaScriptSource\x0a\x09^ '$globals.', self instanceClass name, '.a$cls'",
  15085. referencedClasses: [],
  15086. messageSends: [",", "name", "instanceClass"]
  15087. }),
  15088. $globals.Metaclass);
  15089. $core.addMethod(
  15090. $core.method({
  15091. selector: "definition",
  15092. protocol: "accessing",
  15093. fn: function (){
  15094. var self=this,$self=this;
  15095. return $core.withContext(function($ctx1) {
  15096. var $1,$2;
  15097. return $recv($globals.String)._streamContents_((function(stream){
  15098. return $core.withContext(function($ctx2) {
  15099. $recv(stream)._print_(self);
  15100. $ctx2.sendIdx["print:"]=1;
  15101. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifEmpty_ifNotEmpty_((function(){
  15102. return " ";
  15103. }),(function(tcd){
  15104. return $core.withContext(function($ctx3) {
  15105. $1=$recv($globals.String)._lf();
  15106. $ctx3.sendIdx["lf"]=1;
  15107. $2=$recv($globals.String)._tab();
  15108. $ctx3.sendIdx["tab"]=1;
  15109. return [$1,$2,"uses: ",tcd,$recv($globals.String)._lf(),$recv($globals.String)._tab()];
  15110. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,3)});
  15111. })));
  15112. $ctx2.sendIdx["write:"]=1;
  15113. $recv(stream)._write_("instanceVariableNames: ");
  15114. return $recv(stream)._print_(" "._join_($self._instanceVariableNames()));
  15115. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  15116. }));
  15117. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Metaclass)});
  15118. },
  15119. args: [],
  15120. 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) ]",
  15121. referencedClasses: ["String"],
  15122. messageSends: ["streamContents:", "print:", "write:", "ifEmpty:ifNotEmpty:", "traitCompositionDefinition", "lf", "tab", "join:", "instanceVariableNames"]
  15123. }),
  15124. $globals.Metaclass);
  15125. $core.addMethod(
  15126. $core.method({
  15127. selector: "instanceClass",
  15128. protocol: "accessing",
  15129. fn: function (){
  15130. var self=this,$self=this;
  15131. return $core.withContext(function($ctx1) {
  15132. return self.instanceClass;
  15133. return self;
  15134. }, function($ctx1) {$ctx1.fill(self,"instanceClass",{},$globals.Metaclass)});
  15135. },
  15136. args: [],
  15137. source: "instanceClass\x0a\x09<inlineJS: 'return self.instanceClass'>",
  15138. referencedClasses: [],
  15139. messageSends: []
  15140. }),
  15141. $globals.Metaclass);
  15142. $core.addMethod(
  15143. $core.method({
  15144. selector: "instanceVariableNames:",
  15145. protocol: "accessing",
  15146. fn: function (aCollection){
  15147. var self=this,$self=this;
  15148. return $core.withContext(function($ctx1) {
  15149. $recv($recv($globals.ClassBuilder)._new())._class_instanceVariableNames_(self,aCollection);
  15150. return self;
  15151. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNames:",{aCollection:aCollection},$globals.Metaclass)});
  15152. },
  15153. args: ["aCollection"],
  15154. source: "instanceVariableNames: aCollection\x0a\x09ClassBuilder new\x0a\x09\x09class: self instanceVariableNames: aCollection.\x0a\x09^ self",
  15155. referencedClasses: ["ClassBuilder"],
  15156. messageSends: ["class:instanceVariableNames:", "new"]
  15157. }),
  15158. $globals.Metaclass);
  15159. $core.addMethod(
  15160. $core.method({
  15161. selector: "isMetaclass",
  15162. protocol: "testing",
  15163. fn: function (){
  15164. var self=this,$self=this;
  15165. return true;
  15166. },
  15167. args: [],
  15168. source: "isMetaclass\x0a\x09^ true",
  15169. referencedClasses: [],
  15170. messageSends: []
  15171. }),
  15172. $globals.Metaclass);
  15173. $core.addMethod(
  15174. $core.method({
  15175. selector: "name",
  15176. protocol: "accessing",
  15177. fn: function (){
  15178. var self=this,$self=this;
  15179. return $core.withContext(function($ctx1) {
  15180. return $recv($recv($self._instanceClass())._name()).__comma(" class");
  15181. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.Metaclass)});
  15182. },
  15183. args: [],
  15184. source: "name\x0a\x09^ self instanceClass name, ' class'",
  15185. referencedClasses: [],
  15186. messageSends: [",", "name", "instanceClass"]
  15187. }),
  15188. $globals.Metaclass);
  15189. $core.addMethod(
  15190. $core.method({
  15191. selector: "package",
  15192. protocol: "accessing",
  15193. fn: function (){
  15194. var self=this,$self=this;
  15195. return $core.withContext(function($ctx1) {
  15196. return $recv($self._instanceClass())._package();
  15197. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.Metaclass)});
  15198. },
  15199. args: [],
  15200. source: "package\x0a\x09^ self instanceClass package",
  15201. referencedClasses: [],
  15202. messageSends: ["package", "instanceClass"]
  15203. }),
  15204. $globals.Metaclass);
  15205. $core.addMethod(
  15206. $core.method({
  15207. selector: "subclasses",
  15208. protocol: "accessing",
  15209. fn: function (){
  15210. var self=this,$self=this;
  15211. return $core.withContext(function($ctx1) {
  15212. return $core.metaSubclasses(self);
  15213. return self;
  15214. }, function($ctx1) {$ctx1.fill(self,"subclasses",{},$globals.Metaclass)});
  15215. },
  15216. args: [],
  15217. source: "subclasses\x0a\x09<inlineJS: 'return $core.metaSubclasses(self)'>",
  15218. referencedClasses: [],
  15219. messageSends: []
  15220. }),
  15221. $globals.Metaclass);
  15222. $core.addMethod(
  15223. $core.method({
  15224. selector: "theMetaClass",
  15225. protocol: "accessing",
  15226. fn: function (){
  15227. var self=this,$self=this;
  15228. return self;
  15229. },
  15230. args: [],
  15231. source: "theMetaClass\x0a\x09^ self",
  15232. referencedClasses: [],
  15233. messageSends: []
  15234. }),
  15235. $globals.Metaclass);
  15236. $core.addMethod(
  15237. $core.method({
  15238. selector: "theNonMetaClass",
  15239. protocol: "accessing",
  15240. fn: function (){
  15241. var self=this,$self=this;
  15242. return $core.withContext(function($ctx1) {
  15243. return $self._instanceClass();
  15244. }, function($ctx1) {$ctx1.fill(self,"theNonMetaClass",{},$globals.Metaclass)});
  15245. },
  15246. args: [],
  15247. source: "theNonMetaClass\x0a\x09^ self instanceClass",
  15248. referencedClasses: [],
  15249. messageSends: ["instanceClass"]
  15250. }),
  15251. $globals.Metaclass);
  15252. $core.addMethod(
  15253. $core.method({
  15254. selector: "uses:instanceVariableNames:",
  15255. protocol: "accessing",
  15256. fn: function (aTraitCompositionDescription,aCollection){
  15257. var self=this,$self=this;
  15258. var metaclass;
  15259. return $core.withContext(function($ctx1) {
  15260. metaclass=$self._instanceVariableNames_(aCollection);
  15261. $recv(metaclass)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  15262. return metaclass;
  15263. }, function($ctx1) {$ctx1.fill(self,"uses:instanceVariableNames:",{aTraitCompositionDescription:aTraitCompositionDescription,aCollection:aCollection,metaclass:metaclass},$globals.Metaclass)});
  15264. },
  15265. args: ["aTraitCompositionDescription", "aCollection"],
  15266. source: "uses: aTraitCompositionDescription instanceVariableNames: aCollection\x0a\x09| metaclass |\x0a\x09metaclass := self instanceVariableNames: aCollection.\x0a\x09metaclass setTraitComposition: aTraitCompositionDescription asTraitComposition.\x0a\x09^ metaclass",
  15267. referencedClasses: [],
  15268. messageSends: ["instanceVariableNames:", "setTraitComposition:", "asTraitComposition"]
  15269. }),
  15270. $globals.Metaclass);
  15271. $core.addClass("ClassBuilder", $globals.Object, [], "Kernel-Classes");
  15272. $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:`.";
  15273. $core.addMethod(
  15274. $core.method({
  15275. selector: "addSubclassOf:named:instanceVariableNames:package:",
  15276. protocol: "class definition",
  15277. fn: function (aClass,className,aCollection,packageName){
  15278. var self=this,$self=this;
  15279. var theClass,thePackage;
  15280. return $core.withContext(function($ctx1) {
  15281. var $1,$2,$3,$receiver;
  15282. theClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15283. thePackage=$recv($globals.Package)._named_(packageName);
  15284. $1=theClass;
  15285. if(($receiver = $1) == null || $receiver.a$nil){
  15286. $1;
  15287. } else {
  15288. $recv(theClass)._package_(thePackage);
  15289. $2=$recv($recv(theClass)._superclass()).__eq_eq(aClass);
  15290. if(!$core.assert($2)){
  15291. return $self._migrateClassNamed_superclass_instanceVariableNames_package_(className,aClass,aCollection,packageName);
  15292. }
  15293. }
  15294. $3=$self._basicAddSubclassOf_named_instanceVariableNames_package_(aClass,className,aCollection,packageName);
  15295. $recv($3)._recompile();
  15296. return $recv($3)._yourself();
  15297. }, function($ctx1) {$ctx1.fill(self,"addSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,className:className,aCollection:aCollection,packageName:packageName,theClass:theClass,thePackage:thePackage},$globals.ClassBuilder)});
  15298. },
  15299. args: ["aClass", "className", "aCollection", "packageName"],
  15300. 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",
  15301. referencedClasses: ["Smalltalk", "Package"],
  15302. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "ifFalse:", "==", "superclass", "migrateClassNamed:superclass:instanceVariableNames:package:", "recompile", "basicAddSubclassOf:named:instanceVariableNames:package:", "yourself"]
  15303. }),
  15304. $globals.ClassBuilder);
  15305. $core.addMethod(
  15306. $core.method({
  15307. selector: "addTraitNamed:package:",
  15308. protocol: "class definition",
  15309. fn: function (traitName,packageName){
  15310. var self=this,$self=this;
  15311. var theTrait,thePackage;
  15312. return $core.withContext(function($ctx1) {
  15313. var $1,$2,$receiver;
  15314. theTrait=$recv($recv($globals.Smalltalk)._globals())._at_(traitName);
  15315. thePackage=$recv($globals.Package)._named_(packageName);
  15316. $1=theTrait;
  15317. if(($receiver = $1) == null || $receiver.a$nil){
  15318. $1;
  15319. } else {
  15320. $2=theTrait;
  15321. $recv($2)._package_(thePackage);
  15322. $recv($2)._recompile();
  15323. return $recv($2)._yourself();
  15324. }
  15325. return $self._basicAddTraitNamed_package_(traitName,packageName);
  15326. }, function($ctx1) {$ctx1.fill(self,"addTraitNamed:package:",{traitName:traitName,packageName:packageName,theTrait:theTrait,thePackage:thePackage},$globals.ClassBuilder)});
  15327. },
  15328. args: ["traitName", "packageName"],
  15329. 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",
  15330. referencedClasses: ["Smalltalk", "Package"],
  15331. messageSends: ["at:", "globals", "named:", "ifNotNil:", "package:", "recompile", "yourself", "basicAddTraitNamed:package:"]
  15332. }),
  15333. $globals.ClassBuilder);
  15334. $core.addMethod(
  15335. $core.method({
  15336. selector: "basicAddSubclassOf:named:instanceVariableNames:package:",
  15337. protocol: "private",
  15338. fn: function (aClass,aString,aCollection,packageName){
  15339. var self=this,$self=this;
  15340. return $core.withContext(function($ctx1) {
  15341. return $core.addClass(aString, aClass, aCollection, packageName);
  15342. ;
  15343. return self;
  15344. }, function($ctx1) {$ctx1.fill(self,"basicAddSubclassOf:named:instanceVariableNames:package:",{aClass:aClass,aString:aString,aCollection:aCollection,packageName:packageName},$globals.ClassBuilder)});
  15345. },
  15346. args: ["aClass", "aString", "aCollection", "packageName"],
  15347. source: "basicAddSubclassOf: aClass named: aString instanceVariableNames: aCollection package: packageName\x0a\x09<inlineJS: '\x0a\x09\x09return $core.addClass(aString, aClass, aCollection, packageName);\x0a\x09'>",
  15348. referencedClasses: [],
  15349. messageSends: []
  15350. }),
  15351. $globals.ClassBuilder);
  15352. $core.addMethod(
  15353. $core.method({
  15354. selector: "basicAddTraitNamed:package:",
  15355. protocol: "private",
  15356. fn: function (aString,anotherString){
  15357. var self=this,$self=this;
  15358. return $core.withContext(function($ctx1) {
  15359. return $core.addTrait(aString, anotherString);
  15360. return self;
  15361. }, function($ctx1) {$ctx1.fill(self,"basicAddTraitNamed:package:",{aString:aString,anotherString:anotherString},$globals.ClassBuilder)});
  15362. },
  15363. args: ["aString", "anotherString"],
  15364. source: "basicAddTraitNamed: aString package: anotherString\x0a\x09<inlineJS: 'return $core.addTrait(aString, anotherString)'>",
  15365. referencedClasses: [],
  15366. messageSends: []
  15367. }),
  15368. $globals.ClassBuilder);
  15369. $core.addMethod(
  15370. $core.method({
  15371. selector: "basicClass:instanceVariables:",
  15372. protocol: "private",
  15373. fn: function (aClass,aCollection){
  15374. var self=this,$self=this;
  15375. return $core.withContext(function($ctx1) {
  15376. var $1;
  15377. $1=$recv(aClass)._isMetaclass();
  15378. if(!$core.assert($1)){
  15379. $self._error_($recv($recv(aClass)._name()).__comma(" is not a metaclass"));
  15380. }
  15381. $recv(aClass)._basicAt_put_("iVarNames",aCollection);
  15382. return self;
  15383. }, function($ctx1) {$ctx1.fill(self,"basicClass:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15384. },
  15385. args: ["aClass", "aCollection"],
  15386. source: "basicClass: aClass instanceVariables: aCollection\x0a\x0a\x09aClass isMetaclass ifFalse: [ self error: aClass name, ' is not a metaclass' ].\x0a\x09aClass basicAt: 'iVarNames' put: aCollection",
  15387. referencedClasses: [],
  15388. messageSends: ["ifFalse:", "isMetaclass", "error:", ",", "name", "basicAt:put:"]
  15389. }),
  15390. $globals.ClassBuilder);
  15391. $core.addMethod(
  15392. $core.method({
  15393. selector: "basicRemoveClass:",
  15394. protocol: "private",
  15395. fn: function (aClass){
  15396. var self=this,$self=this;
  15397. return $core.withContext(function($ctx1) {
  15398. $core.removeClass(aClass);
  15399. return self;
  15400. }, function($ctx1) {$ctx1.fill(self,"basicRemoveClass:",{aClass:aClass},$globals.ClassBuilder)});
  15401. },
  15402. args: ["aClass"],
  15403. source: "basicRemoveClass: aClass\x0a\x09<inlineJS: '$core.removeClass(aClass)'>",
  15404. referencedClasses: [],
  15405. messageSends: []
  15406. }),
  15407. $globals.ClassBuilder);
  15408. $core.addMethod(
  15409. $core.method({
  15410. selector: "basicRenameClass:to:",
  15411. protocol: "private",
  15412. fn: function (aClass,aString){
  15413. var self=this,$self=this;
  15414. return $core.withContext(function($ctx1) {
  15415. $globals[aString] = aClass;
  15416. delete $globals[aClass.name];
  15417. aClass.name = aString;
  15418. ;
  15419. return self;
  15420. }, function($ctx1) {$ctx1.fill(self,"basicRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15421. },
  15422. args: ["aClass", "aString"],
  15423. 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'>",
  15424. referencedClasses: [],
  15425. messageSends: []
  15426. }),
  15427. $globals.ClassBuilder);
  15428. $core.addMethod(
  15429. $core.method({
  15430. selector: "basicSwapClassNames:with:",
  15431. protocol: "private",
  15432. fn: function (aClass,anotherClass){
  15433. var self=this,$self=this;
  15434. return $core.withContext(function($ctx1) {
  15435. var tmp = aClass.name;
  15436. aClass.name = anotherClass.name;
  15437. anotherClass.name = tmp;
  15438. ;
  15439. return self;
  15440. }, function($ctx1) {$ctx1.fill(self,"basicSwapClassNames:with:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15441. },
  15442. args: ["aClass", "anotherClass"],
  15443. 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'>",
  15444. referencedClasses: [],
  15445. messageSends: []
  15446. }),
  15447. $globals.ClassBuilder);
  15448. $core.addMethod(
  15449. $core.method({
  15450. selector: "class:instanceVariableNames:",
  15451. protocol: "class definition",
  15452. fn: function (aClass,ivarNames){
  15453. var self=this,$self=this;
  15454. return $core.withContext(function($ctx1) {
  15455. $self._class_instanceVariables_(aClass,$self._instanceVariableNamesFor_(ivarNames));
  15456. return self;
  15457. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariableNames:",{aClass:aClass,ivarNames:ivarNames},$globals.ClassBuilder)});
  15458. },
  15459. args: ["aClass", "ivarNames"],
  15460. source: "class: aClass instanceVariableNames: ivarNames\x0a\x09self class: aClass instanceVariables: (self instanceVariableNamesFor: ivarNames)",
  15461. referencedClasses: [],
  15462. messageSends: ["class:instanceVariables:", "instanceVariableNamesFor:"]
  15463. }),
  15464. $globals.ClassBuilder);
  15465. $core.addMethod(
  15466. $core.method({
  15467. selector: "class:instanceVariables:",
  15468. protocol: "class definition",
  15469. fn: function (aClass,aCollection){
  15470. var self=this,$self=this;
  15471. return $core.withContext(function($ctx1) {
  15472. var $1,$3,$2;
  15473. $self._basicClass_instanceVariables_(aClass,aCollection);
  15474. $1=$recv($globals.SystemAnnouncer)._current();
  15475. $3=$recv($globals.ClassDefinitionChanged)._new();
  15476. $recv($3)._theClass_(aClass);
  15477. $2=$recv($3)._yourself();
  15478. $recv($1)._announce_($2);
  15479. return self;
  15480. }, function($ctx1) {$ctx1.fill(self,"class:instanceVariables:",{aClass:aClass,aCollection:aCollection},$globals.ClassBuilder)});
  15481. },
  15482. args: ["aClass", "aCollection"],
  15483. 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)",
  15484. referencedClasses: ["SystemAnnouncer", "ClassDefinitionChanged"],
  15485. messageSends: ["basicClass:instanceVariables:", "announce:", "current", "theClass:", "new", "yourself"]
  15486. }),
  15487. $globals.ClassBuilder);
  15488. $core.addMethod(
  15489. $core.method({
  15490. selector: "copyClass:named:",
  15491. protocol: "copying",
  15492. fn: function (aClass,className){
  15493. var self=this,$self=this;
  15494. var newClass;
  15495. return $core.withContext(function($ctx1) {
  15496. var $1,$3,$2;
  15497. newClass=$self._addSubclassOf_named_instanceVariableNames_package_($recv(aClass)._superclass(),className,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15498. $self._copyClass_to_(aClass,newClass);
  15499. $1=$recv($globals.SystemAnnouncer)._current();
  15500. $3=$recv($globals.ClassAdded)._new();
  15501. $recv($3)._theClass_(newClass);
  15502. $2=$recv($3)._yourself();
  15503. $recv($1)._announce_($2);
  15504. return newClass;
  15505. }, function($ctx1) {$ctx1.fill(self,"copyClass:named:",{aClass:aClass,className:className,newClass:newClass},$globals.ClassBuilder)});
  15506. },
  15507. args: ["aClass", "className"],
  15508. 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",
  15509. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15510. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "superclass", "instanceVariableNames", "name", "package", "copyClass:to:", "announce:", "current", "theClass:", "new", "yourself"]
  15511. }),
  15512. $globals.ClassBuilder);
  15513. $core.addMethod(
  15514. $core.method({
  15515. selector: "copyClass:to:",
  15516. protocol: "copying",
  15517. fn: function (aClass,anotherClass){
  15518. var self=this,$self=this;
  15519. return $core.withContext(function($ctx1) {
  15520. var $1,$3,$2,$4,$5,$6,$7,$8,$10,$9,$12,$11,$14,$15,$13,$16,$17,$18,$19;
  15521. $recv(anotherClass)._comment_($recv(aClass)._comment());
  15522. $1=$recv(aClass)._methodDictionary();
  15523. $ctx1.sendIdx["methodDictionary"]=1;
  15524. $recv($1)._valuesDo_((function(each){
  15525. return $core.withContext(function($ctx2) {
  15526. $3=$recv(each)._methodClass();
  15527. $ctx2.sendIdx["methodClass"]=1;
  15528. $2=$recv($3).__eq(aClass);
  15529. $ctx2.sendIdx["="]=1;
  15530. if($core.assert($2)){
  15531. $4=$recv($globals.Compiler)._new();
  15532. $ctx2.sendIdx["new"]=1;
  15533. $5=$recv(each)._source();
  15534. $ctx2.sendIdx["source"]=1;
  15535. $6=$recv(each)._protocol();
  15536. $ctx2.sendIdx["protocol"]=1;
  15537. return $recv($4)._install_forClass_protocol_($5,anotherClass,$6);
  15538. $ctx2.sendIdx["install:forClass:protocol:"]=1;
  15539. }
  15540. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15541. }));
  15542. $ctx1.sendIdx["valuesDo:"]=1;
  15543. $7=$recv(aClass)._traitComposition();
  15544. $ctx1.sendIdx["traitComposition"]=1;
  15545. $recv(anotherClass)._setTraitComposition_($7);
  15546. $ctx1.sendIdx["setTraitComposition:"]=1;
  15547. $8=$recv(anotherClass)._class();
  15548. $ctx1.sendIdx["class"]=1;
  15549. $10=$recv(aClass)._class();
  15550. $ctx1.sendIdx["class"]=2;
  15551. $9=$recv($10)._instanceVariableNames();
  15552. $self._basicClass_instanceVariables_($8,$9);
  15553. $12=$recv(aClass)._class();
  15554. $ctx1.sendIdx["class"]=3;
  15555. $11=$recv($12)._methodDictionary();
  15556. $recv($11)._valuesDo_((function(each){
  15557. return $core.withContext(function($ctx2) {
  15558. $14=$recv(each)._methodClass();
  15559. $15=$recv(aClass)._class();
  15560. $ctx2.sendIdx["class"]=4;
  15561. $13=$recv($14).__eq($15);
  15562. if($core.assert($13)){
  15563. $16=$recv($globals.Compiler)._new();
  15564. $17=$recv(each)._source();
  15565. $18=$recv(anotherClass)._class();
  15566. $ctx2.sendIdx["class"]=5;
  15567. return $recv($16)._install_forClass_protocol_($17,$18,$recv(each)._protocol());
  15568. }
  15569. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15570. }));
  15571. $19=$recv(anotherClass)._class();
  15572. $ctx1.sendIdx["class"]=6;
  15573. $recv($19)._setTraitComposition_($recv($recv(aClass)._class())._traitComposition());
  15574. return self;
  15575. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15576. },
  15577. args: ["aClass", "anotherClass"],
  15578. 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",
  15579. referencedClasses: ["Compiler"],
  15580. messageSends: ["comment:", "comment", "valuesDo:", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "new", "source", "protocol", "setTraitComposition:", "traitComposition", "basicClass:instanceVariables:", "class", "instanceVariableNames"]
  15581. }),
  15582. $globals.ClassBuilder);
  15583. $core.addMethod(
  15584. $core.method({
  15585. selector: "installMethod:forClass:protocol:",
  15586. protocol: "method definition",
  15587. fn: function (aCompiledMethod,aBehavior,aString){
  15588. var self=this,$self=this;
  15589. return $core.withContext(function($ctx1) {
  15590. $recv(aCompiledMethod)._protocol_(aString);
  15591. $recv(aBehavior)._addCompiledMethod_(aCompiledMethod);
  15592. return aCompiledMethod;
  15593. }, function($ctx1) {$ctx1.fill(self,"installMethod:forClass:protocol:",{aCompiledMethod:aCompiledMethod,aBehavior:aBehavior,aString:aString},$globals.ClassBuilder)});
  15594. },
  15595. args: ["aCompiledMethod", "aBehavior", "aString"],
  15596. source: "installMethod: aCompiledMethod forClass: aBehavior protocol: aString\x0a\x09aCompiledMethod protocol: aString.\x0a\x09aBehavior addCompiledMethod: aCompiledMethod.\x0a\x09^ aCompiledMethod",
  15597. referencedClasses: [],
  15598. messageSends: ["protocol:", "addCompiledMethod:"]
  15599. }),
  15600. $globals.ClassBuilder);
  15601. $core.addMethod(
  15602. $core.method({
  15603. selector: "instanceVariableNamesFor:",
  15604. protocol: "accessing",
  15605. fn: function (aString){
  15606. var self=this,$self=this;
  15607. return $core.withContext(function($ctx1) {
  15608. return $recv($recv(aString)._tokenize_(" "))._reject_((function(each){
  15609. return $core.withContext(function($ctx2) {
  15610. return $recv(each)._isEmpty();
  15611. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15612. }));
  15613. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aString:aString},$globals.ClassBuilder)});
  15614. },
  15615. args: ["aString"],
  15616. source: "instanceVariableNamesFor: aString\x0a\x09^ (aString tokenize: ' ') reject: [ :each | each isEmpty ]",
  15617. referencedClasses: [],
  15618. messageSends: ["reject:", "tokenize:", "isEmpty"]
  15619. }),
  15620. $globals.ClassBuilder);
  15621. $core.addMethod(
  15622. $core.method({
  15623. selector: "migrateClass:superclass:",
  15624. protocol: "class migration",
  15625. fn: function (aClass,anotherClass){
  15626. var self=this,$self=this;
  15627. return $core.withContext(function($ctx1) {
  15628. var $1;
  15629. $1=$recv(aClass)._name();
  15630. $ctx1.sendIdx["name"]=1;
  15631. return $self._migrateClassNamed_superclass_instanceVariableNames_package_($1,anotherClass,$recv(aClass)._instanceVariableNames(),$recv($recv(aClass)._package())._name());
  15632. }, function($ctx1) {$ctx1.fill(self,"migrateClass:superclass:",{aClass:aClass,anotherClass:anotherClass},$globals.ClassBuilder)});
  15633. },
  15634. args: ["aClass", "anotherClass"],
  15635. 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",
  15636. referencedClasses: [],
  15637. messageSends: ["migrateClassNamed:superclass:instanceVariableNames:package:", "name", "instanceVariableNames", "package"]
  15638. }),
  15639. $globals.ClassBuilder);
  15640. $core.addMethod(
  15641. $core.method({
  15642. selector: "migrateClassNamed:superclass:instanceVariableNames:package:",
  15643. protocol: "class migration",
  15644. fn: function (className,aClass,aCollection,packageName){
  15645. var self=this,$self=this;
  15646. var oldClass,newClass,tmp;
  15647. return $core.withContext(function($ctx1) {
  15648. var $1,$2,$4,$3;
  15649. tmp="new*".__comma(className);
  15650. oldClass=$recv($recv($globals.Smalltalk)._globals())._at_(className);
  15651. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,tmp,aCollection,packageName);
  15652. $self._basicSwapClassNames_with_(oldClass,newClass);
  15653. $ctx1.sendIdx["basicSwapClassNames:with:"]=1;
  15654. $recv((function(){
  15655. return $core.withContext(function($ctx2) {
  15656. return $self._copyClass_to_(oldClass,newClass);
  15657. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  15658. }))._on_do_($globals.Error,(function(exception){
  15659. return $core.withContext(function($ctx2) {
  15660. $self._basicSwapClassNames_with_(oldClass,newClass);
  15661. $1=$self._basicRemoveClass_(newClass);
  15662. $ctx2.sendIdx["basicRemoveClass:"]=1;
  15663. return $recv(exception)._pass();
  15664. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,2)});
  15665. }));
  15666. $self._rawRenameClass_to_(oldClass,tmp);
  15667. $ctx1.sendIdx["rawRenameClass:to:"]=1;
  15668. $self._rawRenameClass_to_(newClass,className);
  15669. $recv($recv(oldClass)._subclasses())._do_((function(each){
  15670. return $core.withContext(function($ctx2) {
  15671. return $self._migrateClass_superclass_(each,newClass);
  15672. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  15673. }));
  15674. $self._basicRemoveClass_(oldClass);
  15675. $2=$recv($globals.SystemAnnouncer)._current();
  15676. $4=$recv($globals.ClassMigrated)._new();
  15677. $recv($4)._theClass_(newClass);
  15678. $recv($4)._oldClass_(oldClass);
  15679. $3=$recv($4)._yourself();
  15680. $recv($2)._announce_($3);
  15681. return newClass;
  15682. }, 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)});
  15683. },
  15684. args: ["className", "aClass", "aCollection", "packageName"],
  15685. 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",
  15686. referencedClasses: ["Smalltalk", "Error", "SystemAnnouncer", "ClassMigrated"],
  15687. 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"]
  15688. }),
  15689. $globals.ClassBuilder);
  15690. $core.addMethod(
  15691. $core.method({
  15692. selector: "rawRenameClass:to:",
  15693. protocol: "private",
  15694. fn: function (aClass,aString){
  15695. var self=this,$self=this;
  15696. return $core.withContext(function($ctx1) {
  15697. $globals[aString] = aClass;
  15698. ;
  15699. return self;
  15700. }, function($ctx1) {$ctx1.fill(self,"rawRenameClass:to:",{aClass:aClass,aString:aString},$globals.ClassBuilder)});
  15701. },
  15702. args: ["aClass", "aString"],
  15703. source: "rawRenameClass: aClass to: aString\x0a\x09<inlineJS: '\x0a\x09\x09$globals[aString] = aClass;\x0a\x09'>",
  15704. referencedClasses: [],
  15705. messageSends: []
  15706. }),
  15707. $globals.ClassBuilder);
  15708. $core.addMethod(
  15709. $core.method({
  15710. selector: "renameClass:to:",
  15711. protocol: "class migration",
  15712. fn: function (aClass,className){
  15713. var self=this,$self=this;
  15714. return $core.withContext(function($ctx1) {
  15715. var $1,$3,$2;
  15716. $self._basicRenameClass_to_(aClass,className);
  15717. $recv(aClass)._recompile();
  15718. $1=$recv($globals.SystemAnnouncer)._current();
  15719. $3=$recv($globals.ClassRenamed)._new();
  15720. $recv($3)._theClass_(aClass);
  15721. $2=$recv($3)._yourself();
  15722. $recv($1)._announce_($2);
  15723. return self;
  15724. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15725. },
  15726. args: ["aClass", "className"],
  15727. 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)",
  15728. referencedClasses: ["SystemAnnouncer", "ClassRenamed"],
  15729. messageSends: ["basicRenameClass:to:", "recompile", "announce:", "current", "theClass:", "new", "yourself"]
  15730. }),
  15731. $globals.ClassBuilder);
  15732. $core.addMethod(
  15733. $core.method({
  15734. selector: "superclass:subclass:",
  15735. protocol: "class definition",
  15736. fn: function (aClass,className){
  15737. var self=this,$self=this;
  15738. return $core.withContext(function($ctx1) {
  15739. return $self._superclass_subclass_instanceVariableNames_package_(aClass,className,"",nil);
  15740. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:",{aClass:aClass,className:className},$globals.ClassBuilder)});
  15741. },
  15742. args: ["aClass", "className"],
  15743. source: "superclass: aClass subclass: className\x0a\x09^ self superclass: aClass subclass: className instanceVariableNames: '' package: nil",
  15744. referencedClasses: [],
  15745. messageSends: ["superclass:subclass:instanceVariableNames:package:"]
  15746. }),
  15747. $globals.ClassBuilder);
  15748. $core.addMethod(
  15749. $core.method({
  15750. selector: "superclass:subclass:instanceVariableNames:package:",
  15751. protocol: "class definition",
  15752. fn: function (aClass,className,ivarNames,packageName){
  15753. var self=this,$self=this;
  15754. var newClass;
  15755. return $core.withContext(function($ctx1) {
  15756. var $1,$2,$3,$5,$4,$receiver;
  15757. $1=$self._instanceVariableNamesFor_(ivarNames);
  15758. if(($receiver = packageName) == null || $receiver.a$nil){
  15759. $2="unclassified";
  15760. } else {
  15761. $2=packageName;
  15762. }
  15763. newClass=$self._addSubclassOf_named_instanceVariableNames_package_(aClass,className,$1,$2);
  15764. $3=$recv($globals.SystemAnnouncer)._current();
  15765. $5=$recv($globals.ClassAdded)._new();
  15766. $recv($5)._theClass_(newClass);
  15767. $4=$recv($5)._yourself();
  15768. $recv($3)._announce_($4);
  15769. return newClass;
  15770. }, function($ctx1) {$ctx1.fill(self,"superclass:subclass:instanceVariableNames:package:",{aClass:aClass,className:className,ivarNames:ivarNames,packageName:packageName,newClass:newClass},$globals.ClassBuilder)});
  15771. },
  15772. args: ["aClass", "className", "ivarNames", "packageName"],
  15773. 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",
  15774. referencedClasses: ["SystemAnnouncer", "ClassAdded"],
  15775. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "instanceVariableNamesFor:", "ifNil:", "announce:", "current", "theClass:", "new", "yourself"]
  15776. }),
  15777. $globals.ClassBuilder);
  15778. $core.addClass("ClassSorterNode", $globals.Object, ["theClass", "level", "nodes"], "Kernel-Classes");
  15779. $globals.ClassSorterNode.comment="I provide an algorithm for sorting classes alphabetically.\x0a\x0aSee [Issue #143](https://lolg.it/amber/amber/issues/143).";
  15780. $core.addMethod(
  15781. $core.method({
  15782. selector: "getNodesFrom:",
  15783. protocol: "accessing",
  15784. fn: function (aCollection){
  15785. var self=this,$self=this;
  15786. var children,others;
  15787. return $core.withContext(function($ctx1) {
  15788. var $1;
  15789. children=[];
  15790. others=[];
  15791. $recv(aCollection)._do_((function(each){
  15792. return $core.withContext(function($ctx2) {
  15793. $1=$recv($recv(each)._superclass()).__eq($self._theClass());
  15794. if($core.assert($1)){
  15795. return $recv(children)._add_(each);
  15796. $ctx2.sendIdx["add:"]=1;
  15797. } else {
  15798. return $recv(others)._add_(each);
  15799. }
  15800. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  15801. }));
  15802. $self["@nodes"]=$recv(children)._collect_((function(each){
  15803. return $core.withContext(function($ctx2) {
  15804. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,$recv($self._level()).__plus((1)));
  15805. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  15806. }));
  15807. return self;
  15808. }, function($ctx1) {$ctx1.fill(self,"getNodesFrom:",{aCollection:aCollection,children:children,others:others},$globals.ClassSorterNode)});
  15809. },
  15810. args: ["aCollection"],
  15811. 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 ]",
  15812. referencedClasses: ["ClassSorterNode"],
  15813. messageSends: ["do:", "ifTrue:ifFalse:", "=", "superclass", "theClass", "add:", "collect:", "on:classes:level:", "+", "level"]
  15814. }),
  15815. $globals.ClassSorterNode);
  15816. $core.addMethod(
  15817. $core.method({
  15818. selector: "level",
  15819. protocol: "accessing",
  15820. fn: function (){
  15821. var self=this,$self=this;
  15822. return $self["@level"];
  15823. },
  15824. args: [],
  15825. source: "level\x0a\x09^ level",
  15826. referencedClasses: [],
  15827. messageSends: []
  15828. }),
  15829. $globals.ClassSorterNode);
  15830. $core.addMethod(
  15831. $core.method({
  15832. selector: "level:",
  15833. protocol: "accessing",
  15834. fn: function (anInteger){
  15835. var self=this,$self=this;
  15836. $self["@level"]=anInteger;
  15837. return self;
  15838. },
  15839. args: ["anInteger"],
  15840. source: "level: anInteger\x0a\x09level := anInteger",
  15841. referencedClasses: [],
  15842. messageSends: []
  15843. }),
  15844. $globals.ClassSorterNode);
  15845. $core.addMethod(
  15846. $core.method({
  15847. selector: "nodes",
  15848. protocol: "accessing",
  15849. fn: function (){
  15850. var self=this,$self=this;
  15851. return $self["@nodes"];
  15852. },
  15853. args: [],
  15854. source: "nodes\x0a\x09^ nodes",
  15855. referencedClasses: [],
  15856. messageSends: []
  15857. }),
  15858. $globals.ClassSorterNode);
  15859. $core.addMethod(
  15860. $core.method({
  15861. selector: "theClass",
  15862. protocol: "accessing",
  15863. fn: function (){
  15864. var self=this,$self=this;
  15865. return $self["@theClass"];
  15866. },
  15867. args: [],
  15868. source: "theClass\x0a\x09^ theClass",
  15869. referencedClasses: [],
  15870. messageSends: []
  15871. }),
  15872. $globals.ClassSorterNode);
  15873. $core.addMethod(
  15874. $core.method({
  15875. selector: "theClass:",
  15876. protocol: "accessing",
  15877. fn: function (aClass){
  15878. var self=this,$self=this;
  15879. $self["@theClass"]=aClass;
  15880. return self;
  15881. },
  15882. args: ["aClass"],
  15883. source: "theClass: aClass\x0a\x09theClass := aClass",
  15884. referencedClasses: [],
  15885. messageSends: []
  15886. }),
  15887. $globals.ClassSorterNode);
  15888. $core.addMethod(
  15889. $core.method({
  15890. selector: "traverseClassesWith:",
  15891. protocol: "visiting",
  15892. fn: function (aCollection){
  15893. var self=this,$self=this;
  15894. return $core.withContext(function($ctx1) {
  15895. var $1,$3,$2;
  15896. $1=$self._theClass();
  15897. $ctx1.sendIdx["theClass"]=1;
  15898. $recv(aCollection)._add_($1);
  15899. $recv($recv($self._nodes())._sorted_((function(a,b){
  15900. return $core.withContext(function($ctx2) {
  15901. $3=$recv(a)._theClass();
  15902. $ctx2.sendIdx["theClass"]=2;
  15903. $2=$recv($3)._name();
  15904. $ctx2.sendIdx["name"]=1;
  15905. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  15906. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  15907. })))._do_((function(aNode){
  15908. return $core.withContext(function($ctx2) {
  15909. return $recv(aNode)._traverseClassesWith_(aCollection);
  15910. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,2)});
  15911. }));
  15912. return self;
  15913. }, function($ctx1) {$ctx1.fill(self,"traverseClassesWith:",{aCollection:aCollection},$globals.ClassSorterNode)});
  15914. },
  15915. args: ["aCollection"],
  15916. 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 ].",
  15917. referencedClasses: [],
  15918. messageSends: ["add:", "theClass", "do:", "sorted:", "nodes", "<=", "name", "traverseClassesWith:"]
  15919. }),
  15920. $globals.ClassSorterNode);
  15921. $core.addMethod(
  15922. $core.method({
  15923. selector: "on:classes:level:",
  15924. protocol: "instance creation",
  15925. fn: function (aClass,aCollection,anInteger){
  15926. var self=this,$self=this;
  15927. return $core.withContext(function($ctx1) {
  15928. var $1;
  15929. $1=$self._new();
  15930. $recv($1)._theClass_(aClass);
  15931. $recv($1)._level_(anInteger);
  15932. $recv($1)._getNodesFrom_(aCollection);
  15933. return $recv($1)._yourself();
  15934. }, function($ctx1) {$ctx1.fill(self,"on:classes:level:",{aClass:aClass,aCollection:aCollection,anInteger:anInteger},$globals.ClassSorterNode.a$cls)});
  15935. },
  15936. args: ["aClass", "aCollection", "anInteger"],
  15937. 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",
  15938. referencedClasses: [],
  15939. messageSends: ["theClass:", "new", "level:", "getNodesFrom:", "yourself"]
  15940. }),
  15941. $globals.ClassSorterNode.a$cls);
  15942. $core.addTrait("TBehaviorDefaults", "Kernel-Classes");
  15943. $core.addMethod(
  15944. $core.method({
  15945. selector: "allInstanceVariableNames",
  15946. protocol: "accessing",
  15947. fn: function (){
  15948. var self=this,$self=this;
  15949. return [];
  15950. },
  15951. args: [],
  15952. source: "allInstanceVariableNames\x0a\x09\x22Default for non-classes; to be able to send #allInstanceVariableNames to any class / trait.\x22\x0a\x09^ #()",
  15953. referencedClasses: [],
  15954. messageSends: []
  15955. }),
  15956. $globals.TBehaviorDefaults);
  15957. $core.addMethod(
  15958. $core.method({
  15959. selector: "allSubclassesDo:",
  15960. protocol: "enumerating",
  15961. fn: function (aBlock){
  15962. var self=this,$self=this;
  15963. return self;
  15964. },
  15965. args: ["aBlock"],
  15966. source: "allSubclassesDo: aBlock\x0a\x09\x22Default for non-classes; to be able to send #allSubclassesDo: to any class / trait.\x22",
  15967. referencedClasses: [],
  15968. messageSends: []
  15969. }),
  15970. $globals.TBehaviorDefaults);
  15971. $core.addMethod(
  15972. $core.method({
  15973. selector: "name",
  15974. protocol: "accessing",
  15975. fn: function (){
  15976. var self=this,$self=this;
  15977. return nil;
  15978. },
  15979. args: [],
  15980. source: "name\x0a\x09^ nil",
  15981. referencedClasses: [],
  15982. messageSends: []
  15983. }),
  15984. $globals.TBehaviorDefaults);
  15985. $core.addMethod(
  15986. $core.method({
  15987. selector: "printOn:",
  15988. protocol: "printing",
  15989. fn: function (aStream){
  15990. var self=this,$self=this;
  15991. return $core.withContext(function($ctx1) {
  15992. var $1,$receiver;
  15993. $1=$self._name();
  15994. if(($receiver = $1) == null || $receiver.a$nil){
  15995. (
  15996. $ctx1.supercall = true,
  15997. ($globals.TBehaviorDefaults.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  15998. $ctx1.supercall = false;
  15999. } else {
  16000. var name;
  16001. name=$receiver;
  16002. $recv(aStream)._nextPutAll_(name);
  16003. }
  16004. return self;
  16005. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.TBehaviorDefaults)});
  16006. },
  16007. args: ["aStream"],
  16008. source: "printOn: aStream\x0a\x09self name\x0a\x09\x09ifNil: [ super printOn: aStream ]\x0a\x09\x09ifNotNil: [ :name | aStream nextPutAll: name ]",
  16009. referencedClasses: [],
  16010. messageSends: ["ifNil:ifNotNil:", "name", "printOn:", "nextPutAll:"]
  16011. }),
  16012. $globals.TBehaviorDefaults);
  16013. $core.addMethod(
  16014. $core.method({
  16015. selector: "superclass",
  16016. protocol: "accessing",
  16017. fn: function (){
  16018. var self=this,$self=this;
  16019. return nil;
  16020. },
  16021. args: [],
  16022. source: "superclass\x0a\x09\x22Default for non-classes; to be able to send #superclass to any class / trait.\x22\x0a\x09^ nil",
  16023. referencedClasses: [],
  16024. messageSends: []
  16025. }),
  16026. $globals.TBehaviorDefaults);
  16027. $core.addMethod(
  16028. $core.method({
  16029. selector: "traitUsers",
  16030. protocol: "accessing",
  16031. fn: function (){
  16032. var self=this,$self=this;
  16033. return [];
  16034. },
  16035. args: [],
  16036. source: "traitUsers\x0a\x09\x22Default for non-traits; to be able to send #traitUsers to any class / trait\x22\x0a\x09^ #()",
  16037. referencedClasses: [],
  16038. messageSends: []
  16039. }),
  16040. $globals.TBehaviorDefaults);
  16041. $core.addTrait("TBehaviorProvider", "Kernel-Classes");
  16042. $globals.TBehaviorProvider.comment="I have method dictionary and organization.";
  16043. $core.addMethod(
  16044. $core.method({
  16045. selector: ">>",
  16046. protocol: "accessing",
  16047. fn: function (aString){
  16048. var self=this,$self=this;
  16049. return $core.withContext(function($ctx1) {
  16050. return $self._methodAt_(aString);
  16051. }, function($ctx1) {$ctx1.fill(self,">>",{aString:aString},$globals.TBehaviorProvider)});
  16052. },
  16053. args: ["aString"],
  16054. source: ">> aString\x0a\x09^ self methodAt: aString",
  16055. referencedClasses: [],
  16056. messageSends: ["methodAt:"]
  16057. }),
  16058. $globals.TBehaviorProvider);
  16059. $core.addMethod(
  16060. $core.method({
  16061. selector: "addCompiledMethod:",
  16062. protocol: "compiling",
  16063. fn: function (aMethod){
  16064. var self=this,$self=this;
  16065. var oldMethod,announcement;
  16066. return $core.withContext(function($ctx1) {
  16067. var $1,$2,$3,$4,$receiver;
  16068. oldMethod=$recv($self._methodDictionary())._at_ifAbsent_($recv(aMethod)._selector(),(function(){
  16069. return nil;
  16070. }));
  16071. $self._basicAddCompiledMethod_(aMethod);
  16072. $1=oldMethod;
  16073. if(($receiver = $1) == null || $receiver.a$nil){
  16074. $2=$recv($globals.MethodAdded)._new();
  16075. $ctx1.sendIdx["new"]=1;
  16076. $recv($2)._method_(aMethod);
  16077. $ctx1.sendIdx["method:"]=1;
  16078. $3=$recv($2)._yourself();
  16079. $ctx1.sendIdx["yourself"]=1;
  16080. announcement=$3;
  16081. } else {
  16082. $4=$recv($globals.MethodModified)._new();
  16083. $recv($4)._oldMethod_(oldMethod);
  16084. $recv($4)._method_(aMethod);
  16085. announcement=$recv($4)._yourself();
  16086. }
  16087. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  16088. return self;
  16089. }, function($ctx1) {$ctx1.fill(self,"addCompiledMethod:",{aMethod:aMethod,oldMethod:oldMethod,announcement:announcement},$globals.TBehaviorProvider)});
  16090. },
  16091. args: ["aMethod"],
  16092. 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",
  16093. referencedClasses: ["MethodAdded", "MethodModified", "SystemAnnouncer"],
  16094. messageSends: ["at:ifAbsent:", "methodDictionary", "selector", "basicAddCompiledMethod:", "ifNil:ifNotNil:", "method:", "new", "yourself", "oldMethod:", "announce:", "current"]
  16095. }),
  16096. $globals.TBehaviorProvider);
  16097. $core.addMethod(
  16098. $core.method({
  16099. selector: "basicAddCompiledMethod:",
  16100. protocol: "private",
  16101. fn: function (aMethod){
  16102. var self=this,$self=this;
  16103. return $core.withContext(function($ctx1) {
  16104. $core.addMethod(aMethod, self);
  16105. return self;
  16106. }, function($ctx1) {$ctx1.fill(self,"basicAddCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16107. },
  16108. args: ["aMethod"],
  16109. source: "basicAddCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.addMethod(aMethod, self)'>",
  16110. referencedClasses: [],
  16111. messageSends: []
  16112. }),
  16113. $globals.TBehaviorProvider);
  16114. $core.addMethod(
  16115. $core.method({
  16116. selector: "basicRemoveCompiledMethod:",
  16117. protocol: "private",
  16118. fn: function (aMethod){
  16119. var self=this,$self=this;
  16120. return $core.withContext(function($ctx1) {
  16121. $core.removeMethod(aMethod,self);
  16122. return self;
  16123. }, function($ctx1) {$ctx1.fill(self,"basicRemoveCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16124. },
  16125. args: ["aMethod"],
  16126. source: "basicRemoveCompiledMethod: aMethod\x0a\x09<inlineJS: '$core.removeMethod(aMethod,self)'>",
  16127. referencedClasses: [],
  16128. messageSends: []
  16129. }),
  16130. $globals.TBehaviorProvider);
  16131. $core.addMethod(
  16132. $core.method({
  16133. selector: "compile:protocol:",
  16134. protocol: "compiling",
  16135. fn: function (aString,anotherString){
  16136. var self=this,$self=this;
  16137. return $core.withContext(function($ctx1) {
  16138. return $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,self,anotherString);
  16139. }, function($ctx1) {$ctx1.fill(self,"compile:protocol:",{aString:aString,anotherString:anotherString},$globals.TBehaviorProvider)});
  16140. },
  16141. args: ["aString", "anotherString"],
  16142. source: "compile: aString protocol: anotherString\x0a\x09^ Compiler new\x0a\x09\x09install: aString\x0a\x09\x09forClass: self\x0a\x09\x09protocol: anotherString",
  16143. referencedClasses: ["Compiler"],
  16144. messageSends: ["install:forClass:protocol:", "new"]
  16145. }),
  16146. $globals.TBehaviorProvider);
  16147. $core.addMethod(
  16148. $core.method({
  16149. selector: "includesSelector:",
  16150. protocol: "testing",
  16151. fn: function (aString){
  16152. var self=this,$self=this;
  16153. return $core.withContext(function($ctx1) {
  16154. return $recv($self._methodDictionary())._includesKey_(aString);
  16155. }, function($ctx1) {$ctx1.fill(self,"includesSelector:",{aString:aString},$globals.TBehaviorProvider)});
  16156. },
  16157. args: ["aString"],
  16158. source: "includesSelector: aString\x0a\x09^ self methodDictionary includesKey: aString",
  16159. referencedClasses: [],
  16160. messageSends: ["includesKey:", "methodDictionary"]
  16161. }),
  16162. $globals.TBehaviorProvider);
  16163. $core.addMethod(
  16164. $core.method({
  16165. selector: "methodAt:",
  16166. protocol: "accessing",
  16167. fn: function (aString){
  16168. var self=this,$self=this;
  16169. return $core.withContext(function($ctx1) {
  16170. return $recv($self._methodDictionary())._at_(aString);
  16171. }, function($ctx1) {$ctx1.fill(self,"methodAt:",{aString:aString},$globals.TBehaviorProvider)});
  16172. },
  16173. args: ["aString"],
  16174. source: "methodAt: aString\x0a\x09^ self methodDictionary at: aString",
  16175. referencedClasses: [],
  16176. messageSends: ["at:", "methodDictionary"]
  16177. }),
  16178. $globals.TBehaviorProvider);
  16179. $core.addMethod(
  16180. $core.method({
  16181. selector: "methodDictionary",
  16182. protocol: "accessing",
  16183. fn: function (){
  16184. var self=this,$self=this;
  16185. return $core.withContext(function($ctx1) {
  16186. var dict = $globals.HashedCollection._new();
  16187. var methods = self.methods;
  16188. Object.keys(methods).forEach(function(i) {
  16189. if(methods[i].selector) {
  16190. dict._at_put_(methods[i].selector, methods[i]);
  16191. }
  16192. });
  16193. return dict;
  16194. return self;
  16195. }, function($ctx1) {$ctx1.fill(self,"methodDictionary",{},$globals.TBehaviorProvider)});
  16196. },
  16197. args: [],
  16198. 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'>",
  16199. referencedClasses: [],
  16200. messageSends: []
  16201. }),
  16202. $globals.TBehaviorProvider);
  16203. $core.addMethod(
  16204. $core.method({
  16205. selector: "methodOrganizationEnter:andLeave:",
  16206. protocol: "accessing",
  16207. fn: function (aMethod,oldMethod){
  16208. var self=this,$self=this;
  16209. return $core.withContext(function($ctx1) {
  16210. var $1,$2,$receiver;
  16211. if(($receiver = aMethod) == null || $receiver.a$nil){
  16212. aMethod;
  16213. } else {
  16214. $1=$self._organization();
  16215. $2=$recv(aMethod)._protocol();
  16216. $ctx1.sendIdx["protocol"]=1;
  16217. $recv($1)._addElement_($2);
  16218. }
  16219. if(($receiver = oldMethod) == null || $receiver.a$nil){
  16220. oldMethod;
  16221. } else {
  16222. $self._removeProtocolIfEmpty_($recv(oldMethod)._protocol());
  16223. }
  16224. return self;
  16225. }, function($ctx1) {$ctx1.fill(self,"methodOrganizationEnter:andLeave:",{aMethod:aMethod,oldMethod:oldMethod},$globals.TBehaviorProvider)});
  16226. },
  16227. args: ["aMethod", "oldMethod"],
  16228. 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 ]",
  16229. referencedClasses: [],
  16230. messageSends: ["ifNotNil:", "addElement:", "organization", "protocol", "removeProtocolIfEmpty:"]
  16231. }),
  16232. $globals.TBehaviorProvider);
  16233. $core.addMethod(
  16234. $core.method({
  16235. selector: "methodTemplate",
  16236. protocol: "accessing",
  16237. fn: function (){
  16238. var self=this,$self=this;
  16239. return $core.withContext(function($ctx1) {
  16240. return $recv($globals.String)._streamContents_((function(stream){
  16241. return $core.withContext(function($ctx2) {
  16242. $recv(stream)._write_("messageSelectorAndArgumentNames");
  16243. $ctx2.sendIdx["write:"]=1;
  16244. $recv(stream)._lf();
  16245. $ctx2.sendIdx["lf"]=1;
  16246. $recv(stream)._tab();
  16247. $ctx2.sendIdx["tab"]=1;
  16248. $recv(stream)._write_("\x22comment stating purpose of message\x22");
  16249. $ctx2.sendIdx["write:"]=2;
  16250. $recv(stream)._lf();
  16251. $ctx2.sendIdx["lf"]=2;
  16252. $recv(stream)._lf();
  16253. $ctx2.sendIdx["lf"]=3;
  16254. $recv(stream)._tab();
  16255. $ctx2.sendIdx["tab"]=2;
  16256. $recv(stream)._write_("| temporary variable names |");
  16257. $ctx2.sendIdx["write:"]=3;
  16258. $recv(stream)._lf();
  16259. $recv(stream)._tab();
  16260. return $recv(stream)._write_("statements");
  16261. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  16262. }));
  16263. }, function($ctx1) {$ctx1.fill(self,"methodTemplate",{},$globals.TBehaviorProvider)});
  16264. },
  16265. args: [],
  16266. 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' ]",
  16267. referencedClasses: ["String"],
  16268. messageSends: ["streamContents:", "write:", "lf", "tab"]
  16269. }),
  16270. $globals.TBehaviorProvider);
  16271. $core.addMethod(
  16272. $core.method({
  16273. selector: "methods",
  16274. protocol: "accessing",
  16275. fn: function (){
  16276. var self=this,$self=this;
  16277. return $core.withContext(function($ctx1) {
  16278. return $recv($self._methodDictionary())._values();
  16279. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.TBehaviorProvider)});
  16280. },
  16281. args: [],
  16282. source: "methods\x0a\x09^ self methodDictionary values",
  16283. referencedClasses: [],
  16284. messageSends: ["values", "methodDictionary"]
  16285. }),
  16286. $globals.TBehaviorProvider);
  16287. $core.addMethod(
  16288. $core.method({
  16289. selector: "methodsInProtocol:",
  16290. protocol: "accessing",
  16291. fn: function (aString){
  16292. var self=this,$self=this;
  16293. return $core.withContext(function($ctx1) {
  16294. return $recv($self._methods())._select_((function(each){
  16295. return $core.withContext(function($ctx2) {
  16296. return $recv($recv(each)._protocol()).__eq(aString);
  16297. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16298. }));
  16299. }, function($ctx1) {$ctx1.fill(self,"methodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16300. },
  16301. args: ["aString"],
  16302. source: "methodsInProtocol: aString\x0a\x09^ self methods select: [ :each | each protocol = aString ]",
  16303. referencedClasses: [],
  16304. messageSends: ["select:", "methods", "=", "protocol"]
  16305. }),
  16306. $globals.TBehaviorProvider);
  16307. $core.addMethod(
  16308. $core.method({
  16309. selector: "organization",
  16310. protocol: "accessing",
  16311. fn: function (){
  16312. var self=this,$self=this;
  16313. return $core.withContext(function($ctx1) {
  16314. var $1,$receiver;
  16315. $1=$self._basicOrganization();
  16316. $ctx1.sendIdx["basicOrganization"]=1;
  16317. if(($receiver = $1) == null || $receiver.a$nil){
  16318. $self._basicOrganization_($recv($globals.ClassOrganizer)._on_(self));
  16319. return $self._basicOrganization();
  16320. } else {
  16321. return $1;
  16322. }
  16323. }, function($ctx1) {$ctx1.fill(self,"organization",{},$globals.TBehaviorProvider)});
  16324. },
  16325. args: [],
  16326. source: "organization\x0a\x09^ self basicOrganization ifNil: [\x0a\x09\x09self basicOrganization: (ClassOrganizer on: self).\x0a\x09\x09self basicOrganization ]",
  16327. referencedClasses: ["ClassOrganizer"],
  16328. messageSends: ["ifNil:", "basicOrganization", "basicOrganization:", "on:"]
  16329. }),
  16330. $globals.TBehaviorProvider);
  16331. $core.addMethod(
  16332. $core.method({
  16333. selector: "ownMethods",
  16334. protocol: "accessing",
  16335. fn: function (){
  16336. var self=this,$self=this;
  16337. return $core.withContext(function($ctx1) {
  16338. var $1;
  16339. return $recv($recv($self._ownProtocols())._inject_into_($recv($globals.OrderedCollection)._new(),(function(acc,each){
  16340. return $core.withContext(function($ctx2) {
  16341. return $recv(acc).__comma($self._ownMethodsInProtocol_(each));
  16342. }, function($ctx2) {$ctx2.fillBlock({acc:acc,each:each},$ctx1,1)});
  16343. })))._sorted_((function(a,b){
  16344. return $core.withContext(function($ctx2) {
  16345. $1=$recv(a)._selector();
  16346. $ctx2.sendIdx["selector"]=1;
  16347. return $recv($1).__lt_eq($recv(b)._selector());
  16348. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,2)});
  16349. }));
  16350. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.TBehaviorProvider)});
  16351. },
  16352. args: [],
  16353. 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 ]",
  16354. referencedClasses: ["OrderedCollection"],
  16355. messageSends: ["sorted:", "inject:into:", "ownProtocols", "new", ",", "ownMethodsInProtocol:", "<=", "selector"]
  16356. }),
  16357. $globals.TBehaviorProvider);
  16358. $core.addMethod(
  16359. $core.method({
  16360. selector: "ownMethodsInProtocol:",
  16361. protocol: "accessing",
  16362. fn: function (aString){
  16363. var self=this,$self=this;
  16364. return $core.withContext(function($ctx1) {
  16365. return $recv($self._methodsInProtocol_(aString))._select_((function(each){
  16366. return $core.withContext(function($ctx2) {
  16367. return $recv($recv(each)._methodClass()).__eq(self);
  16368. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16369. }));
  16370. }, function($ctx1) {$ctx1.fill(self,"ownMethodsInProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16371. },
  16372. args: ["aString"],
  16373. source: "ownMethodsInProtocol: aString\x0a\x09^ (self methodsInProtocol: aString) select: [ :each | each methodClass = self ]",
  16374. referencedClasses: [],
  16375. messageSends: ["select:", "methodsInProtocol:", "=", "methodClass"]
  16376. }),
  16377. $globals.TBehaviorProvider);
  16378. $core.addMethod(
  16379. $core.method({
  16380. selector: "ownProtocols",
  16381. protocol: "accessing",
  16382. fn: function (){
  16383. var self=this,$self=this;
  16384. return $core.withContext(function($ctx1) {
  16385. return $recv($self._protocols())._reject_((function(each){
  16386. return $core.withContext(function($ctx2) {
  16387. return $recv(each)._match_("^\x5c*");
  16388. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16389. }));
  16390. }, function($ctx1) {$ctx1.fill(self,"ownProtocols",{},$globals.TBehaviorProvider)});
  16391. },
  16392. args: [],
  16393. 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*' ]",
  16394. referencedClasses: [],
  16395. messageSends: ["reject:", "protocols", "match:"]
  16396. }),
  16397. $globals.TBehaviorProvider);
  16398. $core.addMethod(
  16399. $core.method({
  16400. selector: "packageOfProtocol:",
  16401. protocol: "accessing",
  16402. fn: function (aString){
  16403. var self=this,$self=this;
  16404. return $core.withContext(function($ctx1) {
  16405. var $1;
  16406. $1=$recv(aString)._beginsWith_("*");
  16407. if(!$core.assert($1)){
  16408. return $self._package();
  16409. }
  16410. return $recv($globals.Package)._named_ifAbsent_($recv(aString)._allButFirst(),(function(){
  16411. return nil;
  16412. }));
  16413. }, function($ctx1) {$ctx1.fill(self,"packageOfProtocol:",{aString:aString},$globals.TBehaviorProvider)});
  16414. },
  16415. args: ["aString"],
  16416. 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 ]",
  16417. referencedClasses: ["Package"],
  16418. messageSends: ["ifFalse:", "beginsWith:", "package", "named:ifAbsent:", "allButFirst"]
  16419. }),
  16420. $globals.TBehaviorProvider);
  16421. $core.addMethod(
  16422. $core.method({
  16423. selector: "protocols",
  16424. protocol: "accessing",
  16425. fn: function (){
  16426. var self=this,$self=this;
  16427. return $core.withContext(function($ctx1) {
  16428. return $recv($recv($recv($self._organization())._elements())._asArray())._sorted();
  16429. }, function($ctx1) {$ctx1.fill(self,"protocols",{},$globals.TBehaviorProvider)});
  16430. },
  16431. args: [],
  16432. source: "protocols\x0a\x09^ self organization elements asArray sorted",
  16433. referencedClasses: [],
  16434. messageSends: ["sorted", "asArray", "elements", "organization"]
  16435. }),
  16436. $globals.TBehaviorProvider);
  16437. $core.addMethod(
  16438. $core.method({
  16439. selector: "protocolsDo:",
  16440. protocol: "enumerating",
  16441. fn: function (aBlock){
  16442. var self=this,$self=this;
  16443. var methodsByProtocol;
  16444. return $core.withContext(function($ctx1) {
  16445. methodsByProtocol=$recv($globals.HashedCollection)._new();
  16446. $ctx1.sendIdx["new"]=1;
  16447. $recv($self._methodDictionary())._valuesDo_((function(m){
  16448. return $core.withContext(function($ctx2) {
  16449. return $recv($recv(methodsByProtocol)._at_ifAbsentPut_($recv(m)._protocol(),(function(){
  16450. return $core.withContext(function($ctx3) {
  16451. return $recv($globals.Array)._new();
  16452. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  16453. })))._add_(m);
  16454. }, function($ctx2) {$ctx2.fillBlock({m:m},$ctx1,1)});
  16455. }));
  16456. $recv($self._protocols())._do_((function(protocol){
  16457. return $core.withContext(function($ctx2) {
  16458. return $recv(aBlock)._value_value_(protocol,$recv(methodsByProtocol)._at_(protocol));
  16459. }, function($ctx2) {$ctx2.fillBlock({protocol:protocol},$ctx1,3)});
  16460. }));
  16461. return self;
  16462. }, function($ctx1) {$ctx1.fill(self,"protocolsDo:",{aBlock:aBlock,methodsByProtocol:methodsByProtocol},$globals.TBehaviorProvider)});
  16463. },
  16464. args: ["aBlock"],
  16465. 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) ]",
  16466. referencedClasses: ["HashedCollection", "Array"],
  16467. messageSends: ["new", "valuesDo:", "methodDictionary", "add:", "at:ifAbsentPut:", "protocol", "do:", "protocols", "value:value:", "at:"]
  16468. }),
  16469. $globals.TBehaviorProvider);
  16470. $core.addMethod(
  16471. $core.method({
  16472. selector: "recompile",
  16473. protocol: "compiling",
  16474. fn: function (){
  16475. var self=this,$self=this;
  16476. return $core.withContext(function($ctx1) {
  16477. return $recv($recv($globals.Compiler)._new())._recompile_(self);
  16478. }, function($ctx1) {$ctx1.fill(self,"recompile",{},$globals.TBehaviorProvider)});
  16479. },
  16480. args: [],
  16481. source: "recompile\x0a\x09^ Compiler new recompile: self",
  16482. referencedClasses: ["Compiler"],
  16483. messageSends: ["recompile:", "new"]
  16484. }),
  16485. $globals.TBehaviorProvider);
  16486. $core.addMethod(
  16487. $core.method({
  16488. selector: "removeCompiledMethod:",
  16489. protocol: "compiling",
  16490. fn: function (aMethod){
  16491. var self=this,$self=this;
  16492. return $core.withContext(function($ctx1) {
  16493. var $1,$3,$2;
  16494. $self._basicRemoveCompiledMethod_(aMethod);
  16495. $1=$recv($globals.SystemAnnouncer)._current();
  16496. $3=$recv($globals.MethodRemoved)._new();
  16497. $recv($3)._method_(aMethod);
  16498. $2=$recv($3)._yourself();
  16499. $recv($1)._announce_($2);
  16500. return self;
  16501. }, function($ctx1) {$ctx1.fill(self,"removeCompiledMethod:",{aMethod:aMethod},$globals.TBehaviorProvider)});
  16502. },
  16503. args: ["aMethod"],
  16504. 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)",
  16505. referencedClasses: ["SystemAnnouncer", "MethodRemoved"],
  16506. messageSends: ["basicRemoveCompiledMethod:", "announce:", "current", "method:", "new", "yourself"]
  16507. }),
  16508. $globals.TBehaviorProvider);
  16509. $core.addMethod(
  16510. $core.method({
  16511. selector: "removeProtocolIfEmpty:",
  16512. protocol: "accessing",
  16513. fn: function (aString){
  16514. var self=this,$self=this;
  16515. return $core.withContext(function($ctx1) {
  16516. $recv($self._methods())._detect_ifNone_((function(each){
  16517. return $core.withContext(function($ctx2) {
  16518. return $recv($recv(each)._protocol()).__eq(aString);
  16519. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  16520. }),(function(){
  16521. return $core.withContext(function($ctx2) {
  16522. return $recv($self._organization())._removeElement_(aString);
  16523. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  16524. }));
  16525. return self;
  16526. }, function($ctx1) {$ctx1.fill(self,"removeProtocolIfEmpty:",{aString:aString},$globals.TBehaviorProvider)});
  16527. },
  16528. args: ["aString"],
  16529. source: "removeProtocolIfEmpty: aString\x0a\x09self methods\x0a\x09\x09detect: [ :each | each protocol = aString ]\x0a\x09\x09ifNone: [ self organization removeElement: aString ]",
  16530. referencedClasses: [],
  16531. messageSends: ["detect:ifNone:", "methods", "=", "protocol", "removeElement:", "organization"]
  16532. }),
  16533. $globals.TBehaviorProvider);
  16534. $core.addMethod(
  16535. $core.method({
  16536. selector: "selectors",
  16537. protocol: "accessing",
  16538. fn: function (){
  16539. var self=this,$self=this;
  16540. return $core.withContext(function($ctx1) {
  16541. return $recv($self._methodDictionary())._keys();
  16542. }, function($ctx1) {$ctx1.fill(self,"selectors",{},$globals.TBehaviorProvider)});
  16543. },
  16544. args: [],
  16545. source: "selectors\x0a\x09^ self methodDictionary keys",
  16546. referencedClasses: [],
  16547. messageSends: ["keys", "methodDictionary"]
  16548. }),
  16549. $globals.TBehaviorProvider);
  16550. $core.addMethod(
  16551. $core.method({
  16552. selector: "setTraitComposition:",
  16553. protocol: "compiling",
  16554. fn: function (aTraitComposition){
  16555. var self=this,$self=this;
  16556. return $core.withContext(function($ctx1) {
  16557. $core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self);
  16558. return self;
  16559. }, function($ctx1) {$ctx1.fill(self,"setTraitComposition:",{aTraitComposition:aTraitComposition},$globals.TBehaviorProvider)});
  16560. },
  16561. args: ["aTraitComposition"],
  16562. source: "setTraitComposition: aTraitComposition\x0a\x09<inlineJS: '$core.setTraitComposition(aTraitComposition._asJavaScriptObject(), self)'>",
  16563. referencedClasses: [],
  16564. messageSends: []
  16565. }),
  16566. $globals.TBehaviorProvider);
  16567. $core.addMethod(
  16568. $core.method({
  16569. selector: "traitComposition",
  16570. protocol: "accessing",
  16571. fn: function (){
  16572. var self=this,$self=this;
  16573. return $core.withContext(function($ctx1) {
  16574. var $1,$receiver;
  16575. $1=$self._basicAt_("traitComposition");
  16576. if(($receiver = $1) == null || $receiver.a$nil){
  16577. return [];
  16578. } else {
  16579. var aCollection;
  16580. aCollection=$receiver;
  16581. return $recv(aCollection)._collect_((function(each){
  16582. return $core.withContext(function($ctx2) {
  16583. return $recv($globals.TraitTransformation)._fromJSON_(each);
  16584. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  16585. }));
  16586. }
  16587. }, function($ctx1) {$ctx1.fill(self,"traitComposition",{},$globals.TBehaviorProvider)});
  16588. },
  16589. args: [],
  16590. source: "traitComposition\x0a\x09^ (self basicAt: 'traitComposition')\x0a\x09\x09ifNil: [ #() ]\x0a\x09\x09ifNotNil: [ :aCollection | aCollection collect: [ :each | TraitTransformation fromJSON: each ] ]",
  16591. referencedClasses: ["TraitTransformation"],
  16592. messageSends: ["ifNil:ifNotNil:", "basicAt:", "collect:", "fromJSON:"]
  16593. }),
  16594. $globals.TBehaviorProvider);
  16595. $core.addMethod(
  16596. $core.method({
  16597. selector: "traitCompositionDefinition",
  16598. protocol: "accessing",
  16599. fn: function (){
  16600. var self=this,$self=this;
  16601. return $core.withContext(function($ctx1) {
  16602. return $recv($self._traitComposition())._ifNotEmpty_((function(traitComposition){
  16603. return $core.withContext(function($ctx2) {
  16604. return $recv($globals.String)._streamContents_((function(str){
  16605. return $core.withContext(function($ctx3) {
  16606. $recv(str)._write_("{");
  16607. $ctx3.sendIdx["write:"]=1;
  16608. $recv(traitComposition)._do_separatedBy_((function(each){
  16609. return $core.withContext(function($ctx4) {
  16610. return $recv(str)._write_($recv(each)._definition());
  16611. $ctx4.sendIdx["write:"]=2;
  16612. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  16613. }),(function(){
  16614. return $core.withContext(function($ctx4) {
  16615. return $recv(str)._write_(". ");
  16616. $ctx4.sendIdx["write:"]=3;
  16617. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  16618. }));
  16619. return $recv(str)._write_("}");
  16620. }, function($ctx3) {$ctx3.fillBlock({str:str},$ctx2,2)});
  16621. }));
  16622. }, function($ctx2) {$ctx2.fillBlock({traitComposition:traitComposition},$ctx1,1)});
  16623. }));
  16624. }, function($ctx1) {$ctx1.fill(self,"traitCompositionDefinition",{},$globals.TBehaviorProvider)});
  16625. },
  16626. args: [],
  16627. 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: '}' ] ]",
  16628. referencedClasses: ["String"],
  16629. messageSends: ["ifNotEmpty:", "traitComposition", "streamContents:", "write:", "do:separatedBy:", "definition"]
  16630. }),
  16631. $globals.TBehaviorProvider);
  16632. $core.addTrait("TMasterBehavior", "Kernel-Classes");
  16633. $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.";
  16634. $core.addMethod(
  16635. $core.method({
  16636. selector: "asJavaScriptSource",
  16637. protocol: "converting",
  16638. fn: function (){
  16639. var self=this,$self=this;
  16640. return $core.withContext(function($ctx1) {
  16641. return "$globals.".__comma($self._name());
  16642. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TMasterBehavior)});
  16643. },
  16644. args: [],
  16645. source: "asJavaScriptSource\x0a\x09^ '$globals.', self name",
  16646. referencedClasses: [],
  16647. messageSends: [",", "name"]
  16648. }),
  16649. $globals.TMasterBehavior);
  16650. $core.addMethod(
  16651. $core.method({
  16652. selector: "browse",
  16653. protocol: "browsing",
  16654. fn: function (){
  16655. var self=this,$self=this;
  16656. return $core.withContext(function($ctx1) {
  16657. $recv($globals.Finder)._findClass_(self);
  16658. return self;
  16659. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.TMasterBehavior)});
  16660. },
  16661. args: [],
  16662. source: "browse\x0a\x09Finder findClass: self",
  16663. referencedClasses: ["Finder"],
  16664. messageSends: ["findClass:"]
  16665. }),
  16666. $globals.TMasterBehavior);
  16667. $core.addMethod(
  16668. $core.method({
  16669. selector: "category",
  16670. protocol: "accessing",
  16671. fn: function (){
  16672. var self=this,$self=this;
  16673. return $core.withContext(function($ctx1) {
  16674. var $1,$receiver;
  16675. $1=$self._package();
  16676. $ctx1.sendIdx["package"]=1;
  16677. if(($receiver = $1) == null || $receiver.a$nil){
  16678. return "Unclassified";
  16679. } else {
  16680. return $recv($self._package())._name();
  16681. }
  16682. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.TMasterBehavior)});
  16683. },
  16684. args: [],
  16685. source: "category\x0a\x09^ self package ifNil: [ 'Unclassified' ] ifNotNil: [ self package name ]",
  16686. referencedClasses: [],
  16687. messageSends: ["ifNil:ifNotNil:", "package", "name"]
  16688. }),
  16689. $globals.TMasterBehavior);
  16690. $core.addMethod(
  16691. $core.method({
  16692. selector: "classTag",
  16693. protocol: "accessing",
  16694. fn: function (){
  16695. var self=this,$self=this;
  16696. return $core.withContext(function($ctx1) {
  16697. return $self._subclassResponsibility();
  16698. }, function($ctx1) {$ctx1.fill(self,"classTag",{},$globals.TMasterBehavior)});
  16699. },
  16700. args: [],
  16701. source: "classTag\x0a\x09\x22Every master behavior should define a class tag.\x22\x0a\x09^ self subclassResponsibility",
  16702. referencedClasses: [],
  16703. messageSends: ["subclassResponsibility"]
  16704. }),
  16705. $globals.TMasterBehavior);
  16706. $core.addMethod(
  16707. $core.method({
  16708. selector: "comment",
  16709. protocol: "accessing",
  16710. fn: function (){
  16711. var self=this,$self=this;
  16712. return $core.withContext(function($ctx1) {
  16713. var $1,$receiver;
  16714. $1=$self._basicAt_("comment");
  16715. if(($receiver = $1) == null || $receiver.a$nil){
  16716. return "";
  16717. } else {
  16718. return $1;
  16719. }
  16720. }, function($ctx1) {$ctx1.fill(self,"comment",{},$globals.TMasterBehavior)});
  16721. },
  16722. args: [],
  16723. source: "comment\x0a\x09^ (self basicAt: 'comment') ifNil: [ '' ]",
  16724. referencedClasses: [],
  16725. messageSends: ["ifNil:", "basicAt:"]
  16726. }),
  16727. $globals.TMasterBehavior);
  16728. $core.addMethod(
  16729. $core.method({
  16730. selector: "comment:",
  16731. protocol: "accessing",
  16732. fn: function (aString){
  16733. var self=this,$self=this;
  16734. return $core.withContext(function($ctx1) {
  16735. var $1,$3,$2;
  16736. $self._basicAt_put_("comment",aString);
  16737. $1=$recv($globals.SystemAnnouncer)._current();
  16738. $3=$recv($globals.ClassCommentChanged)._new();
  16739. $recv($3)._theClass_(self);
  16740. $2=$recv($3)._yourself();
  16741. $recv($1)._announce_($2);
  16742. return self;
  16743. }, function($ctx1) {$ctx1.fill(self,"comment:",{aString:aString},$globals.TMasterBehavior)});
  16744. },
  16745. args: ["aString"],
  16746. 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)",
  16747. referencedClasses: ["SystemAnnouncer", "ClassCommentChanged"],
  16748. messageSends: ["basicAt:put:", "announce:", "current", "theClass:", "new", "yourself"]
  16749. }),
  16750. $globals.TMasterBehavior);
  16751. $core.addMethod(
  16752. $core.method({
  16753. selector: "definedMethods",
  16754. protocol: "accessing",
  16755. fn: function (){
  16756. var self=this,$self=this;
  16757. var methods;
  16758. return $core.withContext(function($ctx1) {
  16759. var $1,$receiver;
  16760. methods=$self._methods();
  16761. $ctx1.sendIdx["methods"]=1;
  16762. $1=$self._theMetaClass();
  16763. if(($receiver = $1) == null || $receiver.a$nil){
  16764. return methods;
  16765. } else {
  16766. var meta;
  16767. meta=$receiver;
  16768. return $recv(methods).__comma($recv(meta)._methods());
  16769. }
  16770. return self;
  16771. }, function($ctx1) {$ctx1.fill(self,"definedMethods",{methods:methods},$globals.TMasterBehavior)});
  16772. },
  16773. args: [],
  16774. 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 ]",
  16775. referencedClasses: [],
  16776. messageSends: ["methods", "ifNil:ifNotNil:", "theMetaClass", ","]
  16777. }),
  16778. $globals.TMasterBehavior);
  16779. $core.addMethod(
  16780. $core.method({
  16781. selector: "enterOrganization",
  16782. protocol: "accessing",
  16783. fn: function (){
  16784. var self=this,$self=this;
  16785. return $core.withContext(function($ctx1) {
  16786. var $1,$receiver;
  16787. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16788. $globals.Smalltalk;
  16789. } else {
  16790. $1=$self._basicAt_("category");
  16791. if(($receiver = $1) == null || $receiver.a$nil){
  16792. $self._basicPackage_(nil);
  16793. $ctx1.sendIdx["basicPackage:"]=1;
  16794. } else {
  16795. var category;
  16796. category=$receiver;
  16797. $self._basicPackage_($recv($globals.Package)._named_(category));
  16798. $recv($recv($self._package())._organization())._addElement_(self);
  16799. }
  16800. }
  16801. return self;
  16802. }, function($ctx1) {$ctx1.fill(self,"enterOrganization",{},$globals.TMasterBehavior)});
  16803. },
  16804. args: [],
  16805. 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 ] ]",
  16806. referencedClasses: ["Smalltalk", "Package"],
  16807. messageSends: ["ifNotNil:", "ifNil:ifNotNil:", "basicAt:", "basicPackage:", "named:", "addElement:", "organization", "package"]
  16808. }),
  16809. $globals.TMasterBehavior);
  16810. $core.addMethod(
  16811. $core.method({
  16812. selector: "leaveOrganization",
  16813. protocol: "accessing",
  16814. fn: function (){
  16815. var self=this,$self=this;
  16816. return $core.withContext(function($ctx1) {
  16817. var $receiver;
  16818. if(($receiver = $globals.Smalltalk) == null || $receiver.a$nil){
  16819. $globals.Smalltalk;
  16820. } else {
  16821. $recv($recv($self._package())._organization())._removeElement_(self);
  16822. }
  16823. return self;
  16824. }, function($ctx1) {$ctx1.fill(self,"leaveOrganization",{},$globals.TMasterBehavior)});
  16825. },
  16826. args: [],
  16827. source: "leaveOrganization\x0a\x09Smalltalk ifNotNil: [\x0a\x09\x09self package organization removeElement: self ]",
  16828. referencedClasses: ["Smalltalk"],
  16829. messageSends: ["ifNotNil:", "removeElement:", "organization", "package"]
  16830. }),
  16831. $globals.TMasterBehavior);
  16832. $core.addMethod(
  16833. $core.method({
  16834. selector: "name",
  16835. protocol: "accessing",
  16836. fn: function (){
  16837. var self=this,$self=this;
  16838. return $core.withContext(function($ctx1) {
  16839. return self.name;
  16840. return self;
  16841. }, function($ctx1) {$ctx1.fill(self,"name",{},$globals.TMasterBehavior)});
  16842. },
  16843. args: [],
  16844. source: "name\x0a\x09<inlineJS: 'return self.name'>",
  16845. referencedClasses: [],
  16846. messageSends: []
  16847. }),
  16848. $globals.TMasterBehavior);
  16849. $core.addMethod(
  16850. $core.method({
  16851. selector: "package:",
  16852. protocol: "accessing",
  16853. fn: function (aPackage){
  16854. var self=this,$self=this;
  16855. var oldPackage;
  16856. return $core.withContext(function($ctx1) {
  16857. var $2,$1,$3,$5,$4;
  16858. $2=$self._package();
  16859. $ctx1.sendIdx["package"]=1;
  16860. $1=$recv($2).__eq(aPackage);
  16861. if($core.assert($1)){
  16862. return self;
  16863. }
  16864. oldPackage=$self._package();
  16865. $self._leaveOrganization();
  16866. $self._basicAt_put_("category",$recv(aPackage)._name());
  16867. $self._enterOrganization();
  16868. $3=$recv($globals.SystemAnnouncer)._current();
  16869. $5=$recv($globals.ClassMoved)._new();
  16870. $recv($5)._theClass_(self);
  16871. $recv($5)._oldPackage_(oldPackage);
  16872. $4=$recv($5)._yourself();
  16873. $recv($3)._announce_($4);
  16874. return self;
  16875. }, function($ctx1) {$ctx1.fill(self,"package:",{aPackage:aPackage,oldPackage:oldPackage},$globals.TMasterBehavior)});
  16876. },
  16877. args: ["aPackage"],
  16878. 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)",
  16879. referencedClasses: ["SystemAnnouncer", "ClassMoved"],
  16880. messageSends: ["ifTrue:", "=", "package", "leaveOrganization", "basicAt:put:", "name", "enterOrganization", "announce:", "current", "theClass:", "new", "oldPackage:", "yourself"]
  16881. }),
  16882. $globals.TMasterBehavior);
  16883. $core.addMethod(
  16884. $core.method({
  16885. selector: "theNonMetaClass",
  16886. protocol: "accessing",
  16887. fn: function (){
  16888. var self=this,$self=this;
  16889. return self;
  16890. },
  16891. args: [],
  16892. source: "theNonMetaClass\x0a\x09^ self",
  16893. referencedClasses: [],
  16894. messageSends: []
  16895. }),
  16896. $globals.TMasterBehavior);
  16897. $core.addClass("Trait", $globals.Object, ["organization", "package"], "Kernel-Classes");
  16898. $core.addMethod(
  16899. $core.method({
  16900. selector: "-",
  16901. protocol: "composition",
  16902. fn: function (anArray){
  16903. var self=this,$self=this;
  16904. return $core.withContext(function($ctx1) {
  16905. return $recv($self._asTraitTransformation()).__minus(anArray);
  16906. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.Trait)});
  16907. },
  16908. args: ["anArray"],
  16909. source: "- anArray\x0a\x09^ self asTraitTransformation - anArray",
  16910. referencedClasses: [],
  16911. messageSends: ["-", "asTraitTransformation"]
  16912. }),
  16913. $globals.Trait);
  16914. $core.addMethod(
  16915. $core.method({
  16916. selector: "@",
  16917. protocol: "composition",
  16918. fn: function (anArrayOfAssociations){
  16919. var self=this,$self=this;
  16920. return $core.withContext(function($ctx1) {
  16921. return $recv($self._asTraitTransformation()).__at(anArrayOfAssociations);
  16922. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.Trait)});
  16923. },
  16924. args: ["anArrayOfAssociations"],
  16925. source: "@ anArrayOfAssociations\x0a\x09^ self asTraitTransformation @ anArrayOfAssociations",
  16926. referencedClasses: [],
  16927. messageSends: ["@", "asTraitTransformation"]
  16928. }),
  16929. $globals.Trait);
  16930. $core.addMethod(
  16931. $core.method({
  16932. selector: "asTraitComposition",
  16933. protocol: "converting",
  16934. fn: function (){
  16935. var self=this,$self=this;
  16936. return $core.withContext(function($ctx1) {
  16937. return $recv($self._asTraitTransformation())._asTraitComposition();
  16938. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Trait)});
  16939. },
  16940. args: [],
  16941. source: "asTraitComposition\x0a\x09^ self asTraitTransformation asTraitComposition",
  16942. referencedClasses: [],
  16943. messageSends: ["asTraitComposition", "asTraitTransformation"]
  16944. }),
  16945. $globals.Trait);
  16946. $core.addMethod(
  16947. $core.method({
  16948. selector: "asTraitTransformation",
  16949. protocol: "converting",
  16950. fn: function (){
  16951. var self=this,$self=this;
  16952. return $core.withContext(function($ctx1) {
  16953. return $recv($globals.TraitTransformation)._on_(self);
  16954. }, function($ctx1) {$ctx1.fill(self,"asTraitTransformation",{},$globals.Trait)});
  16955. },
  16956. args: [],
  16957. source: "asTraitTransformation\x0a\x09^ TraitTransformation on: self",
  16958. referencedClasses: ["TraitTransformation"],
  16959. messageSends: ["on:"]
  16960. }),
  16961. $globals.Trait);
  16962. $core.addMethod(
  16963. $core.method({
  16964. selector: "basicOrganization",
  16965. protocol: "accessing",
  16966. fn: function (){
  16967. var self=this,$self=this;
  16968. return $self["@organization"];
  16969. },
  16970. args: [],
  16971. source: "basicOrganization\x0a\x09^ organization",
  16972. referencedClasses: [],
  16973. messageSends: []
  16974. }),
  16975. $globals.Trait);
  16976. $core.addMethod(
  16977. $core.method({
  16978. selector: "basicOrganization:",
  16979. protocol: "accessing",
  16980. fn: function (aClassOrganizer){
  16981. var self=this,$self=this;
  16982. $self["@organization"]=aClassOrganizer;
  16983. return self;
  16984. },
  16985. args: ["aClassOrganizer"],
  16986. source: "basicOrganization: aClassOrganizer\x0a\x09organization := aClassOrganizer",
  16987. referencedClasses: [],
  16988. messageSends: []
  16989. }),
  16990. $globals.Trait);
  16991. $core.addMethod(
  16992. $core.method({
  16993. selector: "basicPackage:",
  16994. protocol: "accessing",
  16995. fn: function (aPackage){
  16996. var self=this,$self=this;
  16997. $self["@package"]=aPackage;
  16998. return self;
  16999. },
  17000. args: ["aPackage"],
  17001. source: "basicPackage: aPackage\x0a\x09package := aPackage",
  17002. referencedClasses: [],
  17003. messageSends: []
  17004. }),
  17005. $globals.Trait);
  17006. $core.addMethod(
  17007. $core.method({
  17008. selector: "classTag",
  17009. protocol: "accessing",
  17010. fn: function (){
  17011. var self=this,$self=this;
  17012. return "trait";
  17013. },
  17014. args: [],
  17015. source: "classTag\x0a\x09^ 'trait'",
  17016. referencedClasses: [],
  17017. messageSends: []
  17018. }),
  17019. $globals.Trait);
  17020. $core.addMethod(
  17021. $core.method({
  17022. selector: "definition",
  17023. protocol: "accessing",
  17024. fn: function (){
  17025. var self=this,$self=this;
  17026. return $core.withContext(function($ctx1) {
  17027. var $1;
  17028. return $recv($globals.String)._streamContents_((function(stream){
  17029. return $core.withContext(function($ctx2) {
  17030. $recv(stream)._write_("Trait named: ");
  17031. $ctx2.sendIdx["write:"]=1;
  17032. $recv(stream)._printSymbol_($self._name());
  17033. $recv(stream)._lf();
  17034. $ctx2.sendIdx["lf"]=1;
  17035. $recv(stream)._write_($recv($self._traitCompositionDefinition())._ifNotEmpty_((function(tcd){
  17036. return $core.withContext(function($ctx3) {
  17037. $1=$recv($globals.String)._tab();
  17038. $ctx3.sendIdx["tab"]=1;
  17039. return [$1,"uses: ",tcd,$recv($globals.String)._lf()];
  17040. }, function($ctx3) {$ctx3.fillBlock({tcd:tcd},$ctx2,2)});
  17041. })));
  17042. $ctx2.sendIdx["write:"]=2;
  17043. $recv(stream)._tab();
  17044. $recv(stream)._write_("package: ");
  17045. return $recv(stream)._print_($self._category());
  17046. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  17047. }));
  17048. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Trait)});
  17049. },
  17050. args: [],
  17051. 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 ]",
  17052. referencedClasses: ["String"],
  17053. messageSends: ["streamContents:", "write:", "printSymbol:", "name", "lf", "ifNotEmpty:", "traitCompositionDefinition", "tab", "print:", "category"]
  17054. }),
  17055. $globals.Trait);
  17056. $core.addMethod(
  17057. $core.method({
  17058. selector: "package",
  17059. protocol: "accessing",
  17060. fn: function (){
  17061. var self=this,$self=this;
  17062. return $self["@package"];
  17063. },
  17064. args: [],
  17065. source: "package\x0a\x09^ package",
  17066. referencedClasses: [],
  17067. messageSends: []
  17068. }),
  17069. $globals.Trait);
  17070. $core.addMethod(
  17071. $core.method({
  17072. selector: "theMetaClass",
  17073. protocol: "accessing",
  17074. fn: function (){
  17075. var self=this,$self=this;
  17076. return nil;
  17077. },
  17078. args: [],
  17079. source: "theMetaClass\x0a\x09^ nil",
  17080. referencedClasses: [],
  17081. messageSends: []
  17082. }),
  17083. $globals.Trait);
  17084. $core.addMethod(
  17085. $core.method({
  17086. selector: "traitUsers",
  17087. protocol: "accessing",
  17088. fn: function (){
  17089. var self=this,$self=this;
  17090. return $core.withContext(function($ctx1) {
  17091. return $recv($self._basicAt_("traitUsers"))._copy();
  17092. }, function($ctx1) {$ctx1.fill(self,"traitUsers",{},$globals.Trait)});
  17093. },
  17094. args: [],
  17095. source: "traitUsers\x0a\x09^ (self basicAt: 'traitUsers') copy",
  17096. referencedClasses: [],
  17097. messageSends: ["copy", "basicAt:"]
  17098. }),
  17099. $globals.Trait);
  17100. $core.addMethod(
  17101. $core.method({
  17102. selector: "named:package:",
  17103. protocol: "instance creation",
  17104. fn: function (aString,anotherString){
  17105. var self=this,$self=this;
  17106. return $core.withContext(function($ctx1) {
  17107. return $recv($recv($globals.ClassBuilder)._new())._addTraitNamed_package_(aString,anotherString);
  17108. }, function($ctx1) {$ctx1.fill(self,"named:package:",{aString:aString,anotherString:anotherString},$globals.Trait.a$cls)});
  17109. },
  17110. args: ["aString", "anotherString"],
  17111. source: "named: aString package: anotherString\x0a\x09^ ClassBuilder new addTraitNamed: aString package: anotherString",
  17112. referencedClasses: ["ClassBuilder"],
  17113. messageSends: ["addTraitNamed:package:", "new"]
  17114. }),
  17115. $globals.Trait.a$cls);
  17116. $core.addMethod(
  17117. $core.method({
  17118. selector: "named:uses:package:",
  17119. protocol: "instance creation",
  17120. fn: function (aString,aTraitCompositionDescription,anotherString){
  17121. var self=this,$self=this;
  17122. var trait;
  17123. return $core.withContext(function($ctx1) {
  17124. trait=$self._named_package_(aString,anotherString);
  17125. $recv(trait)._setTraitComposition_($recv(aTraitCompositionDescription)._asTraitComposition());
  17126. return trait;
  17127. }, function($ctx1) {$ctx1.fill(self,"named:uses:package:",{aString:aString,aTraitCompositionDescription:aTraitCompositionDescription,anotherString:anotherString,trait:trait},$globals.Trait.a$cls)});
  17128. },
  17129. args: ["aString", "aTraitCompositionDescription", "anotherString"],
  17130. 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",
  17131. referencedClasses: [],
  17132. messageSends: ["named:package:", "setTraitComposition:", "asTraitComposition"]
  17133. }),
  17134. $globals.Trait.a$cls);
  17135. $core.addClass("TraitTransformation", $globals.Object, ["trait", "aliases", "exclusions"], "Kernel-Classes");
  17136. $globals.TraitTransformation.comment="I am a single step in trait composition.\x0a\x0aI represent one trait including its aliases and exclusions.";
  17137. $core.addMethod(
  17138. $core.method({
  17139. selector: "-",
  17140. protocol: "composition",
  17141. fn: function (anArray){
  17142. var self=this,$self=this;
  17143. return $core.withContext(function($ctx1) {
  17144. var $1;
  17145. $1=$self._copy();
  17146. $recv($1)._addExclusions_(anArray);
  17147. return $recv($1)._yourself();
  17148. }, function($ctx1) {$ctx1.fill(self,"-",{anArray:anArray},$globals.TraitTransformation)});
  17149. },
  17150. args: ["anArray"],
  17151. source: "- anArray\x0a\x09^ self copy addExclusions: anArray; yourself",
  17152. referencedClasses: [],
  17153. messageSends: ["addExclusions:", "copy", "yourself"]
  17154. }),
  17155. $globals.TraitTransformation);
  17156. $core.addMethod(
  17157. $core.method({
  17158. selector: "@",
  17159. protocol: "composition",
  17160. fn: function (anArrayOfAssociations){
  17161. var self=this,$self=this;
  17162. return $core.withContext(function($ctx1) {
  17163. var $1;
  17164. $1=$self._copy();
  17165. $recv($1)._addAliases_(anArrayOfAssociations);
  17166. return $recv($1)._yourself();
  17167. }, function($ctx1) {$ctx1.fill(self,"@",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17168. },
  17169. args: ["anArrayOfAssociations"],
  17170. source: "@ anArrayOfAssociations\x0a\x09^ self copy addAliases: anArrayOfAssociations; yourself",
  17171. referencedClasses: [],
  17172. messageSends: ["addAliases:", "copy", "yourself"]
  17173. }),
  17174. $globals.TraitTransformation);
  17175. $core.addMethod(
  17176. $core.method({
  17177. selector: "addAliases:",
  17178. protocol: "accessing",
  17179. fn: function (anArrayOfAssociations){
  17180. var self=this,$self=this;
  17181. return $core.withContext(function($ctx1) {
  17182. $recv(anArrayOfAssociations)._do_((function(each){
  17183. var key;
  17184. return $core.withContext(function($ctx2) {
  17185. key=$recv(each)._key();
  17186. return $recv($self["@aliases"])._at_ifPresent_ifAbsent_(key,(function(){
  17187. return $core.withContext(function($ctx3) {
  17188. return $self._error_("Cannot use same alias name twice.");
  17189. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  17190. }),(function(){
  17191. return $core.withContext(function($ctx3) {
  17192. return $recv($self["@aliases"])._at_put_(key,$recv(each)._value());
  17193. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  17194. }));
  17195. }, function($ctx2) {$ctx2.fillBlock({each:each,key:key},$ctx1,1)});
  17196. }));
  17197. return anArrayOfAssociations;
  17198. }, function($ctx1) {$ctx1.fill(self,"addAliases:",{anArrayOfAssociations:anArrayOfAssociations},$globals.TraitTransformation)});
  17199. },
  17200. args: ["anArrayOfAssociations"],
  17201. 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",
  17202. referencedClasses: [],
  17203. messageSends: ["do:", "key", "at:ifPresent:ifAbsent:", "error:", "at:put:", "value"]
  17204. }),
  17205. $globals.TraitTransformation);
  17206. $core.addMethod(
  17207. $core.method({
  17208. selector: "addExclusions:",
  17209. protocol: "accessing",
  17210. fn: function (anArray){
  17211. var self=this,$self=this;
  17212. return $core.withContext(function($ctx1) {
  17213. $recv($self["@exclusions"])._addAll_(anArray);
  17214. return anArray;
  17215. }, function($ctx1) {$ctx1.fill(self,"addExclusions:",{anArray:anArray},$globals.TraitTransformation)});
  17216. },
  17217. args: ["anArray"],
  17218. source: "addExclusions: anArray\x0a\x09exclusions addAll: anArray.\x0a\x09^ anArray",
  17219. referencedClasses: [],
  17220. messageSends: ["addAll:"]
  17221. }),
  17222. $globals.TraitTransformation);
  17223. $core.addMethod(
  17224. $core.method({
  17225. selector: "aliases",
  17226. protocol: "accessing",
  17227. fn: function (){
  17228. var self=this,$self=this;
  17229. return $self["@aliases"];
  17230. },
  17231. args: [],
  17232. source: "aliases\x0a\x09^ aliases",
  17233. referencedClasses: [],
  17234. messageSends: []
  17235. }),
  17236. $globals.TraitTransformation);
  17237. $core.addMethod(
  17238. $core.method({
  17239. selector: "asJavaScriptObject",
  17240. protocol: "converting",
  17241. fn: function (){
  17242. var self=this,$self=this;
  17243. return $core.withContext(function($ctx1) {
  17244. return $globals.HashedCollection._newFromPairs_(["trait",$self._trait(),"aliases",$self._aliases(),"exclusions",$recv($recv($self._exclusions())._asArray())._sorted()]);
  17245. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.TraitTransformation)});
  17246. },
  17247. args: [],
  17248. source: "asJavaScriptObject\x0a\x09^ #{\x0a\x09\x09'trait' -> self trait.\x0a\x09\x09'aliases' -> self aliases.\x0a\x09\x09'exclusions' -> self exclusions asArray sorted }",
  17249. referencedClasses: [],
  17250. messageSends: ["trait", "aliases", "sorted", "asArray", "exclusions"]
  17251. }),
  17252. $globals.TraitTransformation);
  17253. $core.addMethod(
  17254. $core.method({
  17255. selector: "asJavaScriptSource",
  17256. protocol: "converting",
  17257. fn: function (){
  17258. var self=this,$self=this;
  17259. return $core.withContext(function($ctx1) {
  17260. var $2,$3,$1;
  17261. return $recv($globals.String)._streamContents_((function(str){
  17262. return $core.withContext(function($ctx2) {
  17263. $2=$recv($self._trait())._asJavaScriptSource();
  17264. $ctx2.sendIdx["asJavaScriptSource"]=1;
  17265. $3=$recv($self._aliases())._ifNotEmpty_((function(al){
  17266. return $core.withContext(function($ctx3) {
  17267. return [", aliases: ",$recv(al)._asJSONString()];
  17268. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17269. }));
  17270. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17271. $1=["{trait: ",$2,$3,$recv($self._exclusions())._ifNotEmpty_((function(ex){
  17272. return $core.withContext(function($ctx3) {
  17273. return [", exclusions: ",$recv($recv($recv(ex)._asArray())._sorted())._asJavaScriptSource()];
  17274. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  17275. })),"}"];
  17276. return $recv(str)._write_($1);
  17277. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17278. }));
  17279. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptSource",{},$globals.TraitTransformation)});
  17280. },
  17281. args: [],
  17282. 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'}' } ]",
  17283. referencedClasses: ["String"],
  17284. messageSends: ["streamContents:", "write:", "asJavaScriptSource", "trait", "ifNotEmpty:", "aliases", "asJSONString", "exclusions", "sorted", "asArray"]
  17285. }),
  17286. $globals.TraitTransformation);
  17287. $core.addMethod(
  17288. $core.method({
  17289. selector: "asTraitComposition",
  17290. protocol: "converting",
  17291. fn: function (){
  17292. var self=this,$self=this;
  17293. return [self];
  17294. },
  17295. args: [],
  17296. source: "asTraitComposition\x0a\x09^ { self }",
  17297. referencedClasses: [],
  17298. messageSends: []
  17299. }),
  17300. $globals.TraitTransformation);
  17301. $core.addMethod(
  17302. $core.method({
  17303. selector: "asTraitTransformation",
  17304. protocol: "converting",
  17305. fn: function (){
  17306. var self=this,$self=this;
  17307. return self;
  17308. },
  17309. args: [],
  17310. source: "asTraitTransformation\x0a\x09^ self",
  17311. referencedClasses: [],
  17312. messageSends: []
  17313. }),
  17314. $globals.TraitTransformation);
  17315. $core.addMethod(
  17316. $core.method({
  17317. selector: "definition",
  17318. protocol: "accessing",
  17319. fn: function (){
  17320. var self=this,$self=this;
  17321. return $core.withContext(function($ctx1) {
  17322. return $recv($globals.String)._streamContents_((function(str){
  17323. return $core.withContext(function($ctx2) {
  17324. $recv(str)._print_($self._trait());
  17325. $recv($self._aliases())._ifNotEmpty_((function(al){
  17326. return $core.withContext(function($ctx3) {
  17327. $recv(str)._write_(" @ {");
  17328. $ctx3.sendIdx["write:"]=1;
  17329. $recv($recv(al)._associations())._do_separatedBy_((function(each){
  17330. return $core.withContext(function($ctx4) {
  17331. $recv(str)._printSymbol_($recv(each)._key());
  17332. $ctx4.sendIdx["printSymbol:"]=1;
  17333. $recv(str)._write_(" -> ");
  17334. $ctx4.sendIdx["write:"]=2;
  17335. return $recv(str)._printSymbol_($recv(each)._value());
  17336. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  17337. }),(function(){
  17338. return $core.withContext(function($ctx4) {
  17339. return $recv(str)._write_(". ");
  17340. $ctx4.sendIdx["write:"]=3;
  17341. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  17342. }));
  17343. $ctx3.sendIdx["do:separatedBy:"]=1;
  17344. return $recv(str)._write_("}");
  17345. $ctx3.sendIdx["write:"]=4;
  17346. }, function($ctx3) {$ctx3.fillBlock({al:al},$ctx2,2)});
  17347. }));
  17348. $ctx2.sendIdx["ifNotEmpty:"]=1;
  17349. return $recv($self._exclusions())._ifNotEmpty_((function(ex){
  17350. return $core.withContext(function($ctx3) {
  17351. $recv(str)._write_(" - #(");
  17352. $ctx3.sendIdx["write:"]=5;
  17353. $recv($recv($recv(ex)._asArray())._sorted())._do_separatedBy_((function(each){
  17354. return $core.withContext(function($ctx4) {
  17355. return $recv(str)._write_($recv($recv(each)._symbolPrintString())._allButFirst());
  17356. $ctx4.sendIdx["write:"]=6;
  17357. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,6)});
  17358. }),(function(){
  17359. return $core.withContext(function($ctx4) {
  17360. return $recv(str)._space();
  17361. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,7)});
  17362. }));
  17363. return $recv(str)._write_(")");
  17364. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,5)});
  17365. }));
  17366. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  17367. }));
  17368. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.TraitTransformation)});
  17369. },
  17370. args: [],
  17371. 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: ')' ] ]",
  17372. referencedClasses: ["String"],
  17373. messageSends: ["streamContents:", "print:", "trait", "ifNotEmpty:", "aliases", "write:", "do:separatedBy:", "associations", "printSymbol:", "key", "value", "exclusions", "sorted", "asArray", "allButFirst", "symbolPrintString", "space"]
  17374. }),
  17375. $globals.TraitTransformation);
  17376. $core.addMethod(
  17377. $core.method({
  17378. selector: "exclusions",
  17379. protocol: "accessing",
  17380. fn: function (){
  17381. var self=this,$self=this;
  17382. return $self["@exclusions"];
  17383. },
  17384. args: [],
  17385. source: "exclusions\x0a\x09^ exclusions",
  17386. referencedClasses: [],
  17387. messageSends: []
  17388. }),
  17389. $globals.TraitTransformation);
  17390. $core.addMethod(
  17391. $core.method({
  17392. selector: "initialize",
  17393. protocol: "initialization",
  17394. fn: function (){
  17395. var self=this,$self=this;
  17396. return $core.withContext(function($ctx1) {
  17397. (
  17398. $ctx1.supercall = true,
  17399. ($globals.TraitTransformation.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  17400. $ctx1.supercall = false;
  17401. $self["@aliases"]=$globals.HashedCollection._newFromPairs_([]);
  17402. $self["@exclusions"]=$recv($globals.Set)._new();
  17403. $self["@trait"]=nil;
  17404. return self;
  17405. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TraitTransformation)});
  17406. },
  17407. args: [],
  17408. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09aliases := #{}.\x0a\x09exclusions := Set new.\x0a\x09trait := nil",
  17409. referencedClasses: ["Set"],
  17410. messageSends: ["initialize", "new"]
  17411. }),
  17412. $globals.TraitTransformation);
  17413. $core.addMethod(
  17414. $core.method({
  17415. selector: "postCopy",
  17416. protocol: "copying",
  17417. fn: function (){
  17418. var self=this,$self=this;
  17419. return $core.withContext(function($ctx1) {
  17420. $self["@aliases"]=$recv($self["@aliases"])._copy();
  17421. $ctx1.sendIdx["copy"]=1;
  17422. $self["@exclusions"]=$recv($self["@exclusions"])._copy();
  17423. return self;
  17424. }, function($ctx1) {$ctx1.fill(self,"postCopy",{},$globals.TraitTransformation)});
  17425. },
  17426. args: [],
  17427. source: "postCopy\x0a\x09aliases := aliases copy.\x0a\x09exclusions := exclusions copy",
  17428. referencedClasses: [],
  17429. messageSends: ["copy"]
  17430. }),
  17431. $globals.TraitTransformation);
  17432. $core.addMethod(
  17433. $core.method({
  17434. selector: "trait",
  17435. protocol: "accessing",
  17436. fn: function (){
  17437. var self=this,$self=this;
  17438. return $self["@trait"];
  17439. },
  17440. args: [],
  17441. source: "trait\x0a\x09^ trait",
  17442. referencedClasses: [],
  17443. messageSends: []
  17444. }),
  17445. $globals.TraitTransformation);
  17446. $core.addMethod(
  17447. $core.method({
  17448. selector: "trait:",
  17449. protocol: "accessing",
  17450. fn: function (anObject){
  17451. var self=this,$self=this;
  17452. $self["@trait"]=anObject;
  17453. return self;
  17454. },
  17455. args: ["anObject"],
  17456. source: "trait: anObject\x0a\x09trait := anObject",
  17457. referencedClasses: [],
  17458. messageSends: []
  17459. }),
  17460. $globals.TraitTransformation);
  17461. $core.addMethod(
  17462. $core.method({
  17463. selector: "fromJSON:",
  17464. protocol: "instance creation",
  17465. fn: function (aJSObject){
  17466. var self=this,$self=this;
  17467. return $core.withContext(function($ctx1) {
  17468. var $1,$4,$3,$2;
  17469. $1=(
  17470. $ctx1.supercall = true,
  17471. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17472. $ctx1.supercall = false;
  17473. $recv($1)._trait_($recv(aJSObject)._at_("trait"));
  17474. $4=$recv(aJSObject)._at_ifAbsent_("aliases",(function(){
  17475. return $globals.HashedCollection._newFromPairs_([]);
  17476. }));
  17477. $ctx1.sendIdx["at:ifAbsent:"]=1;
  17478. $3=$recv($globals.Smalltalk)._readJSObject_($4);
  17479. $2=$recv($3)._associations();
  17480. $recv($1)._addAliases_($2);
  17481. $recv($1)._addExclusions_($recv(aJSObject)._at_ifAbsent_("exclusions",(function(){
  17482. return [];
  17483. })));
  17484. return $recv($1)._yourself();
  17485. }, function($ctx1) {$ctx1.fill(self,"fromJSON:",{aJSObject:aJSObject},$globals.TraitTransformation.a$cls)});
  17486. },
  17487. args: ["aJSObject"],
  17488. 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",
  17489. referencedClasses: ["Smalltalk"],
  17490. messageSends: ["trait:", "new", "at:", "addAliases:", "associations", "readJSObject:", "at:ifAbsent:", "addExclusions:", "yourself"]
  17491. }),
  17492. $globals.TraitTransformation.a$cls);
  17493. $core.addMethod(
  17494. $core.method({
  17495. selector: "on:",
  17496. protocol: "instance creation",
  17497. fn: function (aTrait){
  17498. var self=this,$self=this;
  17499. return $core.withContext(function($ctx1) {
  17500. var $1;
  17501. $1=(
  17502. $ctx1.supercall = true,
  17503. ($globals.TraitTransformation.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  17504. $ctx1.supercall = false;
  17505. $recv($1)._trait_(aTrait);
  17506. return $recv($1)._yourself();
  17507. }, function($ctx1) {$ctx1.fill(self,"on:",{aTrait:aTrait},$globals.TraitTransformation.a$cls)});
  17508. },
  17509. args: ["aTrait"],
  17510. source: "on: aTrait\x0a\x09^ super new trait: aTrait; yourself",
  17511. referencedClasses: [],
  17512. messageSends: ["trait:", "new", "yourself"]
  17513. }),
  17514. $globals.TraitTransformation.a$cls);
  17515. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}], $globals.Behavior);
  17516. $core.setTraitComposition([{trait: $globals.TMasterBehavior}, {trait: $globals.TSubclassable}], $globals.Class);
  17517. $core.setTraitComposition([{trait: $globals.TBehaviorDefaults}, {trait: $globals.TBehaviorProvider}, {trait: $globals.TMasterBehavior}], $globals.Trait);
  17518. $core.addMethod(
  17519. $core.method({
  17520. selector: "asTraitComposition",
  17521. protocol: "*Kernel-Classes",
  17522. fn: function (){
  17523. var self=this,$self=this;
  17524. return $core.withContext(function($ctx1) {
  17525. return $self._collect_((function(each){
  17526. return $core.withContext(function($ctx2) {
  17527. return $recv(each)._asTraitTransformation();
  17528. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  17529. }));
  17530. }, function($ctx1) {$ctx1.fill(self,"asTraitComposition",{},$globals.Array)});
  17531. },
  17532. args: [],
  17533. source: "asTraitComposition\x0a\x09\x22not implemented yet, noop atm\x22\x0a\x09^ self collect: [ :each | each asTraitTransformation ]",
  17534. referencedClasses: [],
  17535. messageSends: ["collect:", "asTraitTransformation"]
  17536. }),
  17537. $globals.Array);
  17538. });
  17539. define('amber_core/Kernel-Methods',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  17540. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  17541. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  17542. $core.addPackage("Kernel-Methods");
  17543. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].innerEval = function (expr) { return eval(expr); };
  17544. ($core.packageDescriptors||$core.packages)["Kernel-Methods"].transport = {"type":"amd","amdNamespace":"amber_core"};
  17545. $core.addClass("BlockClosure", $globals.Object, [], "Kernel-Methods");
  17546. $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 | ... ] `";
  17547. $core.addMethod(
  17548. $core.method({
  17549. selector: "applyTo:arguments:",
  17550. protocol: "evaluating",
  17551. fn: function (anObject,aCollection){
  17552. var self=this,$self=this;
  17553. return $core.withContext(function($ctx1) {
  17554. return self.apply(anObject, aCollection);
  17555. return self;
  17556. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.BlockClosure)});
  17557. },
  17558. args: ["anObject", "aCollection"],
  17559. source: "applyTo: anObject arguments: aCollection\x0a\x09<inlineJS: 'return self.apply(anObject, aCollection)'>",
  17560. referencedClasses: [],
  17561. messageSends: []
  17562. }),
  17563. $globals.BlockClosure);
  17564. $core.addMethod(
  17565. $core.method({
  17566. selector: "asCompiledMethod:",
  17567. protocol: "converting",
  17568. fn: function (aString){
  17569. var self=this,$self=this;
  17570. return $core.withContext(function($ctx1) {
  17571. return $core.method({selector:aString, fn:self});;
  17572. return self;
  17573. }, function($ctx1) {$ctx1.fill(self,"asCompiledMethod:",{aString:aString},$globals.BlockClosure)});
  17574. },
  17575. args: ["aString"],
  17576. source: "asCompiledMethod: aString\x0a\x09<inlineJS: 'return $core.method({selector:aString, fn:self});'>",
  17577. referencedClasses: [],
  17578. messageSends: []
  17579. }),
  17580. $globals.BlockClosure);
  17581. $core.addMethod(
  17582. $core.method({
  17583. selector: "compiledSource",
  17584. protocol: "accessing",
  17585. fn: function (){
  17586. var self=this,$self=this;
  17587. return $core.withContext(function($ctx1) {
  17588. return self.toString();
  17589. return self;
  17590. }, function($ctx1) {$ctx1.fill(self,"compiledSource",{},$globals.BlockClosure)});
  17591. },
  17592. args: [],
  17593. source: "compiledSource\x0a\x09<inlineJS: 'return self.toString()'>",
  17594. referencedClasses: [],
  17595. messageSends: []
  17596. }),
  17597. $globals.BlockClosure);
  17598. $core.addMethod(
  17599. $core.method({
  17600. selector: "currySelf",
  17601. protocol: "converting",
  17602. fn: function (){
  17603. var self=this,$self=this;
  17604. return $core.withContext(function($ctx1) {
  17605. return function () {
  17606. var args = [ this ];
  17607. args.push.apply(args, arguments);
  17608. return self.apply(null, args);
  17609. }
  17610. ;
  17611. return self;
  17612. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.BlockClosure)});
  17613. },
  17614. args: [],
  17615. 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'>",
  17616. referencedClasses: [],
  17617. messageSends: []
  17618. }),
  17619. $globals.BlockClosure);
  17620. $core.addMethod(
  17621. $core.method({
  17622. selector: "ensure:",
  17623. protocol: "evaluating",
  17624. fn: function (aBlock){
  17625. var self=this,$self=this;
  17626. return $core.withContext(function($ctx1) {
  17627. try{return $self._value()}finally{aBlock._value()};
  17628. return self;
  17629. }, function($ctx1) {$ctx1.fill(self,"ensure:",{aBlock:aBlock},$globals.BlockClosure)});
  17630. },
  17631. args: ["aBlock"],
  17632. source: "ensure: aBlock\x0a\x09<inlineJS: 'try{return $self._value()}finally{aBlock._value()}'>",
  17633. referencedClasses: [],
  17634. messageSends: []
  17635. }),
  17636. $globals.BlockClosure);
  17637. $core.addMethod(
  17638. $core.method({
  17639. selector: "fork",
  17640. protocol: "timeout/interval",
  17641. fn: function (){
  17642. var self=this,$self=this;
  17643. return $core.withContext(function($ctx1) {
  17644. $recv($recv($globals.ForkPool)._default())._fork_(self);
  17645. return self;
  17646. }, function($ctx1) {$ctx1.fill(self,"fork",{},$globals.BlockClosure)});
  17647. },
  17648. args: [],
  17649. source: "fork\x0a\x09ForkPool default fork: self",
  17650. referencedClasses: ["ForkPool"],
  17651. messageSends: ["fork:", "default"]
  17652. }),
  17653. $globals.BlockClosure);
  17654. $core.addMethod(
  17655. $core.method({
  17656. selector: "new",
  17657. protocol: "evaluating",
  17658. fn: function (){
  17659. var self=this,$self=this;
  17660. return $core.withContext(function($ctx1) {
  17661. return new self();
  17662. return self;
  17663. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.BlockClosure)});
  17664. },
  17665. args: [],
  17666. 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()'>",
  17667. referencedClasses: [],
  17668. messageSends: []
  17669. }),
  17670. $globals.BlockClosure);
  17671. $core.addMethod(
  17672. $core.method({
  17673. selector: "newValue:",
  17674. protocol: "evaluating",
  17675. fn: function (anObject){
  17676. var self=this,$self=this;
  17677. return $core.withContext(function($ctx1) {
  17678. return $self._newWithValues_([anObject]);
  17679. }, function($ctx1) {$ctx1.fill(self,"newValue:",{anObject:anObject},$globals.BlockClosure)});
  17680. },
  17681. args: ["anObject"],
  17682. source: "newValue: anObject\x0a\x09^ self newWithValues: { anObject }",
  17683. referencedClasses: [],
  17684. messageSends: ["newWithValues:"]
  17685. }),
  17686. $globals.BlockClosure);
  17687. $core.addMethod(
  17688. $core.method({
  17689. selector: "newValue:value:",
  17690. protocol: "evaluating",
  17691. fn: function (anObject,anObject2){
  17692. var self=this,$self=this;
  17693. return $core.withContext(function($ctx1) {
  17694. return $self._newWithValues_([anObject,anObject2]);
  17695. }, function($ctx1) {$ctx1.fill(self,"newValue:value:",{anObject:anObject,anObject2:anObject2},$globals.BlockClosure)});
  17696. },
  17697. args: ["anObject", "anObject2"],
  17698. source: "newValue: anObject value: anObject2\x0a\x09^ self newWithValues: { anObject. anObject2 }.",
  17699. referencedClasses: [],
  17700. messageSends: ["newWithValues:"]
  17701. }),
  17702. $globals.BlockClosure);
  17703. $core.addMethod(
  17704. $core.method({
  17705. selector: "newValue:value:value:",
  17706. protocol: "evaluating",
  17707. fn: function (anObject,anObject2,anObject3){
  17708. var self=this,$self=this;
  17709. return $core.withContext(function($ctx1) {
  17710. return $self._newWithValues_([anObject,anObject2,anObject3]);
  17711. }, function($ctx1) {$ctx1.fill(self,"newValue:value:value:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.BlockClosure)});
  17712. },
  17713. args: ["anObject", "anObject2", "anObject3"],
  17714. source: "newValue: anObject value: anObject2 value: anObject3\x0a\x09^ self newWithValues: { anObject. anObject2. anObject3 }.",
  17715. referencedClasses: [],
  17716. messageSends: ["newWithValues:"]
  17717. }),
  17718. $globals.BlockClosure);
  17719. $core.addMethod(
  17720. $core.method({
  17721. selector: "newWithValues:",
  17722. protocol: "evaluating",
  17723. fn: function (aCollection){
  17724. var self=this,$self=this;
  17725. return $core.withContext(function($ctx1) {
  17726. var object = Object.create(self.prototype);
  17727. var result = self.apply(object, aCollection);
  17728. return typeof result === "object" ? result : object;
  17729. ;
  17730. return self;
  17731. }, function($ctx1) {$ctx1.fill(self,"newWithValues:",{aCollection:aCollection},$globals.BlockClosure)});
  17732. },
  17733. args: ["aCollection"],
  17734. 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'>",
  17735. referencedClasses: [],
  17736. messageSends: []
  17737. }),
  17738. $globals.BlockClosure);
  17739. $core.addMethod(
  17740. $core.method({
  17741. selector: "numArgs",
  17742. protocol: "accessing",
  17743. fn: function (){
  17744. var self=this,$self=this;
  17745. return $core.withContext(function($ctx1) {
  17746. return self.length;
  17747. return self;
  17748. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.BlockClosure)});
  17749. },
  17750. args: [],
  17751. source: "numArgs\x0a\x09<inlineJS: 'return self.length'>",
  17752. referencedClasses: [],
  17753. messageSends: []
  17754. }),
  17755. $globals.BlockClosure);
  17756. $core.addMethod(
  17757. $core.method({
  17758. selector: "on:do:",
  17759. protocol: "error handling",
  17760. fn: function (anErrorClass,aBlock){
  17761. var self=this,$self=this;
  17762. return $core.withContext(function($ctx1) {
  17763. var $1;
  17764. return $self._tryCatch_((function(error){
  17765. var smalltalkError;
  17766. return $core.withContext(function($ctx2) {
  17767. smalltalkError=$recv($globals.Smalltalk)._asSmalltalkException_(error);
  17768. $1=$recv(smalltalkError)._isKindOf_(anErrorClass);
  17769. if($core.assert($1)){
  17770. return $recv(aBlock)._value_(smalltalkError);
  17771. } else {
  17772. return $recv(smalltalkError)._pass();
  17773. }
  17774. }, function($ctx2) {$ctx2.fillBlock({error:error,smalltalkError:smalltalkError},$ctx1,1)});
  17775. }));
  17776. }, function($ctx1) {$ctx1.fill(self,"on:do:",{anErrorClass:anErrorClass,aBlock:aBlock},$globals.BlockClosure)});
  17777. },
  17778. args: ["anErrorClass", "aBlock"],
  17779. 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 ] ]",
  17780. referencedClasses: ["Smalltalk"],
  17781. messageSends: ["tryCatch:", "asSmalltalkException:", "ifTrue:ifFalse:", "isKindOf:", "value:", "pass"]
  17782. }),
  17783. $globals.BlockClosure);
  17784. $core.addMethod(
  17785. $core.method({
  17786. selector: "provided",
  17787. protocol: "converting",
  17788. fn: function (){
  17789. var self=this,$self=this;
  17790. return $core.withContext(function($ctx1) {
  17791. return $recv($globals.JSObjectProxy)._on_(self);
  17792. }, function($ctx1) {$ctx1.fill(self,"provided",{},$globals.BlockClosure)});
  17793. },
  17794. args: [],
  17795. source: "provided\x0a\x09\x22Returns JS proxy that allows to access 'static API', as in\x0a\x09 require provided resolve: ...\x0a\x09or\x0a\x09 XMLHttpRequest provided DONE\x22\x0a\x09\x0a\x09^ JSObjectProxy on: self",
  17796. referencedClasses: ["JSObjectProxy"],
  17797. messageSends: ["on:"]
  17798. }),
  17799. $globals.BlockClosure);
  17800. $core.addMethod(
  17801. $core.method({
  17802. selector: "receiver",
  17803. protocol: "accessing",
  17804. fn: function (){
  17805. var self=this,$self=this;
  17806. return nil;
  17807. },
  17808. args: [],
  17809. source: "receiver\x0a\x09^ nil",
  17810. referencedClasses: [],
  17811. messageSends: []
  17812. }),
  17813. $globals.BlockClosure);
  17814. $core.addMethod(
  17815. $core.method({
  17816. selector: "timeToRun",
  17817. protocol: "evaluating",
  17818. fn: function (){
  17819. var self=this,$self=this;
  17820. return $core.withContext(function($ctx1) {
  17821. return $recv($globals.Date)._millisecondsToRun_(self);
  17822. }, function($ctx1) {$ctx1.fill(self,"timeToRun",{},$globals.BlockClosure)});
  17823. },
  17824. args: [],
  17825. source: "timeToRun\x0a\x09\x22Answer the number of milliseconds taken to execute this block.\x22\x0a\x0a\x09^ Date millisecondsToRun: self",
  17826. referencedClasses: ["Date"],
  17827. messageSends: ["millisecondsToRun:"]
  17828. }),
  17829. $globals.BlockClosure);
  17830. $core.addMethod(
  17831. $core.method({
  17832. selector: "tryCatch:",
  17833. protocol: "error handling",
  17834. fn: function (aBlock){
  17835. var self=this,$self=this;
  17836. return $core.withContext(function($ctx1) {
  17837. try {
  17838. return $self._value();
  17839. } catch(error) {
  17840. // pass non-local returns undetected
  17841. if (Array.isArray(error) && error.length === 1) throw error;
  17842. return aBlock._value_(error);
  17843. }
  17844. ;
  17845. return self;
  17846. }, function($ctx1) {$ctx1.fill(self,"tryCatch:",{aBlock:aBlock},$globals.BlockClosure)});
  17847. },
  17848. args: ["aBlock"],
  17849. 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'>",
  17850. referencedClasses: [],
  17851. messageSends: []
  17852. }),
  17853. $globals.BlockClosure);
  17854. $core.addMethod(
  17855. $core.method({
  17856. selector: "value",
  17857. protocol: "evaluating",
  17858. fn: function (){
  17859. var self=this,$self=this;
  17860. return $core.withContext(function($ctx1) {
  17861. return self();;
  17862. return self;
  17863. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.BlockClosure)});
  17864. },
  17865. args: [],
  17866. source: "value\x0a\x09<inlineJS: 'return self();'>",
  17867. referencedClasses: [],
  17868. messageSends: []
  17869. }),
  17870. $globals.BlockClosure);
  17871. $core.addMethod(
  17872. $core.method({
  17873. selector: "value:",
  17874. protocol: "evaluating",
  17875. fn: function (anArg){
  17876. var self=this,$self=this;
  17877. return $core.withContext(function($ctx1) {
  17878. return self(anArg);;
  17879. return self;
  17880. }, function($ctx1) {$ctx1.fill(self,"value:",{anArg:anArg},$globals.BlockClosure)});
  17881. },
  17882. args: ["anArg"],
  17883. source: "value: anArg\x0a\x09<inlineJS: 'return self(anArg);'>",
  17884. referencedClasses: [],
  17885. messageSends: []
  17886. }),
  17887. $globals.BlockClosure);
  17888. $core.addMethod(
  17889. $core.method({
  17890. selector: "value:value:",
  17891. protocol: "evaluating",
  17892. fn: function (firstArg,secondArg){
  17893. var self=this,$self=this;
  17894. return $core.withContext(function($ctx1) {
  17895. return self(firstArg, secondArg);;
  17896. return self;
  17897. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArg:firstArg,secondArg:secondArg},$globals.BlockClosure)});
  17898. },
  17899. args: ["firstArg", "secondArg"],
  17900. source: "value: firstArg value: secondArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg);'>",
  17901. referencedClasses: [],
  17902. messageSends: []
  17903. }),
  17904. $globals.BlockClosure);
  17905. $core.addMethod(
  17906. $core.method({
  17907. selector: "value:value:value:",
  17908. protocol: "evaluating",
  17909. fn: function (firstArg,secondArg,thirdArg){
  17910. var self=this,$self=this;
  17911. return $core.withContext(function($ctx1) {
  17912. return self(firstArg, secondArg, thirdArg);;
  17913. return self;
  17914. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArg:firstArg,secondArg:secondArg,thirdArg:thirdArg},$globals.BlockClosure)});
  17915. },
  17916. args: ["firstArg", "secondArg", "thirdArg"],
  17917. source: "value: firstArg value: secondArg value: thirdArg\x0a\x09<inlineJS: 'return self(firstArg, secondArg, thirdArg);'>",
  17918. referencedClasses: [],
  17919. messageSends: []
  17920. }),
  17921. $globals.BlockClosure);
  17922. $core.addMethod(
  17923. $core.method({
  17924. selector: "valueWithInterval:",
  17925. protocol: "timeout/interval",
  17926. fn: function (aNumber){
  17927. var self=this,$self=this;
  17928. return $core.withContext(function($ctx1) {
  17929. var interval = setInterval(self, aNumber);
  17930. return $globals.Timeout._on_(interval);
  17931. ;
  17932. return self;
  17933. }, function($ctx1) {$ctx1.fill(self,"valueWithInterval:",{aNumber:aNumber},$globals.BlockClosure)});
  17934. },
  17935. args: ["aNumber"],
  17936. source: "valueWithInterval: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var interval = setInterval(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(interval);\x0a\x09'>",
  17937. referencedClasses: [],
  17938. messageSends: []
  17939. }),
  17940. $globals.BlockClosure);
  17941. $core.addMethod(
  17942. $core.method({
  17943. selector: "valueWithPossibleArguments:",
  17944. protocol: "evaluating",
  17945. fn: function (aCollection){
  17946. var self=this,$self=this;
  17947. return $core.withContext(function($ctx1) {
  17948. return self.apply(null, aCollection);;
  17949. return self;
  17950. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.BlockClosure)});
  17951. },
  17952. args: ["aCollection"],
  17953. source: "valueWithPossibleArguments: aCollection\x0a\x09<inlineJS: 'return self.apply(null, aCollection);'>",
  17954. referencedClasses: [],
  17955. messageSends: []
  17956. }),
  17957. $globals.BlockClosure);
  17958. $core.addMethod(
  17959. $core.method({
  17960. selector: "valueWithTimeout:",
  17961. protocol: "timeout/interval",
  17962. fn: function (aNumber){
  17963. var self=this,$self=this;
  17964. return $core.withContext(function($ctx1) {
  17965. var timeout = setTimeout(self, aNumber);
  17966. return $globals.Timeout._on_(timeout);
  17967. ;
  17968. return self;
  17969. }, function($ctx1) {$ctx1.fill(self,"valueWithTimeout:",{aNumber:aNumber},$globals.BlockClosure)});
  17970. },
  17971. args: ["aNumber"],
  17972. source: "valueWithTimeout: aNumber\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = setTimeout(self, aNumber);\x0a\x09\x09return $globals.Timeout._on_(timeout);\x0a\x09'>",
  17973. referencedClasses: [],
  17974. messageSends: []
  17975. }),
  17976. $globals.BlockClosure);
  17977. $core.addMethod(
  17978. $core.method({
  17979. selector: "whileFalse",
  17980. protocol: "controlling",
  17981. fn: function (){
  17982. var self=this,$self=this;
  17983. return $core.withContext(function($ctx1) {
  17984. $self._whileFalse_((function(){
  17985. }));
  17986. return self;
  17987. }, function($ctx1) {$ctx1.fill(self,"whileFalse",{},$globals.BlockClosure)});
  17988. },
  17989. args: [],
  17990. source: "whileFalse\x0a\x09self whileFalse: []",
  17991. referencedClasses: [],
  17992. messageSends: ["whileFalse:"]
  17993. }),
  17994. $globals.BlockClosure);
  17995. $core.addMethod(
  17996. $core.method({
  17997. selector: "whileFalse:",
  17998. protocol: "controlling",
  17999. fn: function (aBlock){
  18000. var self=this,$self=this;
  18001. return $core.withContext(function($ctx1) {
  18002. while(!$core.assert($self._value())) {aBlock._value()};
  18003. return self;
  18004. }, function($ctx1) {$ctx1.fill(self,"whileFalse:",{aBlock:aBlock},$globals.BlockClosure)});
  18005. },
  18006. args: ["aBlock"],
  18007. source: "whileFalse: aBlock\x0a\x09<inlineJS: 'while(!$core.assert($self._value())) {aBlock._value()}'>",
  18008. referencedClasses: [],
  18009. messageSends: []
  18010. }),
  18011. $globals.BlockClosure);
  18012. $core.addMethod(
  18013. $core.method({
  18014. selector: "whileTrue",
  18015. protocol: "controlling",
  18016. fn: function (){
  18017. var self=this,$self=this;
  18018. return $core.withContext(function($ctx1) {
  18019. $self._whileTrue_((function(){
  18020. }));
  18021. return self;
  18022. }, function($ctx1) {$ctx1.fill(self,"whileTrue",{},$globals.BlockClosure)});
  18023. },
  18024. args: [],
  18025. source: "whileTrue\x0a\x09self whileTrue: []",
  18026. referencedClasses: [],
  18027. messageSends: ["whileTrue:"]
  18028. }),
  18029. $globals.BlockClosure);
  18030. $core.addMethod(
  18031. $core.method({
  18032. selector: "whileTrue:",
  18033. protocol: "controlling",
  18034. fn: function (aBlock){
  18035. var self=this,$self=this;
  18036. return $core.withContext(function($ctx1) {
  18037. while($core.assert($self._value())) {aBlock._value()};
  18038. return self;
  18039. }, function($ctx1) {$ctx1.fill(self,"whileTrue:",{aBlock:aBlock},$globals.BlockClosure)});
  18040. },
  18041. args: ["aBlock"],
  18042. source: "whileTrue: aBlock\x0a\x09<inlineJS: 'while($core.assert($self._value())) {aBlock._value()}'>",
  18043. referencedClasses: [],
  18044. messageSends: []
  18045. }),
  18046. $globals.BlockClosure);
  18047. $core.addClass("CompiledMethod", $globals.Object, [], "Kernel-Methods");
  18048. $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";
  18049. $core.addMethod(
  18050. $core.method({
  18051. selector: "arguments",
  18052. protocol: "accessing",
  18053. fn: function (){
  18054. var self=this,$self=this;
  18055. return $core.withContext(function($ctx1) {
  18056. return self.args || [];
  18057. return self;
  18058. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.CompiledMethod)});
  18059. },
  18060. args: [],
  18061. source: "arguments\x0a\x09<inlineJS: 'return self.args || []'>",
  18062. referencedClasses: [],
  18063. messageSends: []
  18064. }),
  18065. $globals.CompiledMethod);
  18066. $core.addMethod(
  18067. $core.method({
  18068. selector: "browse",
  18069. protocol: "browsing",
  18070. fn: function (){
  18071. var self=this,$self=this;
  18072. return $core.withContext(function($ctx1) {
  18073. $recv($globals.Finder)._findMethod_(self);
  18074. return self;
  18075. }, function($ctx1) {$ctx1.fill(self,"browse",{},$globals.CompiledMethod)});
  18076. },
  18077. args: [],
  18078. source: "browse\x0a\x09Finder findMethod: self",
  18079. referencedClasses: ["Finder"],
  18080. messageSends: ["findMethod:"]
  18081. }),
  18082. $globals.CompiledMethod);
  18083. $core.addMethod(
  18084. $core.method({
  18085. selector: "category",
  18086. protocol: "accessing",
  18087. fn: function (){
  18088. var self=this,$self=this;
  18089. return $core.withContext(function($ctx1) {
  18090. return $self._protocol();
  18091. }, function($ctx1) {$ctx1.fill(self,"category",{},$globals.CompiledMethod)});
  18092. },
  18093. args: [],
  18094. source: "category\x0a\x09^ self protocol",
  18095. referencedClasses: [],
  18096. messageSends: ["protocol"]
  18097. }),
  18098. $globals.CompiledMethod);
  18099. $core.addMethod(
  18100. $core.method({
  18101. selector: "defaultProtocol",
  18102. protocol: "defaults",
  18103. fn: function (){
  18104. var self=this,$self=this;
  18105. return "as yet unclassified";
  18106. },
  18107. args: [],
  18108. source: "defaultProtocol\x0a\x09^ 'as yet unclassified'",
  18109. referencedClasses: [],
  18110. messageSends: []
  18111. }),
  18112. $globals.CompiledMethod);
  18113. $core.addMethod(
  18114. $core.method({
  18115. selector: "fn",
  18116. protocol: "accessing",
  18117. fn: function (){
  18118. var self=this,$self=this;
  18119. return $core.withContext(function($ctx1) {
  18120. return $self._basicAt_("fn");
  18121. }, function($ctx1) {$ctx1.fill(self,"fn",{},$globals.CompiledMethod)});
  18122. },
  18123. args: [],
  18124. source: "fn\x0a\x09^ self basicAt: 'fn'",
  18125. referencedClasses: [],
  18126. messageSends: ["basicAt:"]
  18127. }),
  18128. $globals.CompiledMethod);
  18129. $core.addMethod(
  18130. $core.method({
  18131. selector: "fn:",
  18132. protocol: "accessing",
  18133. fn: function (aBlock){
  18134. var self=this,$self=this;
  18135. return $core.withContext(function($ctx1) {
  18136. $self._basicAt_put_("fn",aBlock);
  18137. return self;
  18138. }, function($ctx1) {$ctx1.fill(self,"fn:",{aBlock:aBlock},$globals.CompiledMethod)});
  18139. },
  18140. args: ["aBlock"],
  18141. source: "fn: aBlock\x0a\x09self basicAt: 'fn' put: aBlock",
  18142. referencedClasses: [],
  18143. messageSends: ["basicAt:put:"]
  18144. }),
  18145. $globals.CompiledMethod);
  18146. $core.addMethod(
  18147. $core.method({
  18148. selector: "isCompiledMethod",
  18149. protocol: "testing",
  18150. fn: function (){
  18151. var self=this,$self=this;
  18152. return true;
  18153. },
  18154. args: [],
  18155. source: "isCompiledMethod\x0a\x09^ true",
  18156. referencedClasses: [],
  18157. messageSends: []
  18158. }),
  18159. $globals.CompiledMethod);
  18160. $core.addMethod(
  18161. $core.method({
  18162. selector: "isOverridden",
  18163. protocol: "testing",
  18164. fn: function (){
  18165. var self=this,$self=this;
  18166. var selector;
  18167. return $core.withContext(function($ctx1) {
  18168. var $1;
  18169. var $early={};
  18170. try {
  18171. selector=$self._selector();
  18172. $recv($self._methodClass())._allSubclassesDo_((function(each){
  18173. return $core.withContext(function($ctx2) {
  18174. $1=$recv(each)._includesSelector_(selector);
  18175. if($core.assert($1)){
  18176. throw $early=[true];
  18177. }
  18178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  18179. }));
  18180. return false;
  18181. }
  18182. catch(e) {if(e===$early)return e[0]; throw e}
  18183. }, function($ctx1) {$ctx1.fill(self,"isOverridden",{selector:selector},$globals.CompiledMethod)});
  18184. },
  18185. args: [],
  18186. 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",
  18187. referencedClasses: [],
  18188. messageSends: ["selector", "allSubclassesDo:", "methodClass", "ifTrue:", "includesSelector:"]
  18189. }),
  18190. $globals.CompiledMethod);
  18191. $core.addMethod(
  18192. $core.method({
  18193. selector: "isOverride",
  18194. protocol: "testing",
  18195. fn: function (){
  18196. var self=this,$self=this;
  18197. var superclass;
  18198. return $core.withContext(function($ctx1) {
  18199. var $1,$2,$receiver;
  18200. $1=$self._methodClass();
  18201. $ctx1.sendIdx["methodClass"]=1;
  18202. superclass=$recv($1)._superclass();
  18203. $ctx1.sendIdx["superclass"]=1;
  18204. $2=superclass;
  18205. if(($receiver = $2) == null || $receiver.a$nil){
  18206. return false;
  18207. } else {
  18208. $2;
  18209. }
  18210. return $recv($recv($recv($self._methodClass())._superclass())._lookupSelector_($self._selector()))._notNil();
  18211. }, function($ctx1) {$ctx1.fill(self,"isOverride",{superclass:superclass},$globals.CompiledMethod)});
  18212. },
  18213. args: [],
  18214. 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",
  18215. referencedClasses: [],
  18216. messageSends: ["superclass", "methodClass", "ifNil:", "notNil", "lookupSelector:", "selector"]
  18217. }),
  18218. $globals.CompiledMethod);
  18219. $core.addMethod(
  18220. $core.method({
  18221. selector: "messageSends",
  18222. protocol: "accessing",
  18223. fn: function (){
  18224. var self=this,$self=this;
  18225. return $core.withContext(function($ctx1) {
  18226. return $self._basicAt_("messageSends");
  18227. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.CompiledMethod)});
  18228. },
  18229. args: [],
  18230. source: "messageSends\x0a\x09^ self basicAt: 'messageSends'",
  18231. referencedClasses: [],
  18232. messageSends: ["basicAt:"]
  18233. }),
  18234. $globals.CompiledMethod);
  18235. $core.addMethod(
  18236. $core.method({
  18237. selector: "methodClass",
  18238. protocol: "accessing",
  18239. fn: function (){
  18240. var self=this,$self=this;
  18241. return $core.withContext(function($ctx1) {
  18242. return $self._basicAt_("owner");
  18243. }, function($ctx1) {$ctx1.fill(self,"methodClass",{},$globals.CompiledMethod)});
  18244. },
  18245. args: [],
  18246. source: "methodClass\x0a\x09^ self basicAt: 'owner'",
  18247. referencedClasses: [],
  18248. messageSends: ["basicAt:"]
  18249. }),
  18250. $globals.CompiledMethod);
  18251. $core.addMethod(
  18252. $core.method({
  18253. selector: "package",
  18254. protocol: "accessing",
  18255. fn: function (){
  18256. var self=this,$self=this;
  18257. return $core.withContext(function($ctx1) {
  18258. var $1,$receiver;
  18259. $1=$self._methodClass();
  18260. if(($receiver = $1) == null || $receiver.a$nil){
  18261. return $1;
  18262. } else {
  18263. var class_;
  18264. class_=$receiver;
  18265. return $recv(class_)._packageOfProtocol_($self._protocol());
  18266. }
  18267. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.CompiledMethod)});
  18268. },
  18269. args: [],
  18270. 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 ]",
  18271. referencedClasses: [],
  18272. messageSends: ["ifNotNil:", "methodClass", "packageOfProtocol:", "protocol"]
  18273. }),
  18274. $globals.CompiledMethod);
  18275. $core.addMethod(
  18276. $core.method({
  18277. selector: "protocol",
  18278. protocol: "accessing",
  18279. fn: function (){
  18280. var self=this,$self=this;
  18281. return $core.withContext(function($ctx1) {
  18282. var $1,$receiver;
  18283. $1=$self._basicAt_("protocol");
  18284. if(($receiver = $1) == null || $receiver.a$nil){
  18285. return $self._defaultProtocol();
  18286. } else {
  18287. return $1;
  18288. }
  18289. }, function($ctx1) {$ctx1.fill(self,"protocol",{},$globals.CompiledMethod)});
  18290. },
  18291. args: [],
  18292. source: "protocol\x0a\x09^ (self basicAt: 'protocol') ifNil: [ self defaultProtocol ]",
  18293. referencedClasses: [],
  18294. messageSends: ["ifNil:", "basicAt:", "defaultProtocol"]
  18295. }),
  18296. $globals.CompiledMethod);
  18297. $core.addMethod(
  18298. $core.method({
  18299. selector: "protocol:",
  18300. protocol: "accessing",
  18301. fn: function (aString){
  18302. var self=this,$self=this;
  18303. var oldProtocol;
  18304. return $core.withContext(function($ctx1) {
  18305. var $1,$3,$2,$4,$receiver;
  18306. oldProtocol=$self._protocol();
  18307. $self._basicAt_put_("protocol",aString);
  18308. $1=$recv($globals.SystemAnnouncer)._current();
  18309. $3=$recv($globals.MethodMoved)._new();
  18310. $recv($3)._method_(self);
  18311. $recv($3)._oldProtocol_(oldProtocol);
  18312. $2=$recv($3)._yourself();
  18313. $recv($1)._announce_($2);
  18314. $4=$self._methodClass();
  18315. if(($receiver = $4) == null || $receiver.a$nil){
  18316. $4;
  18317. } else {
  18318. var methodClass;
  18319. methodClass=$receiver;
  18320. $recv($recv(methodClass)._organization())._addElement_(aString);
  18321. $recv(methodClass)._removeProtocolIfEmpty_(oldProtocol);
  18322. }
  18323. return self;
  18324. }, function($ctx1) {$ctx1.fill(self,"protocol:",{aString:aString,oldProtocol:oldProtocol},$globals.CompiledMethod)});
  18325. },
  18326. args: ["aString"],
  18327. 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 ]",
  18328. referencedClasses: ["SystemAnnouncer", "MethodMoved"],
  18329. messageSends: ["protocol", "basicAt:put:", "announce:", "current", "method:", "new", "oldProtocol:", "yourself", "ifNotNil:", "methodClass", "addElement:", "organization", "removeProtocolIfEmpty:"]
  18330. }),
  18331. $globals.CompiledMethod);
  18332. $core.addMethod(
  18333. $core.method({
  18334. selector: "referencedClasses",
  18335. protocol: "accessing",
  18336. fn: function (){
  18337. var self=this,$self=this;
  18338. return $core.withContext(function($ctx1) {
  18339. return $self._basicAt_("referencedClasses");
  18340. }, function($ctx1) {$ctx1.fill(self,"referencedClasses",{},$globals.CompiledMethod)});
  18341. },
  18342. args: [],
  18343. source: "referencedClasses\x0a\x09^ self basicAt: 'referencedClasses'",
  18344. referencedClasses: [],
  18345. messageSends: ["basicAt:"]
  18346. }),
  18347. $globals.CompiledMethod);
  18348. $core.addMethod(
  18349. $core.method({
  18350. selector: "selector",
  18351. protocol: "accessing",
  18352. fn: function (){
  18353. var self=this,$self=this;
  18354. return $core.withContext(function($ctx1) {
  18355. return $self._basicAt_("selector");
  18356. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.CompiledMethod)});
  18357. },
  18358. args: [],
  18359. source: "selector\x0a\x09^ self basicAt: 'selector'",
  18360. referencedClasses: [],
  18361. messageSends: ["basicAt:"]
  18362. }),
  18363. $globals.CompiledMethod);
  18364. $core.addMethod(
  18365. $core.method({
  18366. selector: "selector:",
  18367. protocol: "accessing",
  18368. fn: function (aString){
  18369. var self=this,$self=this;
  18370. return $core.withContext(function($ctx1) {
  18371. $self._basicAt_put_("selector",aString);
  18372. return self;
  18373. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.CompiledMethod)});
  18374. },
  18375. args: ["aString"],
  18376. source: "selector: aString\x0a\x09self basicAt: 'selector' put: aString",
  18377. referencedClasses: [],
  18378. messageSends: ["basicAt:put:"]
  18379. }),
  18380. $globals.CompiledMethod);
  18381. $core.addMethod(
  18382. $core.method({
  18383. selector: "sendTo:arguments:",
  18384. protocol: "evaluating",
  18385. fn: function (anObject,aCollection){
  18386. var self=this,$self=this;
  18387. return $core.withContext(function($ctx1) {
  18388. return $recv($self._fn())._applyTo_arguments_(anObject,aCollection);
  18389. }, function($ctx1) {$ctx1.fill(self,"sendTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.CompiledMethod)});
  18390. },
  18391. args: ["anObject", "aCollection"],
  18392. source: "sendTo: anObject arguments: aCollection\x0a\x09^ self fn applyTo: anObject arguments: aCollection",
  18393. referencedClasses: [],
  18394. messageSends: ["applyTo:arguments:", "fn"]
  18395. }),
  18396. $globals.CompiledMethod);
  18397. $core.addMethod(
  18398. $core.method({
  18399. selector: "source",
  18400. protocol: "accessing",
  18401. fn: function (){
  18402. var self=this,$self=this;
  18403. return $core.withContext(function($ctx1) {
  18404. var $1,$receiver;
  18405. $1=$self._basicAt_("source");
  18406. if(($receiver = $1) == null || $receiver.a$nil){
  18407. return "";
  18408. } else {
  18409. return $1;
  18410. }
  18411. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.CompiledMethod)});
  18412. },
  18413. args: [],
  18414. source: "source\x0a\x09^ (self basicAt: 'source') ifNil: [ '' ]",
  18415. referencedClasses: [],
  18416. messageSends: ["ifNil:", "basicAt:"]
  18417. }),
  18418. $globals.CompiledMethod);
  18419. $core.addMethod(
  18420. $core.method({
  18421. selector: "source:",
  18422. protocol: "accessing",
  18423. fn: function (aString){
  18424. var self=this,$self=this;
  18425. return $core.withContext(function($ctx1) {
  18426. $self._basicAt_put_("source",aString);
  18427. return self;
  18428. }, function($ctx1) {$ctx1.fill(self,"source:",{aString:aString},$globals.CompiledMethod)});
  18429. },
  18430. args: ["aString"],
  18431. source: "source: aString\x0a\x09self basicAt: 'source' put: aString",
  18432. referencedClasses: [],
  18433. messageSends: ["basicAt:put:"]
  18434. }),
  18435. $globals.CompiledMethod);
  18436. $core.addClass("ForkPool", $globals.Object, ["poolSize", "maxPoolSize", "queue", "worker"], "Kernel-Methods");
  18437. $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`";
  18438. $core.addMethod(
  18439. $core.method({
  18440. selector: "addWorker",
  18441. protocol: "private",
  18442. fn: function (){
  18443. var self=this,$self=this;
  18444. return $core.withContext(function($ctx1) {
  18445. $recv($self["@worker"])._valueWithTimeout_((0));
  18446. $self["@poolSize"]=$recv($self["@poolSize"]).__plus((1));
  18447. return self;
  18448. }, function($ctx1) {$ctx1.fill(self,"addWorker",{},$globals.ForkPool)});
  18449. },
  18450. args: [],
  18451. source: "addWorker\x0a\x09worker valueWithTimeout: 0.\x0a\x09poolSize := poolSize + 1",
  18452. referencedClasses: [],
  18453. messageSends: ["valueWithTimeout:", "+"]
  18454. }),
  18455. $globals.ForkPool);
  18456. $core.addMethod(
  18457. $core.method({
  18458. selector: "defaultMaxPoolSize",
  18459. protocol: "defaults",
  18460. fn: function (){
  18461. var self=this,$self=this;
  18462. return $core.withContext(function($ctx1) {
  18463. return $recv($self._class())._defaultMaxPoolSize();
  18464. }, function($ctx1) {$ctx1.fill(self,"defaultMaxPoolSize",{},$globals.ForkPool)});
  18465. },
  18466. args: [],
  18467. source: "defaultMaxPoolSize\x0a\x09^ self class defaultMaxPoolSize",
  18468. referencedClasses: [],
  18469. messageSends: ["defaultMaxPoolSize", "class"]
  18470. }),
  18471. $globals.ForkPool);
  18472. $core.addMethod(
  18473. $core.method({
  18474. selector: "fork:",
  18475. protocol: "actions",
  18476. fn: function (aBlock){
  18477. var self=this,$self=this;
  18478. return $core.withContext(function($ctx1) {
  18479. var $1;
  18480. $1=$recv($self["@poolSize"]).__lt($self._maxPoolSize());
  18481. if($core.assert($1)){
  18482. $self._addWorker();
  18483. }
  18484. $recv($self["@queue"])._nextPut_(aBlock);
  18485. return self;
  18486. }, function($ctx1) {$ctx1.fill(self,"fork:",{aBlock:aBlock},$globals.ForkPool)});
  18487. },
  18488. args: ["aBlock"],
  18489. source: "fork: aBlock\x0a\x09poolSize < self maxPoolSize ifTrue: [ self addWorker ].\x0a\x09queue nextPut: aBlock",
  18490. referencedClasses: [],
  18491. messageSends: ["ifTrue:", "<", "maxPoolSize", "addWorker", "nextPut:"]
  18492. }),
  18493. $globals.ForkPool);
  18494. $core.addMethod(
  18495. $core.method({
  18496. selector: "initialize",
  18497. protocol: "initialization",
  18498. fn: function (){
  18499. var self=this,$self=this;
  18500. return $core.withContext(function($ctx1) {
  18501. (
  18502. $ctx1.supercall = true,
  18503. ($globals.ForkPool.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18504. $ctx1.supercall = false;
  18505. $self["@poolSize"]=(0);
  18506. $self["@queue"]=$recv($globals.Queue)._new();
  18507. $self["@worker"]=$self._makeWorker();
  18508. return self;
  18509. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ForkPool)});
  18510. },
  18511. args: [],
  18512. source: "initialize\x0a\x09super initialize.\x0a\x09\x0a\x09poolSize := 0.\x0a\x09queue := Queue new.\x0a\x09worker := self makeWorker",
  18513. referencedClasses: ["Queue"],
  18514. messageSends: ["initialize", "new", "makeWorker"]
  18515. }),
  18516. $globals.ForkPool);
  18517. $core.addMethod(
  18518. $core.method({
  18519. selector: "makeWorker",
  18520. protocol: "initialization",
  18521. fn: function (){
  18522. var self=this,$self=this;
  18523. var sentinel;
  18524. return $core.withContext(function($ctx1) {
  18525. var $1;
  18526. sentinel=$recv($globals.Object)._new();
  18527. return (function(){
  18528. var block;
  18529. return $core.withContext(function($ctx2) {
  18530. $self["@poolSize"]=$recv($self["@poolSize"]).__minus((1));
  18531. block=$recv($self["@queue"])._nextIfAbsent_((function(){
  18532. return sentinel;
  18533. }));
  18534. $1=$recv(block).__eq_eq(sentinel);
  18535. if(!$core.assert($1)){
  18536. return $recv((function(){
  18537. return $core.withContext(function($ctx3) {
  18538. return $recv(block)._value();
  18539. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  18540. }))._ensure_((function(){
  18541. return $core.withContext(function($ctx3) {
  18542. return $self._addWorker();
  18543. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,5)});
  18544. }));
  18545. }
  18546. }, function($ctx2) {$ctx2.fillBlock({block:block},$ctx1,1)});
  18547. });
  18548. }, function($ctx1) {$ctx1.fill(self,"makeWorker",{sentinel:sentinel},$globals.ForkPool)});
  18549. },
  18550. args: [],
  18551. 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 ] ]]",
  18552. referencedClasses: ["Object"],
  18553. messageSends: ["new", "-", "nextIfAbsent:", "ifFalse:", "==", "ensure:", "value", "addWorker"]
  18554. }),
  18555. $globals.ForkPool);
  18556. $core.addMethod(
  18557. $core.method({
  18558. selector: "maxPoolSize",
  18559. protocol: "accessing",
  18560. fn: function (){
  18561. var self=this,$self=this;
  18562. return $core.withContext(function($ctx1) {
  18563. var $1,$receiver;
  18564. $1=$self["@maxPoolSize"];
  18565. if(($receiver = $1) == null || $receiver.a$nil){
  18566. return $self._defaultMaxPoolSize();
  18567. } else {
  18568. return $1;
  18569. }
  18570. }, function($ctx1) {$ctx1.fill(self,"maxPoolSize",{},$globals.ForkPool)});
  18571. },
  18572. args: [],
  18573. source: "maxPoolSize\x0a\x09^ maxPoolSize ifNil: [ self defaultMaxPoolSize ]",
  18574. referencedClasses: [],
  18575. messageSends: ["ifNil:", "defaultMaxPoolSize"]
  18576. }),
  18577. $globals.ForkPool);
  18578. $core.addMethod(
  18579. $core.method({
  18580. selector: "maxPoolSize:",
  18581. protocol: "accessing",
  18582. fn: function (anInteger){
  18583. var self=this,$self=this;
  18584. $self["@maxPoolSize"]=anInteger;
  18585. return self;
  18586. },
  18587. args: ["anInteger"],
  18588. source: "maxPoolSize: anInteger\x0a\x09maxPoolSize := anInteger",
  18589. referencedClasses: [],
  18590. messageSends: []
  18591. }),
  18592. $globals.ForkPool);
  18593. $globals.ForkPool.a$cls.iVarNames = ["default"];
  18594. $core.addMethod(
  18595. $core.method({
  18596. selector: "default",
  18597. protocol: "accessing",
  18598. fn: function (){
  18599. var self=this,$self=this;
  18600. return $core.withContext(function($ctx1) {
  18601. var $1,$receiver;
  18602. $1=$self["@default"];
  18603. if(($receiver = $1) == null || $receiver.a$nil){
  18604. $self["@default"]=$self._new();
  18605. return $self["@default"];
  18606. } else {
  18607. return $1;
  18608. }
  18609. }, function($ctx1) {$ctx1.fill(self,"default",{},$globals.ForkPool.a$cls)});
  18610. },
  18611. args: [],
  18612. source: "default\x0a\x09^ default ifNil: [ default := self new ]",
  18613. referencedClasses: [],
  18614. messageSends: ["ifNil:", "new"]
  18615. }),
  18616. $globals.ForkPool.a$cls);
  18617. $core.addMethod(
  18618. $core.method({
  18619. selector: "defaultMaxPoolSize",
  18620. protocol: "accessing",
  18621. fn: function (){
  18622. var self=this,$self=this;
  18623. return (100);
  18624. },
  18625. args: [],
  18626. source: "defaultMaxPoolSize\x0a\x09^ 100",
  18627. referencedClasses: [],
  18628. messageSends: []
  18629. }),
  18630. $globals.ForkPool.a$cls);
  18631. $core.addMethod(
  18632. $core.method({
  18633. selector: "resetDefault",
  18634. protocol: "accessing",
  18635. fn: function (){
  18636. var self=this,$self=this;
  18637. $self["@default"]=nil;
  18638. return self;
  18639. },
  18640. args: [],
  18641. source: "resetDefault\x0a\x09default := nil",
  18642. referencedClasses: [],
  18643. messageSends: []
  18644. }),
  18645. $globals.ForkPool.a$cls);
  18646. $core.addClass("Message", $globals.Object, ["selector", "arguments"], "Kernel-Methods");
  18647. $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.";
  18648. $core.addMethod(
  18649. $core.method({
  18650. selector: "arguments",
  18651. protocol: "accessing",
  18652. fn: function (){
  18653. var self=this,$self=this;
  18654. return $self["@arguments"];
  18655. },
  18656. args: [],
  18657. source: "arguments\x0a\x09^ arguments",
  18658. referencedClasses: [],
  18659. messageSends: []
  18660. }),
  18661. $globals.Message);
  18662. $core.addMethod(
  18663. $core.method({
  18664. selector: "arguments:",
  18665. protocol: "accessing",
  18666. fn: function (anArray){
  18667. var self=this,$self=this;
  18668. $self["@arguments"]=anArray;
  18669. return self;
  18670. },
  18671. args: ["anArray"],
  18672. source: "arguments: anArray\x0a\x09arguments := anArray",
  18673. referencedClasses: [],
  18674. messageSends: []
  18675. }),
  18676. $globals.Message);
  18677. $core.addMethod(
  18678. $core.method({
  18679. selector: "printOn:",
  18680. protocol: "printing",
  18681. fn: function (aStream){
  18682. var self=this,$self=this;
  18683. return $core.withContext(function($ctx1) {
  18684. (
  18685. $ctx1.supercall = true,
  18686. ($globals.Message.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18687. $ctx1.supercall = false;
  18688. $recv(aStream)._nextPutAll_("(");
  18689. $ctx1.sendIdx["nextPutAll:"]=1;
  18690. $recv(aStream)._nextPutAll_($self._selector());
  18691. $ctx1.sendIdx["nextPutAll:"]=2;
  18692. $recv(aStream)._nextPutAll_(")");
  18693. return self;
  18694. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Message)});
  18695. },
  18696. args: ["aStream"],
  18697. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self selector;\x0a\x09\x09nextPutAll: ')'",
  18698. referencedClasses: [],
  18699. messageSends: ["printOn:", "nextPutAll:", "selector"]
  18700. }),
  18701. $globals.Message);
  18702. $core.addMethod(
  18703. $core.method({
  18704. selector: "selector",
  18705. protocol: "accessing",
  18706. fn: function (){
  18707. var self=this,$self=this;
  18708. return $self["@selector"];
  18709. },
  18710. args: [],
  18711. source: "selector\x0a\x09^ selector",
  18712. referencedClasses: [],
  18713. messageSends: []
  18714. }),
  18715. $globals.Message);
  18716. $core.addMethod(
  18717. $core.method({
  18718. selector: "selector:",
  18719. protocol: "accessing",
  18720. fn: function (aString){
  18721. var self=this,$self=this;
  18722. $self["@selector"]=aString;
  18723. return self;
  18724. },
  18725. args: ["aString"],
  18726. source: "selector: aString\x0a\x09selector := aString",
  18727. referencedClasses: [],
  18728. messageSends: []
  18729. }),
  18730. $globals.Message);
  18731. $core.addMethod(
  18732. $core.method({
  18733. selector: "sendTo:",
  18734. protocol: "actions",
  18735. fn: function (anObject){
  18736. var self=this,$self=this;
  18737. return $core.withContext(function($ctx1) {
  18738. return $recv(anObject)._perform_withArguments_($self._selector(),$self._arguments());
  18739. }, function($ctx1) {$ctx1.fill(self,"sendTo:",{anObject:anObject},$globals.Message)});
  18740. },
  18741. args: ["anObject"],
  18742. source: "sendTo: anObject\x0a\x09^ anObject perform: self selector withArguments: self arguments",
  18743. referencedClasses: [],
  18744. messageSends: ["perform:withArguments:", "selector", "arguments"]
  18745. }),
  18746. $globals.Message);
  18747. $core.addMethod(
  18748. $core.method({
  18749. selector: "selector:arguments:",
  18750. protocol: "instance creation",
  18751. fn: function (aString,anArray){
  18752. var self=this,$self=this;
  18753. return $core.withContext(function($ctx1) {
  18754. var $1;
  18755. $1=$self._new();
  18756. $recv($1)._selector_(aString);
  18757. $recv($1)._arguments_(anArray);
  18758. return $recv($1)._yourself();
  18759. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:",{aString:aString,anArray:anArray},$globals.Message.a$cls)});
  18760. },
  18761. args: ["aString", "anArray"],
  18762. source: "selector: aString arguments: anArray\x0a\x09^ self new\x0a\x09\x09selector: aString;\x0a\x09\x09arguments: anArray;\x0a\x09\x09yourself",
  18763. referencedClasses: [],
  18764. messageSends: ["selector:", "new", "arguments:", "yourself"]
  18765. }),
  18766. $globals.Message.a$cls);
  18767. $core.addMethod(
  18768. $core.method({
  18769. selector: "selector:arguments:notUnderstoodBy:",
  18770. protocol: "dnu handling",
  18771. fn: function (aString,anArray,anObject){
  18772. var self=this,$self=this;
  18773. return $core.withContext(function($ctx1) {
  18774. return $recv(anObject)._doesNotUnderstand_($self._selector_arguments_(aString,anArray));
  18775. }, function($ctx1) {$ctx1.fill(self,"selector:arguments:notUnderstoodBy:",{aString:aString,anArray:anArray,anObject:anObject},$globals.Message.a$cls)});
  18776. },
  18777. args: ["aString", "anArray", "anObject"],
  18778. 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)",
  18779. referencedClasses: [],
  18780. messageSends: ["doesNotUnderstand:", "selector:arguments:"]
  18781. }),
  18782. $globals.Message.a$cls);
  18783. $core.addClass("MessageSend", $globals.Object, ["receiver", "message"], "Kernel-Methods");
  18784. $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.";
  18785. $core.addMethod(
  18786. $core.method({
  18787. selector: "arguments",
  18788. protocol: "accessing",
  18789. fn: function (){
  18790. var self=this,$self=this;
  18791. return $core.withContext(function($ctx1) {
  18792. return $recv($self["@message"])._arguments();
  18793. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MessageSend)});
  18794. },
  18795. args: [],
  18796. source: "arguments\x0a\x09^ message arguments",
  18797. referencedClasses: [],
  18798. messageSends: ["arguments"]
  18799. }),
  18800. $globals.MessageSend);
  18801. $core.addMethod(
  18802. $core.method({
  18803. selector: "arguments:",
  18804. protocol: "accessing",
  18805. fn: function (aCollection){
  18806. var self=this,$self=this;
  18807. return $core.withContext(function($ctx1) {
  18808. $recv($self["@message"])._arguments_(aCollection);
  18809. return self;
  18810. }, function($ctx1) {$ctx1.fill(self,"arguments:",{aCollection:aCollection},$globals.MessageSend)});
  18811. },
  18812. args: ["aCollection"],
  18813. source: "arguments: aCollection\x0a\x09message arguments: aCollection",
  18814. referencedClasses: [],
  18815. messageSends: ["arguments:"]
  18816. }),
  18817. $globals.MessageSend);
  18818. $core.addMethod(
  18819. $core.method({
  18820. selector: "initialize",
  18821. protocol: "initialization",
  18822. fn: function (){
  18823. var self=this,$self=this;
  18824. return $core.withContext(function($ctx1) {
  18825. (
  18826. $ctx1.supercall = true,
  18827. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  18828. $ctx1.supercall = false;
  18829. $self["@message"]=$recv($globals.Message)._new();
  18830. return self;
  18831. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.MessageSend)});
  18832. },
  18833. args: [],
  18834. source: "initialize\x0a\x09super initialize.\x0a\x09message := Message new",
  18835. referencedClasses: ["Message"],
  18836. messageSends: ["initialize", "new"]
  18837. }),
  18838. $globals.MessageSend);
  18839. $core.addMethod(
  18840. $core.method({
  18841. selector: "printOn:",
  18842. protocol: "printing",
  18843. fn: function (aStream){
  18844. var self=this,$self=this;
  18845. return $core.withContext(function($ctx1) {
  18846. (
  18847. $ctx1.supercall = true,
  18848. ($globals.MessageSend.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  18849. $ctx1.supercall = false;
  18850. $recv(aStream)._nextPutAll_("(");
  18851. $ctx1.sendIdx["nextPutAll:"]=1;
  18852. $recv(aStream)._nextPutAll_($self._receiver());
  18853. $ctx1.sendIdx["nextPutAll:"]=2;
  18854. $recv(aStream)._nextPutAll_(" >> ");
  18855. $ctx1.sendIdx["nextPutAll:"]=3;
  18856. $recv(aStream)._nextPutAll_($self._selector());
  18857. $ctx1.sendIdx["nextPutAll:"]=4;
  18858. $recv(aStream)._nextPutAll_(")");
  18859. return self;
  18860. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MessageSend)});
  18861. },
  18862. args: ["aStream"],
  18863. 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: ')'",
  18864. referencedClasses: [],
  18865. messageSends: ["printOn:", "nextPutAll:", "receiver", "selector"]
  18866. }),
  18867. $globals.MessageSend);
  18868. $core.addMethod(
  18869. $core.method({
  18870. selector: "receiver",
  18871. protocol: "accessing",
  18872. fn: function (){
  18873. var self=this,$self=this;
  18874. return $self["@receiver"];
  18875. },
  18876. args: [],
  18877. source: "receiver\x0a\x09^ receiver",
  18878. referencedClasses: [],
  18879. messageSends: []
  18880. }),
  18881. $globals.MessageSend);
  18882. $core.addMethod(
  18883. $core.method({
  18884. selector: "receiver:",
  18885. protocol: "accessing",
  18886. fn: function (anObject){
  18887. var self=this,$self=this;
  18888. $self["@receiver"]=anObject;
  18889. return self;
  18890. },
  18891. args: ["anObject"],
  18892. source: "receiver: anObject\x0a\x09receiver := anObject",
  18893. referencedClasses: [],
  18894. messageSends: []
  18895. }),
  18896. $globals.MessageSend);
  18897. $core.addMethod(
  18898. $core.method({
  18899. selector: "selector",
  18900. protocol: "accessing",
  18901. fn: function (){
  18902. var self=this,$self=this;
  18903. return $core.withContext(function($ctx1) {
  18904. return $recv($self["@message"])._selector();
  18905. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MessageSend)});
  18906. },
  18907. args: [],
  18908. source: "selector\x0a\x09^ message selector",
  18909. referencedClasses: [],
  18910. messageSends: ["selector"]
  18911. }),
  18912. $globals.MessageSend);
  18913. $core.addMethod(
  18914. $core.method({
  18915. selector: "selector:",
  18916. protocol: "accessing",
  18917. fn: function (aString){
  18918. var self=this,$self=this;
  18919. return $core.withContext(function($ctx1) {
  18920. $recv($self["@message"])._selector_(aString);
  18921. return self;
  18922. }, function($ctx1) {$ctx1.fill(self,"selector:",{aString:aString},$globals.MessageSend)});
  18923. },
  18924. args: ["aString"],
  18925. source: "selector: aString\x0a\x09message selector: aString",
  18926. referencedClasses: [],
  18927. messageSends: ["selector:"]
  18928. }),
  18929. $globals.MessageSend);
  18930. $core.addMethod(
  18931. $core.method({
  18932. selector: "value",
  18933. protocol: "evaluating",
  18934. fn: function (){
  18935. var self=this,$self=this;
  18936. return $core.withContext(function($ctx1) {
  18937. return $recv($self["@message"])._sendTo_($self._receiver());
  18938. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.MessageSend)});
  18939. },
  18940. args: [],
  18941. source: "value\x0a\x09^ message sendTo: self receiver",
  18942. referencedClasses: [],
  18943. messageSends: ["sendTo:", "receiver"]
  18944. }),
  18945. $globals.MessageSend);
  18946. $core.addMethod(
  18947. $core.method({
  18948. selector: "value:",
  18949. protocol: "evaluating",
  18950. fn: function (anObject){
  18951. var self=this,$self=this;
  18952. return $core.withContext(function($ctx1) {
  18953. var $1;
  18954. $1=$self["@message"];
  18955. $recv($1)._arguments_([anObject]);
  18956. return $recv($1)._sendTo_($self._receiver());
  18957. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.MessageSend)});
  18958. },
  18959. args: ["anObject"],
  18960. source: "value: anObject\x0a\x09^ message \x0a\x09\x09arguments: { anObject };\x0a\x09\x09sendTo: self receiver",
  18961. referencedClasses: [],
  18962. messageSends: ["arguments:", "sendTo:", "receiver"]
  18963. }),
  18964. $globals.MessageSend);
  18965. $core.addMethod(
  18966. $core.method({
  18967. selector: "value:value:",
  18968. protocol: "evaluating",
  18969. fn: function (firstArgument,secondArgument){
  18970. var self=this,$self=this;
  18971. return $core.withContext(function($ctx1) {
  18972. var $1;
  18973. $1=$self["@message"];
  18974. $recv($1)._arguments_([firstArgument,secondArgument]);
  18975. return $recv($1)._sendTo_($self._receiver());
  18976. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.MessageSend)});
  18977. },
  18978. args: ["firstArgument", "secondArgument"],
  18979. source: "value: firstArgument value: secondArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument };\x0a\x09\x09sendTo: self receiver",
  18980. referencedClasses: [],
  18981. messageSends: ["arguments:", "sendTo:", "receiver"]
  18982. }),
  18983. $globals.MessageSend);
  18984. $core.addMethod(
  18985. $core.method({
  18986. selector: "value:value:value:",
  18987. protocol: "evaluating",
  18988. fn: function (firstArgument,secondArgument,thirdArgument){
  18989. var self=this,$self=this;
  18990. return $core.withContext(function($ctx1) {
  18991. var $1;
  18992. $1=$self["@message"];
  18993. $recv($1)._arguments_([firstArgument,secondArgument,thirdArgument]);
  18994. return $recv($1)._sendTo_($self._receiver());
  18995. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.MessageSend)});
  18996. },
  18997. args: ["firstArgument", "secondArgument", "thirdArgument"],
  18998. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ message \x0a\x09\x09arguments: { firstArgument. secondArgument. thirdArgument };\x0a\x09\x09sendTo: self receiver",
  18999. referencedClasses: [],
  19000. messageSends: ["arguments:", "sendTo:", "receiver"]
  19001. }),
  19002. $globals.MessageSend);
  19003. $core.addMethod(
  19004. $core.method({
  19005. selector: "valueWithPossibleArguments:",
  19006. protocol: "evaluating",
  19007. fn: function (aCollection){
  19008. var self=this,$self=this;
  19009. return $core.withContext(function($ctx1) {
  19010. $self._arguments_(aCollection);
  19011. return $self._value();
  19012. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection},$globals.MessageSend)});
  19013. },
  19014. args: ["aCollection"],
  19015. source: "valueWithPossibleArguments: aCollection\x0a\x09self arguments: aCollection.\x0a\x09^ self value",
  19016. referencedClasses: [],
  19017. messageSends: ["arguments:", "value"]
  19018. }),
  19019. $globals.MessageSend);
  19020. $core.addClass("MethodContext", $globals.Object, [], "Kernel-Methods");
  19021. $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`.";
  19022. $core.addMethod(
  19023. $core.method({
  19024. selector: "asString",
  19025. protocol: "converting",
  19026. fn: function (){
  19027. var self=this,$self=this;
  19028. return $core.withContext(function($ctx1) {
  19029. var $2,$3,$5,$7,$6,$4,$11,$10,$9,$8,$12,$16,$15,$14,$13,$1;
  19030. $2=$self._isBlockContext();
  19031. if($core.assert($2)){
  19032. $3="a block (in ".__comma($recv($self._methodContext())._asString());
  19033. $ctx1.sendIdx[","]=2;
  19034. $1=$recv($3).__comma(")");
  19035. $ctx1.sendIdx[","]=1;
  19036. } else {
  19037. var methodClass;
  19038. methodClass=$recv($self._method())._methodClass();
  19039. $5=methodClass;
  19040. $7=$self._receiver();
  19041. $ctx1.sendIdx["receiver"]=1;
  19042. $6=$recv($7)._class();
  19043. $ctx1.sendIdx["class"]=1;
  19044. $4=$recv($5).__eq($6);
  19045. if($core.assert($4)){
  19046. $11=$self._receiver();
  19047. $ctx1.sendIdx["receiver"]=2;
  19048. $10=$recv($11)._class();
  19049. $ctx1.sendIdx["class"]=2;
  19050. $9=$recv($10)._name();
  19051. $ctx1.sendIdx["name"]=1;
  19052. $8=$recv($9).__comma(" >> ");
  19053. $ctx1.sendIdx[","]=4;
  19054. $12=$self._selector();
  19055. $ctx1.sendIdx["selector"]=1;
  19056. $1=$recv($8).__comma($12);
  19057. $ctx1.sendIdx[","]=3;
  19058. } else {
  19059. $16=$recv($recv($self._receiver())._class())._name();
  19060. $ctx1.sendIdx["name"]=2;
  19061. $15=$recv($16).__comma("(");
  19062. $14=$recv($15).__comma($recv(methodClass)._name());
  19063. $ctx1.sendIdx[","]=7;
  19064. $13=$recv($14).__comma(") >> ");
  19065. $ctx1.sendIdx[","]=6;
  19066. $1=$recv($13).__comma($self._selector());
  19067. $ctx1.sendIdx[","]=5;
  19068. }
  19069. }
  19070. return $1;
  19071. }, function($ctx1) {$ctx1.fill(self,"asString",{},$globals.MethodContext)});
  19072. },
  19073. args: [],
  19074. 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 ] ]",
  19075. referencedClasses: [],
  19076. messageSends: ["ifTrue:ifFalse:", "isBlockContext", ",", "asString", "methodContext", "methodClass", "method", "=", "class", "receiver", "name", "selector"]
  19077. }),
  19078. $globals.MethodContext);
  19079. $core.addMethod(
  19080. $core.method({
  19081. selector: "basicReceiver",
  19082. protocol: "accessing",
  19083. fn: function (){
  19084. var self=this,$self=this;
  19085. return $core.withContext(function($ctx1) {
  19086. return self.receiver;
  19087. return self;
  19088. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.MethodContext)});
  19089. },
  19090. args: [],
  19091. source: "basicReceiver\x0a\x09<inlineJS: 'return self.receiver'>",
  19092. referencedClasses: [],
  19093. messageSends: []
  19094. }),
  19095. $globals.MethodContext);
  19096. $core.addMethod(
  19097. $core.method({
  19098. selector: "evaluatedSelector",
  19099. protocol: "accessing",
  19100. fn: function (){
  19101. var self=this,$self=this;
  19102. return $core.withContext(function($ctx1) {
  19103. return self.evaluatedSelector;
  19104. return self;
  19105. }, function($ctx1) {$ctx1.fill(self,"evaluatedSelector",{},$globals.MethodContext)});
  19106. },
  19107. args: [],
  19108. source: "evaluatedSelector\x0a\x09<inlineJS: 'return self.evaluatedSelector'>",
  19109. referencedClasses: [],
  19110. messageSends: []
  19111. }),
  19112. $globals.MethodContext);
  19113. $core.addMethod(
  19114. $core.method({
  19115. selector: "findContextSuchThat:",
  19116. protocol: "accessing",
  19117. fn: function (testBlock){
  19118. var self=this,$self=this;
  19119. var context;
  19120. return $core.withContext(function($ctx1) {
  19121. var $1;
  19122. var $early={};
  19123. try {
  19124. context=self;
  19125. $recv((function(){
  19126. return $core.withContext(function($ctx2) {
  19127. return $recv(context)._isNil();
  19128. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19129. }))._whileFalse_((function(){
  19130. return $core.withContext(function($ctx2) {
  19131. $1=$recv(testBlock)._value_(context);
  19132. if($core.assert($1)){
  19133. throw $early=[context];
  19134. }
  19135. context=$recv(context)._outerContext();
  19136. return context;
  19137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  19138. }));
  19139. return nil;
  19140. }
  19141. catch(e) {if(e===$early)return e[0]; throw e}
  19142. }, function($ctx1) {$ctx1.fill(self,"findContextSuchThat:",{testBlock:testBlock,context:context},$globals.MethodContext)});
  19143. },
  19144. args: ["testBlock"],
  19145. 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",
  19146. referencedClasses: [],
  19147. messageSends: ["whileFalse:", "isNil", "ifTrue:", "value:", "outerContext"]
  19148. }),
  19149. $globals.MethodContext);
  19150. $core.addMethod(
  19151. $core.method({
  19152. selector: "home",
  19153. protocol: "accessing",
  19154. fn: function (){
  19155. var self=this,$self=this;
  19156. return $core.withContext(function($ctx1) {
  19157. return self.homeContext;
  19158. return self;
  19159. }, function($ctx1) {$ctx1.fill(self,"home",{},$globals.MethodContext)});
  19160. },
  19161. args: [],
  19162. source: "home\x0a\x09<inlineJS: 'return self.homeContext'>",
  19163. referencedClasses: [],
  19164. messageSends: []
  19165. }),
  19166. $globals.MethodContext);
  19167. $core.addMethod(
  19168. $core.method({
  19169. selector: "index",
  19170. protocol: "accessing",
  19171. fn: function (){
  19172. var self=this,$self=this;
  19173. return $core.withContext(function($ctx1) {
  19174. return self.index || 0;
  19175. return self;
  19176. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.MethodContext)});
  19177. },
  19178. args: [],
  19179. source: "index\x0a\x09<inlineJS: 'return self.index || 0'>",
  19180. referencedClasses: [],
  19181. messageSends: []
  19182. }),
  19183. $globals.MethodContext);
  19184. $core.addMethod(
  19185. $core.method({
  19186. selector: "isBlockContext",
  19187. protocol: "testing",
  19188. fn: function (){
  19189. var self=this,$self=this;
  19190. return $core.withContext(function($ctx1) {
  19191. return $recv($self._selector())._isNil();
  19192. }, function($ctx1) {$ctx1.fill(self,"isBlockContext",{},$globals.MethodContext)});
  19193. },
  19194. args: [],
  19195. source: "isBlockContext\x0a\x09\x22Block context do not have selectors.\x22\x0a\x09\x0a\x09^ self selector isNil",
  19196. referencedClasses: [],
  19197. messageSends: ["isNil", "selector"]
  19198. }),
  19199. $globals.MethodContext);
  19200. $core.addMethod(
  19201. $core.method({
  19202. selector: "locals",
  19203. protocol: "accessing",
  19204. fn: function (){
  19205. var self=this,$self=this;
  19206. return $core.withContext(function($ctx1) {
  19207. return self.locals || {};
  19208. return self;
  19209. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.MethodContext)});
  19210. },
  19211. args: [],
  19212. source: "locals\x0a\x09<inlineJS: 'return self.locals || {}'>",
  19213. referencedClasses: [],
  19214. messageSends: []
  19215. }),
  19216. $globals.MethodContext);
  19217. $core.addMethod(
  19218. $core.method({
  19219. selector: "method",
  19220. protocol: "accessing",
  19221. fn: function (){
  19222. var self=this,$self=this;
  19223. var method,lookupClass,receiverClass,supercall;
  19224. return $core.withContext(function($ctx1) {
  19225. var $1,$3,$2,$4,$6,$5,$7,$8,$receiver;
  19226. $1=$self._methodContext();
  19227. $ctx1.sendIdx["methodContext"]=1;
  19228. if(($receiver = $1) == null || $receiver.a$nil){
  19229. return nil;
  19230. } else {
  19231. $1;
  19232. }
  19233. $3=$self._methodContext();
  19234. $ctx1.sendIdx["methodContext"]=2;
  19235. $2=$recv($3)._receiver();
  19236. receiverClass=$recv($2)._class();
  19237. $4=receiverClass;
  19238. $6=$self._methodContext();
  19239. $ctx1.sendIdx["methodContext"]=3;
  19240. $5=$recv($6)._selector();
  19241. $ctx1.sendIdx["selector"]=1;
  19242. method=$recv($4)._lookupSelector_($5);
  19243. $ctx1.sendIdx["lookupSelector:"]=1;
  19244. $7=$self._outerContext();
  19245. if(($receiver = $7) == null || $receiver.a$nil){
  19246. supercall=false;
  19247. } else {
  19248. var outer;
  19249. outer=$receiver;
  19250. supercall=$recv(outer)._supercall();
  19251. }
  19252. $8=supercall;
  19253. if($core.assert($8)){
  19254. return $recv($recv($recv(method)._methodClass())._superclass())._lookupSelector_($recv($self._methodContext())._selector());
  19255. } else {
  19256. return method;
  19257. }
  19258. }, function($ctx1) {$ctx1.fill(self,"method",{method:method,lookupClass:lookupClass,receiverClass:receiverClass,supercall:supercall},$globals.MethodContext)});
  19259. },
  19260. args: [],
  19261. 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 ]",
  19262. referencedClasses: [],
  19263. messageSends: ["ifNil:", "methodContext", "class", "receiver", "lookupSelector:", "selector", "ifNil:ifNotNil:", "outerContext", "supercall", "ifFalse:ifTrue:", "superclass", "methodClass"]
  19264. }),
  19265. $globals.MethodContext);
  19266. $core.addMethod(
  19267. $core.method({
  19268. selector: "methodContext",
  19269. protocol: "accessing",
  19270. fn: function (){
  19271. var self=this,$self=this;
  19272. return $core.withContext(function($ctx1) {
  19273. var $1,$2,$receiver;
  19274. $1=$self._isBlockContext();
  19275. if(!$core.assert($1)){
  19276. return self;
  19277. }
  19278. $2=$self._outerContext();
  19279. if(($receiver = $2) == null || $receiver.a$nil){
  19280. return $2;
  19281. } else {
  19282. var outer;
  19283. outer=$receiver;
  19284. return $recv(outer)._methodContext();
  19285. }
  19286. }, function($ctx1) {$ctx1.fill(self,"methodContext",{},$globals.MethodContext)});
  19287. },
  19288. args: [],
  19289. source: "methodContext\x0a\x09self isBlockContext ifFalse: [ ^ self ].\x0a\x09\x0a\x09^ self outerContext ifNotNil: [ :outer |\x0a\x09\x09outer methodContext ]",
  19290. referencedClasses: [],
  19291. messageSends: ["ifFalse:", "isBlockContext", "ifNotNil:", "outerContext", "methodContext"]
  19292. }),
  19293. $globals.MethodContext);
  19294. $core.addMethod(
  19295. $core.method({
  19296. selector: "outerContext",
  19297. protocol: "accessing",
  19298. fn: function (){
  19299. var self=this,$self=this;
  19300. return $core.withContext(function($ctx1) {
  19301. return self.outerContext || self.homeContext;
  19302. return self;
  19303. }, function($ctx1) {$ctx1.fill(self,"outerContext",{},$globals.MethodContext)});
  19304. },
  19305. args: [],
  19306. source: "outerContext\x0a\x09<inlineJS: 'return self.outerContext || self.homeContext'>",
  19307. referencedClasses: [],
  19308. messageSends: []
  19309. }),
  19310. $globals.MethodContext);
  19311. $core.addMethod(
  19312. $core.method({
  19313. selector: "printOn:",
  19314. protocol: "printing",
  19315. fn: function (aStream){
  19316. var self=this,$self=this;
  19317. return $core.withContext(function($ctx1) {
  19318. (
  19319. $ctx1.supercall = true,
  19320. ($globals.MethodContext.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  19321. $ctx1.supercall = false;
  19322. $recv(aStream)._nextPutAll_("(");
  19323. $ctx1.sendIdx["nextPutAll:"]=1;
  19324. $recv(aStream)._nextPutAll_($self._asString());
  19325. $ctx1.sendIdx["nextPutAll:"]=2;
  19326. $recv(aStream)._nextPutAll_(")");
  19327. return self;
  19328. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.MethodContext)});
  19329. },
  19330. args: ["aStream"],
  19331. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: '(';\x0a\x09\x09nextPutAll: self asString;\x0a\x09\x09nextPutAll: ')'",
  19332. referencedClasses: [],
  19333. messageSends: ["printOn:", "nextPutAll:", "asString"]
  19334. }),
  19335. $globals.MethodContext);
  19336. $core.addMethod(
  19337. $core.method({
  19338. selector: "receiver",
  19339. protocol: "accessing",
  19340. fn: function (){
  19341. var self=this,$self=this;
  19342. return $core.withContext(function($ctx1) {
  19343. var $2,$1;
  19344. $1=$recv($self._isBlockContext())._and_((function(){
  19345. return $core.withContext(function($ctx2) {
  19346. $2=$self._outerContext();
  19347. $ctx2.sendIdx["outerContext"]=1;
  19348. return $recv($2)._notNil();
  19349. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19350. }));
  19351. if($core.assert($1)){
  19352. return $recv($self._outerContext())._receiver();
  19353. } else {
  19354. return $self._basicReceiver();
  19355. }
  19356. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.MethodContext)});
  19357. },
  19358. args: [],
  19359. source: "receiver\x0a\x09^ (self isBlockContext and: [ self outerContext notNil ])\x0a\x09\x09ifTrue: [ self outerContext receiver ]\x0a\x09\x09ifFalse: [ self basicReceiver ]",
  19360. referencedClasses: [],
  19361. messageSends: ["ifTrue:ifFalse:", "and:", "isBlockContext", "notNil", "outerContext", "receiver", "basicReceiver"]
  19362. }),
  19363. $globals.MethodContext);
  19364. $core.addMethod(
  19365. $core.method({
  19366. selector: "selector",
  19367. protocol: "accessing",
  19368. fn: function (){
  19369. var self=this,$self=this;
  19370. return $core.withContext(function($ctx1) {
  19371. if(self.selector) {
  19372. return $core.js2st(self.selector);
  19373. } else {
  19374. return nil;
  19375. }
  19376. ;
  19377. return self;
  19378. }, function($ctx1) {$ctx1.fill(self,"selector",{},$globals.MethodContext)});
  19379. },
  19380. args: [],
  19381. 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'>",
  19382. referencedClasses: [],
  19383. messageSends: []
  19384. }),
  19385. $globals.MethodContext);
  19386. $core.addMethod(
  19387. $core.method({
  19388. selector: "sendIndexAt:",
  19389. protocol: "accessing",
  19390. fn: function (aSelector){
  19391. var self=this,$self=this;
  19392. return $core.withContext(function($ctx1) {
  19393. return self.sendIdx[aSelector] || 0;
  19394. return self;
  19395. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aSelector:aSelector},$globals.MethodContext)});
  19396. },
  19397. args: ["aSelector"],
  19398. source: "sendIndexAt: aSelector\x0a\x09<inlineJS: 'return self.sendIdx[aSelector] || 0'>",
  19399. referencedClasses: [],
  19400. messageSends: []
  19401. }),
  19402. $globals.MethodContext);
  19403. $core.addMethod(
  19404. $core.method({
  19405. selector: "sendIndexes",
  19406. protocol: "accessing",
  19407. fn: function (){
  19408. var self=this,$self=this;
  19409. return $core.withContext(function($ctx1) {
  19410. return self.sendIdx;
  19411. return self;
  19412. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.MethodContext)});
  19413. },
  19414. args: [],
  19415. source: "sendIndexes\x0a\x09<inlineJS: 'return self.sendIdx'>",
  19416. referencedClasses: [],
  19417. messageSends: []
  19418. }),
  19419. $globals.MethodContext);
  19420. $core.addMethod(
  19421. $core.method({
  19422. selector: "stubHere",
  19423. protocol: "accessing",
  19424. fn: function (){
  19425. var self=this,$self=this;
  19426. return $core.withContext(function($ctx1) {
  19427. self.homeContext = undefined;
  19428. return self;
  19429. }, function($ctx1) {$ctx1.fill(self,"stubHere",{},$globals.MethodContext)});
  19430. },
  19431. args: [],
  19432. source: "stubHere\x0a\x09<inlineJS: 'self.homeContext = undefined'>",
  19433. referencedClasses: [],
  19434. messageSends: []
  19435. }),
  19436. $globals.MethodContext);
  19437. $core.addMethod(
  19438. $core.method({
  19439. selector: "stubToAtMost:",
  19440. protocol: "error handling",
  19441. fn: function (anInteger){
  19442. var self=this,$self=this;
  19443. var context;
  19444. return $core.withContext(function($ctx1) {
  19445. var $1,$2,$receiver;
  19446. context=self;
  19447. $recv(anInteger)._timesRepeat_((function(){
  19448. return $core.withContext(function($ctx2) {
  19449. $1=context;
  19450. if(($receiver = $1) == null || $receiver.a$nil){
  19451. context=$1;
  19452. } else {
  19453. context=$recv(context)._home();
  19454. }
  19455. return context;
  19456. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  19457. }));
  19458. $2=context;
  19459. if(($receiver = $2) == null || $receiver.a$nil){
  19460. $2;
  19461. } else {
  19462. $recv(context)._stubHere();
  19463. }
  19464. return self;
  19465. }, function($ctx1) {$ctx1.fill(self,"stubToAtMost:",{anInteger:anInteger,context:context},$globals.MethodContext)});
  19466. },
  19467. args: ["anInteger"],
  19468. source: "stubToAtMost: anInteger\x0a\x09| context |\x0a\x09context := self.\x0a\x09anInteger timesRepeat: [ context := context ifNotNil: [ context home ] ].\x0a\x09context ifNotNil: [ context stubHere ]",
  19469. referencedClasses: [],
  19470. messageSends: ["timesRepeat:", "ifNotNil:", "home", "stubHere"]
  19471. }),
  19472. $globals.MethodContext);
  19473. $core.addMethod(
  19474. $core.method({
  19475. selector: "supercall",
  19476. protocol: "accessing",
  19477. fn: function (){
  19478. var self=this,$self=this;
  19479. return $core.withContext(function($ctx1) {
  19480. return self.supercall == true;
  19481. return self;
  19482. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.MethodContext)});
  19483. },
  19484. args: [],
  19485. source: "supercall\x0a\x09<inlineJS: 'return self.supercall == true'>",
  19486. referencedClasses: [],
  19487. messageSends: []
  19488. }),
  19489. $globals.MethodContext);
  19490. $core.addClass("NativeFunction", $globals.Object, [], "Kernel-Methods");
  19491. $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' ]";
  19492. $core.addMethod(
  19493. $core.method({
  19494. selector: "constructorNamed:",
  19495. protocol: "instance creation",
  19496. fn: function (aString){
  19497. var self=this,$self=this;
  19498. return $core.withContext(function($ctx1) {
  19499. var nativeFunc=$globals.Platform._globals()[aString];
  19500. return new nativeFunc();
  19501. ;
  19502. return self;
  19503. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19504. },
  19505. args: ["aString"],
  19506. source: "constructorNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19507. referencedClasses: [],
  19508. messageSends: []
  19509. }),
  19510. $globals.NativeFunction.a$cls);
  19511. $core.addMethod(
  19512. $core.method({
  19513. selector: "constructorNamed:value:",
  19514. protocol: "instance creation",
  19515. fn: function (aString,anObject){
  19516. var self=this,$self=this;
  19517. return $core.withContext(function($ctx1) {
  19518. var nativeFunc=$globals.Platform._globals()[aString];
  19519. return new nativeFunc(anObject);
  19520. ;
  19521. return self;
  19522. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19523. },
  19524. args: ["aString", "anObject"],
  19525. source: "constructorNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19526. referencedClasses: [],
  19527. messageSends: []
  19528. }),
  19529. $globals.NativeFunction.a$cls);
  19530. $core.addMethod(
  19531. $core.method({
  19532. selector: "constructorNamed:value:value:",
  19533. protocol: "instance creation",
  19534. fn: function (aString,anObject,anObject2){
  19535. var self=this,$self=this;
  19536. return $core.withContext(function($ctx1) {
  19537. var nativeFunc=$globals.Platform._globals[aString];
  19538. return new nativeFunc(anObject,anObject2);
  19539. ;
  19540. return self;
  19541. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19542. },
  19543. args: ["aString", "anObject", "anObject2"],
  19544. 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'>",
  19545. referencedClasses: [],
  19546. messageSends: []
  19547. }),
  19548. $globals.NativeFunction.a$cls);
  19549. $core.addMethod(
  19550. $core.method({
  19551. selector: "constructorNamed:value:value:value:",
  19552. protocol: "instance creation",
  19553. fn: function (aString,anObject,anObject2,anObject3){
  19554. var self=this,$self=this;
  19555. return $core.withContext(function($ctx1) {
  19556. var nativeFunc=$globals.Platform._globals[aString];
  19557. return new nativeFunc(anObject,anObject2, anObject3);
  19558. ;
  19559. return self;
  19560. }, function($ctx1) {$ctx1.fill(self,"constructorNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19561. },
  19562. args: ["aString", "anObject", "anObject2", "anObject3"],
  19563. 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'>",
  19564. referencedClasses: [],
  19565. messageSends: []
  19566. }),
  19567. $globals.NativeFunction.a$cls);
  19568. $core.addMethod(
  19569. $core.method({
  19570. selector: "constructorOf:",
  19571. protocol: "instance creation",
  19572. fn: function (nativeFunc){
  19573. var self=this,$self=this;
  19574. return $core.withContext(function($ctx1) {
  19575. return new nativeFunc();
  19576. ;
  19577. return self;
  19578. }, function($ctx1) {$ctx1.fill(self,"constructorOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19579. },
  19580. args: ["nativeFunc"],
  19581. source: "constructorOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc();\x0a\x09'>",
  19582. referencedClasses: [],
  19583. messageSends: []
  19584. }),
  19585. $globals.NativeFunction.a$cls);
  19586. $core.addMethod(
  19587. $core.method({
  19588. selector: "constructorOf:value:",
  19589. protocol: "instance creation",
  19590. fn: function (nativeFunc,anObject){
  19591. var self=this,$self=this;
  19592. return $core.withContext(function($ctx1) {
  19593. return new nativeFunc(anObject);
  19594. ;
  19595. return self;
  19596. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19597. },
  19598. args: ["nativeFunc", "anObject"],
  19599. source: "constructorOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject);\x0a\x09'>",
  19600. referencedClasses: [],
  19601. messageSends: []
  19602. }),
  19603. $globals.NativeFunction.a$cls);
  19604. $core.addMethod(
  19605. $core.method({
  19606. selector: "constructorOf:value:value:",
  19607. protocol: "instance creation",
  19608. fn: function (nativeFunc,anObject,anObject2){
  19609. var self=this,$self=this;
  19610. return $core.withContext(function($ctx1) {
  19611. return new nativeFunc(anObject,anObject2);
  19612. ;
  19613. return self;
  19614. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19615. },
  19616. args: ["nativeFunc", "anObject", "anObject2"],
  19617. source: "constructorOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2);\x0a\x09'>",
  19618. referencedClasses: [],
  19619. messageSends: []
  19620. }),
  19621. $globals.NativeFunction.a$cls);
  19622. $core.addMethod(
  19623. $core.method({
  19624. selector: "constructorOf:value:value:value:",
  19625. protocol: "instance creation",
  19626. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19627. var self=this,$self=this;
  19628. return $core.withContext(function($ctx1) {
  19629. return new nativeFunc(anObject,anObject2, anObject3);
  19630. ;
  19631. return self;
  19632. }, function($ctx1) {$ctx1.fill(self,"constructorOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19633. },
  19634. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19635. source: "constructorOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return new nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19636. referencedClasses: [],
  19637. messageSends: []
  19638. }),
  19639. $globals.NativeFunction.a$cls);
  19640. $core.addMethod(
  19641. $core.method({
  19642. selector: "exists:",
  19643. protocol: "testing",
  19644. fn: function (aString){
  19645. var self=this,$self=this;
  19646. return $core.withContext(function($ctx1) {
  19647. return $recv($globals.Platform)._includesGlobal_(aString);
  19648. }, function($ctx1) {$ctx1.fill(self,"exists:",{aString:aString},$globals.NativeFunction.a$cls)});
  19649. },
  19650. args: ["aString"],
  19651. source: "exists: aString\x0a\x09^ Platform includesGlobal: aString",
  19652. referencedClasses: ["Platform"],
  19653. messageSends: ["includesGlobal:"]
  19654. }),
  19655. $globals.NativeFunction.a$cls);
  19656. $core.addMethod(
  19657. $core.method({
  19658. selector: "functionNamed:",
  19659. protocol: "function calling",
  19660. fn: function (aString){
  19661. var self=this,$self=this;
  19662. return $core.withContext(function($ctx1) {
  19663. var nativeFunc=$globals.Platform._globals[aString];
  19664. return nativeFunc();
  19665. ;
  19666. return self;
  19667. }, function($ctx1) {$ctx1.fill(self,"functionNamed:",{aString:aString},$globals.NativeFunction.a$cls)});
  19668. },
  19669. args: ["aString"],
  19670. source: "functionNamed: aString\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals[aString];\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19671. referencedClasses: [],
  19672. messageSends: []
  19673. }),
  19674. $globals.NativeFunction.a$cls);
  19675. $core.addMethod(
  19676. $core.method({
  19677. selector: "functionNamed:value:",
  19678. protocol: "function calling",
  19679. fn: function (aString,anObject){
  19680. var self=this,$self=this;
  19681. return $core.withContext(function($ctx1) {
  19682. var nativeFunc=$globals.Platform._globals()[aString];
  19683. return nativeFunc(anObject);
  19684. ;
  19685. return self;
  19686. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:",{aString:aString,anObject:anObject},$globals.NativeFunction.a$cls)});
  19687. },
  19688. args: ["aString", "anObject"],
  19689. source: "functionNamed: aString value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09var nativeFunc=$globals.Platform._globals()[aString];\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19690. referencedClasses: [],
  19691. messageSends: []
  19692. }),
  19693. $globals.NativeFunction.a$cls);
  19694. $core.addMethod(
  19695. $core.method({
  19696. selector: "functionNamed:value:value:",
  19697. protocol: "function calling",
  19698. fn: function (aString,anObject,anObject2){
  19699. var self=this,$self=this;
  19700. return $core.withContext(function($ctx1) {
  19701. var nativeFunc=$globals.Platform._globals()[aString];
  19702. return nativeFunc(anObject,anObject2);
  19703. ;
  19704. return self;
  19705. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19706. },
  19707. args: ["aString", "anObject", "anObject2"],
  19708. 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'>",
  19709. referencedClasses: [],
  19710. messageSends: []
  19711. }),
  19712. $globals.NativeFunction.a$cls);
  19713. $core.addMethod(
  19714. $core.method({
  19715. selector: "functionNamed:value:value:value:",
  19716. protocol: "function calling",
  19717. fn: function (aString,anObject,anObject2,anObject3){
  19718. var self=this,$self=this;
  19719. return $core.withContext(function($ctx1) {
  19720. var nativeFunc=$globals.Platform._globals()[aString];
  19721. return nativeFunc(anObject,anObject2, anObject3);
  19722. ;
  19723. return self;
  19724. }, function($ctx1) {$ctx1.fill(self,"functionNamed:value:value:value:",{aString:aString,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19725. },
  19726. args: ["aString", "anObject", "anObject2", "anObject3"],
  19727. 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'>",
  19728. referencedClasses: [],
  19729. messageSends: []
  19730. }),
  19731. $globals.NativeFunction.a$cls);
  19732. $core.addMethod(
  19733. $core.method({
  19734. selector: "functionNamed:valueWithArgs:",
  19735. protocol: "function calling",
  19736. fn: function (aString,args){
  19737. var self=this,$self=this;
  19738. return $core.withContext(function($ctx1) {
  19739. var nativeFunc=$globals.Platform._globals()[aString];
  19740. return Function.prototype.apply.call(nativeFunc, null, args);
  19741. ;
  19742. return self;
  19743. }, function($ctx1) {$ctx1.fill(self,"functionNamed:valueWithArgs:",{aString:aString,args:args},$globals.NativeFunction.a$cls)});
  19744. },
  19745. args: ["aString", "args"],
  19746. 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'>",
  19747. referencedClasses: [],
  19748. messageSends: []
  19749. }),
  19750. $globals.NativeFunction.a$cls);
  19751. $core.addMethod(
  19752. $core.method({
  19753. selector: "functionOf:",
  19754. protocol: "function calling",
  19755. fn: function (nativeFunc){
  19756. var self=this,$self=this;
  19757. return $core.withContext(function($ctx1) {
  19758. return nativeFunc();
  19759. ;
  19760. return self;
  19761. }, function($ctx1) {$ctx1.fill(self,"functionOf:",{nativeFunc:nativeFunc},$globals.NativeFunction.a$cls)});
  19762. },
  19763. args: ["nativeFunc"],
  19764. source: "functionOf: nativeFunc\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc();\x0a\x09'>",
  19765. referencedClasses: [],
  19766. messageSends: []
  19767. }),
  19768. $globals.NativeFunction.a$cls);
  19769. $core.addMethod(
  19770. $core.method({
  19771. selector: "functionOf:value:",
  19772. protocol: "function calling",
  19773. fn: function (nativeFunc,anObject){
  19774. var self=this,$self=this;
  19775. return $core.withContext(function($ctx1) {
  19776. return nativeFunc(anObject);
  19777. ;
  19778. return self;
  19779. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:",{nativeFunc:nativeFunc,anObject:anObject},$globals.NativeFunction.a$cls)});
  19780. },
  19781. args: ["nativeFunc", "anObject"],
  19782. source: "functionOf: nativeFunc value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject);\x0a\x09'>",
  19783. referencedClasses: [],
  19784. messageSends: []
  19785. }),
  19786. $globals.NativeFunction.a$cls);
  19787. $core.addMethod(
  19788. $core.method({
  19789. selector: "functionOf:value:value:",
  19790. protocol: "function calling",
  19791. fn: function (nativeFunc,anObject,anObject2){
  19792. var self=this,$self=this;
  19793. return $core.withContext(function($ctx1) {
  19794. return nativeFunc(anObject,anObject2);
  19795. ;
  19796. return self;
  19797. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19798. },
  19799. args: ["nativeFunc", "anObject", "anObject2"],
  19800. source: "functionOf: nativeFunc value: anObject value: anObject2\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2);\x0a\x09'>",
  19801. referencedClasses: [],
  19802. messageSends: []
  19803. }),
  19804. $globals.NativeFunction.a$cls);
  19805. $core.addMethod(
  19806. $core.method({
  19807. selector: "functionOf:value:value:value:",
  19808. protocol: "function calling",
  19809. fn: function (nativeFunc,anObject,anObject2,anObject3){
  19810. var self=this,$self=this;
  19811. return $core.withContext(function($ctx1) {
  19812. return nativeFunc(anObject,anObject2, anObject3);
  19813. ;
  19814. return self;
  19815. }, function($ctx1) {$ctx1.fill(self,"functionOf:value:value:value:",{nativeFunc:nativeFunc,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19816. },
  19817. args: ["nativeFunc", "anObject", "anObject2", "anObject3"],
  19818. source: "functionOf: nativeFunc value: anObject value: anObject2 value: anObject3\x0a\x09<inlineJS: '\x0a\x09\x09return nativeFunc(anObject,anObject2, anObject3);\x0a\x09'>",
  19819. referencedClasses: [],
  19820. messageSends: []
  19821. }),
  19822. $globals.NativeFunction.a$cls);
  19823. $core.addMethod(
  19824. $core.method({
  19825. selector: "functionOf:valueWithArgs:",
  19826. protocol: "function calling",
  19827. fn: function (nativeFunc,args){
  19828. var self=this,$self=this;
  19829. return $core.withContext(function($ctx1) {
  19830. return Function.prototype.apply.call(nativeFunc, null, args);
  19831. ;
  19832. return self;
  19833. }, function($ctx1) {$ctx1.fill(self,"functionOf:valueWithArgs:",{nativeFunc:nativeFunc,args:args},$globals.NativeFunction.a$cls)});
  19834. },
  19835. args: ["nativeFunc", "args"],
  19836. source: "functionOf: nativeFunc valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, null, args);\x0a\x09'>",
  19837. referencedClasses: [],
  19838. messageSends: []
  19839. }),
  19840. $globals.NativeFunction.a$cls);
  19841. $core.addMethod(
  19842. $core.method({
  19843. selector: "isNativeFunction:",
  19844. protocol: "testing",
  19845. fn: function (anObject){
  19846. var self=this,$self=this;
  19847. return $core.withContext(function($ctx1) {
  19848. return typeof anObject === "function";
  19849. return self;
  19850. }, function($ctx1) {$ctx1.fill(self,"isNativeFunction:",{anObject:anObject},$globals.NativeFunction.a$cls)});
  19851. },
  19852. args: ["anObject"],
  19853. source: "isNativeFunction: anObject\x0a\x09<inlineJS: 'return typeof anObject === \x22function\x22'>",
  19854. referencedClasses: [],
  19855. messageSends: []
  19856. }),
  19857. $globals.NativeFunction.a$cls);
  19858. $core.addMethod(
  19859. $core.method({
  19860. selector: "methodOf:this:",
  19861. protocol: "method calling",
  19862. fn: function (nativeFunc,thisObject){
  19863. var self=this,$self=this;
  19864. return $core.withContext(function($ctx1) {
  19865. return Function.prototype.call.call(nativeFunc, thisObject);
  19866. ;
  19867. return self;
  19868. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:",{nativeFunc:nativeFunc,thisObject:thisObject},$globals.NativeFunction.a$cls)});
  19869. },
  19870. args: ["nativeFunc", "thisObject"],
  19871. source: "methodOf: nativeFunc this: thisObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject);\x0a\x09'>",
  19872. referencedClasses: [],
  19873. messageSends: []
  19874. }),
  19875. $globals.NativeFunction.a$cls);
  19876. $core.addMethod(
  19877. $core.method({
  19878. selector: "methodOf:this:value:",
  19879. protocol: "method calling",
  19880. fn: function (nativeFunc,thisObject,anObject){
  19881. var self=this,$self=this;
  19882. return $core.withContext(function($ctx1) {
  19883. return Function.prototype.call.call(nativeFunc, thisObject, anObject);
  19884. ;
  19885. return self;
  19886. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject},$globals.NativeFunction.a$cls)});
  19887. },
  19888. args: ["nativeFunc", "thisObject", "anObject"],
  19889. source: "methodOf: nativeFunc this: thisObject value: anObject\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.call.call(nativeFunc, thisObject, anObject);\x0a\x09'>",
  19890. referencedClasses: [],
  19891. messageSends: []
  19892. }),
  19893. $globals.NativeFunction.a$cls);
  19894. $core.addMethod(
  19895. $core.method({
  19896. selector: "methodOf:this:value:value:",
  19897. protocol: "method calling",
  19898. fn: function (nativeFunc,thisObject,anObject,anObject2){
  19899. var self=this,$self=this;
  19900. return $core.withContext(function($ctx1) {
  19901. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2);
  19902. ;
  19903. return self;
  19904. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2},$globals.NativeFunction.a$cls)});
  19905. },
  19906. args: ["nativeFunc", "thisObject", "anObject", "anObject2"],
  19907. 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'>",
  19908. referencedClasses: [],
  19909. messageSends: []
  19910. }),
  19911. $globals.NativeFunction.a$cls);
  19912. $core.addMethod(
  19913. $core.method({
  19914. selector: "methodOf:this:value:value:value:",
  19915. protocol: "method calling",
  19916. fn: function (nativeFunc,thisObject,anObject,anObject2,anObject3){
  19917. var self=this,$self=this;
  19918. return $core.withContext(function($ctx1) {
  19919. return Function.prototype.call.call(nativeFunc, thisObject,anObject,anObject2, anObject3);
  19920. ;
  19921. return self;
  19922. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:value:value:value:",{nativeFunc:nativeFunc,thisObject:thisObject,anObject:anObject,anObject2:anObject2,anObject3:anObject3},$globals.NativeFunction.a$cls)});
  19923. },
  19924. args: ["nativeFunc", "thisObject", "anObject", "anObject2", "anObject3"],
  19925. 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'>",
  19926. referencedClasses: [],
  19927. messageSends: []
  19928. }),
  19929. $globals.NativeFunction.a$cls);
  19930. $core.addMethod(
  19931. $core.method({
  19932. selector: "methodOf:this:valueWithArgs:",
  19933. protocol: "method calling",
  19934. fn: function (nativeFunc,thisObject,args){
  19935. var self=this,$self=this;
  19936. return $core.withContext(function($ctx1) {
  19937. return Function.prototype.apply.call(nativeFunc, thisObject, args);
  19938. ;
  19939. return self;
  19940. }, function($ctx1) {$ctx1.fill(self,"methodOf:this:valueWithArgs:",{nativeFunc:nativeFunc,thisObject:thisObject,args:args},$globals.NativeFunction.a$cls)});
  19941. },
  19942. args: ["nativeFunc", "thisObject", "args"],
  19943. source: "methodOf: nativeFunc this: thisObject valueWithArgs: args\x0a\x09<inlineJS: '\x0a\x09\x09return Function.prototype.apply.call(nativeFunc, thisObject, args);\x0a\x09'>",
  19944. referencedClasses: [],
  19945. messageSends: []
  19946. }),
  19947. $globals.NativeFunction.a$cls);
  19948. $core.addClass("Timeout", $globals.Object, ["rawTimeout"], "Kernel-Methods");
  19949. $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.";
  19950. $core.addMethod(
  19951. $core.method({
  19952. selector: "clearInterval",
  19953. protocol: "timeout/interval",
  19954. fn: function (){
  19955. var self=this,$self=this;
  19956. return $core.withContext(function($ctx1) {
  19957. var interval = $self["@rawTimeout"];
  19958. clearInterval(interval);
  19959. ;
  19960. return self;
  19961. }, function($ctx1) {$ctx1.fill(self,"clearInterval",{},$globals.Timeout)});
  19962. },
  19963. args: [],
  19964. source: "clearInterval\x0a\x09<inlineJS: '\x0a\x09\x09var interval = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearInterval(interval);\x0a\x09'>",
  19965. referencedClasses: [],
  19966. messageSends: []
  19967. }),
  19968. $globals.Timeout);
  19969. $core.addMethod(
  19970. $core.method({
  19971. selector: "clearTimeout",
  19972. protocol: "timeout/interval",
  19973. fn: function (){
  19974. var self=this,$self=this;
  19975. return $core.withContext(function($ctx1) {
  19976. var timeout = $self["@rawTimeout"];
  19977. clearTimeout(timeout);
  19978. ;
  19979. return self;
  19980. }, function($ctx1) {$ctx1.fill(self,"clearTimeout",{},$globals.Timeout)});
  19981. },
  19982. args: [],
  19983. source: "clearTimeout\x0a\x09<inlineJS: '\x0a\x09\x09var timeout = $self[\x22@rawTimeout\x22];\x0a\x09\x09clearTimeout(timeout);\x0a\x09'>",
  19984. referencedClasses: [],
  19985. messageSends: []
  19986. }),
  19987. $globals.Timeout);
  19988. $core.addMethod(
  19989. $core.method({
  19990. selector: "rawTimeout:",
  19991. protocol: "accessing",
  19992. fn: function (anObject){
  19993. var self=this,$self=this;
  19994. $self["@rawTimeout"]=anObject;
  19995. return self;
  19996. },
  19997. args: ["anObject"],
  19998. source: "rawTimeout: anObject\x0a\x09rawTimeout := anObject",
  19999. referencedClasses: [],
  20000. messageSends: []
  20001. }),
  20002. $globals.Timeout);
  20003. $core.addMethod(
  20004. $core.method({
  20005. selector: "on:",
  20006. protocol: "instance creation",
  20007. fn: function (anObject){
  20008. var self=this,$self=this;
  20009. return $core.withContext(function($ctx1) {
  20010. var $1;
  20011. $1=$self._new();
  20012. $recv($1)._rawTimeout_(anObject);
  20013. return $recv($1)._yourself();
  20014. }, function($ctx1) {$ctx1.fill(self,"on:",{anObject:anObject},$globals.Timeout.a$cls)});
  20015. },
  20016. args: ["anObject"],
  20017. source: "on: anObject\x0a\x09^ self new rawTimeout: anObject; yourself",
  20018. referencedClasses: [],
  20019. messageSends: ["rawTimeout:", "new", "yourself"]
  20020. }),
  20021. $globals.Timeout.a$cls);
  20022. });
  20023. define('amber_core/Kernel-Dag',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20024. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20025. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20026. $core.addPackage("Kernel-Dag");
  20027. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].innerEval = function (expr) { return eval(expr); };
  20028. ($core.packageDescriptors||$core.packages)["Kernel-Dag"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20029. $core.addClass("AbstractDagVisitor", $globals.Object, [], "Kernel-Dag");
  20030. $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:`.";
  20031. $core.addMethod(
  20032. $core.method({
  20033. selector: "value:",
  20034. protocol: "evaluating",
  20035. fn: function (anObject){
  20036. var self=this,$self=this;
  20037. return $core.withContext(function($ctx1) {
  20038. return $self._visit_(anObject);
  20039. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AbstractDagVisitor)});
  20040. },
  20041. args: ["anObject"],
  20042. source: "value: anObject\x0a\x09^ self visit: anObject",
  20043. referencedClasses: [],
  20044. messageSends: ["visit:"]
  20045. }),
  20046. $globals.AbstractDagVisitor);
  20047. $core.addMethod(
  20048. $core.method({
  20049. selector: "visit:",
  20050. protocol: "visiting",
  20051. fn: function (aNode){
  20052. var self=this,$self=this;
  20053. return $core.withContext(function($ctx1) {
  20054. return $recv(aNode)._acceptDagVisitor_(self);
  20055. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20056. },
  20057. args: ["aNode"],
  20058. source: "visit: aNode\x0a\x09^ aNode acceptDagVisitor: self",
  20059. referencedClasses: [],
  20060. messageSends: ["acceptDagVisitor:"]
  20061. }),
  20062. $globals.AbstractDagVisitor);
  20063. $core.addMethod(
  20064. $core.method({
  20065. selector: "visitAll:",
  20066. protocol: "visiting",
  20067. fn: function (aCollection){
  20068. var self=this,$self=this;
  20069. return $core.withContext(function($ctx1) {
  20070. return $recv(aCollection)._collect_((function(each){
  20071. return $core.withContext(function($ctx2) {
  20072. return $self._visit_(each);
  20073. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20074. }));
  20075. }, function($ctx1) {$ctx1.fill(self,"visitAll:",{aCollection:aCollection},$globals.AbstractDagVisitor)});
  20076. },
  20077. args: ["aCollection"],
  20078. source: "visitAll: aCollection\x0a\x09^ aCollection collect: [ :each | self visit: each ]",
  20079. referencedClasses: [],
  20080. messageSends: ["collect:", "visit:"]
  20081. }),
  20082. $globals.AbstractDagVisitor);
  20083. $core.addMethod(
  20084. $core.method({
  20085. selector: "visitAllChildren:",
  20086. protocol: "visiting",
  20087. fn: function (aDagNode){
  20088. var self=this,$self=this;
  20089. return $core.withContext(function($ctx1) {
  20090. return $self._visitAll_($recv(aDagNode)._dagChildren());
  20091. }, function($ctx1) {$ctx1.fill(self,"visitAllChildren:",{aDagNode:aDagNode},$globals.AbstractDagVisitor)});
  20092. },
  20093. args: ["aDagNode"],
  20094. source: "visitAllChildren: aDagNode\x0a\x09^ self visitAll: aDagNode dagChildren",
  20095. referencedClasses: [],
  20096. messageSends: ["visitAll:", "dagChildren"]
  20097. }),
  20098. $globals.AbstractDagVisitor);
  20099. $core.addMethod(
  20100. $core.method({
  20101. selector: "visitDagNode:",
  20102. protocol: "visiting",
  20103. fn: function (aNode){
  20104. var self=this,$self=this;
  20105. return $core.withContext(function($ctx1) {
  20106. $self._subclassResponsibility();
  20107. return self;
  20108. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20109. },
  20110. args: ["aNode"],
  20111. source: "visitDagNode: aNode\x0a\x09self subclassResponsibility",
  20112. referencedClasses: [],
  20113. messageSends: ["subclassResponsibility"]
  20114. }),
  20115. $globals.AbstractDagVisitor);
  20116. $core.addMethod(
  20117. $core.method({
  20118. selector: "visitDagNodeVariantRedux:",
  20119. protocol: "visiting",
  20120. fn: function (aNode){
  20121. var self=this,$self=this;
  20122. var newChildren,oldChildren;
  20123. return $core.withContext(function($ctx1) {
  20124. var $2,$3,$1,$4,$5;
  20125. var $early={};
  20126. try {
  20127. oldChildren=$recv(aNode)._dagChildren();
  20128. newChildren=$self._visitAllChildren_(aNode);
  20129. $2=$recv(oldChildren)._size();
  20130. $ctx1.sendIdx["size"]=1;
  20131. $3=$recv(newChildren)._size();
  20132. $ctx1.sendIdx["size"]=2;
  20133. $1=$recv($2).__eq($3);
  20134. if($core.assert($1)){
  20135. $recv((1)._to_($recv(oldChildren)._size()))._detect_ifNone_((function(i){
  20136. return $core.withContext(function($ctx2) {
  20137. $4=$recv(oldChildren)._at_(i);
  20138. $ctx2.sendIdx["at:"]=1;
  20139. return $recv($4).__tild_eq($recv(newChildren)._at_(i));
  20140. }, function($ctx2) {$ctx2.fillBlock({i:i},$ctx1,2)});
  20141. }),(function(){
  20142. throw $early=[aNode];
  20143. }));
  20144. }
  20145. $5=$recv(aNode)._copy();
  20146. $recv($5)._dagChildren_(newChildren);
  20147. return $recv($5)._yourself();
  20148. }
  20149. catch(e) {if(e===$early)return e[0]; throw e}
  20150. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newChildren:newChildren,oldChildren:oldChildren},$globals.AbstractDagVisitor)});
  20151. },
  20152. args: ["aNode"],
  20153. 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",
  20154. referencedClasses: [],
  20155. messageSends: ["dagChildren", "visitAllChildren:", "ifTrue:", "=", "size", "detect:ifNone:", "to:", "~=", "at:", "dagChildren:", "copy", "yourself"]
  20156. }),
  20157. $globals.AbstractDagVisitor);
  20158. $core.addMethod(
  20159. $core.method({
  20160. selector: "visitDagNodeVariantSimple:",
  20161. protocol: "visiting",
  20162. fn: function (aNode){
  20163. var self=this,$self=this;
  20164. return $core.withContext(function($ctx1) {
  20165. $self._visitAllChildren_(aNode);
  20166. return aNode;
  20167. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantSimple:",{aNode:aNode},$globals.AbstractDagVisitor)});
  20168. },
  20169. args: ["aNode"],
  20170. source: "visitDagNodeVariantSimple: aNode\x0a\x09\x22Simple implementation of visitDagNode:.\x0a\x09Visits children, then returns aNode\x22\x0a\x0a\x09self visitAllChildren: aNode.\x0a\x09^ aNode",
  20171. referencedClasses: [],
  20172. messageSends: ["visitAllChildren:"]
  20173. }),
  20174. $globals.AbstractDagVisitor);
  20175. $core.addClass("PathDagVisitor", $globals.AbstractDagVisitor, ["path"], "Kernel-Dag");
  20176. $globals.PathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  20177. $core.addMethod(
  20178. $core.method({
  20179. selector: "initialize",
  20180. protocol: "initialization",
  20181. fn: function (){
  20182. var self=this,$self=this;
  20183. return $core.withContext(function($ctx1) {
  20184. (
  20185. $ctx1.supercall = true,
  20186. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  20187. $ctx1.supercall = false;
  20188. $self["@path"]=[];
  20189. return self;
  20190. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PathDagVisitor)});
  20191. },
  20192. args: [],
  20193. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09path := #()",
  20194. referencedClasses: [],
  20195. messageSends: ["initialize"]
  20196. }),
  20197. $globals.PathDagVisitor);
  20198. $core.addMethod(
  20199. $core.method({
  20200. selector: "path",
  20201. protocol: "accessing",
  20202. fn: function (){
  20203. var self=this,$self=this;
  20204. return $self["@path"];
  20205. },
  20206. args: [],
  20207. source: "path\x0a\x09^ path",
  20208. referencedClasses: [],
  20209. messageSends: []
  20210. }),
  20211. $globals.PathDagVisitor);
  20212. $core.addMethod(
  20213. $core.method({
  20214. selector: "visit:",
  20215. protocol: "visiting",
  20216. fn: function (aNode){
  20217. var self=this,$self=this;
  20218. var oldPath,result;
  20219. return $core.withContext(function($ctx1) {
  20220. result=aNode;
  20221. oldPath=$self["@path"];
  20222. $recv((function(){
  20223. return $core.withContext(function($ctx2) {
  20224. $self["@path"]=$recv($self["@path"]).__comma([aNode]);
  20225. result=(
  20226. $ctx2.supercall = true,
  20227. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  20228. $ctx2.supercall = false;
  20229. return result;
  20230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20231. }))._ensure_((function(){
  20232. $self["@path"]=oldPath;
  20233. return $self["@path"];
  20234. }));
  20235. return result;
  20236. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode,oldPath:oldPath,result:result},$globals.PathDagVisitor)});
  20237. },
  20238. args: ["aNode"],
  20239. 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",
  20240. referencedClasses: [],
  20241. messageSends: ["ensure:", ",", "visit:"]
  20242. }),
  20243. $globals.PathDagVisitor);
  20244. $core.addMethod(
  20245. $core.method({
  20246. selector: "visitDagNodeVariantRedux:",
  20247. protocol: "visiting",
  20248. fn: function (aNode){
  20249. var self=this,$self=this;
  20250. var newNode;
  20251. return $core.withContext(function($ctx1) {
  20252. var $1;
  20253. newNode=(
  20254. $ctx1.supercall = true,
  20255. ($globals.PathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visitDagNodeVariantRedux_.apply($self, [aNode]));
  20256. $ctx1.supercall = false;
  20257. $1=$recv(aNode).__eq_eq(newNode);
  20258. if(!$core.assert($1)){
  20259. $recv($self["@path"])._at_put_($recv($self["@path"])._size(),newNode);
  20260. }
  20261. return newNode;
  20262. }, function($ctx1) {$ctx1.fill(self,"visitDagNodeVariantRedux:",{aNode:aNode,newNode:newNode},$globals.PathDagVisitor)});
  20263. },
  20264. args: ["aNode"],
  20265. source: "visitDagNodeVariantRedux: aNode\x0a\x09| newNode |\x0a\x09newNode := super visitDagNodeVariantRedux: aNode.\x0a\x09aNode == newNode ifFalse: [ path at: path size put: newNode ].\x0a\x09^ newNode",
  20266. referencedClasses: [],
  20267. messageSends: ["visitDagNodeVariantRedux:", "ifFalse:", "==", "at:put:", "size"]
  20268. }),
  20269. $globals.PathDagVisitor);
  20270. $core.addClass("DagNode", $globals.Object, [], "Kernel-Dag");
  20271. $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).";
  20272. $core.addMethod(
  20273. $core.method({
  20274. selector: "acceptDagVisitor:",
  20275. protocol: "visiting",
  20276. fn: function (aVisitor){
  20277. var self=this,$self=this;
  20278. return $core.withContext(function($ctx1) {
  20279. return $recv(aVisitor)._visitDagNode_(self);
  20280. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DagNode)});
  20281. },
  20282. args: ["aVisitor"],
  20283. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDagNode: self",
  20284. referencedClasses: [],
  20285. messageSends: ["visitDagNode:"]
  20286. }),
  20287. $globals.DagNode);
  20288. $core.addMethod(
  20289. $core.method({
  20290. selector: "allDagChildren",
  20291. protocol: "accessing",
  20292. fn: function (){
  20293. var self=this,$self=this;
  20294. var allNodes;
  20295. return $core.withContext(function($ctx1) {
  20296. var $1;
  20297. $1=$self._dagChildren();
  20298. $ctx1.sendIdx["dagChildren"]=1;
  20299. allNodes=$recv($1)._asSet();
  20300. $recv($self._dagChildren())._do_((function(each){
  20301. return $core.withContext(function($ctx2) {
  20302. return $recv(allNodes)._addAll_($recv(each)._allDagChildren());
  20303. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  20304. }));
  20305. return allNodes;
  20306. }, function($ctx1) {$ctx1.fill(self,"allDagChildren",{allNodes:allNodes},$globals.DagNode)});
  20307. },
  20308. args: [],
  20309. 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",
  20310. referencedClasses: [],
  20311. messageSends: ["asSet", "dagChildren", "do:", "addAll:", "allDagChildren"]
  20312. }),
  20313. $globals.DagNode);
  20314. $core.addMethod(
  20315. $core.method({
  20316. selector: "dagChildren",
  20317. protocol: "accessing",
  20318. fn: function (){
  20319. var self=this,$self=this;
  20320. return $core.withContext(function($ctx1) {
  20321. $self._subclassResponsibility();
  20322. return self;
  20323. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagNode)});
  20324. },
  20325. args: [],
  20326. source: "dagChildren\x0a\x09self subclassResponsibility",
  20327. referencedClasses: [],
  20328. messageSends: ["subclassResponsibility"]
  20329. }),
  20330. $globals.DagNode);
  20331. $core.addMethod(
  20332. $core.method({
  20333. selector: "dagChildren:",
  20334. protocol: "accessing",
  20335. fn: function (aCollection){
  20336. var self=this,$self=this;
  20337. return $core.withContext(function($ctx1) {
  20338. $self._subclassResponsibility();
  20339. return self;
  20340. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagNode)});
  20341. },
  20342. args: ["aCollection"],
  20343. source: "dagChildren: aCollection\x0a\x09self subclassResponsibility",
  20344. referencedClasses: [],
  20345. messageSends: ["subclassResponsibility"]
  20346. }),
  20347. $globals.DagNode);
  20348. $core.addMethod(
  20349. $core.method({
  20350. selector: "isDagNode",
  20351. protocol: "testing",
  20352. fn: function (){
  20353. var self=this,$self=this;
  20354. return true;
  20355. },
  20356. args: [],
  20357. source: "isDagNode\x0a\x09^ true",
  20358. referencedClasses: [],
  20359. messageSends: []
  20360. }),
  20361. $globals.DagNode);
  20362. $core.addClass("DagParentNode", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20363. $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.";
  20364. $core.addMethod(
  20365. $core.method({
  20366. selector: "addDagChild:",
  20367. protocol: "accessing",
  20368. fn: function (aDagNode){
  20369. var self=this,$self=this;
  20370. return $core.withContext(function($ctx1) {
  20371. $recv($self._dagChildren())._add_(aDagNode);
  20372. return self;
  20373. }, function($ctx1) {$ctx1.fill(self,"addDagChild:",{aDagNode:aDagNode},$globals.DagParentNode)});
  20374. },
  20375. args: ["aDagNode"],
  20376. source: "addDagChild: aDagNode\x0a\x09self dagChildren add: aDagNode",
  20377. referencedClasses: [],
  20378. messageSends: ["add:", "dagChildren"]
  20379. }),
  20380. $globals.DagParentNode);
  20381. $core.addMethod(
  20382. $core.method({
  20383. selector: "dagChildren",
  20384. protocol: "accessing",
  20385. fn: function (){
  20386. var self=this,$self=this;
  20387. return $core.withContext(function($ctx1) {
  20388. var $1,$receiver;
  20389. $1=$self["@nodes"];
  20390. if(($receiver = $1) == null || $receiver.a$nil){
  20391. $self["@nodes"]=$recv($globals.Array)._new();
  20392. return $self["@nodes"];
  20393. } else {
  20394. return $1;
  20395. }
  20396. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.DagParentNode)});
  20397. },
  20398. args: [],
  20399. source: "dagChildren\x0a\x09^ nodes ifNil: [ nodes := Array new ]",
  20400. referencedClasses: ["Array"],
  20401. messageSends: ["ifNil:", "new"]
  20402. }),
  20403. $globals.DagParentNode);
  20404. $core.addMethod(
  20405. $core.method({
  20406. selector: "dagChildren:",
  20407. protocol: "accessing",
  20408. fn: function (aCollection){
  20409. var self=this,$self=this;
  20410. $self["@nodes"]=aCollection;
  20411. return self;
  20412. },
  20413. args: ["aCollection"],
  20414. source: "dagChildren: aCollection\x0a\x09nodes := aCollection",
  20415. referencedClasses: [],
  20416. messageSends: []
  20417. }),
  20418. $globals.DagParentNode);
  20419. $core.addClass("DagSink", $globals.DagNode, ["nodes"], "Kernel-Dag");
  20420. $globals.DagSink.comment="I am `DagNode` with no direct successors.\x0a\x0aSending `dagChildren:` with empty collection is legal.";
  20421. $core.addMethod(
  20422. $core.method({
  20423. selector: "dagChildren",
  20424. protocol: "accessing",
  20425. fn: function (){
  20426. var self=this,$self=this;
  20427. return [];
  20428. },
  20429. args: [],
  20430. source: "dagChildren\x0a\x09^ #()",
  20431. referencedClasses: [],
  20432. messageSends: []
  20433. }),
  20434. $globals.DagSink);
  20435. $core.addMethod(
  20436. $core.method({
  20437. selector: "dagChildren:",
  20438. protocol: "accessing",
  20439. fn: function (aCollection){
  20440. var self=this,$self=this;
  20441. return $core.withContext(function($ctx1) {
  20442. $recv(aCollection)._ifNotEmpty_((function(){
  20443. return $core.withContext(function($ctx2) {
  20444. return $self._error_("A DagSink cannot have children.");
  20445. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20446. }));
  20447. return self;
  20448. }, function($ctx1) {$ctx1.fill(self,"dagChildren:",{aCollection:aCollection},$globals.DagSink)});
  20449. },
  20450. args: ["aCollection"],
  20451. source: "dagChildren: aCollection\x0a\x09aCollection ifNotEmpty: [ self error: 'A DagSink cannot have children.' ]",
  20452. referencedClasses: [],
  20453. messageSends: ["ifNotEmpty:", "error:"]
  20454. }),
  20455. $globals.DagSink);
  20456. $core.addMethod(
  20457. $core.method({
  20458. selector: "isDagNode",
  20459. protocol: "*Kernel-Dag",
  20460. fn: function (){
  20461. var self=this,$self=this;
  20462. return false;
  20463. },
  20464. args: [],
  20465. source: "isDagNode\x0a\x09^ false",
  20466. referencedClasses: [],
  20467. messageSends: []
  20468. }),
  20469. $globals.Object);
  20470. });
  20471. define('amber_core/Kernel-Exceptions',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  20472. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  20473. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  20474. $core.addPackage("Kernel-Exceptions");
  20475. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].innerEval = function (expr) { return eval(expr); };
  20476. ($core.packageDescriptors||$core.packages)["Kernel-Exceptions"].transport = {"type":"amd","amdNamespace":"amber_core"};
  20477. $core.addClass("Error", $globals.Object, ["messageText"], "Kernel-Exceptions");
  20478. $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.";
  20479. $core.addMethod(
  20480. $core.method({
  20481. selector: "beHandled",
  20482. protocol: "accessing",
  20483. fn: function (){
  20484. var self=this,$self=this;
  20485. return $core.withContext(function($ctx1) {
  20486. self.amberHandled = true;
  20487. return self;
  20488. }, function($ctx1) {$ctx1.fill(self,"beHandled",{},$globals.Error)});
  20489. },
  20490. args: [],
  20491. source: "beHandled\x0a\x09<inlineJS: 'self.amberHandled = true'>",
  20492. referencedClasses: [],
  20493. messageSends: []
  20494. }),
  20495. $globals.Error);
  20496. $core.addMethod(
  20497. $core.method({
  20498. selector: "beUnhandled",
  20499. protocol: "accessing",
  20500. fn: function (){
  20501. var self=this,$self=this;
  20502. return $core.withContext(function($ctx1) {
  20503. self.amberHandled = false;
  20504. return self;
  20505. }, function($ctx1) {$ctx1.fill(self,"beUnhandled",{},$globals.Error)});
  20506. },
  20507. args: [],
  20508. source: "beUnhandled\x0a\x09<inlineJS: 'self.amberHandled = false'>",
  20509. referencedClasses: [],
  20510. messageSends: []
  20511. }),
  20512. $globals.Error);
  20513. $core.addMethod(
  20514. $core.method({
  20515. selector: "context",
  20516. protocol: "accessing",
  20517. fn: function (){
  20518. var self=this,$self=this;
  20519. return $core.withContext(function($ctx1) {
  20520. return self.context;
  20521. return self;
  20522. }, function($ctx1) {$ctx1.fill(self,"context",{},$globals.Error)});
  20523. },
  20524. args: [],
  20525. source: "context\x0a\x09<inlineJS: 'return self.context'>",
  20526. referencedClasses: [],
  20527. messageSends: []
  20528. }),
  20529. $globals.Error);
  20530. $core.addMethod(
  20531. $core.method({
  20532. selector: "initialize",
  20533. protocol: "initialization",
  20534. fn: function (){
  20535. var self=this,$self=this;
  20536. return $core.withContext(function($ctx1) {
  20537. $self._messageText_("Errorclass: ".__comma($recv($self._class())._name()));
  20538. return self;
  20539. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Error)});
  20540. },
  20541. args: [],
  20542. source: "initialize\x0a\x09self messageText: 'Errorclass: ', (self class name).",
  20543. referencedClasses: [],
  20544. messageSends: ["messageText:", ",", "name", "class"]
  20545. }),
  20546. $globals.Error);
  20547. $core.addMethod(
  20548. $core.method({
  20549. selector: "isSmalltalkError",
  20550. protocol: "testing",
  20551. fn: function (){
  20552. var self=this,$self=this;
  20553. return $core.withContext(function($ctx1) {
  20554. return self.smalltalkError === true;
  20555. return self;
  20556. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkError",{},$globals.Error)});
  20557. },
  20558. args: [],
  20559. source: "isSmalltalkError\x0a\x09<inlineJS: 'return self.smalltalkError === true'>",
  20560. referencedClasses: [],
  20561. messageSends: []
  20562. }),
  20563. $globals.Error);
  20564. $core.addMethod(
  20565. $core.method({
  20566. selector: "jsStack",
  20567. protocol: "accessing",
  20568. fn: function (){
  20569. var self=this,$self=this;
  20570. return $core.withContext(function($ctx1) {
  20571. return self.stack;
  20572. return self;
  20573. }, function($ctx1) {$ctx1.fill(self,"jsStack",{},$globals.Error)});
  20574. },
  20575. args: [],
  20576. source: "jsStack\x0a\x09<inlineJS: 'return self.stack'>",
  20577. referencedClasses: [],
  20578. messageSends: []
  20579. }),
  20580. $globals.Error);
  20581. $core.addMethod(
  20582. $core.method({
  20583. selector: "messageText",
  20584. protocol: "accessing",
  20585. fn: function (){
  20586. var self=this,$self=this;
  20587. return $self["@messageText"];
  20588. },
  20589. args: [],
  20590. source: "messageText\x0a\x09^ messageText",
  20591. referencedClasses: [],
  20592. messageSends: []
  20593. }),
  20594. $globals.Error);
  20595. $core.addMethod(
  20596. $core.method({
  20597. selector: "messageText:",
  20598. protocol: "accessing",
  20599. fn: function (aString){
  20600. var self=this,$self=this;
  20601. $self["@messageText"]=aString;
  20602. return self;
  20603. },
  20604. args: ["aString"],
  20605. source: "messageText: aString\x0a\x09messageText := aString",
  20606. referencedClasses: [],
  20607. messageSends: []
  20608. }),
  20609. $globals.Error);
  20610. $core.addMethod(
  20611. $core.method({
  20612. selector: "outer",
  20613. protocol: "signaling",
  20614. fn: function (){
  20615. var self=this,$self=this;
  20616. return $core.withContext(function($ctx1) {
  20617. return $self._pass();
  20618. }, function($ctx1) {$ctx1.fill(self,"outer",{},$globals.Error)});
  20619. },
  20620. args: [],
  20621. source: "outer\x0a\x09\x22Pharo compatibility. Just sends #pass.\x22\x0a\x09\x0a\x09^ self pass",
  20622. referencedClasses: [],
  20623. messageSends: ["pass"]
  20624. }),
  20625. $globals.Error);
  20626. $core.addMethod(
  20627. $core.method({
  20628. selector: "pass",
  20629. protocol: "signaling",
  20630. fn: function (){
  20631. var self=this,$self=this;
  20632. return $core.withContext(function($ctx1) {
  20633. self.amberHandled = false;
  20634. throw self;
  20635. ;
  20636. return self;
  20637. }, function($ctx1) {$ctx1.fill(self,"pass",{},$globals.Error)});
  20638. },
  20639. args: [],
  20640. 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'>",
  20641. referencedClasses: [],
  20642. messageSends: []
  20643. }),
  20644. $globals.Error);
  20645. $core.addMethod(
  20646. $core.method({
  20647. selector: "resignal",
  20648. protocol: "signaling",
  20649. fn: function (){
  20650. var self=this,$self=this;
  20651. return $core.withContext(function($ctx1) {
  20652. $self._deprecatedAPI_("Use #pass.");
  20653. return $self._pass();
  20654. }, function($ctx1) {$ctx1.fill(self,"resignal",{},$globals.Error)});
  20655. },
  20656. args: [],
  20657. source: "resignal\x0a\x09self deprecatedAPI: 'Use #pass.'.\x0a\x09^ self pass",
  20658. referencedClasses: [],
  20659. messageSends: ["deprecatedAPI:", "pass"]
  20660. }),
  20661. $globals.Error);
  20662. $core.addMethod(
  20663. $core.method({
  20664. selector: "signal",
  20665. protocol: "signaling",
  20666. fn: function (){
  20667. var self=this,$self=this;
  20668. return $core.withContext(function($ctx1) {
  20669. self.amberHandled = false;
  20670. self.context = $core.getThisContext();
  20671. self.smalltalkError = true;
  20672. throw self;
  20673. ;
  20674. return self;
  20675. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error)});
  20676. },
  20677. args: [],
  20678. 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'>",
  20679. referencedClasses: [],
  20680. messageSends: []
  20681. }),
  20682. $globals.Error);
  20683. $core.addMethod(
  20684. $core.method({
  20685. selector: "signal:",
  20686. protocol: "signaling",
  20687. fn: function (aString){
  20688. var self=this,$self=this;
  20689. return $core.withContext(function($ctx1) {
  20690. $self._messageText_(aString);
  20691. $self._signal();
  20692. return self;
  20693. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error)});
  20694. },
  20695. args: ["aString"],
  20696. source: "signal: aString\x0a\x09self messageText: aString.\x0a\x09self signal",
  20697. referencedClasses: [],
  20698. messageSends: ["messageText:", "signal"]
  20699. }),
  20700. $globals.Error);
  20701. $core.addMethod(
  20702. $core.method({
  20703. selector: "signalerContext",
  20704. protocol: "accessing",
  20705. fn: function (){
  20706. var self=this,$self=this;
  20707. return $core.withContext(function($ctx1) {
  20708. return $self._signalerContextFrom_($self._context());
  20709. }, function($ctx1) {$ctx1.fill(self,"signalerContext",{},$globals.Error)});
  20710. },
  20711. args: [],
  20712. source: "signalerContext\x0a\x09^ self signalerContextFrom: self context",
  20713. referencedClasses: [],
  20714. messageSends: ["signalerContextFrom:", "context"]
  20715. }),
  20716. $globals.Error);
  20717. $core.addMethod(
  20718. $core.method({
  20719. selector: "signalerContextFrom:",
  20720. protocol: "accessing",
  20721. fn: function (aContext){
  20722. var self=this,$self=this;
  20723. return $core.withContext(function($ctx1) {
  20724. var $3,$2,$1;
  20725. return $recv(aContext)._findContextSuchThat_((function(context){
  20726. return $core.withContext(function($ctx2) {
  20727. $3=$recv(context)._receiver();
  20728. $ctx2.sendIdx["receiver"]=1;
  20729. $2=$recv($3).__eq_eq(self);
  20730. $ctx2.sendIdx["=="]=1;
  20731. $1=$recv($2)._or_((function(){
  20732. return $core.withContext(function($ctx3) {
  20733. return $recv($recv(context)._receiver()).__eq_eq($self._class());
  20734. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20735. }));
  20736. return $recv($1)._not();
  20737. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20738. }));
  20739. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Error)});
  20740. },
  20741. args: ["aContext"],
  20742. 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 ]",
  20743. referencedClasses: [],
  20744. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class"]
  20745. }),
  20746. $globals.Error);
  20747. $core.addMethod(
  20748. $core.method({
  20749. selector: "wasHandled",
  20750. protocol: "testing",
  20751. fn: function (){
  20752. var self=this,$self=this;
  20753. return $core.withContext(function($ctx1) {
  20754. return self.amberHandled || false;
  20755. return self;
  20756. }, function($ctx1) {$ctx1.fill(self,"wasHandled",{},$globals.Error)});
  20757. },
  20758. args: [],
  20759. source: "wasHandled\x0a\x09<inlineJS: 'return self.amberHandled || false'>",
  20760. referencedClasses: [],
  20761. messageSends: []
  20762. }),
  20763. $globals.Error);
  20764. $core.addMethod(
  20765. $core.method({
  20766. selector: "classTag",
  20767. protocol: "accessing",
  20768. fn: function (){
  20769. var self=this,$self=this;
  20770. return "exception";
  20771. },
  20772. args: [],
  20773. 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'",
  20774. referencedClasses: [],
  20775. messageSends: []
  20776. }),
  20777. $globals.Error.a$cls);
  20778. $core.addMethod(
  20779. $core.method({
  20780. selector: "signal",
  20781. protocol: "instance creation",
  20782. fn: function (){
  20783. var self=this,$self=this;
  20784. return $core.withContext(function($ctx1) {
  20785. return $recv($self._new())._signal();
  20786. }, function($ctx1) {$ctx1.fill(self,"signal",{},$globals.Error.a$cls)});
  20787. },
  20788. args: [],
  20789. source: "signal\x0a\x09^ self new signal",
  20790. referencedClasses: [],
  20791. messageSends: ["signal", "new"]
  20792. }),
  20793. $globals.Error.a$cls);
  20794. $core.addMethod(
  20795. $core.method({
  20796. selector: "signal:",
  20797. protocol: "instance creation",
  20798. fn: function (aString){
  20799. var self=this,$self=this;
  20800. return $core.withContext(function($ctx1) {
  20801. return $recv($self._new())._signal_(aString);
  20802. }, function($ctx1) {$ctx1.fill(self,"signal:",{aString:aString},$globals.Error.a$cls)});
  20803. },
  20804. args: ["aString"],
  20805. source: "signal: aString\x0a\x09^ self new\x0a\x09\x09signal: aString",
  20806. referencedClasses: [],
  20807. messageSends: ["signal:", "new"]
  20808. }),
  20809. $globals.Error.a$cls);
  20810. $core.addClass("Halt", $globals.Error, [], "Kernel-Exceptions");
  20811. $globals.Halt.comment="I am provided to support `Object>>#halt`.";
  20812. $core.addMethod(
  20813. $core.method({
  20814. selector: "messageText",
  20815. protocol: "accessing",
  20816. fn: function (){
  20817. var self=this,$self=this;
  20818. return "Halt encountered";
  20819. },
  20820. args: [],
  20821. source: "messageText\x0a\x09^ 'Halt encountered'",
  20822. referencedClasses: [],
  20823. messageSends: []
  20824. }),
  20825. $globals.Halt);
  20826. $core.addMethod(
  20827. $core.method({
  20828. selector: "signalerContextFrom:",
  20829. protocol: "accessing",
  20830. fn: function (aContext){
  20831. var self=this,$self=this;
  20832. return $core.withContext(function($ctx1) {
  20833. var $3,$2,$1;
  20834. return $recv(aContext)._findContextSuchThat_((function(context){
  20835. return $core.withContext(function($ctx2) {
  20836. $3=$recv(context)._receiver();
  20837. $ctx2.sendIdx["receiver"]=1;
  20838. $2=$recv($3).__eq_eq(self);
  20839. $ctx2.sendIdx["=="]=1;
  20840. $1=$recv($2)._or_((function(){
  20841. return $core.withContext(function($ctx3) {
  20842. return $recv($recv($recv(context)._receiver()).__eq_eq($self._class()))._or_((function(){
  20843. return $core.withContext(function($ctx4) {
  20844. return $recv($recv($recv(context)._method())._selector()).__eq("halt");
  20845. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  20846. }));
  20847. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  20848. }));
  20849. $ctx2.sendIdx["or:"]=1;
  20850. return $recv($1)._not();
  20851. }, function($ctx2) {$ctx2.fillBlock({context:context},$ctx1,1)});
  20852. }));
  20853. }, function($ctx1) {$ctx1.fill(self,"signalerContextFrom:",{aContext:aContext},$globals.Halt)});
  20854. },
  20855. args: ["aContext"],
  20856. 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 ]",
  20857. referencedClasses: [],
  20858. messageSends: ["findContextSuchThat:", "not", "or:", "==", "receiver", "class", "=", "selector", "method"]
  20859. }),
  20860. $globals.Halt);
  20861. $core.addClass("JavaScriptException", $globals.Error, ["exception"], "Kernel-Exceptions");
  20862. $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:`";
  20863. $core.addMethod(
  20864. $core.method({
  20865. selector: "context:",
  20866. protocol: "accessing",
  20867. fn: function (aMethodContext){
  20868. var self=this,$self=this;
  20869. return $core.withContext(function($ctx1) {
  20870. self.context = aMethodContext;
  20871. return self;
  20872. }, function($ctx1) {$ctx1.fill(self,"context:",{aMethodContext:aMethodContext},$globals.JavaScriptException)});
  20873. },
  20874. args: ["aMethodContext"],
  20875. 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'>",
  20876. referencedClasses: [],
  20877. messageSends: []
  20878. }),
  20879. $globals.JavaScriptException);
  20880. $core.addMethod(
  20881. $core.method({
  20882. selector: "exception",
  20883. protocol: "accessing",
  20884. fn: function (){
  20885. var self=this,$self=this;
  20886. return $self["@exception"];
  20887. },
  20888. args: [],
  20889. source: "exception\x0a\x09^ exception",
  20890. referencedClasses: [],
  20891. messageSends: []
  20892. }),
  20893. $globals.JavaScriptException);
  20894. $core.addMethod(
  20895. $core.method({
  20896. selector: "exception:",
  20897. protocol: "accessing",
  20898. fn: function (anException){
  20899. var self=this,$self=this;
  20900. $self["@exception"]=anException;
  20901. return self;
  20902. },
  20903. args: ["anException"],
  20904. source: "exception: anException\x0a\x09exception := anException",
  20905. referencedClasses: [],
  20906. messageSends: []
  20907. }),
  20908. $globals.JavaScriptException);
  20909. $core.addMethod(
  20910. $core.method({
  20911. selector: "messageText",
  20912. protocol: "accessing",
  20913. fn: function (){
  20914. var self=this,$self=this;
  20915. return $core.withContext(function($ctx1) {
  20916. return "JavaScript exception: " + $self["@exception"].toString();
  20917. return self;
  20918. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.JavaScriptException)});
  20919. },
  20920. args: [],
  20921. source: "messageText\x0a\x09<inlineJS: 'return \x22JavaScript exception: \x22 + $self[\x22@exception\x22].toString()'>",
  20922. referencedClasses: [],
  20923. messageSends: []
  20924. }),
  20925. $globals.JavaScriptException);
  20926. $core.addMethod(
  20927. $core.method({
  20928. selector: "shouldBeStubbed",
  20929. protocol: "testing",
  20930. fn: function (){
  20931. var self=this,$self=this;
  20932. return $core.withContext(function($ctx1) {
  20933. return $self["@exception"] instanceof RangeError;
  20934. return self;
  20935. }, function($ctx1) {$ctx1.fill(self,"shouldBeStubbed",{},$globals.JavaScriptException)});
  20936. },
  20937. args: [],
  20938. source: "shouldBeStubbed\x0a\x09<inlineJS: 'return $self[\x22@exception\x22] instanceof RangeError'>",
  20939. referencedClasses: [],
  20940. messageSends: []
  20941. }),
  20942. $globals.JavaScriptException);
  20943. $core.addMethod(
  20944. $core.method({
  20945. selector: "wrap",
  20946. protocol: "error handling",
  20947. fn: function (){
  20948. var self=this,$self=this;
  20949. return $core.withContext(function($ctx1) {
  20950. var $1;
  20951. $recv((function(){
  20952. return $core.withContext(function($ctx2) {
  20953. return $self._signal();
  20954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  20955. }))._tryCatch_((function(){
  20956. return $core.withContext(function($ctx2) {
  20957. $1=$self._shouldBeStubbed();
  20958. if($core.assert($1)){
  20959. return $recv($self._context())._stubToAtMost_((100));
  20960. }
  20961. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  20962. }));
  20963. return self;
  20964. }, function($ctx1) {$ctx1.fill(self,"wrap",{},$globals.JavaScriptException)});
  20965. },
  20966. args: [],
  20967. source: "wrap\x0a\x09[ self signal ] tryCatch:\x0a\x09\x09[ self shouldBeStubbed ifTrue: [ self context stubToAtMost: 100 ] ]",
  20968. referencedClasses: [],
  20969. messageSends: ["tryCatch:", "signal", "ifTrue:", "shouldBeStubbed", "stubToAtMost:", "context"]
  20970. }),
  20971. $globals.JavaScriptException);
  20972. $core.addMethod(
  20973. $core.method({
  20974. selector: "on:",
  20975. protocol: "instance creation",
  20976. fn: function (anException){
  20977. var self=this,$self=this;
  20978. return $core.withContext(function($ctx1) {
  20979. var $1;
  20980. $1=$self._new();
  20981. $recv($1)._exception_(anException);
  20982. return $recv($1)._yourself();
  20983. }, function($ctx1) {$ctx1.fill(self,"on:",{anException:anException},$globals.JavaScriptException.a$cls)});
  20984. },
  20985. args: ["anException"],
  20986. source: "on: anException\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09yourself",
  20987. referencedClasses: [],
  20988. messageSends: ["exception:", "new", "yourself"]
  20989. }),
  20990. $globals.JavaScriptException.a$cls);
  20991. $core.addMethod(
  20992. $core.method({
  20993. selector: "on:context:",
  20994. protocol: "instance creation",
  20995. fn: function (anException,aMethodContext){
  20996. var self=this,$self=this;
  20997. return $core.withContext(function($ctx1) {
  20998. var $1;
  20999. $1=$self._new();
  21000. $recv($1)._exception_(anException);
  21001. $recv($1)._context_(aMethodContext);
  21002. return $recv($1)._yourself();
  21003. }, function($ctx1) {$ctx1.fill(self,"on:context:",{anException:anException,aMethodContext:aMethodContext},$globals.JavaScriptException.a$cls)});
  21004. },
  21005. args: ["anException", "aMethodContext"],
  21006. source: "on: anException context: aMethodContext\x0a\x09^ self new\x0a\x09\x09exception: anException;\x0a\x09\x09context: aMethodContext;\x0a\x09\x09yourself",
  21007. referencedClasses: [],
  21008. messageSends: ["exception:", "new", "context:", "yourself"]
  21009. }),
  21010. $globals.JavaScriptException.a$cls);
  21011. $core.addClass("MessageNotUnderstood", $globals.Error, ["message", "receiver"], "Kernel-Exceptions");
  21012. $globals.MessageNotUnderstood.comment="This exception is provided to support `Object>>doesNotUnderstand:`.";
  21013. $core.addMethod(
  21014. $core.method({
  21015. selector: "message",
  21016. protocol: "accessing",
  21017. fn: function (){
  21018. var self=this,$self=this;
  21019. return $self["@message"];
  21020. },
  21021. args: [],
  21022. source: "message\x0a\x09^ message",
  21023. referencedClasses: [],
  21024. messageSends: []
  21025. }),
  21026. $globals.MessageNotUnderstood);
  21027. $core.addMethod(
  21028. $core.method({
  21029. selector: "message:",
  21030. protocol: "accessing",
  21031. fn: function (aMessage){
  21032. var self=this,$self=this;
  21033. $self["@message"]=aMessage;
  21034. return self;
  21035. },
  21036. args: ["aMessage"],
  21037. source: "message: aMessage\x0a\x09message := aMessage",
  21038. referencedClasses: [],
  21039. messageSends: []
  21040. }),
  21041. $globals.MessageNotUnderstood);
  21042. $core.addMethod(
  21043. $core.method({
  21044. selector: "messageText",
  21045. protocol: "accessing",
  21046. fn: function (){
  21047. var self=this,$self=this;
  21048. return $core.withContext(function($ctx1) {
  21049. var $1;
  21050. $1=$recv($recv($recv($self._receiver())._asString()).__comma(" does not understand #")).__comma($recv($self._message())._selector());
  21051. $ctx1.sendIdx[","]=1;
  21052. return $1;
  21053. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.MessageNotUnderstood)});
  21054. },
  21055. args: [],
  21056. source: "messageText\x0a\x09^ self receiver asString, ' does not understand #', self message selector",
  21057. referencedClasses: [],
  21058. messageSends: [",", "asString", "receiver", "selector", "message"]
  21059. }),
  21060. $globals.MessageNotUnderstood);
  21061. $core.addMethod(
  21062. $core.method({
  21063. selector: "receiver",
  21064. protocol: "accessing",
  21065. fn: function (){
  21066. var self=this,$self=this;
  21067. return $self["@receiver"];
  21068. },
  21069. args: [],
  21070. source: "receiver\x0a\x09^ receiver",
  21071. referencedClasses: [],
  21072. messageSends: []
  21073. }),
  21074. $globals.MessageNotUnderstood);
  21075. $core.addMethod(
  21076. $core.method({
  21077. selector: "receiver:",
  21078. protocol: "accessing",
  21079. fn: function (anObject){
  21080. var self=this,$self=this;
  21081. $self["@receiver"]=anObject;
  21082. return self;
  21083. },
  21084. args: ["anObject"],
  21085. source: "receiver: anObject\x0a\x09receiver := anObject",
  21086. referencedClasses: [],
  21087. messageSends: []
  21088. }),
  21089. $globals.MessageNotUnderstood);
  21090. $core.addClass("NonBooleanReceiver", $globals.Error, ["object"], "Kernel-Exceptions");
  21091. $globals.NonBooleanReceiver.comment="NonBooleanReceiver exceptions may be thrown when executing inlined methods such as `#ifTrue:` with a non boolean receiver.";
  21092. $core.addMethod(
  21093. $core.method({
  21094. selector: "object",
  21095. protocol: "accessing",
  21096. fn: function (){
  21097. var self=this,$self=this;
  21098. return $self["@object"];
  21099. },
  21100. args: [],
  21101. source: "object\x0a\x09^ object",
  21102. referencedClasses: [],
  21103. messageSends: []
  21104. }),
  21105. $globals.NonBooleanReceiver);
  21106. $core.addMethod(
  21107. $core.method({
  21108. selector: "object:",
  21109. protocol: "accessing",
  21110. fn: function (anObject){
  21111. var self=this,$self=this;
  21112. $self["@object"]=anObject;
  21113. return self;
  21114. },
  21115. args: ["anObject"],
  21116. source: "object: anObject\x0a\x09object := anObject",
  21117. referencedClasses: [],
  21118. messageSends: []
  21119. }),
  21120. $globals.NonBooleanReceiver);
  21121. $core.addMethod(
  21122. $core.method({
  21123. selector: "signalOn:",
  21124. protocol: "instance creation",
  21125. fn: function (anObject){
  21126. var self=this,$self=this;
  21127. return $core.withContext(function($ctx1) {
  21128. var $1;
  21129. $1=$self._new();
  21130. $recv($1)._object_(anObject);
  21131. return $recv($1)._signal();
  21132. }, function($ctx1) {$ctx1.fill(self,"signalOn:",{anObject:anObject},$globals.NonBooleanReceiver.a$cls)});
  21133. },
  21134. args: ["anObject"],
  21135. source: "signalOn: anObject\x0a\x09^ self new\x0a\x09\x09object: anObject;\x0a\x09\x09signal",
  21136. referencedClasses: [],
  21137. messageSends: ["object:", "new", "signal"]
  21138. }),
  21139. $globals.NonBooleanReceiver.a$cls);
  21140. });
  21141. define('amber_core/Kernel-Promises',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  21142. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21143. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21144. $core.addPackage("Kernel-Promises");
  21145. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].innerEval = function (expr) { return eval(expr); };
  21146. ($core.packageDescriptors||$core.packages)["Kernel-Promises"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21147. $core.addClass("Promise", $globals.Object, [], "Kernel-Promises");
  21148. $core.addMethod(
  21149. $core.method({
  21150. selector: "all:",
  21151. protocol: "composites",
  21152. fn: function (aCollection){
  21153. var self=this,$self=this;
  21154. return $core.withContext(function($ctx1) {
  21155. return Promise.all($recv(aCollection)._asArray());
  21156. return self;
  21157. }, function($ctx1) {$ctx1.fill(self,"all:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21158. },
  21159. args: ["aCollection"],
  21160. source: "all: aCollection\x0a\x22Returns a Promise resolved with results of sub-promises.\x22\x0a<inlineJS: 'return Promise.all($recv(aCollection)._asArray())'>",
  21161. referencedClasses: [],
  21162. messageSends: []
  21163. }),
  21164. $globals.Promise.a$cls);
  21165. $core.addMethod(
  21166. $core.method({
  21167. selector: "any:",
  21168. protocol: "composites",
  21169. fn: function (aCollection){
  21170. var self=this,$self=this;
  21171. return $core.withContext(function($ctx1) {
  21172. return Promise.race($recv(aCollection)._asArray());
  21173. return self;
  21174. }, function($ctx1) {$ctx1.fill(self,"any:",{aCollection:aCollection},$globals.Promise.a$cls)});
  21175. },
  21176. args: ["aCollection"],
  21177. source: "any: aCollection\x0a\x22Returns a Promise resolved with first result of sub-promises.\x22\x0a<inlineJS: 'return Promise.race($recv(aCollection)._asArray())'>",
  21178. referencedClasses: [],
  21179. messageSends: []
  21180. }),
  21181. $globals.Promise.a$cls);
  21182. $core.addMethod(
  21183. $core.method({
  21184. selector: "forBlock:",
  21185. protocol: "instance creation",
  21186. fn: function (aBlock){
  21187. var self=this,$self=this;
  21188. return $core.withContext(function($ctx1) {
  21189. return $recv($self._new())._then_(aBlock);
  21190. }, function($ctx1) {$ctx1.fill(self,"forBlock:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21191. },
  21192. args: ["aBlock"],
  21193. 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",
  21194. referencedClasses: [],
  21195. messageSends: ["then:", "new"]
  21196. }),
  21197. $globals.Promise.a$cls);
  21198. $core.addMethod(
  21199. $core.method({
  21200. selector: "new",
  21201. protocol: "instance creation",
  21202. fn: function (){
  21203. var self=this,$self=this;
  21204. return $core.withContext(function($ctx1) {
  21205. return Promise.resolve();
  21206. return self;
  21207. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Promise.a$cls)});
  21208. },
  21209. args: [],
  21210. source: "new\x0a\x22Returns a dumb Promise resolved with nil.\x22\x0a<inlineJS: 'return Promise.resolve()'>",
  21211. referencedClasses: [],
  21212. messageSends: []
  21213. }),
  21214. $globals.Promise.a$cls);
  21215. $core.addMethod(
  21216. $core.method({
  21217. selector: "new:",
  21218. protocol: "instance creation",
  21219. fn: function (aBlock){
  21220. var self=this,$self=this;
  21221. return $core.withContext(function($ctx1) {
  21222. return new Promise(function (resolve, reject) {
  21223. var model = {value: resolve, signal: reject};
  21224. aBlock._value_(model);
  21225. });
  21226. return self;
  21227. }, function($ctx1) {$ctx1.fill(self,"new:",{aBlock:aBlock},$globals.Promise.a$cls)});
  21228. },
  21229. args: ["aBlock"],
  21230. 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})'>",
  21231. referencedClasses: [],
  21232. messageSends: []
  21233. }),
  21234. $globals.Promise.a$cls);
  21235. $core.addMethod(
  21236. $core.method({
  21237. selector: "signal:",
  21238. protocol: "instance creation",
  21239. fn: function (anObject){
  21240. var self=this,$self=this;
  21241. return $core.withContext(function($ctx1) {
  21242. return $recv(anObject)._in_(function (x) {return Promise.reject(x)});
  21243. return self;
  21244. }, function($ctx1) {$ctx1.fill(self,"signal:",{anObject:anObject},$globals.Promise.a$cls)});
  21245. },
  21246. args: ["anObject"],
  21247. source: "signal: anObject\x0a\x22Returns a Promise rejected with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.reject(x)})'>",
  21248. referencedClasses: [],
  21249. messageSends: []
  21250. }),
  21251. $globals.Promise.a$cls);
  21252. $core.addMethod(
  21253. $core.method({
  21254. selector: "value:",
  21255. protocol: "instance creation",
  21256. fn: function (anObject){
  21257. var self=this,$self=this;
  21258. return $core.withContext(function($ctx1) {
  21259. return $recv(anObject)._in_(function (x) {return Promise.resolve(x)});
  21260. return self;
  21261. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.Promise.a$cls)});
  21262. },
  21263. args: ["anObject"],
  21264. source: "value: anObject\x0a\x22Returns a Promise resolved with anObject.\x22\x0a<inlineJS: 'return $recv(anObject)._in_(function (x) {return Promise.resolve(x)})'>",
  21265. referencedClasses: [],
  21266. messageSends: []
  21267. }),
  21268. $globals.Promise.a$cls);
  21269. $core.addTrait("TThenable", "Kernel-Promises");
  21270. $core.addMethod(
  21271. $core.method({
  21272. selector: "catch:",
  21273. protocol: "promises",
  21274. fn: function (aBlock){
  21275. var self=this,$self=this;
  21276. return $core.withContext(function($ctx1) {
  21277. return self.then(null, function (err) {return $core.seamless(function () {
  21278. return aBlock._value_(err);
  21279. })});
  21280. return self;
  21281. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.TThenable)});
  21282. },
  21283. args: ["aBlock"],
  21284. source: "catch: aBlock\x0a<inlineJS: 'return self.then(null, function (err) {return $core.seamless(function () {\x0a return aBlock._value_(err);\x0a})})'>",
  21285. referencedClasses: [],
  21286. messageSends: []
  21287. }),
  21288. $globals.TThenable);
  21289. $core.addMethod(
  21290. $core.method({
  21291. selector: "on:do:",
  21292. protocol: "promises",
  21293. fn: function (aClass,aBlock){
  21294. var self=this,$self=this;
  21295. return $core.withContext(function($ctx1) {
  21296. return self.then(null, function (err) {return $core.seamless(function () {
  21297. if (err._isKindOf_(aClass)) return aBlock._value_(err);
  21298. else throw err;
  21299. })});
  21300. return self;
  21301. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21302. },
  21303. args: ["aClass", "aBlock"],
  21304. 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})})'>",
  21305. referencedClasses: [],
  21306. messageSends: []
  21307. }),
  21308. $globals.TThenable);
  21309. $core.addMethod(
  21310. $core.method({
  21311. selector: "on:do:catch:",
  21312. protocol: "promises",
  21313. fn: function (aClass,aBlock,anotherBlock){
  21314. var self=this,$self=this;
  21315. return $core.withContext(function($ctx1) {
  21316. return $recv($self._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21317. }, function($ctx1) {$ctx1.fill(self,"on:do:catch:",{aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21318. },
  21319. args: ["aClass", "aBlock", "anotherBlock"],
  21320. source: "on: aClass do: aBlock catch: anotherBlock\x0a\x09^ (self on: aClass do: aBlock) catch: anotherBlock",
  21321. referencedClasses: [],
  21322. messageSends: ["catch:", "on:do:"]
  21323. }),
  21324. $globals.TThenable);
  21325. $core.addMethod(
  21326. $core.method({
  21327. selector: "then:",
  21328. protocol: "promises",
  21329. fn: function (aBlockOrArray){
  21330. var self=this,$self=this;
  21331. return $core.withContext(function($ctx1) {
  21332. var array = Array.isArray(aBlockOrArray) ? aBlockOrArray : [aBlockOrArray];
  21333. return array.reduce(function (soFar, aBlock) {
  21334. return soFar.then(typeof aBlock === "function" && aBlock.length > 1 ?
  21335. function (result) {return $core.seamless(function () {
  21336. if (Array.isArray(result)) {
  21337. return aBlock._valueWithPossibleArguments_([result].concat(result.slice(0, aBlock.length-1)));
  21338. } else {
  21339. return aBlock._value_(result);
  21340. }
  21341. })} :
  21342. function (result) {return $core.seamless(function () {
  21343. return aBlock._value_(result);
  21344. })}
  21345. );
  21346. }, self);
  21347. return self;
  21348. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.TThenable)});
  21349. },
  21350. args: ["aBlockOrArray"],
  21351. 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)'>",
  21352. referencedClasses: [],
  21353. messageSends: []
  21354. }),
  21355. $globals.TThenable);
  21356. $core.addMethod(
  21357. $core.method({
  21358. selector: "then:catch:",
  21359. protocol: "promises",
  21360. fn: function (aBlockOrArray,anotherBlock){
  21361. var self=this,$self=this;
  21362. return $core.withContext(function($ctx1) {
  21363. return $recv($self._then_(aBlockOrArray))._catch_(anotherBlock);
  21364. }, function($ctx1) {$ctx1.fill(self,"then:catch:",{aBlockOrArray:aBlockOrArray,anotherBlock:anotherBlock},$globals.TThenable)});
  21365. },
  21366. args: ["aBlockOrArray", "anotherBlock"],
  21367. source: "then: aBlockOrArray catch: anotherBlock\x0a\x09^ (self then: aBlockOrArray) catch: anotherBlock",
  21368. referencedClasses: [],
  21369. messageSends: ["catch:", "then:"]
  21370. }),
  21371. $globals.TThenable);
  21372. $core.addMethod(
  21373. $core.method({
  21374. selector: "then:on:do:",
  21375. protocol: "promises",
  21376. fn: function (aBlockOrArray,aClass,aBlock){
  21377. var self=this,$self=this;
  21378. return $core.withContext(function($ctx1) {
  21379. return $recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock);
  21380. }, function($ctx1) {$ctx1.fill(self,"then:on:do:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock},$globals.TThenable)});
  21381. },
  21382. args: ["aBlockOrArray", "aClass", "aBlock"],
  21383. source: "then: aBlockOrArray on: aClass do: aBlock\x0a\x09^ (self then: aBlockOrArray) on: aClass do: aBlock",
  21384. referencedClasses: [],
  21385. messageSends: ["on:do:", "then:"]
  21386. }),
  21387. $globals.TThenable);
  21388. $core.addMethod(
  21389. $core.method({
  21390. selector: "then:on:do:catch:",
  21391. protocol: "promises",
  21392. fn: function (aBlockOrArray,aClass,aBlock,anotherBlock){
  21393. var self=this,$self=this;
  21394. return $core.withContext(function($ctx1) {
  21395. return $recv($recv($self._then_(aBlockOrArray))._on_do_(aClass,aBlock))._catch_(anotherBlock);
  21396. }, function($ctx1) {$ctx1.fill(self,"then:on:do:catch:",{aBlockOrArray:aBlockOrArray,aClass:aClass,aBlock:aBlock,anotherBlock:anotherBlock},$globals.TThenable)});
  21397. },
  21398. args: ["aBlockOrArray", "aClass", "aBlock", "anotherBlock"],
  21399. source: "then: aBlockOrArray on: aClass do: aBlock catch: anotherBlock\x0a\x09^ ((self then: aBlockOrArray) on: aClass do: aBlock) catch: anotherBlock",
  21400. referencedClasses: [],
  21401. messageSends: ["catch:", "on:do:", "then:"]
  21402. }),
  21403. $globals.TThenable);
  21404. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.Promise);
  21405. });
  21406. 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";
  21407. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  21408. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  21409. $core.addPackage("Kernel-Infrastructure");
  21410. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].innerEval = function (expr) { return eval(expr); };
  21411. ($core.packageDescriptors||$core.packages)["Kernel-Infrastructure"].transport = {"type":"amd","amdNamespace":"amber_core"};
  21412. $core.addClass("AmberBootstrapInitialization", $globals.Object, [], "Kernel-Infrastructure");
  21413. $core.addMethod(
  21414. $core.method({
  21415. selector: "organizeClasses",
  21416. protocol: "organization",
  21417. fn: function (){
  21418. var self=this,$self=this;
  21419. return $core.withContext(function($ctx1) {
  21420. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  21421. return $core.withContext(function($ctx2) {
  21422. return $recv(each)._enterOrganization();
  21423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  21424. }));
  21425. return self;
  21426. }, function($ctx1) {$ctx1.fill(self,"organizeClasses",{},$globals.AmberBootstrapInitialization.a$cls)});
  21427. },
  21428. args: [],
  21429. source: "organizeClasses\x0a\x09Smalltalk classes do: [ :each | each enterOrganization ]",
  21430. referencedClasses: ["Smalltalk"],
  21431. messageSends: ["do:", "classes", "enterOrganization"]
  21432. }),
  21433. $globals.AmberBootstrapInitialization.a$cls);
  21434. $core.addMethod(
  21435. $core.method({
  21436. selector: "organizeMethods",
  21437. protocol: "organization",
  21438. fn: function (){
  21439. var self=this,$self=this;
  21440. return $core.withContext(function($ctx1) {
  21441. $recv($recv($globals.Smalltalk)._classes())._do_((function(eachClass){
  21442. return $core.withContext(function($ctx2) {
  21443. return $recv($recv(eachClass)._definedMethods())._do_((function(eachMethod){
  21444. return $core.withContext(function($ctx3) {
  21445. return $recv($recv(eachMethod)._methodClass())._methodOrganizationEnter_andLeave_(eachMethod,nil);
  21446. }, function($ctx3) {$ctx3.fillBlock({eachMethod:eachMethod},$ctx2,2)});
  21447. }));
  21448. }, function($ctx2) {$ctx2.fillBlock({eachClass:eachClass},$ctx1,1)});
  21449. }));
  21450. $ctx1.sendIdx["do:"]=1;
  21451. return self;
  21452. }, function($ctx1) {$ctx1.fill(self,"organizeMethods",{},$globals.AmberBootstrapInitialization.a$cls)});
  21453. },
  21454. args: [],
  21455. source: "organizeMethods\x0a\x09Smalltalk classes do: [ :eachClass |\x0a\x09\x09eachClass definedMethods do: [ :eachMethod |\x0a\x09\x09\x09eachMethod methodClass methodOrganizationEnter: eachMethod andLeave: nil ] ]",
  21456. referencedClasses: ["Smalltalk"],
  21457. messageSends: ["do:", "classes", "definedMethods", "methodOrganizationEnter:andLeave:", "methodClass"]
  21458. }),
  21459. $globals.AmberBootstrapInitialization.a$cls);
  21460. $core.addMethod(
  21461. $core.method({
  21462. selector: "run",
  21463. protocol: "public api",
  21464. fn: function (){
  21465. var self=this,$self=this;
  21466. return $core.withContext(function($ctx1) {
  21467. $recv($globals.SmalltalkImage)._initialize();
  21468. $self._organizeClasses();
  21469. $self._organizeMethods();
  21470. $recv($globals.Smalltalk)._postLoad();
  21471. return self;
  21472. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.AmberBootstrapInitialization.a$cls)});
  21473. },
  21474. args: [],
  21475. source: "run\x0a\x09SmalltalkImage initialize.\x0a\x09self\x0a\x09\x09organizeClasses;\x0a\x09\x09organizeMethods.\x0a\x09Smalltalk postLoad",
  21476. referencedClasses: ["SmalltalkImage", "Smalltalk"],
  21477. messageSends: ["initialize", "organizeClasses", "organizeMethods", "postLoad"]
  21478. }),
  21479. $globals.AmberBootstrapInitialization.a$cls);
  21480. $core.addClass("JSObjectProxy", $globals.ProtoObject, ["jsObject"], "Kernel-Infrastructure");
  21481. $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`.";
  21482. $core.addMethod(
  21483. $core.method({
  21484. selector: "=",
  21485. protocol: "comparing",
  21486. fn: function (anObject){
  21487. var self=this,$self=this;
  21488. return $core.withContext(function($ctx1) {
  21489. var $2,$1;
  21490. $2=$recv(anObject)._class();
  21491. $ctx1.sendIdx["class"]=1;
  21492. $1=$recv($2).__eq_eq($self._class());
  21493. if(!$core.assert($1)){
  21494. return false;
  21495. }
  21496. return $recv($globals.JSObjectProxy)._compareJSObjectOfProxy_withProxy_(self,anObject);
  21497. }, function($ctx1) {$ctx1.fill(self,"=",{anObject:anObject},$globals.JSObjectProxy)});
  21498. },
  21499. args: ["anObject"],
  21500. source: "= anObject\x0a\x09anObject class == self class ifFalse: [ ^ false ].\x0a\x09^ JSObjectProxy compareJSObjectOfProxy: self withProxy: anObject",
  21501. referencedClasses: ["JSObjectProxy"],
  21502. messageSends: ["ifFalse:", "==", "class", "compareJSObjectOfProxy:withProxy:"]
  21503. }),
  21504. $globals.JSObjectProxy);
  21505. $core.addMethod(
  21506. $core.method({
  21507. selector: "asJavaScriptObject",
  21508. protocol: "converting",
  21509. fn: function (){
  21510. var self=this,$self=this;
  21511. return $self["@jsObject"];
  21512. },
  21513. args: [],
  21514. source: "asJavaScriptObject\x0a\x09\x22Answers the receiver in a stringify-friendly fashion\x22\x0a\x0a\x09^ jsObject",
  21515. referencedClasses: [],
  21516. messageSends: []
  21517. }),
  21518. $globals.JSObjectProxy);
  21519. $core.addMethod(
  21520. $core.method({
  21521. selector: "at:",
  21522. protocol: "accessing",
  21523. fn: function (aString){
  21524. var self=this,$self=this;
  21525. return $core.withContext(function($ctx1) {
  21526. return $self['@jsObject'][aString];
  21527. return self;
  21528. }, function($ctx1) {$ctx1.fill(self,"at:",{aString:aString},$globals.JSObjectProxy)});
  21529. },
  21530. args: ["aString"],
  21531. source: "at: aString\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString]'>",
  21532. referencedClasses: [],
  21533. messageSends: []
  21534. }),
  21535. $globals.JSObjectProxy);
  21536. $core.addMethod(
  21537. $core.method({
  21538. selector: "at:ifAbsent:",
  21539. protocol: "accessing",
  21540. fn: function (aString,aBlock){
  21541. var self=this,$self=this;
  21542. return $core.withContext(function($ctx1) {
  21543. var obj = $self['@jsObject'];
  21544. return aString in obj ? obj[aString] : aBlock._value();
  21545. ;
  21546. return self;
  21547. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21548. },
  21549. args: ["aString", "aBlock"],
  21550. 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'>",
  21551. referencedClasses: [],
  21552. messageSends: []
  21553. }),
  21554. $globals.JSObjectProxy);
  21555. $core.addMethod(
  21556. $core.method({
  21557. selector: "at:ifPresent:",
  21558. protocol: "accessing",
  21559. fn: function (aString,aBlock){
  21560. var self=this,$self=this;
  21561. return $core.withContext(function($ctx1) {
  21562. var obj = $self['@jsObject'];
  21563. return aString in obj ? aBlock._value_(obj[aString]) : nil;
  21564. ;
  21565. return self;
  21566. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:",{aString:aString,aBlock:aBlock},$globals.JSObjectProxy)});
  21567. },
  21568. args: ["aString", "aBlock"],
  21569. 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'>",
  21570. referencedClasses: [],
  21571. messageSends: []
  21572. }),
  21573. $globals.JSObjectProxy);
  21574. $core.addMethod(
  21575. $core.method({
  21576. selector: "at:ifPresent:ifAbsent:",
  21577. protocol: "accessing",
  21578. fn: function (aString,aBlock,anotherBlock){
  21579. var self=this,$self=this;
  21580. return $core.withContext(function($ctx1) {
  21581. var obj = $self['@jsObject'];
  21582. return aString in obj ? aBlock._value_(obj[aString]) : anotherBlock._value();
  21583. ;
  21584. return self;
  21585. }, function($ctx1) {$ctx1.fill(self,"at:ifPresent:ifAbsent:",{aString:aString,aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSObjectProxy)});
  21586. },
  21587. args: ["aString", "aBlock", "anotherBlock"],
  21588. 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'>",
  21589. referencedClasses: [],
  21590. messageSends: []
  21591. }),
  21592. $globals.JSObjectProxy);
  21593. $core.addMethod(
  21594. $core.method({
  21595. selector: "at:put:",
  21596. protocol: "accessing",
  21597. fn: function (aString,anObject){
  21598. var self=this,$self=this;
  21599. return $core.withContext(function($ctx1) {
  21600. return $self['@jsObject'][aString] = anObject;
  21601. return self;
  21602. }, function($ctx1) {$ctx1.fill(self,"at:put:",{aString:aString,anObject:anObject},$globals.JSObjectProxy)});
  21603. },
  21604. args: ["aString", "anObject"],
  21605. source: "at: aString put: anObject\x0a\x09<inlineJS: 'return $self[''@jsObject''][aString] = anObject'>",
  21606. referencedClasses: [],
  21607. messageSends: []
  21608. }),
  21609. $globals.JSObjectProxy);
  21610. $core.addMethod(
  21611. $core.method({
  21612. selector: "catch:",
  21613. protocol: "promises",
  21614. fn: function (aBlock){
  21615. var self=this,$self=this;
  21616. return $core.withContext(function($ctx1) {
  21617. var $1,$2;
  21618. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21619. if($core.assert($1)){
  21620. return $recv($recv($globals.TThenable).__gt_gt("catch:"))._sendTo_arguments_($self["@jsObject"],[aBlock]);
  21621. } else {
  21622. $2=(
  21623. $ctx1.supercall = true,
  21624. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._catch_.apply($self, [aBlock]));
  21625. $ctx1.supercall = false;
  21626. return $2;
  21627. }
  21628. return self;
  21629. }, function($ctx1) {$ctx1.fill(self,"catch:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21630. },
  21631. args: ["aBlock"],
  21632. source: "catch: aBlock\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #catch:) sendTo: jsObject arguments: {aBlock} ]\x0a\x09ifFalse: [ ^ super catch: aBlock ]",
  21633. referencedClasses: ["NativeFunction", "TThenable"],
  21634. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "catch:"]
  21635. }),
  21636. $globals.JSObjectProxy);
  21637. $core.addMethod(
  21638. $core.method({
  21639. selector: "doesNotUnderstand:",
  21640. protocol: "proxy",
  21641. fn: function (aMessage){
  21642. var self=this,$self=this;
  21643. return $core.withContext(function($ctx1) {
  21644. var $1,$receiver;
  21645. $1=$recv($globals.JSObjectProxy)._lookupProperty_ofProxy_($recv($recv(aMessage)._selector())._asJavaScriptPropertyName(),self);
  21646. if(($receiver = $1) == null || $receiver.a$nil){
  21647. return (
  21648. $ctx1.supercall = true,
  21649. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._doesNotUnderstand_.apply($self, [aMessage]));
  21650. $ctx1.supercall = false;
  21651. } else {
  21652. var jsSelector;
  21653. jsSelector=$receiver;
  21654. return $recv($globals.JSObjectProxy)._forwardMessage_withArguments_ofProxy_(jsSelector,$recv(aMessage)._arguments(),self);
  21655. }
  21656. }, function($ctx1) {$ctx1.fill(self,"doesNotUnderstand:",{aMessage:aMessage},$globals.JSObjectProxy)});
  21657. },
  21658. args: ["aMessage"],
  21659. 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 ]",
  21660. referencedClasses: ["JSObjectProxy"],
  21661. messageSends: ["ifNil:ifNotNil:", "lookupProperty:ofProxy:", "asJavaScriptPropertyName", "selector", "doesNotUnderstand:", "forwardMessage:withArguments:ofProxy:", "arguments"]
  21662. }),
  21663. $globals.JSObjectProxy);
  21664. $core.addMethod(
  21665. $core.method({
  21666. selector: "in:",
  21667. protocol: "accessing",
  21668. fn: function (aValuable){
  21669. var self=this,$self=this;
  21670. return $core.withContext(function($ctx1) {
  21671. return $recv(aValuable)._value_($self["@jsObject"]);
  21672. }, function($ctx1) {$ctx1.fill(self,"in:",{aValuable:aValuable},$globals.JSObjectProxy)});
  21673. },
  21674. args: ["aValuable"],
  21675. source: "in: aValuable\x0a\x09^ aValuable value: jsObject",
  21676. referencedClasses: [],
  21677. messageSends: ["value:"]
  21678. }),
  21679. $globals.JSObjectProxy);
  21680. $core.addMethod(
  21681. $core.method({
  21682. selector: "jsObject",
  21683. protocol: "accessing",
  21684. fn: function (){
  21685. var self=this,$self=this;
  21686. return $self["@jsObject"];
  21687. },
  21688. args: [],
  21689. source: "jsObject\x0a\x09^ jsObject",
  21690. referencedClasses: [],
  21691. messageSends: []
  21692. }),
  21693. $globals.JSObjectProxy);
  21694. $core.addMethod(
  21695. $core.method({
  21696. selector: "keysAndValuesDo:",
  21697. protocol: "enumerating",
  21698. fn: function (aBlock){
  21699. var self=this,$self=this;
  21700. return $core.withContext(function($ctx1) {
  21701. var o = $self['@jsObject'];
  21702. for(var i in o) {
  21703. aBlock._value_value_(i, o[i]);
  21704. }
  21705. ;
  21706. return self;
  21707. }, function($ctx1) {$ctx1.fill(self,"keysAndValuesDo:",{aBlock:aBlock},$globals.JSObjectProxy)});
  21708. },
  21709. args: ["aBlock"],
  21710. 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'>",
  21711. referencedClasses: [],
  21712. messageSends: []
  21713. }),
  21714. $globals.JSObjectProxy);
  21715. $core.addMethod(
  21716. $core.method({
  21717. selector: "on:do:",
  21718. protocol: "promises",
  21719. fn: function (aClass,aBlock){
  21720. var self=this,$self=this;
  21721. return $core.withContext(function($ctx1) {
  21722. var $1,$2;
  21723. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21724. if($core.assert($1)){
  21725. return $recv($recv($globals.TThenable).__gt_gt("on:do:"))._sendTo_arguments_($self["@jsObject"],[aClass,aBlock]);
  21726. } else {
  21727. $2=(
  21728. $ctx1.supercall = true,
  21729. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._on_do_.apply($self, [aClass,aBlock]));
  21730. $ctx1.supercall = false;
  21731. return $2;
  21732. }
  21733. return self;
  21734. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.JSObjectProxy)});
  21735. },
  21736. args: ["aClass", "aBlock"],
  21737. 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 ]",
  21738. referencedClasses: ["NativeFunction", "TThenable"],
  21739. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "on:do:"]
  21740. }),
  21741. $globals.JSObjectProxy);
  21742. $core.addMethod(
  21743. $core.method({
  21744. selector: "printOn:",
  21745. protocol: "printing",
  21746. fn: function (aStream){
  21747. var self=this,$self=this;
  21748. return $core.withContext(function($ctx1) {
  21749. $recv(aStream)._nextPutAll_($self._printString());
  21750. return self;
  21751. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21752. },
  21753. args: ["aStream"],
  21754. source: "printOn: aStream\x0a\x09aStream nextPutAll: self printString",
  21755. referencedClasses: [],
  21756. messageSends: ["nextPutAll:", "printString"]
  21757. }),
  21758. $globals.JSObjectProxy);
  21759. $core.addMethod(
  21760. $core.method({
  21761. selector: "printString",
  21762. protocol: "printing",
  21763. fn: function (){
  21764. var self=this,$self=this;
  21765. return $core.withContext(function($ctx1) {
  21766. var js = $self['@jsObject'];
  21767. return js.toString
  21768. ? js.toString()
  21769. : Object.prototype.toString.call(js)
  21770. ;
  21771. return self;
  21772. }, function($ctx1) {$ctx1.fill(self,"printString",{},$globals.JSObjectProxy)});
  21773. },
  21774. args: [],
  21775. 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'>",
  21776. referencedClasses: [],
  21777. messageSends: []
  21778. }),
  21779. $globals.JSObjectProxy);
  21780. $core.addMethod(
  21781. $core.method({
  21782. selector: "putOn:",
  21783. protocol: "streaming",
  21784. fn: function (aStream){
  21785. var self=this,$self=this;
  21786. return $core.withContext(function($ctx1) {
  21787. $recv(aStream)._nextPutJSObject_($self["@jsObject"]);
  21788. return self;
  21789. }, function($ctx1) {$ctx1.fill(self,"putOn:",{aStream:aStream},$globals.JSObjectProxy)});
  21790. },
  21791. args: ["aStream"],
  21792. source: "putOn: aStream\x0a\x09aStream nextPutJSObject: jsObject",
  21793. referencedClasses: [],
  21794. messageSends: ["nextPutJSObject:"]
  21795. }),
  21796. $globals.JSObjectProxy);
  21797. $core.addMethod(
  21798. $core.method({
  21799. selector: "removeKey:",
  21800. protocol: "accessing",
  21801. fn: function (aString){
  21802. var self=this,$self=this;
  21803. return $core.withContext(function($ctx1) {
  21804. delete $self['@jsObject'][aString]; return aString;
  21805. return self;
  21806. }, function($ctx1) {$ctx1.fill(self,"removeKey:",{aString:aString},$globals.JSObjectProxy)});
  21807. },
  21808. args: ["aString"],
  21809. source: "removeKey: aString\x0a\x09<inlineJS: 'delete $self[''@jsObject''][aString]; return aString'>",
  21810. referencedClasses: [],
  21811. messageSends: []
  21812. }),
  21813. $globals.JSObjectProxy);
  21814. $core.addMethod(
  21815. $core.method({
  21816. selector: "then:",
  21817. protocol: "promises",
  21818. fn: function (aBlockOrArray){
  21819. var self=this,$self=this;
  21820. return $core.withContext(function($ctx1) {
  21821. var $1,$2;
  21822. $1=$recv($globals.NativeFunction)._isNativeFunction_($self._at_("then"));
  21823. if($core.assert($1)){
  21824. return $recv($recv($globals.TThenable).__gt_gt("then:"))._sendTo_arguments_($self["@jsObject"],[aBlockOrArray]);
  21825. } else {
  21826. $2=(
  21827. $ctx1.supercall = true,
  21828. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._then_.apply($self, [aBlockOrArray]));
  21829. $ctx1.supercall = false;
  21830. return $2;
  21831. }
  21832. return self;
  21833. }, function($ctx1) {$ctx1.fill(self,"then:",{aBlockOrArray:aBlockOrArray},$globals.JSObjectProxy)});
  21834. },
  21835. args: ["aBlockOrArray"],
  21836. source: "then: aBlockOrArray\x0a(NativeFunction isNativeFunction: (self at: #then))\x0a\x09ifTrue: [ ^ (TThenable >> #then:) sendTo: jsObject arguments: {aBlockOrArray} ]\x0a\x09ifFalse: [ ^ super then: aBlockOrArray ]",
  21837. referencedClasses: ["NativeFunction", "TThenable"],
  21838. messageSends: ["ifTrue:ifFalse:", "isNativeFunction:", "at:", "sendTo:arguments:", ">>", "then:"]
  21839. }),
  21840. $globals.JSObjectProxy);
  21841. $core.addMethod(
  21842. $core.method({
  21843. selector: "addObjectVariablesTo:ofProxy:",
  21844. protocol: "proxy",
  21845. fn: function (aDictionary,aProxy){
  21846. var self=this,$self=this;
  21847. return $core.withContext(function($ctx1) {
  21848. var jsObject = aProxy['@jsObject'];
  21849. for(var i in jsObject) {
  21850. aDictionary._at_put_(i, jsObject[i]);
  21851. }
  21852. ;
  21853. return self;
  21854. }, function($ctx1) {$ctx1.fill(self,"addObjectVariablesTo:ofProxy:",{aDictionary:aDictionary,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21855. },
  21856. args: ["aDictionary", "aProxy"],
  21857. 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'>",
  21858. referencedClasses: [],
  21859. messageSends: []
  21860. }),
  21861. $globals.JSObjectProxy.a$cls);
  21862. $core.addMethod(
  21863. $core.method({
  21864. selector: "compareJSObjectOfProxy:withProxy:",
  21865. protocol: "proxy",
  21866. fn: function (aProxy,anotherProxy){
  21867. var self=this,$self=this;
  21868. return $core.withContext(function($ctx1) {
  21869. var anotherJSObject = anotherProxy.a$cls ? anotherProxy["@jsObject"] : anotherProxy;
  21870. return aProxy["@jsObject"] === anotherJSObject;
  21871. return self;
  21872. }, function($ctx1) {$ctx1.fill(self,"compareJSObjectOfProxy:withProxy:",{aProxy:aProxy,anotherProxy:anotherProxy},$globals.JSObjectProxy.a$cls)});
  21873. },
  21874. args: ["aProxy", "anotherProxy"],
  21875. 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'>",
  21876. referencedClasses: [],
  21877. messageSends: []
  21878. }),
  21879. $globals.JSObjectProxy.a$cls);
  21880. $core.addMethod(
  21881. $core.method({
  21882. selector: "forwardMessage:withArguments:ofProxy:",
  21883. protocol: "proxy",
  21884. fn: function (aString,anArray,aProxy){
  21885. var self=this,$self=this;
  21886. return $core.withContext(function($ctx1) {
  21887. return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);
  21888. ;
  21889. return self;
  21890. }, function($ctx1) {$ctx1.fill(self,"forwardMessage:withArguments:ofProxy:",{aString:aString,anArray:anArray,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21891. },
  21892. args: ["aString", "anArray", "aProxy"],
  21893. source: "forwardMessage: aString withArguments: anArray ofProxy: aProxy\x0a\x09<inlineJS: '\x0a\x09\x09return $core.accessJavaScript(aProxy._jsObject(), aString, anArray);\x0a\x09'>",
  21894. referencedClasses: [],
  21895. messageSends: []
  21896. }),
  21897. $globals.JSObjectProxy.a$cls);
  21898. $core.addMethod(
  21899. $core.method({
  21900. selector: "jsObject:ofProxy:",
  21901. protocol: "proxy",
  21902. fn: function (aJSObject,aProxy){
  21903. var self=this,$self=this;
  21904. return $core.withContext(function($ctx1) {
  21905. aProxy['@jsObject'] = aJSObject;
  21906. return self;
  21907. }, function($ctx1) {$ctx1.fill(self,"jsObject:ofProxy:",{aJSObject:aJSObject,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21908. },
  21909. args: ["aJSObject", "aProxy"],
  21910. source: "jsObject: aJSObject ofProxy: aProxy\x0a\x09<inlineJS: 'aProxy[''@jsObject''] = aJSObject'>",
  21911. referencedClasses: [],
  21912. messageSends: []
  21913. }),
  21914. $globals.JSObjectProxy.a$cls);
  21915. $core.addMethod(
  21916. $core.method({
  21917. selector: "lookupProperty:ofProxy:",
  21918. protocol: "proxy",
  21919. fn: function (aString,aProxy){
  21920. var self=this,$self=this;
  21921. return $core.withContext(function($ctx1) {
  21922. return aString in aProxy._jsObject() ? aString : nil;
  21923. return self;
  21924. }, function($ctx1) {$ctx1.fill(self,"lookupProperty:ofProxy:",{aString:aString,aProxy:aProxy},$globals.JSObjectProxy.a$cls)});
  21925. },
  21926. args: ["aString", "aProxy"],
  21927. 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'>",
  21928. referencedClasses: [],
  21929. messageSends: []
  21930. }),
  21931. $globals.JSObjectProxy.a$cls);
  21932. $core.addMethod(
  21933. $core.method({
  21934. selector: "null",
  21935. protocol: "accessing",
  21936. fn: function (){
  21937. var self=this,$self=this;
  21938. return $core.withContext(function($ctx1) {
  21939. return null;
  21940. return self;
  21941. }, function($ctx1) {$ctx1.fill(self,"null",{},$globals.JSObjectProxy.a$cls)});
  21942. },
  21943. args: [],
  21944. source: "null\x0a\x09<inlineJS: 'return null'>",
  21945. referencedClasses: [],
  21946. messageSends: []
  21947. }),
  21948. $globals.JSObjectProxy.a$cls);
  21949. $core.addMethod(
  21950. $core.method({
  21951. selector: "on:",
  21952. protocol: "instance creation",
  21953. fn: function (aJSObject){
  21954. var self=this,$self=this;
  21955. var instance;
  21956. return $core.withContext(function($ctx1) {
  21957. instance=$self._new();
  21958. $self._jsObject_ofProxy_(aJSObject,instance);
  21959. return instance;
  21960. }, function($ctx1) {$ctx1.fill(self,"on:",{aJSObject:aJSObject,instance:instance},$globals.JSObjectProxy.a$cls)});
  21961. },
  21962. args: ["aJSObject"],
  21963. source: "on: aJSObject\x0a\x09| instance |\x0a\x09instance := self new.\x0a\x09self jsObject: aJSObject ofProxy: instance.\x0a\x09^ instance",
  21964. referencedClasses: [],
  21965. messageSends: ["new", "jsObject:ofProxy:"]
  21966. }),
  21967. $globals.JSObjectProxy.a$cls);
  21968. $core.addMethod(
  21969. $core.method({
  21970. selector: "undefined",
  21971. protocol: "accessing",
  21972. fn: function (){
  21973. var self=this,$self=this;
  21974. return $core.withContext(function($ctx1) {
  21975. return undefined;
  21976. return self;
  21977. }, function($ctx1) {$ctx1.fill(self,"undefined",{},$globals.JSObjectProxy.a$cls)});
  21978. },
  21979. args: [],
  21980. source: "undefined\x0a\x09<inlineJS: 'return undefined'>",
  21981. referencedClasses: [],
  21982. messageSends: []
  21983. }),
  21984. $globals.JSObjectProxy.a$cls);
  21985. $core.addClass("Organizer", $globals.Object, ["elements"], "Kernel-Infrastructure");
  21986. $globals.Organizer.comment="I represent categorization information. \x0a\x0a## API\x0a\x0aUse `#addElement:` and `#removeElement:` to manipulate instances.";
  21987. $core.addMethod(
  21988. $core.method({
  21989. selector: "addElement:",
  21990. protocol: "accessing",
  21991. fn: function (anObject){
  21992. var self=this,$self=this;
  21993. return $core.withContext(function($ctx1) {
  21994. $recv($self._elements())._add_(anObject);
  21995. return self;
  21996. }, function($ctx1) {$ctx1.fill(self,"addElement:",{anObject:anObject},$globals.Organizer)});
  21997. },
  21998. args: ["anObject"],
  21999. source: "addElement: anObject\x0a\x09self elements add: anObject",
  22000. referencedClasses: [],
  22001. messageSends: ["add:", "elements"]
  22002. }),
  22003. $globals.Organizer);
  22004. $core.addMethod(
  22005. $core.method({
  22006. selector: "elements",
  22007. protocol: "accessing",
  22008. fn: function (){
  22009. var self=this,$self=this;
  22010. return $self["@elements"];
  22011. },
  22012. args: [],
  22013. source: "elements\x0a\x09^ elements",
  22014. referencedClasses: [],
  22015. messageSends: []
  22016. }),
  22017. $globals.Organizer);
  22018. $core.addMethod(
  22019. $core.method({
  22020. selector: "initialize",
  22021. protocol: "initialization",
  22022. fn: function (){
  22023. var self=this,$self=this;
  22024. return $core.withContext(function($ctx1) {
  22025. (
  22026. $ctx1.supercall = true,
  22027. ($globals.Organizer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22028. $ctx1.supercall = false;
  22029. $self["@elements"]=$recv($globals.Set)._new();
  22030. return self;
  22031. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Organizer)});
  22032. },
  22033. args: [],
  22034. source: "initialize\x0a\x09super initialize.\x0a\x09elements := Set new",
  22035. referencedClasses: ["Set"],
  22036. messageSends: ["initialize", "new"]
  22037. }),
  22038. $globals.Organizer);
  22039. $core.addMethod(
  22040. $core.method({
  22041. selector: "removeElement:",
  22042. protocol: "accessing",
  22043. fn: function (anObject){
  22044. var self=this,$self=this;
  22045. return $core.withContext(function($ctx1) {
  22046. $recv($self._elements())._remove_ifAbsent_(anObject,(function(){
  22047. }));
  22048. return self;
  22049. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{anObject:anObject},$globals.Organizer)});
  22050. },
  22051. args: ["anObject"],
  22052. source: "removeElement: anObject\x0a\x09self elements remove: anObject ifAbsent: []",
  22053. referencedClasses: [],
  22054. messageSends: ["remove:ifAbsent:", "elements"]
  22055. }),
  22056. $globals.Organizer);
  22057. $core.addClass("ClassOrganizer", $globals.Organizer, ["traitOrBehavior"], "Kernel-Infrastructure");
  22058. $globals.ClassOrganizer.comment="I am an organizer specific to classes. I hold method categorization information for classes.";
  22059. $core.addMethod(
  22060. $core.method({
  22061. selector: "addElement:",
  22062. protocol: "accessing",
  22063. fn: function (aString){
  22064. var self=this,$self=this;
  22065. return $core.withContext(function($ctx1) {
  22066. var $1,$3,$2;
  22067. (
  22068. $ctx1.supercall = true,
  22069. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._addElement_.apply($self, [aString]));
  22070. $ctx1.supercall = false;
  22071. $1=$recv($globals.SystemAnnouncer)._current();
  22072. $3=$recv($globals.ProtocolAdded)._new();
  22073. $recv($3)._protocol_(aString);
  22074. $recv($3)._theClass_($self._theClass());
  22075. $2=$recv($3)._yourself();
  22076. $recv($1)._announce_($2);
  22077. return self;
  22078. }, function($ctx1) {$ctx1.fill(self,"addElement:",{aString:aString},$globals.ClassOrganizer)});
  22079. },
  22080. args: ["aString"],
  22081. 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)",
  22082. referencedClasses: ["SystemAnnouncer", "ProtocolAdded"],
  22083. messageSends: ["addElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22084. }),
  22085. $globals.ClassOrganizer);
  22086. $core.addMethod(
  22087. $core.method({
  22088. selector: "removeElement:",
  22089. protocol: "accessing",
  22090. fn: function (aString){
  22091. var self=this,$self=this;
  22092. return $core.withContext(function($ctx1) {
  22093. var $1,$3,$2;
  22094. (
  22095. $ctx1.supercall = true,
  22096. ($globals.ClassOrganizer.superclass||$boot.nilAsClass).fn.prototype._removeElement_.apply($self, [aString]));
  22097. $ctx1.supercall = false;
  22098. $1=$recv($globals.SystemAnnouncer)._current();
  22099. $3=$recv($globals.ProtocolRemoved)._new();
  22100. $recv($3)._protocol_(aString);
  22101. $recv($3)._theClass_($self._theClass());
  22102. $2=$recv($3)._yourself();
  22103. $recv($1)._announce_($2);
  22104. return self;
  22105. }, function($ctx1) {$ctx1.fill(self,"removeElement:",{aString:aString},$globals.ClassOrganizer)});
  22106. },
  22107. args: ["aString"],
  22108. 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)",
  22109. referencedClasses: ["SystemAnnouncer", "ProtocolRemoved"],
  22110. messageSends: ["removeElement:", "announce:", "current", "protocol:", "new", "theClass:", "theClass", "yourself"]
  22111. }),
  22112. $globals.ClassOrganizer);
  22113. $core.addMethod(
  22114. $core.method({
  22115. selector: "theClass",
  22116. protocol: "accessing",
  22117. fn: function (){
  22118. var self=this,$self=this;
  22119. return $self["@traitOrBehavior"];
  22120. },
  22121. args: [],
  22122. source: "theClass\x0a\x09^ traitOrBehavior",
  22123. referencedClasses: [],
  22124. messageSends: []
  22125. }),
  22126. $globals.ClassOrganizer);
  22127. $core.addMethod(
  22128. $core.method({
  22129. selector: "theClass:",
  22130. protocol: "accessing",
  22131. fn: function (aClass){
  22132. var self=this,$self=this;
  22133. $self["@traitOrBehavior"]=aClass;
  22134. return self;
  22135. },
  22136. args: ["aClass"],
  22137. source: "theClass: aClass\x0a\x09traitOrBehavior := aClass",
  22138. referencedClasses: [],
  22139. messageSends: []
  22140. }),
  22141. $globals.ClassOrganizer);
  22142. $core.addMethod(
  22143. $core.method({
  22144. selector: "on:",
  22145. protocol: "instance creation",
  22146. fn: function (aClass){
  22147. var self=this,$self=this;
  22148. return $core.withContext(function($ctx1) {
  22149. var $1;
  22150. $1=$self._new();
  22151. $recv($1)._theClass_(aClass);
  22152. return $recv($1)._yourself();
  22153. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.ClassOrganizer.a$cls)});
  22154. },
  22155. args: ["aClass"],
  22156. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  22157. referencedClasses: [],
  22158. messageSends: ["theClass:", "new", "yourself"]
  22159. }),
  22160. $globals.ClassOrganizer.a$cls);
  22161. $core.addClass("PackageOrganizer", $globals.Organizer, [], "Kernel-Infrastructure");
  22162. $globals.PackageOrganizer.comment="I am an organizer specific to packages. I hold classes categorization information.";
  22163. $core.addClass("Package", $globals.Object, ["evalBlock", "basicTransport", "name", "transport", "imports", "dirty", "organization"], "Kernel-Infrastructure");
  22164. $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'";
  22165. $core.addMethod(
  22166. $core.method({
  22167. selector: "basicTransport",
  22168. protocol: "private",
  22169. fn: function (){
  22170. var self=this,$self=this;
  22171. return $self["@basicTransport"];
  22172. },
  22173. args: [],
  22174. source: "basicTransport\x0a\x09\x22Answer the transport literal JavaScript object as setup in the JavaScript file, if any\x22\x0a\x09\x0a\x09^ basicTransport",
  22175. referencedClasses: [],
  22176. messageSends: []
  22177. }),
  22178. $globals.Package);
  22179. $core.addMethod(
  22180. $core.method({
  22181. selector: "beClean",
  22182. protocol: "accessing",
  22183. fn: function (){
  22184. var self=this,$self=this;
  22185. return $core.withContext(function($ctx1) {
  22186. var $1,$3,$2;
  22187. $self["@dirty"]=false;
  22188. $1=$recv($globals.SystemAnnouncer)._current();
  22189. $3=$recv($globals.PackageClean)._new();
  22190. $recv($3)._package_(self);
  22191. $2=$recv($3)._yourself();
  22192. $recv($1)._announce_($2);
  22193. return self;
  22194. }, function($ctx1) {$ctx1.fill(self,"beClean",{},$globals.Package)});
  22195. },
  22196. args: [],
  22197. source: "beClean\x0a\x09dirty := false.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageClean new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22198. referencedClasses: ["SystemAnnouncer", "PackageClean"],
  22199. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22200. }),
  22201. $globals.Package);
  22202. $core.addMethod(
  22203. $core.method({
  22204. selector: "beDirty",
  22205. protocol: "accessing",
  22206. fn: function (){
  22207. var self=this,$self=this;
  22208. return $core.withContext(function($ctx1) {
  22209. var $1,$3,$2;
  22210. $self["@dirty"]=true;
  22211. $1=$recv($globals.SystemAnnouncer)._current();
  22212. $3=$recv($globals.PackageDirty)._new();
  22213. $recv($3)._package_(self);
  22214. $2=$recv($3)._yourself();
  22215. $recv($1)._announce_($2);
  22216. return self;
  22217. }, function($ctx1) {$ctx1.fill(self,"beDirty",{},$globals.Package)});
  22218. },
  22219. args: [],
  22220. source: "beDirty\x0a\x09dirty := true.\x0a\x09\x0a\x09SystemAnnouncer current announce: (PackageDirty new\x0a\x09\x09package: self;\x0a\x09\x09yourself)",
  22221. referencedClasses: ["SystemAnnouncer", "PackageDirty"],
  22222. messageSends: ["announce:", "current", "package:", "new", "yourself"]
  22223. }),
  22224. $globals.Package);
  22225. $core.addMethod(
  22226. $core.method({
  22227. selector: "classTemplate",
  22228. protocol: "accessing",
  22229. fn: function (){
  22230. var self=this,$self=this;
  22231. return $core.withContext(function($ctx1) {
  22232. return $recv($globals.String)._streamContents_((function(stream){
  22233. return $core.withContext(function($ctx2) {
  22234. $recv(stream)._write_("Object subclass: #NameOfSubclass");
  22235. $ctx2.sendIdx["write:"]=1;
  22236. $recv(stream)._lf();
  22237. $ctx2.sendIdx["lf"]=1;
  22238. $recv(stream)._tab();
  22239. $ctx2.sendIdx["tab"]=1;
  22240. $recv(stream)._write_("instanceVariableNames: ''");
  22241. $ctx2.sendIdx["write:"]=2;
  22242. $recv(stream)._lf();
  22243. $recv(stream)._tab();
  22244. $recv(stream)._write_("package: ");
  22245. return $recv(stream)._print_($self._name());
  22246. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22247. }));
  22248. }, function($ctx1) {$ctx1.fill(self,"classTemplate",{},$globals.Package)});
  22249. },
  22250. args: [],
  22251. 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 ]",
  22252. referencedClasses: ["String"],
  22253. messageSends: ["streamContents:", "write:", "lf", "tab", "print:", "name"]
  22254. }),
  22255. $globals.Package);
  22256. $core.addMethod(
  22257. $core.method({
  22258. selector: "classes",
  22259. protocol: "classes",
  22260. fn: function (){
  22261. var self=this,$self=this;
  22262. return $core.withContext(function($ctx1) {
  22263. return $recv($recv($self._organization())._elements())._copy();
  22264. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Package)});
  22265. },
  22266. args: [],
  22267. source: "classes\x0a\x09^ self organization elements copy",
  22268. referencedClasses: [],
  22269. messageSends: ["copy", "elements", "organization"]
  22270. }),
  22271. $globals.Package);
  22272. $core.addMethod(
  22273. $core.method({
  22274. selector: "definition",
  22275. protocol: "accessing",
  22276. fn: function (){
  22277. var self=this,$self=this;
  22278. return $core.withContext(function($ctx1) {
  22279. var $1;
  22280. return $recv($globals.String)._streamContents_((function(stream){
  22281. return $core.withContext(function($ctx2) {
  22282. $1=$recv($self._class())._name();
  22283. $ctx2.sendIdx["name"]=1;
  22284. $recv(stream)._write_($1);
  22285. $ctx2.sendIdx["write:"]=1;
  22286. $recv(stream)._lf();
  22287. $ctx2.sendIdx["lf"]=1;
  22288. $recv(stream)._tab();
  22289. $ctx2.sendIdx["tab"]=1;
  22290. $recv(stream)._write_("named: ");
  22291. $ctx2.sendIdx["write:"]=2;
  22292. $recv(stream)._print_($self._name());
  22293. $recv(stream)._lf();
  22294. $ctx2.sendIdx["lf"]=2;
  22295. $recv(stream)._tab();
  22296. $ctx2.sendIdx["tab"]=2;
  22297. $recv(stream)._write_(["imports: ",$self._importsDefinition()]);
  22298. $ctx2.sendIdx["write:"]=3;
  22299. $recv(stream)._lf();
  22300. $recv(stream)._tab();
  22301. return $recv(stream)._write_(["transport: (",$recv($self._transport())._definition(),")"]);
  22302. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22303. }));
  22304. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.Package)});
  22305. },
  22306. args: [],
  22307. 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. ')' } ]",
  22308. referencedClasses: ["String"],
  22309. messageSends: ["streamContents:", "write:", "name", "class", "lf", "tab", "print:", "importsDefinition", "definition", "transport"]
  22310. }),
  22311. $globals.Package);
  22312. $core.addMethod(
  22313. $core.method({
  22314. selector: "eval:",
  22315. protocol: "evaluating",
  22316. fn: function (aString){
  22317. var self=this,$self=this;
  22318. return $core.withContext(function($ctx1) {
  22319. var $1,$receiver;
  22320. $1=$self["@evalBlock"];
  22321. if(($receiver = $1) == null || $receiver.a$nil){
  22322. return $recv($globals.Compiler)._eval_(aString);
  22323. } else {
  22324. return $recv($self["@evalBlock"])._value_(aString);
  22325. }
  22326. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Package)});
  22327. },
  22328. args: ["aString"],
  22329. source: "eval: aString\x0a\x09^ evalBlock\x0a\x09\x09ifNotNil: [ evalBlock value: aString ]\x0a\x09\x09ifNil: [ Compiler eval: aString ]",
  22330. referencedClasses: ["Compiler"],
  22331. messageSends: ["ifNotNil:ifNil:", "value:", "eval:"]
  22332. }),
  22333. $globals.Package);
  22334. $core.addMethod(
  22335. $core.method({
  22336. selector: "evalBlock",
  22337. protocol: "accessing",
  22338. fn: function (){
  22339. var self=this,$self=this;
  22340. return $self["@evalBlock"];
  22341. },
  22342. args: [],
  22343. source: "evalBlock\x0a\x09^ evalBlock",
  22344. referencedClasses: [],
  22345. messageSends: []
  22346. }),
  22347. $globals.Package);
  22348. $core.addMethod(
  22349. $core.method({
  22350. selector: "evalBlock:",
  22351. protocol: "accessing",
  22352. fn: function (aBlock){
  22353. var self=this,$self=this;
  22354. $self["@evalBlock"]=aBlock;
  22355. return self;
  22356. },
  22357. args: ["aBlock"],
  22358. source: "evalBlock: aBlock\x0a\x09evalBlock := aBlock",
  22359. referencedClasses: [],
  22360. messageSends: []
  22361. }),
  22362. $globals.Package);
  22363. $core.addMethod(
  22364. $core.method({
  22365. selector: "imports",
  22366. protocol: "accessing",
  22367. fn: function (){
  22368. var self=this,$self=this;
  22369. return $core.withContext(function($ctx1) {
  22370. var $1,$receiver;
  22371. $1=$self["@imports"];
  22372. if(($receiver = $1) == null || $receiver.a$nil){
  22373. $self._imports_([]);
  22374. return $self["@imports"];
  22375. } else {
  22376. return $1;
  22377. }
  22378. }, function($ctx1) {$ctx1.fill(self,"imports",{},$globals.Package)});
  22379. },
  22380. args: [],
  22381. source: "imports\x0a\x09^ imports ifNil: [\x0a\x09\x09self imports: #().\x0a\x09\x09imports ]",
  22382. referencedClasses: [],
  22383. messageSends: ["ifNil:", "imports:"]
  22384. }),
  22385. $globals.Package);
  22386. $core.addMethod(
  22387. $core.method({
  22388. selector: "imports:",
  22389. protocol: "accessing",
  22390. fn: function (anArray){
  22391. var self=this,$self=this;
  22392. return $core.withContext(function($ctx1) {
  22393. $self._validateImports_(anArray);
  22394. $self["@imports"]=$recv(anArray)._asSet();
  22395. return self;
  22396. }, function($ctx1) {$ctx1.fill(self,"imports:",{anArray:anArray},$globals.Package)});
  22397. },
  22398. args: ["anArray"],
  22399. source: "imports: anArray\x0a\x09self validateImports: anArray.\x0a\x09imports := anArray asSet",
  22400. referencedClasses: [],
  22401. messageSends: ["validateImports:", "asSet"]
  22402. }),
  22403. $globals.Package);
  22404. $core.addMethod(
  22405. $core.method({
  22406. selector: "importsAsJson",
  22407. protocol: "converting",
  22408. fn: function (){
  22409. var self=this,$self=this;
  22410. return $core.withContext(function($ctx1) {
  22411. var $1;
  22412. return $recv($self._sortedImportsAsArray())._collect_((function(each){
  22413. return $core.withContext(function($ctx2) {
  22414. $1=$recv(each)._isString();
  22415. if($core.assert($1)){
  22416. return each;
  22417. } else {
  22418. return $recv($recv($recv(each)._key()).__comma("=")).__comma($recv(each)._value());
  22419. $ctx2.sendIdx[","]=1;
  22420. }
  22421. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22422. }));
  22423. }, function($ctx1) {$ctx1.fill(self,"importsAsJson",{},$globals.Package)});
  22424. },
  22425. args: [],
  22426. 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 ]]",
  22427. referencedClasses: [],
  22428. messageSends: ["collect:", "sortedImportsAsArray", "ifTrue:ifFalse:", "isString", ",", "key", "value"]
  22429. }),
  22430. $globals.Package);
  22431. $core.addMethod(
  22432. $core.method({
  22433. selector: "importsDefinition",
  22434. protocol: "accessing",
  22435. fn: function (){
  22436. var self=this,$self=this;
  22437. return $core.withContext(function($ctx1) {
  22438. return $recv($globals.String)._streamContents_((function(stream){
  22439. return $core.withContext(function($ctx2) {
  22440. $recv(stream)._write_("{");
  22441. $ctx2.sendIdx["write:"]=1;
  22442. $recv($self._sortedImportsAsArray())._do_separatedBy_((function(each){
  22443. return $core.withContext(function($ctx3) {
  22444. return $recv(stream)._print_(each);
  22445. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  22446. }),(function(){
  22447. return $core.withContext(function($ctx3) {
  22448. return $recv(stream)._write_(". ");
  22449. $ctx3.sendIdx["write:"]=2;
  22450. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  22451. }));
  22452. return $recv(stream)._write_("}");
  22453. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  22454. }));
  22455. }, function($ctx1) {$ctx1.fill(self,"importsDefinition",{},$globals.Package)});
  22456. },
  22457. args: [],
  22458. 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: '}' ]",
  22459. referencedClasses: ["String"],
  22460. messageSends: ["streamContents:", "write:", "do:separatedBy:", "sortedImportsAsArray", "print:"]
  22461. }),
  22462. $globals.Package);
  22463. $core.addMethod(
  22464. $core.method({
  22465. selector: "importsFromJson:",
  22466. protocol: "converting",
  22467. fn: function (anArray){
  22468. var self=this,$self=this;
  22469. return $core.withContext(function($ctx1) {
  22470. var $1;
  22471. return $recv(anArray)._collect_((function(each){
  22472. var split;
  22473. return $core.withContext(function($ctx2) {
  22474. split=$recv(each)._tokenize_("=");
  22475. $1=$recv($recv(split)._size()).__eq((1));
  22476. if($core.assert($1)){
  22477. return $recv(split)._first();
  22478. $ctx2.sendIdx["first"]=1;
  22479. } else {
  22480. return $recv($recv(split)._first()).__minus_gt($recv(split)._second());
  22481. }
  22482. }, function($ctx2) {$ctx2.fillBlock({each:each,split:split},$ctx1,1)});
  22483. }));
  22484. }, function($ctx1) {$ctx1.fill(self,"importsFromJson:",{anArray:anArray},$globals.Package)});
  22485. },
  22486. args: ["anArray"],
  22487. 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 ]]",
  22488. referencedClasses: [],
  22489. messageSends: ["collect:", "tokenize:", "ifTrue:ifFalse:", "=", "size", "first", "->", "second"]
  22490. }),
  22491. $globals.Package);
  22492. $core.addMethod(
  22493. $core.method({
  22494. selector: "initialize",
  22495. protocol: "initialization",
  22496. fn: function (){
  22497. var self=this,$self=this;
  22498. return $core.withContext(function($ctx1) {
  22499. (
  22500. $ctx1.supercall = true,
  22501. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  22502. $ctx1.supercall = false;
  22503. $self["@organization"]=$recv($globals.PackageOrganizer)._new();
  22504. $self["@evalBlock"]=nil;
  22505. $self["@dirty"]=nil;
  22506. $self["@imports"]=nil;
  22507. $self["@transport"]=nil;
  22508. return self;
  22509. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Package)});
  22510. },
  22511. args: [],
  22512. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09organization := PackageOrganizer new.\x0a\x09evalBlock := nil.\x0a\x09dirty := nil.\x0a\x09imports := nil.\x0a\x09transport := nil",
  22513. referencedClasses: ["PackageOrganizer"],
  22514. messageSends: ["initialize", "new"]
  22515. }),
  22516. $globals.Package);
  22517. $core.addMethod(
  22518. $core.method({
  22519. selector: "isDirty",
  22520. protocol: "testing",
  22521. fn: function (){
  22522. var self=this,$self=this;
  22523. return $core.withContext(function($ctx1) {
  22524. var $1,$receiver;
  22525. $1=$self["@dirty"];
  22526. if(($receiver = $1) == null || $receiver.a$nil){
  22527. return false;
  22528. } else {
  22529. return $1;
  22530. }
  22531. }, function($ctx1) {$ctx1.fill(self,"isDirty",{},$globals.Package)});
  22532. },
  22533. args: [],
  22534. source: "isDirty\x0a\x09^ dirty ifNil: [ false ]",
  22535. referencedClasses: [],
  22536. messageSends: ["ifNil:"]
  22537. }),
  22538. $globals.Package);
  22539. $core.addMethod(
  22540. $core.method({
  22541. selector: "isPackage",
  22542. protocol: "testing",
  22543. fn: function (){
  22544. var self=this,$self=this;
  22545. return true;
  22546. },
  22547. args: [],
  22548. source: "isPackage\x0a\x09^ true",
  22549. referencedClasses: [],
  22550. messageSends: []
  22551. }),
  22552. $globals.Package);
  22553. $core.addMethod(
  22554. $core.method({
  22555. selector: "javaScriptDescriptor:",
  22556. protocol: "accessing",
  22557. fn: function (anObject){
  22558. var self=this,$self=this;
  22559. var basicEval,basicImports;
  22560. return $core.withContext(function($ctx1) {
  22561. basicEval=$recv(anObject)._at_ifAbsent_("innerEval",(function(){
  22562. return $core.withContext(function($ctx2) {
  22563. return nil._asJavaScriptObject();
  22564. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22565. }));
  22566. $ctx1.sendIdx["at:ifAbsent:"]=1;
  22567. basicImports=$recv(anObject)._at_ifAbsent_("imports",(function(){
  22568. return [];
  22569. }));
  22570. $ctx1.sendIdx["at:ifAbsent:"]=2;
  22571. $self["@basicTransport"]=$recv(anObject)._at_ifAbsent_("transport",(function(){
  22572. }));
  22573. $self._evalBlock_(basicEval);
  22574. $self._imports_($self._importsFromJson_(basicImports));
  22575. return self;
  22576. }, function($ctx1) {$ctx1.fill(self,"javaScriptDescriptor:",{anObject:anObject,basicEval:basicEval,basicImports:basicImports},$globals.Package)});
  22577. },
  22578. args: ["anObject"],
  22579. 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)",
  22580. referencedClasses: [],
  22581. messageSends: ["at:ifAbsent:", "asJavaScriptObject", "evalBlock:", "imports:", "importsFromJson:"]
  22582. }),
  22583. $globals.Package);
  22584. $core.addMethod(
  22585. $core.method({
  22586. selector: "loadDependencies",
  22587. protocol: "dependencies",
  22588. fn: function (){
  22589. var self=this,$self=this;
  22590. var classes,packages;
  22591. return $core.withContext(function($ctx1) {
  22592. var $1;
  22593. classes=$self._loadDependencyClasses();
  22594. $1=$recv($recv(classes)._collect_((function(each){
  22595. return $core.withContext(function($ctx2) {
  22596. return $recv(each)._package();
  22597. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22598. })))._asSet();
  22599. $recv($1)._remove_ifAbsent_(self,(function(){
  22600. }));
  22601. return $recv($1)._yourself();
  22602. }, function($ctx1) {$ctx1.fill(self,"loadDependencies",{classes:classes,packages:packages},$globals.Package)});
  22603. },
  22604. args: [],
  22605. 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",
  22606. referencedClasses: [],
  22607. messageSends: ["loadDependencyClasses", "remove:ifAbsent:", "asSet", "collect:", "package", "yourself"]
  22608. }),
  22609. $globals.Package);
  22610. $core.addMethod(
  22611. $core.method({
  22612. selector: "loadDependencyClasses",
  22613. protocol: "dependencies",
  22614. fn: function (){
  22615. var self=this,$self=this;
  22616. var starCategoryName;
  22617. return $core.withContext(function($ctx1) {
  22618. var $3,$2,$1,$5,$7,$6,$4,$receiver;
  22619. starCategoryName="*".__comma($self._name());
  22620. $ctx1.sendIdx[","]=1;
  22621. $3=$self._classes();
  22622. $ctx1.sendIdx["classes"]=1;
  22623. $2=$recv($3)._collect_((function(each){
  22624. return $core.withContext(function($ctx2) {
  22625. return $recv(each)._superclass();
  22626. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22627. }));
  22628. $ctx1.sendIdx["collect:"]=1;
  22629. $1=$recv($2)._asSet();
  22630. $recv($1)._addAll_($recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  22631. return $core.withContext(function($ctx2) {
  22632. $5=$recv(each)._protocols();
  22633. $ctx2.sendIdx["protocols"]=1;
  22634. $7=$recv(each)._theMetaClass();
  22635. if(($receiver = $7) == null || $receiver.a$nil){
  22636. $6=[];
  22637. } else {
  22638. var meta;
  22639. meta=$receiver;
  22640. $6=$recv(meta)._protocols();
  22641. }
  22642. $4=$recv($5).__comma($6);
  22643. return $recv($4)._includes_(starCategoryName);
  22644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  22645. })));
  22646. $ctx1.sendIdx["addAll:"]=1;
  22647. $recv($1)._addAll_($recv($globals.Array)._streamContents_((function(as){
  22648. return $core.withContext(function($ctx2) {
  22649. return $recv($self._traitCompositions())._valuesDo_((function(each){
  22650. return $core.withContext(function($ctx3) {
  22651. return $recv(as)._write_($recv(each)._collect_((function(eachTT){
  22652. return $core.withContext(function($ctx4) {
  22653. return $recv(eachTT)._trait();
  22654. }, function($ctx4) {$ctx4.fillBlock({eachTT:eachTT},$ctx3,7)});
  22655. })));
  22656. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,6)});
  22657. }));
  22658. }, function($ctx2) {$ctx2.fillBlock({as:as},$ctx1,5)});
  22659. })));
  22660. $recv($1)._remove_ifAbsent_(nil,(function(){
  22661. }));
  22662. return $recv($1)._yourself();
  22663. }, function($ctx1) {$ctx1.fill(self,"loadDependencyClasses",{starCategoryName:starCategoryName},$globals.Package)});
  22664. },
  22665. args: [],
  22666. 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",
  22667. referencedClasses: ["Smalltalk", "Array"],
  22668. messageSends: [",", "name", "addAll:", "asSet", "collect:", "classes", "superclass", "select:", "includes:", "protocols", "ifNil:ifNotNil:", "theMetaClass", "streamContents:", "valuesDo:", "traitCompositions", "write:", "trait", "remove:ifAbsent:", "yourself"]
  22669. }),
  22670. $globals.Package);
  22671. $core.addMethod(
  22672. $core.method({
  22673. selector: "name",
  22674. protocol: "accessing",
  22675. fn: function (){
  22676. var self=this,$self=this;
  22677. return $self["@name"];
  22678. },
  22679. args: [],
  22680. source: "name\x0a\x09^ name",
  22681. referencedClasses: [],
  22682. messageSends: []
  22683. }),
  22684. $globals.Package);
  22685. $core.addMethod(
  22686. $core.method({
  22687. selector: "name:",
  22688. protocol: "accessing",
  22689. fn: function (aString){
  22690. var self=this,$self=this;
  22691. $self["@name"]=aString;
  22692. return self;
  22693. },
  22694. args: ["aString"],
  22695. source: "name: aString\x0a\x09name := aString",
  22696. referencedClasses: [],
  22697. messageSends: []
  22698. }),
  22699. $globals.Package);
  22700. $core.addMethod(
  22701. $core.method({
  22702. selector: "organization",
  22703. protocol: "accessing",
  22704. fn: function (){
  22705. var self=this,$self=this;
  22706. return $self["@organization"];
  22707. },
  22708. args: [],
  22709. source: "organization\x0a\x09^ organization",
  22710. referencedClasses: [],
  22711. messageSends: []
  22712. }),
  22713. $globals.Package);
  22714. $core.addMethod(
  22715. $core.method({
  22716. selector: "printOn:",
  22717. protocol: "printing",
  22718. fn: function (aStream){
  22719. var self=this,$self=this;
  22720. return $core.withContext(function($ctx1) {
  22721. (
  22722. $ctx1.supercall = true,
  22723. ($globals.Package.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  22724. $ctx1.supercall = false;
  22725. $recv(aStream)._nextPutAll_(" (");
  22726. $ctx1.sendIdx["nextPutAll:"]=1;
  22727. $recv(aStream)._nextPutAll_($self._name());
  22728. $ctx1.sendIdx["nextPutAll:"]=2;
  22729. $recv(aStream)._nextPutAll_(")");
  22730. return self;
  22731. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.Package)});
  22732. },
  22733. args: ["aStream"],
  22734. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream \x0a\x09\x09nextPutAll: ' (';\x0a\x09\x09nextPutAll: self name;\x0a\x09\x09nextPutAll: ')'",
  22735. referencedClasses: [],
  22736. messageSends: ["printOn:", "nextPutAll:", "name"]
  22737. }),
  22738. $globals.Package);
  22739. $core.addMethod(
  22740. $core.method({
  22741. selector: "setupClasses",
  22742. protocol: "classes",
  22743. fn: function (){
  22744. var self=this,$self=this;
  22745. return $core.withContext(function($ctx1) {
  22746. $recv($self._classes())._do_((function(each){
  22747. return $core.withContext(function($ctx2) {
  22748. return $recv(each)._initialize();
  22749. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22750. }));
  22751. return self;
  22752. }, function($ctx1) {$ctx1.fill(self,"setupClasses",{},$globals.Package)});
  22753. },
  22754. args: [],
  22755. source: "setupClasses\x0a\x09self classes do: [ :each | each initialize ]",
  22756. referencedClasses: [],
  22757. messageSends: ["do:", "classes", "initialize"]
  22758. }),
  22759. $globals.Package);
  22760. $core.addMethod(
  22761. $core.method({
  22762. selector: "sortedClasses",
  22763. protocol: "classes",
  22764. fn: function (){
  22765. var self=this,$self=this;
  22766. return $core.withContext(function($ctx1) {
  22767. return $recv($self._class())._sortedClasses_($self._classes());
  22768. }, function($ctx1) {$ctx1.fill(self,"sortedClasses",{},$globals.Package)});
  22769. },
  22770. args: [],
  22771. 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",
  22772. referencedClasses: [],
  22773. messageSends: ["sortedClasses:", "class", "classes"]
  22774. }),
  22775. $globals.Package);
  22776. $core.addMethod(
  22777. $core.method({
  22778. selector: "sortedImportsAsArray",
  22779. protocol: "private",
  22780. fn: function (){
  22781. var self=this,$self=this;
  22782. return $core.withContext(function($ctx1) {
  22783. var $3,$2,$4,$1,$6,$5,$7;
  22784. return $recv($recv($self._imports())._asArray())._sorted_((function(a,b){
  22785. return $core.withContext(function($ctx2) {
  22786. $3=$recv(a)._isString();
  22787. $ctx2.sendIdx["isString"]=1;
  22788. $2=$recv($3)._not();
  22789. $4=$recv(b)._isString();
  22790. $ctx2.sendIdx["isString"]=2;
  22791. $1=$recv($2).__and($4);
  22792. return $recv($1)._or_((function(){
  22793. return $core.withContext(function($ctx3) {
  22794. $6=$recv(a)._isString();
  22795. $ctx3.sendIdx["isString"]=3;
  22796. $5=$recv($6).__eq($recv(b)._isString());
  22797. return $recv($5)._and_((function(){
  22798. return $core.withContext(function($ctx4) {
  22799. $7=$recv(a)._value();
  22800. $ctx4.sendIdx["value"]=1;
  22801. return $recv($7).__lt_eq($recv(b)._value());
  22802. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  22803. }));
  22804. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  22805. }));
  22806. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  22807. }));
  22808. }, function($ctx1) {$ctx1.fill(self,"sortedImportsAsArray",{},$globals.Package)});
  22809. },
  22810. args: [],
  22811. 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 ]]]",
  22812. referencedClasses: [],
  22813. messageSends: ["sorted:", "asArray", "imports", "or:", "&", "not", "isString", "and:", "=", "<=", "value"]
  22814. }),
  22815. $globals.Package);
  22816. $core.addMethod(
  22817. $core.method({
  22818. selector: "traitCompositions",
  22819. protocol: "dependencies",
  22820. fn: function (){
  22821. var self=this,$self=this;
  22822. var traitCompositions;
  22823. return $core.withContext(function($ctx1) {
  22824. var $1,$2,$3,$receiver;
  22825. traitCompositions=$recv($globals.Dictionary)._new();
  22826. $recv($self._classes())._do_((function(each){
  22827. return $core.withContext(function($ctx2) {
  22828. $1=traitCompositions;
  22829. $2=$recv(each)._traitComposition();
  22830. $ctx2.sendIdx["traitComposition"]=1;
  22831. $recv($1)._at_put_(each,$2);
  22832. $ctx2.sendIdx["at:put:"]=1;
  22833. $3=$recv(each)._theMetaClass();
  22834. if(($receiver = $3) == null || $receiver.a$nil){
  22835. return $3;
  22836. } else {
  22837. var meta;
  22838. meta=$receiver;
  22839. return $recv(traitCompositions)._at_put_(meta,$recv(meta)._traitComposition());
  22840. }
  22841. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  22842. }));
  22843. return $recv(traitCompositions)._reject_((function(each){
  22844. return $core.withContext(function($ctx2) {
  22845. return $recv(each)._isEmpty();
  22846. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  22847. }));
  22848. }, function($ctx1) {$ctx1.fill(self,"traitCompositions",{traitCompositions:traitCompositions},$globals.Package)});
  22849. },
  22850. args: [],
  22851. 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 ]",
  22852. referencedClasses: ["Dictionary"],
  22853. messageSends: ["new", "do:", "classes", "at:put:", "traitComposition", "ifNotNil:", "theMetaClass", "reject:", "isEmpty"]
  22854. }),
  22855. $globals.Package);
  22856. $core.addMethod(
  22857. $core.method({
  22858. selector: "transport",
  22859. protocol: "accessing",
  22860. fn: function (){
  22861. var self=this,$self=this;
  22862. return $core.withContext(function($ctx1) {
  22863. var $1,$receiver;
  22864. $1=$self["@transport"];
  22865. if(($receiver = $1) == null || $receiver.a$nil){
  22866. $self._transport_($recv($globals.PackageTransport)._fromJson_($self._basicTransport()));
  22867. return $self["@transport"];
  22868. } else {
  22869. return $1;
  22870. }
  22871. }, function($ctx1) {$ctx1.fill(self,"transport",{},$globals.Package)});
  22872. },
  22873. args: [],
  22874. source: "transport\x0a\x09^ transport ifNil: [ \x0a\x09\x09self transport: (PackageTransport fromJson: self basicTransport).\x0a\x09\x09transport ]",
  22875. referencedClasses: ["PackageTransport"],
  22876. messageSends: ["ifNil:", "transport:", "fromJson:", "basicTransport"]
  22877. }),
  22878. $globals.Package);
  22879. $core.addMethod(
  22880. $core.method({
  22881. selector: "transport:",
  22882. protocol: "accessing",
  22883. fn: function (aPackageTransport){
  22884. var self=this,$self=this;
  22885. return $core.withContext(function($ctx1) {
  22886. $self["@transport"]=aPackageTransport;
  22887. $recv(aPackageTransport)._package_(self);
  22888. return self;
  22889. }, function($ctx1) {$ctx1.fill(self,"transport:",{aPackageTransport:aPackageTransport},$globals.Package)});
  22890. },
  22891. args: ["aPackageTransport"],
  22892. source: "transport: aPackageTransport\x0a\x09transport := aPackageTransport.\x0a\x09aPackageTransport package: self",
  22893. referencedClasses: [],
  22894. messageSends: ["package:"]
  22895. }),
  22896. $globals.Package);
  22897. $core.addMethod(
  22898. $core.method({
  22899. selector: "validateImports:",
  22900. protocol: "validation",
  22901. fn: function (aCollection){
  22902. var self=this,$self=this;
  22903. return $core.withContext(function($ctx1) {
  22904. var $1,$2,$5,$4,$3,$6;
  22905. $recv(aCollection)._do_((function(import_){
  22906. return $core.withContext(function($ctx2) {
  22907. $1=$recv(import_)._isString();
  22908. $ctx2.sendIdx["isString"]=1;
  22909. if(!$core.assert($1)){
  22910. $2=$recv(import_)._respondsTo_("key");
  22911. if(!$core.assert($2)){
  22912. $self._error_("Imports must be Strings or Associations");
  22913. $ctx2.sendIdx["error:"]=1;
  22914. }
  22915. $5=$recv(import_)._key();
  22916. $ctx2.sendIdx["key"]=1;
  22917. $4=$recv($5)._isString();
  22918. $ctx2.sendIdx["isString"]=2;
  22919. $3=$recv($4).__and($recv($recv(import_)._value())._isString());
  22920. if(!$core.assert($3)){
  22921. $self._error_("Key and value must be Strings");
  22922. $ctx2.sendIdx["error:"]=2;
  22923. }
  22924. $6=$recv($recv(import_)._key())._match_("^[a-zA-Z][a-zA-Z0-9]*$");
  22925. if(!$core.assert($6)){
  22926. return $self._error_("Keys must be identifiers");
  22927. }
  22928. }
  22929. }, function($ctx2) {$ctx2.fillBlock({import_:import_},$ctx1,1)});
  22930. }));
  22931. return self;
  22932. }, function($ctx1) {$ctx1.fill(self,"validateImports:",{aCollection:aCollection},$globals.Package)});
  22933. },
  22934. args: ["aCollection"],
  22935. 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' ]]]",
  22936. referencedClasses: [],
  22937. messageSends: ["do:", "ifFalse:", "isString", "respondsTo:", "error:", "&", "key", "value", "match:"]
  22938. }),
  22939. $globals.Package);
  22940. $globals.Package.a$cls.iVarNames = ["defaultCommitPathJs", "defaultCommitPathSt"];
  22941. $core.addMethod(
  22942. $core.method({
  22943. selector: "named:",
  22944. protocol: "accessing",
  22945. fn: function (aPackageName){
  22946. var self=this,$self=this;
  22947. return $core.withContext(function($ctx1) {
  22948. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,(function(){
  22949. return $core.withContext(function($ctx2) {
  22950. return $recv($globals.Smalltalk)._createPackage_(aPackageName);
  22951. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  22952. }));
  22953. }, function($ctx1) {$ctx1.fill(self,"named:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  22954. },
  22955. args: ["aPackageName"],
  22956. source: "named: aPackageName\x0a\x09^ Smalltalk \x0a\x09\x09packageAt: aPackageName\x0a\x09\x09ifAbsent: [ \x0a\x09\x09\x09Smalltalk createPackage: aPackageName ]",
  22957. referencedClasses: ["Smalltalk"],
  22958. messageSends: ["packageAt:ifAbsent:", "createPackage:"]
  22959. }),
  22960. $globals.Package.a$cls);
  22961. $core.addMethod(
  22962. $core.method({
  22963. selector: "named:ifAbsent:",
  22964. protocol: "accessing",
  22965. fn: function (aPackageName,aBlock){
  22966. var self=this,$self=this;
  22967. return $core.withContext(function($ctx1) {
  22968. return $recv($globals.Smalltalk)._packageAt_ifAbsent_(aPackageName,aBlock);
  22969. }, function($ctx1) {$ctx1.fill(self,"named:ifAbsent:",{aPackageName:aPackageName,aBlock:aBlock},$globals.Package.a$cls)});
  22970. },
  22971. args: ["aPackageName", "aBlock"],
  22972. source: "named: aPackageName ifAbsent: aBlock\x0a\x09^ Smalltalk packageAt: aPackageName ifAbsent: aBlock",
  22973. referencedClasses: ["Smalltalk"],
  22974. messageSends: ["packageAt:ifAbsent:"]
  22975. }),
  22976. $globals.Package.a$cls);
  22977. $core.addMethod(
  22978. $core.method({
  22979. selector: "named:imports:transport:",
  22980. protocol: "accessing",
  22981. fn: function (aPackageName,anArray,aTransport){
  22982. var self=this,$self=this;
  22983. var pkg;
  22984. return $core.withContext(function($ctx1) {
  22985. pkg=$self._named_(aPackageName);
  22986. $recv(pkg)._imports_(anArray);
  22987. $recv(pkg)._transport_(aTransport);
  22988. return pkg;
  22989. }, function($ctx1) {$ctx1.fill(self,"named:imports:transport:",{aPackageName:aPackageName,anArray:anArray,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  22990. },
  22991. args: ["aPackageName", "anArray", "aTransport"],
  22992. 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",
  22993. referencedClasses: [],
  22994. messageSends: ["named:", "imports:", "transport:"]
  22995. }),
  22996. $globals.Package.a$cls);
  22997. $core.addMethod(
  22998. $core.method({
  22999. selector: "named:javaScriptDescriptor:",
  23000. protocol: "instance creation",
  23001. fn: function (aString,anObject){
  23002. var self=this,$self=this;
  23003. var pkg;
  23004. return $core.withContext(function($ctx1) {
  23005. pkg=$recv($globals.Smalltalk)._createPackage_(aString);
  23006. $recv(pkg)._javaScriptDescriptor_(anObject);
  23007. return pkg;
  23008. }, function($ctx1) {$ctx1.fill(self,"named:javaScriptDescriptor:",{aString:aString,anObject:anObject,pkg:pkg},$globals.Package.a$cls)});
  23009. },
  23010. args: ["aString", "anObject"],
  23011. source: "named: aString javaScriptDescriptor: anObject\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := Smalltalk createPackage: aString.\x0a\x09pkg javaScriptDescriptor: anObject.\x0a\x09^ pkg",
  23012. referencedClasses: ["Smalltalk"],
  23013. messageSends: ["createPackage:", "javaScriptDescriptor:"]
  23014. }),
  23015. $globals.Package.a$cls);
  23016. $core.addMethod(
  23017. $core.method({
  23018. selector: "named:transport:",
  23019. protocol: "accessing",
  23020. fn: function (aPackageName,aTransport){
  23021. var self=this,$self=this;
  23022. var pkg;
  23023. return $core.withContext(function($ctx1) {
  23024. pkg=$self._named_(aPackageName);
  23025. $recv(pkg)._transport_(aTransport);
  23026. return pkg;
  23027. }, function($ctx1) {$ctx1.fill(self,"named:transport:",{aPackageName:aPackageName,aTransport:aTransport,pkg:pkg},$globals.Package.a$cls)});
  23028. },
  23029. args: ["aPackageName", "aTransport"],
  23030. source: "named: aPackageName transport: aTransport\x0a\x09| pkg |\x0a\x09\x0a\x09pkg := self named: aPackageName.\x0a\x09pkg transport: aTransport.\x0a\x09\x0a\x09^ pkg",
  23031. referencedClasses: [],
  23032. messageSends: ["named:", "transport:"]
  23033. }),
  23034. $globals.Package.a$cls);
  23035. $core.addMethod(
  23036. $core.method({
  23037. selector: "new:",
  23038. protocol: "instance creation",
  23039. fn: function (aString){
  23040. var self=this,$self=this;
  23041. return $core.withContext(function($ctx1) {
  23042. var $1;
  23043. $1=$recv($globals.Package)._new();
  23044. $recv($1)._name_(aString);
  23045. return $recv($1)._yourself();
  23046. }, function($ctx1) {$ctx1.fill(self,"new:",{aString:aString},$globals.Package.a$cls)});
  23047. },
  23048. args: ["aString"],
  23049. source: "new: aString\x0a\x09^ Package new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  23050. referencedClasses: ["Package"],
  23051. messageSends: ["name:", "new", "yourself"]
  23052. }),
  23053. $globals.Package.a$cls);
  23054. $core.addMethod(
  23055. $core.method({
  23056. selector: "sortedClasses:",
  23057. protocol: "sorting",
  23058. fn: function (classes){
  23059. var self=this,$self=this;
  23060. var children,others,nodes,expandedClasses;
  23061. return $core.withContext(function($ctx1) {
  23062. var $1,$3,$2;
  23063. children=[];
  23064. others=[];
  23065. $recv(classes)._do_((function(each){
  23066. return $core.withContext(function($ctx2) {
  23067. $1=$recv(classes)._includes_($recv(each)._superclass());
  23068. if($core.assert($1)){
  23069. return $recv(others)._add_(each);
  23070. } else {
  23071. return $recv(children)._add_(each);
  23072. $ctx2.sendIdx["add:"]=1;
  23073. }
  23074. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23075. }));
  23076. $ctx1.sendIdx["do:"]=1;
  23077. nodes=$recv(children)._collect_((function(each){
  23078. return $core.withContext(function($ctx2) {
  23079. return $recv($globals.ClassSorterNode)._on_classes_level_(each,others,(0));
  23080. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  23081. }));
  23082. nodes=$recv(nodes)._sorted_((function(a,b){
  23083. return $core.withContext(function($ctx2) {
  23084. $3=$recv(a)._theClass();
  23085. $ctx2.sendIdx["theClass"]=1;
  23086. $2=$recv($3)._name();
  23087. $ctx2.sendIdx["name"]=1;
  23088. return $recv($2).__lt_eq($recv($recv(b)._theClass())._name());
  23089. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,5)});
  23090. }));
  23091. expandedClasses=$recv($globals.Array)._new();
  23092. $recv(nodes)._do_((function(aNode){
  23093. return $core.withContext(function($ctx2) {
  23094. return $recv(aNode)._traverseClassesWith_(expandedClasses);
  23095. }, function($ctx2) {$ctx2.fillBlock({aNode:aNode},$ctx1,6)});
  23096. }));
  23097. return expandedClasses;
  23098. }, function($ctx1) {$ctx1.fill(self,"sortedClasses:",{classes:classes,children:children,others:others,nodes:nodes,expandedClasses:expandedClasses},$globals.Package.a$cls)});
  23099. },
  23100. args: ["classes"],
  23101. 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",
  23102. referencedClasses: ["ClassSorterNode", "Array"],
  23103. messageSends: ["do:", "ifFalse:ifTrue:", "includes:", "superclass", "add:", "collect:", "on:classes:level:", "sorted:", "<=", "name", "theClass", "new", "traverseClassesWith:"]
  23104. }),
  23105. $globals.Package.a$cls);
  23106. $core.addClass("PackageStateObserver", $globals.Object, [], "Kernel-Infrastructure");
  23107. $globals.PackageStateObserver.comment="My current instance listens for any changes in the system that might affect the state of a package (being dirty).";
  23108. $core.addMethod(
  23109. $core.method({
  23110. selector: "announcer",
  23111. protocol: "accessing",
  23112. fn: function (){
  23113. var self=this,$self=this;
  23114. return $core.withContext(function($ctx1) {
  23115. return $recv($globals.SystemAnnouncer)._current();
  23116. }, function($ctx1) {$ctx1.fill(self,"announcer",{},$globals.PackageStateObserver)});
  23117. },
  23118. args: [],
  23119. source: "announcer\x0a\x09^ SystemAnnouncer current",
  23120. referencedClasses: ["SystemAnnouncer"],
  23121. messageSends: ["current"]
  23122. }),
  23123. $globals.PackageStateObserver);
  23124. $core.addMethod(
  23125. $core.method({
  23126. selector: "observeSystem",
  23127. protocol: "actions",
  23128. fn: function (){
  23129. var self=this,$self=this;
  23130. return $core.withContext(function($ctx1) {
  23131. var $1;
  23132. $1=$self._announcer();
  23133. $recv($1)._on_send_to_($globals.PackageAdded,"onPackageAdded:",self);
  23134. $ctx1.sendIdx["on:send:to:"]=1;
  23135. $recv($1)._on_send_to_($globals.ClassAnnouncement,"onClassModification:",self);
  23136. $ctx1.sendIdx["on:send:to:"]=2;
  23137. $recv($1)._on_send_to_($globals.MethodAnnouncement,"onMethodModification:",self);
  23138. $ctx1.sendIdx["on:send:to:"]=3;
  23139. $recv($1)._on_send_to_($globals.ProtocolAnnouncement,"onProtocolModification:",self);
  23140. return self;
  23141. }, function($ctx1) {$ctx1.fill(self,"observeSystem",{},$globals.PackageStateObserver)});
  23142. },
  23143. args: [],
  23144. 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",
  23145. referencedClasses: ["PackageAdded", "ClassAnnouncement", "MethodAnnouncement", "ProtocolAnnouncement"],
  23146. messageSends: ["on:send:to:", "announcer"]
  23147. }),
  23148. $globals.PackageStateObserver);
  23149. $core.addMethod(
  23150. $core.method({
  23151. selector: "onClassModification:",
  23152. protocol: "reactions",
  23153. fn: function (anAnnouncement){
  23154. var self=this,$self=this;
  23155. return $core.withContext(function($ctx1) {
  23156. var $1,$receiver;
  23157. $1=$recv(anAnnouncement)._theClass();
  23158. if(($receiver = $1) == null || $receiver.a$nil){
  23159. $1;
  23160. } else {
  23161. var theClass;
  23162. theClass=$receiver;
  23163. $recv($recv(theClass)._package())._beDirty();
  23164. }
  23165. return self;
  23166. }, function($ctx1) {$ctx1.fill(self,"onClassModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23167. },
  23168. args: ["anAnnouncement"],
  23169. source: "onClassModification: anAnnouncement\x0a\x09anAnnouncement theClass ifNotNil: [ :theClass | theClass package beDirty ]",
  23170. referencedClasses: [],
  23171. messageSends: ["ifNotNil:", "theClass", "beDirty", "package"]
  23172. }),
  23173. $globals.PackageStateObserver);
  23174. $core.addMethod(
  23175. $core.method({
  23176. selector: "onMethodModification:",
  23177. protocol: "reactions",
  23178. fn: function (anAnnouncement){
  23179. var self=this,$self=this;
  23180. return $core.withContext(function($ctx1) {
  23181. var $1,$receiver;
  23182. $1=$recv($recv(anAnnouncement)._method())._package();
  23183. if(($receiver = $1) == null || $receiver.a$nil){
  23184. $1;
  23185. } else {
  23186. var package_;
  23187. package_=$receiver;
  23188. $recv(package_)._beDirty();
  23189. }
  23190. return self;
  23191. }, function($ctx1) {$ctx1.fill(self,"onMethodModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23192. },
  23193. args: ["anAnnouncement"],
  23194. source: "onMethodModification: anAnnouncement\x0a\x09anAnnouncement method package ifNotNil: [ :package | package beDirty ]",
  23195. referencedClasses: [],
  23196. messageSends: ["ifNotNil:", "package", "method", "beDirty"]
  23197. }),
  23198. $globals.PackageStateObserver);
  23199. $core.addMethod(
  23200. $core.method({
  23201. selector: "onPackageAdded:",
  23202. protocol: "reactions",
  23203. fn: function (anAnnouncement){
  23204. var self=this,$self=this;
  23205. return $core.withContext(function($ctx1) {
  23206. $recv($recv(anAnnouncement)._package())._beDirty();
  23207. return self;
  23208. }, function($ctx1) {$ctx1.fill(self,"onPackageAdded:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23209. },
  23210. args: ["anAnnouncement"],
  23211. source: "onPackageAdded: anAnnouncement\x0a\x09anAnnouncement package beDirty",
  23212. referencedClasses: [],
  23213. messageSends: ["beDirty", "package"]
  23214. }),
  23215. $globals.PackageStateObserver);
  23216. $core.addMethod(
  23217. $core.method({
  23218. selector: "onProtocolModification:",
  23219. protocol: "reactions",
  23220. fn: function (anAnnouncement){
  23221. var self=this,$self=this;
  23222. return $core.withContext(function($ctx1) {
  23223. var $1,$receiver;
  23224. $1=$recv(anAnnouncement)._package();
  23225. if(($receiver = $1) == null || $receiver.a$nil){
  23226. $1;
  23227. } else {
  23228. var package_;
  23229. package_=$receiver;
  23230. $recv(package_)._beDirty();
  23231. }
  23232. return self;
  23233. }, function($ctx1) {$ctx1.fill(self,"onProtocolModification:",{anAnnouncement:anAnnouncement},$globals.PackageStateObserver)});
  23234. },
  23235. args: ["anAnnouncement"],
  23236. source: "onProtocolModification: anAnnouncement\x0a\x09anAnnouncement package ifNotNil: [ :package | package beDirty ]",
  23237. referencedClasses: [],
  23238. messageSends: ["ifNotNil:", "package", "beDirty"]
  23239. }),
  23240. $globals.PackageStateObserver);
  23241. $globals.PackageStateObserver.a$cls.iVarNames = ["current"];
  23242. $core.addMethod(
  23243. $core.method({
  23244. selector: "current",
  23245. protocol: "accessing",
  23246. fn: function (){
  23247. var self=this,$self=this;
  23248. return $core.withContext(function($ctx1) {
  23249. var $1,$receiver;
  23250. $1=$self["@current"];
  23251. if(($receiver = $1) == null || $receiver.a$nil){
  23252. $self["@current"]=$self._new();
  23253. return $self["@current"];
  23254. } else {
  23255. return $1;
  23256. }
  23257. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.PackageStateObserver.a$cls)});
  23258. },
  23259. args: [],
  23260. source: "current\x0a\x09^ current ifNil: [ current := self new ]",
  23261. referencedClasses: [],
  23262. messageSends: ["ifNil:", "new"]
  23263. }),
  23264. $globals.PackageStateObserver.a$cls);
  23265. $core.addMethod(
  23266. $core.method({
  23267. selector: "initialize",
  23268. protocol: "initialization",
  23269. fn: function (){
  23270. var self=this,$self=this;
  23271. return $core.withContext(function($ctx1) {
  23272. $recv($self._current())._observeSystem();
  23273. return self;
  23274. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageStateObserver.a$cls)});
  23275. },
  23276. args: [],
  23277. source: "initialize\x0a\x09self current observeSystem",
  23278. referencedClasses: [],
  23279. messageSends: ["observeSystem", "current"]
  23280. }),
  23281. $globals.PackageStateObserver.a$cls);
  23282. $core.addClass("ParseError", $globals.Error, [], "Kernel-Infrastructure");
  23283. $globals.ParseError.comment="Instance of ParseError are signaled on any parsing error.\x0aSee `Smalltalk >> #parse:`";
  23284. $core.addClass("Setting", $globals.Object, ["key", "value", "defaultValue"], "Kernel-Infrastructure");
  23285. $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`";
  23286. $core.addMethod(
  23287. $core.method({
  23288. selector: "defaultValue",
  23289. protocol: "accessing",
  23290. fn: function (){
  23291. var self=this,$self=this;
  23292. return $self["@defaultValue"];
  23293. },
  23294. args: [],
  23295. source: "defaultValue\x0a\x09^ defaultValue",
  23296. referencedClasses: [],
  23297. messageSends: []
  23298. }),
  23299. $globals.Setting);
  23300. $core.addMethod(
  23301. $core.method({
  23302. selector: "defaultValue:",
  23303. protocol: "accessing",
  23304. fn: function (aStringifiableObject){
  23305. var self=this,$self=this;
  23306. $self["@defaultValue"]=aStringifiableObject;
  23307. return self;
  23308. },
  23309. args: ["aStringifiableObject"],
  23310. source: "defaultValue: aStringifiableObject\x0a\x09defaultValue := aStringifiableObject",
  23311. referencedClasses: [],
  23312. messageSends: []
  23313. }),
  23314. $globals.Setting);
  23315. $core.addMethod(
  23316. $core.method({
  23317. selector: "key",
  23318. protocol: "accessing",
  23319. fn: function (){
  23320. var self=this,$self=this;
  23321. return $self["@key"];
  23322. },
  23323. args: [],
  23324. source: "key\x0a\x09^ key",
  23325. referencedClasses: [],
  23326. messageSends: []
  23327. }),
  23328. $globals.Setting);
  23329. $core.addMethod(
  23330. $core.method({
  23331. selector: "key:",
  23332. protocol: "accessing",
  23333. fn: function (aString){
  23334. var self=this,$self=this;
  23335. $self["@key"]=aString;
  23336. return self;
  23337. },
  23338. args: ["aString"],
  23339. source: "key: aString\x0a\x09key := aString",
  23340. referencedClasses: [],
  23341. messageSends: []
  23342. }),
  23343. $globals.Setting);
  23344. $core.addMethod(
  23345. $core.method({
  23346. selector: "value",
  23347. protocol: "accessing",
  23348. fn: function (){
  23349. var self=this,$self=this;
  23350. return $core.withContext(function($ctx1) {
  23351. return $recv($recv($globals.Smalltalk)._settings())._at_ifAbsent_($self._key(),(function(){
  23352. return $core.withContext(function($ctx2) {
  23353. return $self._defaultValue();
  23354. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23355. }));
  23356. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.Setting)});
  23357. },
  23358. args: [],
  23359. source: "value\x0a\x09^ Smalltalk settings at: self key ifAbsent: [ self defaultValue ]",
  23360. referencedClasses: ["Smalltalk"],
  23361. messageSends: ["at:ifAbsent:", "settings", "key", "defaultValue"]
  23362. }),
  23363. $globals.Setting);
  23364. $core.addMethod(
  23365. $core.method({
  23366. selector: "value:",
  23367. protocol: "accessing",
  23368. fn: function (aStringifiableObject){
  23369. var self=this,$self=this;
  23370. return $core.withContext(function($ctx1) {
  23371. return $recv($recv($globals.Smalltalk)._settings())._at_put_($self._key(),aStringifiableObject);
  23372. }, function($ctx1) {$ctx1.fill(self,"value:",{aStringifiableObject:aStringifiableObject},$globals.Setting)});
  23373. },
  23374. args: ["aStringifiableObject"],
  23375. source: "value: aStringifiableObject\x0a\x09^ Smalltalk settings at: self key put: aStringifiableObject",
  23376. referencedClasses: ["Smalltalk"],
  23377. messageSends: ["at:put:", "settings", "key"]
  23378. }),
  23379. $globals.Setting);
  23380. $core.addMethod(
  23381. $core.method({
  23382. selector: "at:ifAbsent:",
  23383. protocol: "instance creation",
  23384. fn: function (aString,aDefaultValue){
  23385. var self=this,$self=this;
  23386. return $core.withContext(function($ctx1) {
  23387. var $1;
  23388. $1=(
  23389. $ctx1.supercall = true,
  23390. ($globals.Setting.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  23391. $ctx1.supercall = false;
  23392. $recv($1)._key_(aString);
  23393. $recv($1)._defaultValue_(aDefaultValue);
  23394. return $recv($1)._yourself();
  23395. }, function($ctx1) {$ctx1.fill(self,"at:ifAbsent:",{aString:aString,aDefaultValue:aDefaultValue},$globals.Setting.a$cls)});
  23396. },
  23397. args: ["aString", "aDefaultValue"],
  23398. source: "at: aString ifAbsent: aDefaultValue\x0a\x09\x0a\x09^ super new\x0a\x09\x09key: aString;\x0a\x09\x09defaultValue: aDefaultValue;\x0a\x09\x09yourself",
  23399. referencedClasses: [],
  23400. messageSends: ["key:", "new", "defaultValue:", "yourself"]
  23401. }),
  23402. $globals.Setting.a$cls);
  23403. $core.addMethod(
  23404. $core.method({
  23405. selector: "new",
  23406. protocol: "instance creation",
  23407. fn: function (){
  23408. var self=this,$self=this;
  23409. return $core.withContext(function($ctx1) {
  23410. $self._shouldNotImplement();
  23411. return self;
  23412. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Setting.a$cls)});
  23413. },
  23414. args: [],
  23415. source: "new\x0a\x09self shouldNotImplement",
  23416. referencedClasses: [],
  23417. messageSends: ["shouldNotImplement"]
  23418. }),
  23419. $globals.Setting.a$cls);
  23420. $core.addClass("SmalltalkImage", $globals.Object, ["globalJsVariables", "packageDictionary"], "Kernel-Infrastructure");
  23421. $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.";
  23422. $core.addMethod(
  23423. $core.method({
  23424. selector: "addGlobalJsVariable:",
  23425. protocol: "globals",
  23426. fn: function (aString){
  23427. var self=this,$self=this;
  23428. return $core.withContext(function($ctx1) {
  23429. $recv($self._globalJsVariables())._add_(aString);
  23430. return self;
  23431. }, function($ctx1) {$ctx1.fill(self,"addGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23432. },
  23433. args: ["aString"],
  23434. source: "addGlobalJsVariable: aString\x0a\x09self globalJsVariables add: aString",
  23435. referencedClasses: [],
  23436. messageSends: ["add:", "globalJsVariables"]
  23437. }),
  23438. $globals.SmalltalkImage);
  23439. $core.addMethod(
  23440. $core.method({
  23441. selector: "adoptPackageDescriptors",
  23442. protocol: "private",
  23443. fn: function (){
  23444. var self=this,$self=this;
  23445. var pkgs;
  23446. return $core.withContext(function($ctx1) {
  23447. pkgs=$recv($globals.Set)._new();
  23448. $recv($recv($self._core())._packageDescriptors())._keysAndValuesDo_((function(key,value){
  23449. return $core.withContext(function($ctx2) {
  23450. return $recv(pkgs)._add_($recv($globals.Package)._named_javaScriptDescriptor_(key,value));
  23451. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  23452. }));
  23453. return pkgs;
  23454. }, function($ctx1) {$ctx1.fill(self,"adoptPackageDescriptors",{pkgs:pkgs},$globals.SmalltalkImage)});
  23455. },
  23456. args: [],
  23457. 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",
  23458. referencedClasses: ["Set", "Package"],
  23459. messageSends: ["new", "keysAndValuesDo:", "packageDescriptors", "core", "add:", "named:javaScriptDescriptor:"]
  23460. }),
  23461. $globals.SmalltalkImage);
  23462. $core.addMethod(
  23463. $core.method({
  23464. selector: "amdRequire",
  23465. protocol: "accessing amd",
  23466. fn: function (){
  23467. var self=this,$self=this;
  23468. return $core.withContext(function($ctx1) {
  23469. return $recv($self._core())._at_("amdRequire");
  23470. }, function($ctx1) {$ctx1.fill(self,"amdRequire",{},$globals.SmalltalkImage)});
  23471. },
  23472. args: [],
  23473. source: "amdRequire\x0a\x09^ self core at: 'amdRequire'",
  23474. referencedClasses: [],
  23475. messageSends: ["at:", "core"]
  23476. }),
  23477. $globals.SmalltalkImage);
  23478. $core.addMethod(
  23479. $core.method({
  23480. selector: "asSmalltalkException:",
  23481. protocol: "error handling",
  23482. fn: function (anObject){
  23483. var self=this,$self=this;
  23484. return $core.withContext(function($ctx1) {
  23485. var $1;
  23486. $1=$recv($self._isSmalltalkObject_(anObject))._and_((function(){
  23487. return $core.withContext(function($ctx2) {
  23488. return $recv(anObject)._isKindOf_($globals.Error);
  23489. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23490. }));
  23491. if($core.assert($1)){
  23492. return anObject;
  23493. } else {
  23494. return $recv($globals.JavaScriptException)._on_(anObject);
  23495. }
  23496. }, function($ctx1) {$ctx1.fill(self,"asSmalltalkException:",{anObject:anObject},$globals.SmalltalkImage)});
  23497. },
  23498. args: ["anObject"],
  23499. 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 ]",
  23500. referencedClasses: ["Error", "JavaScriptException"],
  23501. messageSends: ["ifTrue:ifFalse:", "and:", "isSmalltalkObject:", "isKindOf:", "on:"]
  23502. }),
  23503. $globals.SmalltalkImage);
  23504. $core.addMethod(
  23505. $core.method({
  23506. selector: "basicCreatePackage:",
  23507. protocol: "private",
  23508. fn: function (packageName){
  23509. var self=this,$self=this;
  23510. return $core.withContext(function($ctx1) {
  23511. return $recv($self._packageDictionary())._at_ifAbsentPut_(packageName,(function(){
  23512. return $core.withContext(function($ctx2) {
  23513. return $recv($globals.Package)._new_(packageName);
  23514. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23515. }));
  23516. }, function($ctx1) {$ctx1.fill(self,"basicCreatePackage:",{packageName:packageName},$globals.SmalltalkImage)});
  23517. },
  23518. args: ["packageName"],
  23519. 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 ]",
  23520. referencedClasses: ["Package"],
  23521. messageSends: ["at:ifAbsentPut:", "packageDictionary", "new:"]
  23522. }),
  23523. $globals.SmalltalkImage);
  23524. $core.addMethod(
  23525. $core.method({
  23526. selector: "basicParse:",
  23527. protocol: "private",
  23528. fn: function (aString){
  23529. var self=this,$self=this;
  23530. return $core.withContext(function($ctx1) {
  23531. return $recv($globals.SmalltalkParser)._parse_(aString);
  23532. }, function($ctx1) {$ctx1.fill(self,"basicParse:",{aString:aString},$globals.SmalltalkImage)});
  23533. },
  23534. args: ["aString"],
  23535. source: "basicParse: aString\x0a\x09^ SmalltalkParser parse: aString",
  23536. referencedClasses: ["SmalltalkParser"],
  23537. messageSends: ["parse:"]
  23538. }),
  23539. $globals.SmalltalkImage);
  23540. $core.addMethod(
  23541. $core.method({
  23542. selector: "cancelOptOut:",
  23543. protocol: "accessing",
  23544. fn: function (anObject){
  23545. var self=this,$self=this;
  23546. return $core.withContext(function($ctx1) {
  23547. delete anObject.klass; delete anObject.a$cls;;
  23548. return self;
  23549. }, function($ctx1) {$ctx1.fill(self,"cancelOptOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23550. },
  23551. args: ["anObject"],
  23552. 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;'>",
  23553. referencedClasses: [],
  23554. messageSends: []
  23555. }),
  23556. $globals.SmalltalkImage);
  23557. $core.addMethod(
  23558. $core.method({
  23559. selector: "classes",
  23560. protocol: "classes",
  23561. fn: function (){
  23562. var self=this,$self=this;
  23563. return $core.withContext(function($ctx1) {
  23564. return $recv($recv($self._core())._traitsOrClasses())._copy();
  23565. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.SmalltalkImage)});
  23566. },
  23567. args: [],
  23568. source: "classes\x0a\x09^ self core traitsOrClasses copy",
  23569. referencedClasses: [],
  23570. messageSends: ["copy", "traitsOrClasses", "core"]
  23571. }),
  23572. $globals.SmalltalkImage);
  23573. $core.addMethod(
  23574. $core.method({
  23575. selector: "core",
  23576. protocol: "accessing",
  23577. fn: function (){
  23578. var self=this,$self=this;
  23579. return $core.withContext(function($ctx1) {
  23580. return $core;
  23581. return self;
  23582. }, function($ctx1) {$ctx1.fill(self,"core",{},$globals.SmalltalkImage)});
  23583. },
  23584. args: [],
  23585. source: "core\x0a\x09<inlineJS: 'return $core'>",
  23586. referencedClasses: [],
  23587. messageSends: []
  23588. }),
  23589. $globals.SmalltalkImage);
  23590. $core.addMethod(
  23591. $core.method({
  23592. selector: "createPackage:",
  23593. protocol: "packages",
  23594. fn: function (packageName){
  23595. var self=this,$self=this;
  23596. var package_,announcement;
  23597. return $core.withContext(function($ctx1) {
  23598. var $1;
  23599. package_=$self._basicCreatePackage_(packageName);
  23600. $1=$recv($globals.PackageAdded)._new();
  23601. $recv($1)._package_(package_);
  23602. announcement=$recv($1)._yourself();
  23603. $recv($recv($globals.SystemAnnouncer)._current())._announce_(announcement);
  23604. return package_;
  23605. }, function($ctx1) {$ctx1.fill(self,"createPackage:",{packageName:packageName,package_:package_,announcement:announcement},$globals.SmalltalkImage)});
  23606. },
  23607. args: ["packageName"],
  23608. 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",
  23609. referencedClasses: ["PackageAdded", "SystemAnnouncer"],
  23610. messageSends: ["basicCreatePackage:", "package:", "new", "yourself", "announce:", "current"]
  23611. }),
  23612. $globals.SmalltalkImage);
  23613. $core.addMethod(
  23614. $core.method({
  23615. selector: "defaultAmdNamespace",
  23616. protocol: "accessing amd",
  23617. fn: function (){
  23618. var self=this,$self=this;
  23619. return $core.withContext(function($ctx1) {
  23620. return "transport.defaultAmdNamespace"._settingValue();
  23621. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace",{},$globals.SmalltalkImage)});
  23622. },
  23623. args: [],
  23624. source: "defaultAmdNamespace\x0a\x09^ 'transport.defaultAmdNamespace' settingValue",
  23625. referencedClasses: [],
  23626. messageSends: ["settingValue"]
  23627. }),
  23628. $globals.SmalltalkImage);
  23629. $core.addMethod(
  23630. $core.method({
  23631. selector: "defaultAmdNamespace:",
  23632. protocol: "accessing amd",
  23633. fn: function (aString){
  23634. var self=this,$self=this;
  23635. return $core.withContext(function($ctx1) {
  23636. "transport.defaultAmdNamespace"._settingValue_(aString);
  23637. return self;
  23638. }, function($ctx1) {$ctx1.fill(self,"defaultAmdNamespace:",{aString:aString},$globals.SmalltalkImage)});
  23639. },
  23640. args: ["aString"],
  23641. source: "defaultAmdNamespace: aString\x0a\x09'transport.defaultAmdNamespace' settingValue: aString",
  23642. referencedClasses: [],
  23643. messageSends: ["settingValue:"]
  23644. }),
  23645. $globals.SmalltalkImage);
  23646. $core.addMethod(
  23647. $core.method({
  23648. selector: "deleteClass:",
  23649. protocol: "private",
  23650. fn: function (aClass){
  23651. var self=this,$self=this;
  23652. return $core.withContext(function($ctx1) {
  23653. $core.removeClass(aClass);
  23654. return self;
  23655. }, function($ctx1) {$ctx1.fill(self,"deleteClass:",{aClass:aClass},$globals.SmalltalkImage)});
  23656. },
  23657. args: ["aClass"],
  23658. 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)'>",
  23659. referencedClasses: [],
  23660. messageSends: []
  23661. }),
  23662. $globals.SmalltalkImage);
  23663. $core.addMethod(
  23664. $core.method({
  23665. selector: "deleteGlobalJsVariable:",
  23666. protocol: "globals",
  23667. fn: function (aString){
  23668. var self=this,$self=this;
  23669. return $core.withContext(function($ctx1) {
  23670. $recv($self._globalJsVariables())._remove_ifAbsent_(aString,(function(){
  23671. }));
  23672. return self;
  23673. }, function($ctx1) {$ctx1.fill(self,"deleteGlobalJsVariable:",{aString:aString},$globals.SmalltalkImage)});
  23674. },
  23675. args: ["aString"],
  23676. source: "deleteGlobalJsVariable: aString\x0a\x09self globalJsVariables remove: aString ifAbsent:[]",
  23677. referencedClasses: [],
  23678. messageSends: ["remove:ifAbsent:", "globalJsVariables"]
  23679. }),
  23680. $globals.SmalltalkImage);
  23681. $core.addMethod(
  23682. $core.method({
  23683. selector: "existsJsGlobal:",
  23684. protocol: "testing",
  23685. fn: function (aString){
  23686. var self=this,$self=this;
  23687. return $core.withContext(function($ctx1) {
  23688. $self._deprecatedAPI_("Use Platform >> includesGlobal: instead");
  23689. return $recv($globals.Platform)._includesGlobal_(aString);
  23690. }, function($ctx1) {$ctx1.fill(self,"existsJsGlobal:",{aString:aString},$globals.SmalltalkImage)});
  23691. },
  23692. args: ["aString"],
  23693. source: "existsJsGlobal: aString\x0a\x09self deprecatedAPI: 'Use Platform >> includesGlobal: instead'.\x0a\x09^ Platform includesGlobal: aString",
  23694. referencedClasses: ["Platform"],
  23695. messageSends: ["deprecatedAPI:", "includesGlobal:"]
  23696. }),
  23697. $globals.SmalltalkImage);
  23698. $core.addMethod(
  23699. $core.method({
  23700. selector: "globalJsVariables",
  23701. protocol: "globals",
  23702. fn: function (){
  23703. var self=this,$self=this;
  23704. return $core.withContext(function($ctx1) {
  23705. var $1,$receiver;
  23706. $1=$self["@globalJsVariables"];
  23707. if(($receiver = $1) == null || $receiver.a$nil){
  23708. $self["@globalJsVariables"]=["window", "document", "process", "global"];
  23709. return $self["@globalJsVariables"];
  23710. } else {
  23711. return $1;
  23712. }
  23713. }, function($ctx1) {$ctx1.fill(self,"globalJsVariables",{},$globals.SmalltalkImage)});
  23714. },
  23715. args: [],
  23716. source: "globalJsVariables\x0a\x09^ globalJsVariables ifNil: [\x0a\x09\x09globalJsVariables := #(window document process global) ]",
  23717. referencedClasses: [],
  23718. messageSends: ["ifNil:"]
  23719. }),
  23720. $globals.SmalltalkImage);
  23721. $core.addMethod(
  23722. $core.method({
  23723. selector: "globals",
  23724. protocol: "accessing",
  23725. fn: function (){
  23726. var self=this,$self=this;
  23727. return $core.withContext(function($ctx1) {
  23728. return $globals;
  23729. return self;
  23730. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.SmalltalkImage)});
  23731. },
  23732. args: [],
  23733. source: "globals\x0a\x09<inlineJS: 'return $globals'>",
  23734. referencedClasses: [],
  23735. messageSends: []
  23736. }),
  23737. $globals.SmalltalkImage);
  23738. $core.addMethod(
  23739. $core.method({
  23740. selector: "includesKey:",
  23741. protocol: "accessing",
  23742. fn: function (aKey){
  23743. var self=this,$self=this;
  23744. return $core.withContext(function($ctx1) {
  23745. return $core.hasOwnProperty(aKey);
  23746. return self;
  23747. }, function($ctx1) {$ctx1.fill(self,"includesKey:",{aKey:aKey},$globals.SmalltalkImage)});
  23748. },
  23749. args: ["aKey"],
  23750. source: "includesKey: aKey\x0a\x09<inlineJS: 'return $core.hasOwnProperty(aKey)'>",
  23751. referencedClasses: [],
  23752. messageSends: []
  23753. }),
  23754. $globals.SmalltalkImage);
  23755. $core.addMethod(
  23756. $core.method({
  23757. selector: "isSmalltalkObject:",
  23758. protocol: "testing",
  23759. fn: function (anObject){
  23760. var self=this,$self=this;
  23761. return $core.withContext(function($ctx1) {
  23762. return anObject.a$cls != null;
  23763. return self;
  23764. }, function($ctx1) {$ctx1.fill(self,"isSmalltalkObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23765. },
  23766. args: ["anObject"],
  23767. 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'>",
  23768. referencedClasses: [],
  23769. messageSends: []
  23770. }),
  23771. $globals.SmalltalkImage);
  23772. $core.addMethod(
  23773. $core.method({
  23774. selector: "optOut:",
  23775. protocol: "accessing",
  23776. fn: function (anObject){
  23777. var self=this,$self=this;
  23778. return $core.withContext(function($ctx1) {
  23779. anObject.klass = null; anObject.a$cls = null;
  23780. return self;
  23781. }, function($ctx1) {$ctx1.fill(self,"optOut:",{anObject:anObject},$globals.SmalltalkImage)});
  23782. },
  23783. args: ["anObject"],
  23784. 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'>",
  23785. referencedClasses: [],
  23786. messageSends: []
  23787. }),
  23788. $globals.SmalltalkImage);
  23789. $core.addMethod(
  23790. $core.method({
  23791. selector: "packageAt:ifAbsent:",
  23792. protocol: "packages",
  23793. fn: function (packageName,aBlock){
  23794. var self=this,$self=this;
  23795. return $core.withContext(function($ctx1) {
  23796. return $recv($self._packageDictionary())._at_ifAbsent_(packageName,aBlock);
  23797. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifAbsent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23798. },
  23799. args: ["packageName", "aBlock"],
  23800. source: "packageAt: packageName ifAbsent: aBlock\x0a\x09^ self packageDictionary at: packageName ifAbsent: aBlock",
  23801. referencedClasses: [],
  23802. messageSends: ["at:ifAbsent:", "packageDictionary"]
  23803. }),
  23804. $globals.SmalltalkImage);
  23805. $core.addMethod(
  23806. $core.method({
  23807. selector: "packageAt:ifPresent:",
  23808. protocol: "packages",
  23809. fn: function (packageName,aBlock){
  23810. var self=this,$self=this;
  23811. return $core.withContext(function($ctx1) {
  23812. return $recv($self._packageDictionary())._at_ifPresent_(packageName,aBlock);
  23813. }, function($ctx1) {$ctx1.fill(self,"packageAt:ifPresent:",{packageName:packageName,aBlock:aBlock},$globals.SmalltalkImage)});
  23814. },
  23815. args: ["packageName", "aBlock"],
  23816. source: "packageAt: packageName ifPresent: aBlock\x0a\x09^ self packageDictionary at: packageName ifPresent: aBlock",
  23817. referencedClasses: [],
  23818. messageSends: ["at:ifPresent:", "packageDictionary"]
  23819. }),
  23820. $globals.SmalltalkImage);
  23821. $core.addMethod(
  23822. $core.method({
  23823. selector: "packageDictionary",
  23824. protocol: "packages",
  23825. fn: function (){
  23826. var self=this,$self=this;
  23827. return $core.withContext(function($ctx1) {
  23828. var $1,$receiver;
  23829. $1=$self["@packageDictionary"];
  23830. if(($receiver = $1) == null || $receiver.a$nil){
  23831. $self["@packageDictionary"]=$recv($globals.Dictionary)._new();
  23832. return $self["@packageDictionary"];
  23833. } else {
  23834. return $1;
  23835. }
  23836. }, function($ctx1) {$ctx1.fill(self,"packageDictionary",{},$globals.SmalltalkImage)});
  23837. },
  23838. args: [],
  23839. source: "packageDictionary\x0a\x09^ packageDictionary ifNil: [ packageDictionary := Dictionary new ]",
  23840. referencedClasses: ["Dictionary"],
  23841. messageSends: ["ifNil:", "new"]
  23842. }),
  23843. $globals.SmalltalkImage);
  23844. $core.addMethod(
  23845. $core.method({
  23846. selector: "packages",
  23847. protocol: "packages",
  23848. fn: function (){
  23849. var self=this,$self=this;
  23850. return $core.withContext(function($ctx1) {
  23851. return $recv($recv($self._packageDictionary())._values())._copy();
  23852. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.SmalltalkImage)});
  23853. },
  23854. args: [],
  23855. source: "packages\x0a\x09\x22Return all Package instances in the system.\x22\x0a\x0a\x09^ self packageDictionary values copy",
  23856. referencedClasses: [],
  23857. messageSends: ["copy", "values", "packageDictionary"]
  23858. }),
  23859. $globals.SmalltalkImage);
  23860. $core.addMethod(
  23861. $core.method({
  23862. selector: "parse:",
  23863. protocol: "accessing",
  23864. fn: function (aString){
  23865. var self=this,$self=this;
  23866. var result;
  23867. return $core.withContext(function($ctx1) {
  23868. var $1;
  23869. $recv((function(){
  23870. return $core.withContext(function($ctx2) {
  23871. result=$self._basicParse_(aString);
  23872. return result;
  23873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  23874. }))._tryCatch_((function(ex){
  23875. return $core.withContext(function($ctx2) {
  23876. return $recv($self._parseError_parsing_(ex,aString))._signal();
  23877. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  23878. }));
  23879. $1=result;
  23880. $recv($1)._source_(aString);
  23881. return $recv($1)._yourself();
  23882. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString,result:result},$globals.SmalltalkImage)});
  23883. },
  23884. args: ["aString"],
  23885. 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",
  23886. referencedClasses: [],
  23887. messageSends: ["tryCatch:", "basicParse:", "signal", "parseError:parsing:", "source:", "yourself"]
  23888. }),
  23889. $globals.SmalltalkImage);
  23890. $core.addMethod(
  23891. $core.method({
  23892. selector: "parseError:parsing:",
  23893. protocol: "error handling",
  23894. fn: function (anException,aString){
  23895. var self=this,$self=this;
  23896. return $core.withContext(function($ctx1) {
  23897. var $1,$2,$9,$8,$7,$6,$5,$4,$3,$receiver;
  23898. $1=$recv(anException)._basicAt_("location");
  23899. $ctx1.sendIdx["basicAt:"]=1;
  23900. if(($receiver = $1) == null || $receiver.a$nil){
  23901. return $recv(anException)._pass();
  23902. } else {
  23903. var loc;
  23904. loc=$receiver;
  23905. $2=$recv($globals.ParseError)._new();
  23906. $9=$recv(loc)._start();
  23907. $ctx1.sendIdx["start"]=1;
  23908. $8=$recv($9)._line();
  23909. $7="Parse error on line ".__comma($8);
  23910. $6=$recv($7).__comma(" column ");
  23911. $ctx1.sendIdx[","]=4;
  23912. $5=$recv($6).__comma($recv($recv(loc)._start())._column());
  23913. $ctx1.sendIdx[","]=3;
  23914. $4=$recv($5).__comma(" : Unexpected character ");
  23915. $ctx1.sendIdx[","]=2;
  23916. $3=$recv($4).__comma($recv(anException)._basicAt_("found"));
  23917. $ctx1.sendIdx[","]=1;
  23918. $recv($2)._messageText_($3);
  23919. return $recv($2)._yourself();
  23920. }
  23921. return self;
  23922. }, function($ctx1) {$ctx1.fill(self,"parseError:parsing:",{anException:anException,aString:aString},$globals.SmalltalkImage)});
  23923. },
  23924. args: ["anException", "aString"],
  23925. 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 ]",
  23926. referencedClasses: ["ParseError"],
  23927. messageSends: ["ifNil:ifNotNil:", "basicAt:", "pass", "messageText:", "new", ",", "line", "start", "column", "yourself"]
  23928. }),
  23929. $globals.SmalltalkImage);
  23930. $core.addMethod(
  23931. $core.method({
  23932. selector: "postLoad",
  23933. protocol: "image",
  23934. fn: function (){
  23935. var self=this,$self=this;
  23936. var pkgs,classes;
  23937. return $core.withContext(function($ctx1) {
  23938. var $1;
  23939. pkgs=$self._adoptPackageDescriptors();
  23940. $recv(pkgs)._do_("beClean");
  23941. $ctx1.sendIdx["do:"]=1;
  23942. classes=$recv($recv($globals.Smalltalk)._classes())._select_((function(each){
  23943. return $core.withContext(function($ctx2) {
  23944. return $recv(pkgs)._includes_($recv(each)._package());
  23945. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  23946. }));
  23947. $recv(classes)._do_((function(each){
  23948. return $core.withContext(function($ctx2) {
  23949. $1=$recv(each).__eq($self._class());
  23950. if(!$core.assert($1)){
  23951. return $recv(each)._initialize();
  23952. }
  23953. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  23954. }));
  23955. $self._sweepPackageDescriptors_(pkgs);
  23956. return self;
  23957. }, function($ctx1) {$ctx1.fill(self,"postLoad",{pkgs:pkgs,classes:classes},$globals.SmalltalkImage)});
  23958. },
  23959. args: [],
  23960. 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",
  23961. referencedClasses: ["Smalltalk"],
  23962. messageSends: ["adoptPackageDescriptors", "do:", "select:", "classes", "includes:", "package", "ifFalse:", "=", "class", "initialize", "sweepPackageDescriptors:"]
  23963. }),
  23964. $globals.SmalltalkImage);
  23965. $core.addMethod(
  23966. $core.method({
  23967. selector: "pseudoVariableNames",
  23968. protocol: "accessing",
  23969. fn: function (){
  23970. var self=this,$self=this;
  23971. return ["self", "super", "nil", "true", "false", "thisContext"];
  23972. },
  23973. args: [],
  23974. source: "pseudoVariableNames\x0a\x09^ #('self' 'super' 'nil' 'true' 'false' 'thisContext')",
  23975. referencedClasses: [],
  23976. messageSends: []
  23977. }),
  23978. $globals.SmalltalkImage);
  23979. $core.addMethod(
  23980. $core.method({
  23981. selector: "readJSObject:",
  23982. protocol: "accessing",
  23983. fn: function (anObject){
  23984. var self=this,$self=this;
  23985. return $core.withContext(function($ctx1) {
  23986. return $core.readJSObject(anObject);
  23987. return self;
  23988. }, function($ctx1) {$ctx1.fill(self,"readJSObject:",{anObject:anObject},$globals.SmalltalkImage)});
  23989. },
  23990. args: ["anObject"],
  23991. source: "readJSObject: anObject\x0a\x09<inlineJS: 'return $core.readJSObject(anObject)'>",
  23992. referencedClasses: [],
  23993. messageSends: []
  23994. }),
  23995. $globals.SmalltalkImage);
  23996. $core.addMethod(
  23997. $core.method({
  23998. selector: "removeClass:",
  23999. protocol: "classes",
  24000. fn: function (aClass){
  24001. var self=this,$self=this;
  24002. return $core.withContext(function($ctx1) {
  24003. var $1,$2,$5,$4,$6,$3,$7,$8,$10,$9,$receiver;
  24004. $1=$recv(aClass)._isMetaclass();
  24005. if($core.assert($1)){
  24006. $2=$recv($recv(aClass)._asString()).__comma(" is a Metaclass and cannot be removed!");
  24007. $ctx1.sendIdx[","]=1;
  24008. $self._error_($2);
  24009. $ctx1.sendIdx["error:"]=1;
  24010. }
  24011. $recv(aClass)._allSubclassesDo_((function(subclass){
  24012. return $core.withContext(function($ctx2) {
  24013. $5=$recv(aClass)._name();
  24014. $ctx2.sendIdx["name"]=1;
  24015. $4=$recv($5).__comma(" has a subclass: ");
  24016. $ctx2.sendIdx[","]=3;
  24017. $6=$recv(subclass)._name();
  24018. $ctx2.sendIdx["name"]=2;
  24019. $3=$recv($4).__comma($6);
  24020. $ctx2.sendIdx[","]=2;
  24021. return $self._error_($3);
  24022. $ctx2.sendIdx["error:"]=2;
  24023. }, function($ctx2) {$ctx2.fillBlock({subclass:subclass},$ctx1,2)});
  24024. }));
  24025. $recv($recv(aClass)._traitUsers())._ifNotEmpty_((function(){
  24026. return $core.withContext(function($ctx2) {
  24027. return $self._error_($recv($recv(aClass)._name()).__comma(" has trait users."));
  24028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  24029. }));
  24030. $self._deleteClass_(aClass);
  24031. $recv(aClass)._setTraitComposition_([]);
  24032. $ctx1.sendIdx["setTraitComposition:"]=1;
  24033. $7=$recv(aClass)._theMetaClass();
  24034. if(($receiver = $7) == null || $receiver.a$nil){
  24035. $7;
  24036. } else {
  24037. var meta;
  24038. meta=$receiver;
  24039. $recv(meta)._setTraitComposition_([]);
  24040. }
  24041. $8=$recv($globals.SystemAnnouncer)._current();
  24042. $10=$recv($globals.ClassRemoved)._new();
  24043. $recv($10)._theClass_(aClass);
  24044. $9=$recv($10)._yourself();
  24045. $recv($8)._announce_($9);
  24046. return self;
  24047. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.SmalltalkImage)});
  24048. },
  24049. args: ["aClass"],
  24050. 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)",
  24051. referencedClasses: ["SystemAnnouncer", "ClassRemoved"],
  24052. messageSends: ["ifTrue:", "isMetaclass", "error:", ",", "asString", "allSubclassesDo:", "name", "ifNotEmpty:", "traitUsers", "deleteClass:", "setTraitComposition:", "ifNotNil:", "theMetaClass", "announce:", "current", "theClass:", "new", "yourself"]
  24053. }),
  24054. $globals.SmalltalkImage);
  24055. $core.addMethod(
  24056. $core.method({
  24057. selector: "removePackage:",
  24058. protocol: "packages",
  24059. fn: function (packageName){
  24060. var self=this,$self=this;
  24061. var pkg;
  24062. return $core.withContext(function($ctx1) {
  24063. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24064. return $core.withContext(function($ctx2) {
  24065. return $self._error_("Missing package: ".__comma(packageName));
  24066. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24067. }));
  24068. $recv($recv(pkg)._classes())._do_((function(each){
  24069. return $core.withContext(function($ctx2) {
  24070. return $self._removeClass_(each);
  24071. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  24072. }));
  24073. $recv($self._packageDictionary())._removeKey_(packageName);
  24074. return self;
  24075. }, function($ctx1) {$ctx1.fill(self,"removePackage:",{packageName:packageName,pkg:pkg},$globals.SmalltalkImage)});
  24076. },
  24077. args: ["packageName"],
  24078. 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",
  24079. referencedClasses: [],
  24080. messageSends: ["packageAt:ifAbsent:", "error:", ",", "do:", "classes", "removeClass:", "removeKey:", "packageDictionary"]
  24081. }),
  24082. $globals.SmalltalkImage);
  24083. $core.addMethod(
  24084. $core.method({
  24085. selector: "renamePackage:to:",
  24086. protocol: "packages",
  24087. fn: function (packageName,newName){
  24088. var self=this,$self=this;
  24089. var pkg;
  24090. return $core.withContext(function($ctx1) {
  24091. var $1,$2,$3;
  24092. pkg=$self._packageAt_ifAbsent_(packageName,(function(){
  24093. return $core.withContext(function($ctx2) {
  24094. $1="Missing package: ".__comma(packageName);
  24095. $ctx2.sendIdx[","]=1;
  24096. return $self._error_($1);
  24097. $ctx2.sendIdx["error:"]=1;
  24098. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  24099. }));
  24100. $self._packageAt_ifPresent_(newName,(function(){
  24101. return $core.withContext(function($ctx2) {
  24102. return $self._error_("Already exists a package called: ".__comma(newName));
  24103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  24104. }));
  24105. $2=pkg;
  24106. $recv($2)._name_(newName);
  24107. $recv($2)._beDirty();
  24108. $3=$self._packageDictionary();
  24109. $recv($3)._at_put_(newName,pkg);
  24110. $recv($3)._removeKey_(packageName);
  24111. return self;
  24112. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{packageName:packageName,newName:newName,pkg:pkg},$globals.SmalltalkImage)});
  24113. },
  24114. args: ["packageName", "newName"],
  24115. 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",
  24116. referencedClasses: [],
  24117. messageSends: ["packageAt:ifAbsent:", "error:", ",", "packageAt:ifPresent:", "name:", "beDirty", "at:put:", "packageDictionary", "removeKey:"]
  24118. }),
  24119. $globals.SmalltalkImage);
  24120. $core.addMethod(
  24121. $core.method({
  24122. selector: "reservedWords",
  24123. protocol: "accessing",
  24124. fn: function (){
  24125. var self=this,$self=this;
  24126. 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"];
  24127. },
  24128. args: [],
  24129. 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)",
  24130. referencedClasses: [],
  24131. messageSends: []
  24132. }),
  24133. $globals.SmalltalkImage);
  24134. $core.addMethod(
  24135. $core.method({
  24136. selector: "settings",
  24137. protocol: "accessing",
  24138. fn: function (){
  24139. var self=this,$self=this;
  24140. return $globals.SmalltalkSettings;
  24141. },
  24142. args: [],
  24143. source: "settings\x0a\x09^ SmalltalkSettings",
  24144. referencedClasses: ["SmalltalkSettings"],
  24145. messageSends: []
  24146. }),
  24147. $globals.SmalltalkImage);
  24148. $core.addMethod(
  24149. $core.method({
  24150. selector: "sweepPackageDescriptors:",
  24151. protocol: "private",
  24152. fn: function (pkgs){
  24153. var self=this,$self=this;
  24154. var pd;
  24155. return $core.withContext(function($ctx1) {
  24156. pd=$recv($self._core())._packageDescriptors();
  24157. $recv(pkgs)._do_((function(each){
  24158. return $core.withContext(function($ctx2) {
  24159. return $recv(pd)._removeKey_($recv(each)._name());
  24160. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24161. }));
  24162. return self;
  24163. }, function($ctx1) {$ctx1.fill(self,"sweepPackageDescriptors:",{pkgs:pkgs,pd:pd},$globals.SmalltalkImage)});
  24164. },
  24165. args: ["pkgs"],
  24166. source: "sweepPackageDescriptors: pkgs\x0a\x09| pd |\x09\x0a\x09pd := self core packageDescriptors.\x0a\x09pkgs do: [ :each | pd removeKey: each name ]",
  24167. referencedClasses: [],
  24168. messageSends: ["packageDescriptors", "core", "do:", "removeKey:", "name"]
  24169. }),
  24170. $globals.SmalltalkImage);
  24171. $core.addMethod(
  24172. $core.method({
  24173. selector: "version",
  24174. protocol: "accessing",
  24175. fn: function (){
  24176. var self=this,$self=this;
  24177. return "0.22.1";
  24178. },
  24179. args: [],
  24180. source: "version\x0a\x09\x22Answer the version string of Amber\x22\x0a\x09\x0a\x09^ '0.22.1'",
  24181. referencedClasses: [],
  24182. messageSends: []
  24183. }),
  24184. $globals.SmalltalkImage);
  24185. $globals.SmalltalkImage.a$cls.iVarNames = ["current"];
  24186. $core.addMethod(
  24187. $core.method({
  24188. selector: "current",
  24189. protocol: "instance creation",
  24190. fn: function (){
  24191. var self=this,$self=this;
  24192. return $core.withContext(function($ctx1) {
  24193. var $1,$receiver;
  24194. $1=$self["@current"];
  24195. if(($receiver = $1) == null || $receiver.a$nil){
  24196. $self["@current"]=(
  24197. $ctx1.supercall = true,
  24198. ($globals.SmalltalkImage.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24199. $ctx1.supercall = false;
  24200. return $self["@current"];
  24201. } else {
  24202. $self._deprecatedAPI();
  24203. return $self["@current"];
  24204. }
  24205. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SmalltalkImage.a$cls)});
  24206. },
  24207. args: [],
  24208. source: "current\x0a\x09^ current ifNil: [ current := super new ] ifNotNil: [ self deprecatedAPI. current ]",
  24209. referencedClasses: [],
  24210. messageSends: ["ifNil:ifNotNil:", "new", "deprecatedAPI"]
  24211. }),
  24212. $globals.SmalltalkImage.a$cls);
  24213. $core.addMethod(
  24214. $core.method({
  24215. selector: "initialize",
  24216. protocol: "initialization",
  24217. fn: function (){
  24218. var self=this,$self=this;
  24219. var st;
  24220. return $core.withContext(function($ctx1) {
  24221. st=$self._current();
  24222. $recv($recv(st)._globals())._at_put_("Smalltalk",st);
  24223. return self;
  24224. }, function($ctx1) {$ctx1.fill(self,"initialize",{st:st},$globals.SmalltalkImage.a$cls)});
  24225. },
  24226. args: [],
  24227. source: "initialize\x0a\x09| st |\x0a\x09st := self current.\x0a\x09st globals at: 'Smalltalk' put: st",
  24228. referencedClasses: [],
  24229. messageSends: ["current", "at:put:", "globals"]
  24230. }),
  24231. $globals.SmalltalkImage.a$cls);
  24232. $core.addMethod(
  24233. $core.method({
  24234. selector: "new",
  24235. protocol: "instance creation",
  24236. fn: function (){
  24237. var self=this,$self=this;
  24238. return $core.withContext(function($ctx1) {
  24239. $self._shouldNotImplement();
  24240. return self;
  24241. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SmalltalkImage.a$cls)});
  24242. },
  24243. args: [],
  24244. source: "new\x0a\x09self shouldNotImplement",
  24245. referencedClasses: [],
  24246. messageSends: ["shouldNotImplement"]
  24247. }),
  24248. $globals.SmalltalkImage.a$cls);
  24249. $core.setTraitComposition([{trait: $globals.TThenable}], $globals.JSObjectProxy);
  24250. $core.addMethod(
  24251. $core.method({
  24252. selector: "nextPutJSObject:",
  24253. protocol: "*Kernel-Infrastructure",
  24254. fn: function (aJSObject){
  24255. var self=this,$self=this;
  24256. return $core.withContext(function($ctx1) {
  24257. $self._nextPut_(aJSObject);
  24258. return self;
  24259. }, function($ctx1) {$ctx1.fill(self,"nextPutJSObject:",{aJSObject:aJSObject},$globals.ProtoStream)});
  24260. },
  24261. args: ["aJSObject"],
  24262. source: "nextPutJSObject: aJSObject\x0a\x09self nextPut: aJSObject",
  24263. referencedClasses: [],
  24264. messageSends: ["nextPut:"]
  24265. }),
  24266. $globals.ProtoStream);
  24267. $core.addMethod(
  24268. $core.method({
  24269. selector: "asJavaScriptPropertyName",
  24270. protocol: "*Kernel-Infrastructure",
  24271. fn: function (){
  24272. var self=this,$self=this;
  24273. return $core.withContext(function($ctx1) {
  24274. return $core.st2prop(self);
  24275. return self;
  24276. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptPropertyName",{},$globals.String)});
  24277. },
  24278. args: [],
  24279. source: "asJavaScriptPropertyName\x0a<inlineJS: 'return $core.st2prop(self)'>",
  24280. referencedClasses: [],
  24281. messageSends: []
  24282. }),
  24283. $globals.String);
  24284. $core.addMethod(
  24285. $core.method({
  24286. selector: "asSetting",
  24287. protocol: "*Kernel-Infrastructure",
  24288. fn: function (){
  24289. var self=this,$self=this;
  24290. return $core.withContext(function($ctx1) {
  24291. return $recv($globals.Setting)._at_ifAbsent_(self,nil);
  24292. }, function($ctx1) {$ctx1.fill(self,"asSetting",{},$globals.String)});
  24293. },
  24294. args: [],
  24295. 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",
  24296. referencedClasses: ["Setting"],
  24297. messageSends: ["at:ifAbsent:"]
  24298. }),
  24299. $globals.String);
  24300. $core.addMethod(
  24301. $core.method({
  24302. selector: "asSettingIfAbsent:",
  24303. protocol: "*Kernel-Infrastructure",
  24304. fn: function (aDefaultValue){
  24305. var self=this,$self=this;
  24306. return $core.withContext(function($ctx1) {
  24307. return $recv($globals.Setting)._at_ifAbsent_(self,aDefaultValue);
  24308. }, function($ctx1) {$ctx1.fill(self,"asSettingIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24309. },
  24310. args: ["aDefaultValue"],
  24311. 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",
  24312. referencedClasses: ["Setting"],
  24313. messageSends: ["at:ifAbsent:"]
  24314. }),
  24315. $globals.String);
  24316. $core.addMethod(
  24317. $core.method({
  24318. selector: "settingValue",
  24319. protocol: "*Kernel-Infrastructure",
  24320. fn: function (){
  24321. var self=this,$self=this;
  24322. return $core.withContext(function($ctx1) {
  24323. return $recv($self._asSetting())._value();
  24324. }, function($ctx1) {$ctx1.fill(self,"settingValue",{},$globals.String)});
  24325. },
  24326. args: [],
  24327. source: "settingValue\x0a\x09^ self asSetting value",
  24328. referencedClasses: [],
  24329. messageSends: ["value", "asSetting"]
  24330. }),
  24331. $globals.String);
  24332. $core.addMethod(
  24333. $core.method({
  24334. selector: "settingValue:",
  24335. protocol: "*Kernel-Infrastructure",
  24336. fn: function (aValue){
  24337. var self=this,$self=this;
  24338. return $core.withContext(function($ctx1) {
  24339. return $recv($self._asSetting())._value_(aValue);
  24340. }, function($ctx1) {$ctx1.fill(self,"settingValue:",{aValue:aValue},$globals.String)});
  24341. },
  24342. args: ["aValue"],
  24343. 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",
  24344. referencedClasses: [],
  24345. messageSends: ["value:", "asSetting"]
  24346. }),
  24347. $globals.String);
  24348. $core.addMethod(
  24349. $core.method({
  24350. selector: "settingValueIfAbsent:",
  24351. protocol: "*Kernel-Infrastructure",
  24352. fn: function (aDefaultValue){
  24353. var self=this,$self=this;
  24354. return $core.withContext(function($ctx1) {
  24355. return $recv($self._asSettingIfAbsent_(aDefaultValue))._value();
  24356. }, function($ctx1) {$ctx1.fill(self,"settingValueIfAbsent:",{aDefaultValue:aDefaultValue},$globals.String)});
  24357. },
  24358. args: ["aDefaultValue"],
  24359. 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",
  24360. referencedClasses: [],
  24361. messageSends: ["value", "asSettingIfAbsent:"]
  24362. }),
  24363. $globals.String);
  24364. });
  24365. define('amber_core/Kernel-Announcements',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  24366. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  24367. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  24368. $core.addPackage("Kernel-Announcements");
  24369. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].innerEval = function (expr) { return eval(expr); };
  24370. ($core.packageDescriptors||$core.packages)["Kernel-Announcements"].transport = {"type":"amd","amdNamespace":"amber_core"};
  24371. $core.addClass("AnnouncementSubscription", $globals.Object, ["valuable", "announcementClass"], "Kernel-Announcements");
  24372. $globals.AnnouncementSubscription.comment="I am a single entry in a subscription registry of an `Announcer`.\x0aSeveral subscriptions by the same object is possible.";
  24373. $core.addMethod(
  24374. $core.method({
  24375. selector: "announcementClass",
  24376. protocol: "accessing",
  24377. fn: function (){
  24378. var self=this,$self=this;
  24379. return $self["@announcementClass"];
  24380. },
  24381. args: [],
  24382. source: "announcementClass\x0a\x09^ announcementClass",
  24383. referencedClasses: [],
  24384. messageSends: []
  24385. }),
  24386. $globals.AnnouncementSubscription);
  24387. $core.addMethod(
  24388. $core.method({
  24389. selector: "announcementClass:",
  24390. protocol: "accessing",
  24391. fn: function (aClass){
  24392. var self=this,$self=this;
  24393. $self["@announcementClass"]=aClass;
  24394. return self;
  24395. },
  24396. args: ["aClass"],
  24397. source: "announcementClass: aClass\x0a\x09announcementClass := aClass",
  24398. referencedClasses: [],
  24399. messageSends: []
  24400. }),
  24401. $globals.AnnouncementSubscription);
  24402. $core.addMethod(
  24403. $core.method({
  24404. selector: "deliver:",
  24405. protocol: "announcing",
  24406. fn: function (anAnnouncement){
  24407. var self=this,$self=this;
  24408. return $core.withContext(function($ctx1) {
  24409. var $1;
  24410. $1=$self._handlesAnnouncement_(anAnnouncement);
  24411. if($core.assert($1)){
  24412. $recv($self._valuable())._value_(anAnnouncement);
  24413. }
  24414. return self;
  24415. }, function($ctx1) {$ctx1.fill(self,"deliver:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24416. },
  24417. args: ["anAnnouncement"],
  24418. source: "deliver: anAnnouncement\x0a\x09(self handlesAnnouncement: anAnnouncement)\x0a\x09\x09ifTrue: [ self valuable value: anAnnouncement ]",
  24419. referencedClasses: [],
  24420. messageSends: ["ifTrue:", "handlesAnnouncement:", "value:", "valuable"]
  24421. }),
  24422. $globals.AnnouncementSubscription);
  24423. $core.addMethod(
  24424. $core.method({
  24425. selector: "handlesAnnouncement:",
  24426. protocol: "announcing",
  24427. fn: function (anAnnouncement){
  24428. var self=this,$self=this;
  24429. return $core.withContext(function($ctx1) {
  24430. var $2,$3,$1,$receiver;
  24431. $2=$recv($globals.Smalltalk)._globals();
  24432. $ctx1.sendIdx["globals"]=1;
  24433. $3=$recv($self._announcementClass())._name();
  24434. $ctx1.sendIdx["name"]=1;
  24435. $1=$recv($2)._at_($3);
  24436. $ctx1.sendIdx["at:"]=1;
  24437. if(($receiver = $1) == null || $receiver.a$nil){
  24438. return false;
  24439. } else {
  24440. var class_;
  24441. class_=$receiver;
  24442. return $recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv($recv(anAnnouncement)._class())._theNonMetaClass())._name()))._includesBehavior_(class_);
  24443. }
  24444. }, function($ctx1) {$ctx1.fill(self,"handlesAnnouncement:",{anAnnouncement:anAnnouncement},$globals.AnnouncementSubscription)});
  24445. },
  24446. args: ["anAnnouncement"],
  24447. 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 ]",
  24448. referencedClasses: ["Smalltalk"],
  24449. messageSends: ["ifNil:ifNotNil:", "at:", "globals", "name", "announcementClass", "includesBehavior:", "theNonMetaClass", "class"]
  24450. }),
  24451. $globals.AnnouncementSubscription);
  24452. $core.addMethod(
  24453. $core.method({
  24454. selector: "receiver",
  24455. protocol: "accessing",
  24456. fn: function (){
  24457. var self=this,$self=this;
  24458. return $core.withContext(function($ctx1) {
  24459. return $recv($self._valuable())._receiver();
  24460. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.AnnouncementSubscription)});
  24461. },
  24462. args: [],
  24463. source: "receiver\x0a\x09^ self valuable receiver",
  24464. referencedClasses: [],
  24465. messageSends: ["receiver", "valuable"]
  24466. }),
  24467. $globals.AnnouncementSubscription);
  24468. $core.addMethod(
  24469. $core.method({
  24470. selector: "valuable",
  24471. protocol: "accessing",
  24472. fn: function (){
  24473. var self=this,$self=this;
  24474. return $self["@valuable"];
  24475. },
  24476. args: [],
  24477. source: "valuable\x0a\x09^ valuable",
  24478. referencedClasses: [],
  24479. messageSends: []
  24480. }),
  24481. $globals.AnnouncementSubscription);
  24482. $core.addMethod(
  24483. $core.method({
  24484. selector: "valuable:",
  24485. protocol: "accessing",
  24486. fn: function (aValuable){
  24487. var self=this,$self=this;
  24488. $self["@valuable"]=aValuable;
  24489. return self;
  24490. },
  24491. args: ["aValuable"],
  24492. source: "valuable: aValuable\x0a\x09valuable := aValuable",
  24493. referencedClasses: [],
  24494. messageSends: []
  24495. }),
  24496. $globals.AnnouncementSubscription);
  24497. $core.addClass("AnnouncementValuable", $globals.Object, ["valuable", "receiver"], "Kernel-Announcements");
  24498. $globals.AnnouncementValuable.comment="I wrap `valuable` objects (typically instances of `BlockClosure`) with a `receiver` to be able to unregister subscriptions based on a `receiver`.";
  24499. $core.addMethod(
  24500. $core.method({
  24501. selector: "receiver",
  24502. protocol: "accessing",
  24503. fn: function (){
  24504. var self=this,$self=this;
  24505. return $self["@receiver"];
  24506. },
  24507. args: [],
  24508. source: "receiver\x0a\x09^ receiver",
  24509. referencedClasses: [],
  24510. messageSends: []
  24511. }),
  24512. $globals.AnnouncementValuable);
  24513. $core.addMethod(
  24514. $core.method({
  24515. selector: "receiver:",
  24516. protocol: "accessing",
  24517. fn: function (anObject){
  24518. var self=this,$self=this;
  24519. $self["@receiver"]=anObject;
  24520. return self;
  24521. },
  24522. args: ["anObject"],
  24523. source: "receiver: anObject\x0a\x09receiver := anObject",
  24524. referencedClasses: [],
  24525. messageSends: []
  24526. }),
  24527. $globals.AnnouncementValuable);
  24528. $core.addMethod(
  24529. $core.method({
  24530. selector: "valuable",
  24531. protocol: "accessing",
  24532. fn: function (){
  24533. var self=this,$self=this;
  24534. return $self["@valuable"];
  24535. },
  24536. args: [],
  24537. source: "valuable\x0a\x09^ valuable",
  24538. referencedClasses: [],
  24539. messageSends: []
  24540. }),
  24541. $globals.AnnouncementValuable);
  24542. $core.addMethod(
  24543. $core.method({
  24544. selector: "valuable:",
  24545. protocol: "accessing",
  24546. fn: function (anObject){
  24547. var self=this,$self=this;
  24548. $self["@valuable"]=anObject;
  24549. return self;
  24550. },
  24551. args: ["anObject"],
  24552. source: "valuable: anObject\x0a\x09valuable := anObject",
  24553. referencedClasses: [],
  24554. messageSends: []
  24555. }),
  24556. $globals.AnnouncementValuable);
  24557. $core.addMethod(
  24558. $core.method({
  24559. selector: "value",
  24560. protocol: "evaluating",
  24561. fn: function (){
  24562. var self=this,$self=this;
  24563. return $core.withContext(function($ctx1) {
  24564. return $recv($self._valuable())._value();
  24565. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AnnouncementValuable)});
  24566. },
  24567. args: [],
  24568. source: "value\x0a\x09^ self valuable value",
  24569. referencedClasses: [],
  24570. messageSends: ["value", "valuable"]
  24571. }),
  24572. $globals.AnnouncementValuable);
  24573. $core.addMethod(
  24574. $core.method({
  24575. selector: "value:",
  24576. protocol: "evaluating",
  24577. fn: function (anObject){
  24578. var self=this,$self=this;
  24579. return $core.withContext(function($ctx1) {
  24580. return $recv($self._valuable())._value_(anObject);
  24581. }, function($ctx1) {$ctx1.fill(self,"value:",{anObject:anObject},$globals.AnnouncementValuable)});
  24582. },
  24583. args: ["anObject"],
  24584. source: "value: anObject\x0a\x09^ self valuable value: anObject",
  24585. referencedClasses: [],
  24586. messageSends: ["value:", "valuable"]
  24587. }),
  24588. $globals.AnnouncementValuable);
  24589. $core.addClass("Announcer", $globals.Object, ["registry", "subscriptions"], "Kernel-Announcements");
  24590. $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' ].";
  24591. $core.addMethod(
  24592. $core.method({
  24593. selector: "announce:",
  24594. protocol: "announcing",
  24595. fn: function (anAnnouncement){
  24596. var self=this,$self=this;
  24597. return $core.withContext(function($ctx1) {
  24598. $recv($self["@subscriptions"])._do_((function(each){
  24599. return $core.withContext(function($ctx2) {
  24600. return $recv(each)._deliver_(anAnnouncement);
  24601. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24602. }));
  24603. return self;
  24604. }, function($ctx1) {$ctx1.fill(self,"announce:",{anAnnouncement:anAnnouncement},$globals.Announcer)});
  24605. },
  24606. args: ["anAnnouncement"],
  24607. source: "announce: anAnnouncement\x0a\x09subscriptions do: [ :each |\x0a\x09\x09each deliver: anAnnouncement ]",
  24608. referencedClasses: [],
  24609. messageSends: ["do:", "deliver:"]
  24610. }),
  24611. $globals.Announcer);
  24612. $core.addMethod(
  24613. $core.method({
  24614. selector: "initialize",
  24615. protocol: "initialization",
  24616. fn: function (){
  24617. var self=this,$self=this;
  24618. return $core.withContext(function($ctx1) {
  24619. (
  24620. $ctx1.supercall = true,
  24621. ($globals.Announcer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  24622. $ctx1.supercall = false;
  24623. $self["@subscriptions"]=$recv($globals.OrderedCollection)._new();
  24624. return self;
  24625. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Announcer)});
  24626. },
  24627. args: [],
  24628. source: "initialize\x0a\x09super initialize.\x0a\x09subscriptions := OrderedCollection new",
  24629. referencedClasses: ["OrderedCollection"],
  24630. messageSends: ["initialize", "new"]
  24631. }),
  24632. $globals.Announcer);
  24633. $core.addMethod(
  24634. $core.method({
  24635. selector: "on:do:",
  24636. protocol: "subscribing",
  24637. fn: function (aClass,aBlock){
  24638. var self=this,$self=this;
  24639. return $core.withContext(function($ctx1) {
  24640. $self._on_do_for_(aClass,aBlock,nil);
  24641. return self;
  24642. }, function($ctx1) {$ctx1.fill(self,"on:do:",{aClass:aClass,aBlock:aBlock},$globals.Announcer)});
  24643. },
  24644. args: ["aClass", "aBlock"],
  24645. source: "on: aClass do: aBlock\x0a\x09self on: aClass do: aBlock for: nil",
  24646. referencedClasses: [],
  24647. messageSends: ["on:do:for:"]
  24648. }),
  24649. $globals.Announcer);
  24650. $core.addMethod(
  24651. $core.method({
  24652. selector: "on:do:for:",
  24653. protocol: "subscribing",
  24654. fn: function (aClass,aBlock,aReceiver){
  24655. var self=this,$self=this;
  24656. return $core.withContext(function($ctx1) {
  24657. var $1,$3,$5,$6,$4,$2;
  24658. $1=$self["@subscriptions"];
  24659. $3=$recv($globals.AnnouncementSubscription)._new();
  24660. $ctx1.sendIdx["new"]=1;
  24661. $5=$recv($globals.AnnouncementValuable)._new();
  24662. $recv($5)._valuable_(aBlock);
  24663. $recv($5)._receiver_(aReceiver);
  24664. $6=$recv($5)._yourself();
  24665. $ctx1.sendIdx["yourself"]=1;
  24666. $4=$6;
  24667. $recv($3)._valuable_($4);
  24668. $ctx1.sendIdx["valuable:"]=1;
  24669. $recv($3)._announcementClass_(aClass);
  24670. $2=$recv($3)._yourself();
  24671. $recv($1)._add_($2);
  24672. return self;
  24673. }, function($ctx1) {$ctx1.fill(self,"on:do:for:",{aClass:aClass,aBlock:aBlock,aReceiver:aReceiver},$globals.Announcer)});
  24674. },
  24675. args: ["aClass", "aBlock", "aReceiver"],
  24676. 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)",
  24677. referencedClasses: ["AnnouncementSubscription", "AnnouncementValuable"],
  24678. messageSends: ["add:", "valuable:", "new", "receiver:", "yourself", "announcementClass:"]
  24679. }),
  24680. $globals.Announcer);
  24681. $core.addMethod(
  24682. $core.method({
  24683. selector: "on:doOnce:",
  24684. protocol: "subscribing",
  24685. fn: function (aClass,aBlock){
  24686. var self=this,$self=this;
  24687. var subscription;
  24688. return $core.withContext(function($ctx1) {
  24689. var $1;
  24690. $1=$recv($globals.AnnouncementSubscription)._new();
  24691. $recv($1)._announcementClass_(aClass);
  24692. subscription=$recv($1)._yourself();
  24693. $recv(subscription)._valuable_((function(ann){
  24694. return $core.withContext(function($ctx2) {
  24695. $recv($self["@subscriptions"])._remove_(subscription);
  24696. return $recv(aBlock)._value_(ann);
  24697. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,1)});
  24698. }));
  24699. $recv($self["@subscriptions"])._add_(subscription);
  24700. return self;
  24701. }, function($ctx1) {$ctx1.fill(self,"on:doOnce:",{aClass:aClass,aBlock:aBlock,subscription:subscription},$globals.Announcer)});
  24702. },
  24703. args: ["aClass", "aBlock"],
  24704. 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",
  24705. referencedClasses: ["AnnouncementSubscription"],
  24706. messageSends: ["announcementClass:", "new", "yourself", "valuable:", "remove:", "value:", "add:"]
  24707. }),
  24708. $globals.Announcer);
  24709. $core.addMethod(
  24710. $core.method({
  24711. selector: "on:send:to:",
  24712. protocol: "subscribing",
  24713. fn: function (aClass,aSelector,anObject){
  24714. var self=this,$self=this;
  24715. return $core.withContext(function($ctx1) {
  24716. var $1,$3,$5,$6,$4,$2;
  24717. $1=$self["@subscriptions"];
  24718. $3=$recv($globals.AnnouncementSubscription)._new();
  24719. $ctx1.sendIdx["new"]=1;
  24720. $5=$recv($globals.MessageSend)._new();
  24721. $recv($5)._receiver_(anObject);
  24722. $recv($5)._selector_(aSelector);
  24723. $6=$recv($5)._yourself();
  24724. $ctx1.sendIdx["yourself"]=1;
  24725. $4=$6;
  24726. $recv($3)._valuable_($4);
  24727. $recv($3)._announcementClass_(aClass);
  24728. $2=$recv($3)._yourself();
  24729. $recv($1)._add_($2);
  24730. return self;
  24731. }, function($ctx1) {$ctx1.fill(self,"on:send:to:",{aClass:aClass,aSelector:aSelector,anObject:anObject},$globals.Announcer)});
  24732. },
  24733. args: ["aClass", "aSelector", "anObject"],
  24734. 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)",
  24735. referencedClasses: ["AnnouncementSubscription", "MessageSend"],
  24736. messageSends: ["add:", "valuable:", "new", "receiver:", "selector:", "yourself", "announcementClass:"]
  24737. }),
  24738. $globals.Announcer);
  24739. $core.addMethod(
  24740. $core.method({
  24741. selector: "unsubscribe:",
  24742. protocol: "subscribing",
  24743. fn: function (anObject){
  24744. var self=this,$self=this;
  24745. return $core.withContext(function($ctx1) {
  24746. $self["@subscriptions"]=$recv($self["@subscriptions"])._reject_((function(each){
  24747. return $core.withContext(function($ctx2) {
  24748. return $recv($recv(each)._receiver()).__eq(anObject);
  24749. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  24750. }));
  24751. return self;
  24752. }, function($ctx1) {$ctx1.fill(self,"unsubscribe:",{anObject:anObject},$globals.Announcer)});
  24753. },
  24754. args: ["anObject"],
  24755. source: "unsubscribe: anObject\x0a\x09subscriptions := subscriptions reject: [ :each |\x0a\x09\x09each receiver = anObject ]",
  24756. referencedClasses: [],
  24757. messageSends: ["reject:", "=", "receiver"]
  24758. }),
  24759. $globals.Announcer);
  24760. $core.addClass("SystemAnnouncer", $globals.Announcer, [], "Kernel-Announcements");
  24761. $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`";
  24762. $globals.SystemAnnouncer.a$cls.iVarNames = ["current"];
  24763. $core.addMethod(
  24764. $core.method({
  24765. selector: "current",
  24766. protocol: "accessing",
  24767. fn: function (){
  24768. var self=this,$self=this;
  24769. return $core.withContext(function($ctx1) {
  24770. var $1,$receiver;
  24771. $1=$self["@current"];
  24772. if(($receiver = $1) == null || $receiver.a$nil){
  24773. $self["@current"]=(
  24774. $ctx1.supercall = true,
  24775. ($globals.SystemAnnouncer.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  24776. $ctx1.supercall = false;
  24777. return $self["@current"];
  24778. } else {
  24779. return $1;
  24780. }
  24781. }, function($ctx1) {$ctx1.fill(self,"current",{},$globals.SystemAnnouncer.a$cls)});
  24782. },
  24783. args: [],
  24784. source: "current\x0a\x09^ current ifNil: [ current := super new ]",
  24785. referencedClasses: [],
  24786. messageSends: ["ifNil:", "new"]
  24787. }),
  24788. $globals.SystemAnnouncer.a$cls);
  24789. $core.addMethod(
  24790. $core.method({
  24791. selector: "new",
  24792. protocol: "instance creation",
  24793. fn: function (){
  24794. var self=this,$self=this;
  24795. return $core.withContext(function($ctx1) {
  24796. $self._shouldNotImplement();
  24797. return self;
  24798. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.SystemAnnouncer.a$cls)});
  24799. },
  24800. args: [],
  24801. source: "new\x0a\x09self shouldNotImplement",
  24802. referencedClasses: [],
  24803. messageSends: ["shouldNotImplement"]
  24804. }),
  24805. $globals.SystemAnnouncer.a$cls);
  24806. $core.addClass("SystemAnnouncement", $globals.Object, [], "Kernel-Announcements");
  24807. $globals.SystemAnnouncement.comment="I am the superclass of all system announcements";
  24808. $core.addMethod(
  24809. $core.method({
  24810. selector: "classTag",
  24811. protocol: "accessing",
  24812. fn: function (){
  24813. var self=this,$self=this;
  24814. return "announcement";
  24815. },
  24816. args: [],
  24817. 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'",
  24818. referencedClasses: [],
  24819. messageSends: []
  24820. }),
  24821. $globals.SystemAnnouncement.a$cls);
  24822. $core.addClass("ClassAnnouncement", $globals.SystemAnnouncement, ["theClass"], "Kernel-Announcements");
  24823. $globals.ClassAnnouncement.comment="I am the abstract superclass of class-related announcements.";
  24824. $core.addMethod(
  24825. $core.method({
  24826. selector: "theClass",
  24827. protocol: "accessing",
  24828. fn: function (){
  24829. var self=this,$self=this;
  24830. return $self["@theClass"];
  24831. },
  24832. args: [],
  24833. source: "theClass\x0a\x09^ theClass",
  24834. referencedClasses: [],
  24835. messageSends: []
  24836. }),
  24837. $globals.ClassAnnouncement);
  24838. $core.addMethod(
  24839. $core.method({
  24840. selector: "theClass:",
  24841. protocol: "accessing",
  24842. fn: function (aClass){
  24843. var self=this,$self=this;
  24844. $self["@theClass"]=aClass;
  24845. return self;
  24846. },
  24847. args: ["aClass"],
  24848. source: "theClass: aClass\x0a\x09theClass := aClass",
  24849. referencedClasses: [],
  24850. messageSends: []
  24851. }),
  24852. $globals.ClassAnnouncement);
  24853. $core.addClass("ClassAdded", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24854. $globals.ClassAdded.comment="I am emitted when a class is added to the system.\x0aSee ClassBuilder >> #addSubclassOf:... methods";
  24855. $core.addClass("ClassCommentChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24856. $globals.ClassCommentChanged.comment="I am emitted when the comment of a class changes. (Behavior >> #comment)";
  24857. $core.addClass("ClassDefinitionChanged", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24858. $globals.ClassDefinitionChanged.comment="I am emitted when the definition of a class changes.\x0aSee ClassBuilder >> #class:instanceVariableNames:";
  24859. $core.addClass("ClassMigrated", $globals.ClassAnnouncement, ["oldClass"], "Kernel-Announcements");
  24860. $globals.ClassMigrated.comment="I am emitted when a class is migrated.";
  24861. $core.addMethod(
  24862. $core.method({
  24863. selector: "oldClass",
  24864. protocol: "accessing",
  24865. fn: function (){
  24866. var self=this,$self=this;
  24867. return $self["@oldClass"];
  24868. },
  24869. args: [],
  24870. source: "oldClass\x0a\x09^ oldClass",
  24871. referencedClasses: [],
  24872. messageSends: []
  24873. }),
  24874. $globals.ClassMigrated);
  24875. $core.addMethod(
  24876. $core.method({
  24877. selector: "oldClass:",
  24878. protocol: "accessing",
  24879. fn: function (aClass){
  24880. var self=this,$self=this;
  24881. $self["@oldClass"]=aClass;
  24882. return self;
  24883. },
  24884. args: ["aClass"],
  24885. source: "oldClass: aClass\x0a\x09oldClass := aClass",
  24886. referencedClasses: [],
  24887. messageSends: []
  24888. }),
  24889. $globals.ClassMigrated);
  24890. $core.addClass("ClassMoved", $globals.ClassAnnouncement, ["oldPackage"], "Kernel-Announcements");
  24891. $globals.ClassMoved.comment="I am emitted when a class is moved from one package to another.";
  24892. $core.addMethod(
  24893. $core.method({
  24894. selector: "oldPackage",
  24895. protocol: "accessing",
  24896. fn: function (){
  24897. var self=this,$self=this;
  24898. return $self["@oldPackage"];
  24899. },
  24900. args: [],
  24901. source: "oldPackage\x0a\x09^ oldPackage",
  24902. referencedClasses: [],
  24903. messageSends: []
  24904. }),
  24905. $globals.ClassMoved);
  24906. $core.addMethod(
  24907. $core.method({
  24908. selector: "oldPackage:",
  24909. protocol: "accessing",
  24910. fn: function (aPackage){
  24911. var self=this,$self=this;
  24912. $self["@oldPackage"]=aPackage;
  24913. return self;
  24914. },
  24915. args: ["aPackage"],
  24916. source: "oldPackage: aPackage\x0a\x09oldPackage := aPackage",
  24917. referencedClasses: [],
  24918. messageSends: []
  24919. }),
  24920. $globals.ClassMoved);
  24921. $core.addClass("ClassRemoved", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24922. $globals.ClassRemoved.comment="I am emitted when a class is removed.\x0aSee Smalltalk >> #removeClass:";
  24923. $core.addClass("ClassRenamed", $globals.ClassAnnouncement, [], "Kernel-Announcements");
  24924. $globals.ClassRenamed.comment="I am emitted when a class is renamed.\x0aSee ClassBuilder >> #renameClass:to:";
  24925. $core.addClass("MethodAnnouncement", $globals.SystemAnnouncement, ["method"], "Kernel-Announcements");
  24926. $globals.MethodAnnouncement.comment="I am the abstract superclass of method-related announcements.";
  24927. $core.addMethod(
  24928. $core.method({
  24929. selector: "method",
  24930. protocol: "accessing",
  24931. fn: function (){
  24932. var self=this,$self=this;
  24933. return $self["@method"];
  24934. },
  24935. args: [],
  24936. source: "method\x0a\x09^ method",
  24937. referencedClasses: [],
  24938. messageSends: []
  24939. }),
  24940. $globals.MethodAnnouncement);
  24941. $core.addMethod(
  24942. $core.method({
  24943. selector: "method:",
  24944. protocol: "accessing",
  24945. fn: function (aCompiledMethod){
  24946. var self=this,$self=this;
  24947. $self["@method"]=aCompiledMethod;
  24948. return self;
  24949. },
  24950. args: ["aCompiledMethod"],
  24951. source: "method: aCompiledMethod\x0a\x09method := aCompiledMethod",
  24952. referencedClasses: [],
  24953. messageSends: []
  24954. }),
  24955. $globals.MethodAnnouncement);
  24956. $core.addClass("MethodAdded", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  24957. $globals.MethodAdded.comment="I am emitted when a `CompiledMethod` is added to a class.";
  24958. $core.addClass("MethodModified", $globals.MethodAnnouncement, ["oldMethod"], "Kernel-Announcements");
  24959. $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.";
  24960. $core.addMethod(
  24961. $core.method({
  24962. selector: "oldMethod",
  24963. protocol: "accessing",
  24964. fn: function (){
  24965. var self=this,$self=this;
  24966. return $self["@oldMethod"];
  24967. },
  24968. args: [],
  24969. source: "oldMethod\x0a\x09^ oldMethod",
  24970. referencedClasses: [],
  24971. messageSends: []
  24972. }),
  24973. $globals.MethodModified);
  24974. $core.addMethod(
  24975. $core.method({
  24976. selector: "oldMethod:",
  24977. protocol: "accessing",
  24978. fn: function (aMethod){
  24979. var self=this,$self=this;
  24980. $self["@oldMethod"]=aMethod;
  24981. return self;
  24982. },
  24983. args: ["aMethod"],
  24984. source: "oldMethod: aMethod\x0a\x09oldMethod := aMethod",
  24985. referencedClasses: [],
  24986. messageSends: []
  24987. }),
  24988. $globals.MethodModified);
  24989. $core.addClass("MethodMoved", $globals.MethodAnnouncement, ["oldProtocol"], "Kernel-Announcements");
  24990. $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.";
  24991. $core.addMethod(
  24992. $core.method({
  24993. selector: "oldProtocol",
  24994. protocol: "accessing",
  24995. fn: function (){
  24996. var self=this,$self=this;
  24997. return $self["@oldProtocol"];
  24998. },
  24999. args: [],
  25000. source: "oldProtocol\x0a\x09^ oldProtocol",
  25001. referencedClasses: [],
  25002. messageSends: []
  25003. }),
  25004. $globals.MethodMoved);
  25005. $core.addMethod(
  25006. $core.method({
  25007. selector: "oldProtocol:",
  25008. protocol: "accessing",
  25009. fn: function (aString){
  25010. var self=this,$self=this;
  25011. $self["@oldProtocol"]=aString;
  25012. return self;
  25013. },
  25014. args: ["aString"],
  25015. source: "oldProtocol: aString\x0a\x09oldProtocol := aString",
  25016. referencedClasses: [],
  25017. messageSends: []
  25018. }),
  25019. $globals.MethodMoved);
  25020. $core.addClass("MethodRemoved", $globals.MethodAnnouncement, [], "Kernel-Announcements");
  25021. $globals.MethodRemoved.comment="I am emitted when a `CompiledMethod` is removed from a class.";
  25022. $core.addClass("PackageAnnouncement", $globals.SystemAnnouncement, ["package"], "Kernel-Announcements");
  25023. $globals.PackageAnnouncement.comment="I am the abstract superclass of package-related announcements.";
  25024. $core.addMethod(
  25025. $core.method({
  25026. selector: "package",
  25027. protocol: "accessing",
  25028. fn: function (){
  25029. var self=this,$self=this;
  25030. return $self["@package"];
  25031. },
  25032. args: [],
  25033. source: "package\x0a\x09^ package",
  25034. referencedClasses: [],
  25035. messageSends: []
  25036. }),
  25037. $globals.PackageAnnouncement);
  25038. $core.addMethod(
  25039. $core.method({
  25040. selector: "package:",
  25041. protocol: "accessing",
  25042. fn: function (aPackage){
  25043. var self=this,$self=this;
  25044. $self["@package"]=aPackage;
  25045. return self;
  25046. },
  25047. args: ["aPackage"],
  25048. source: "package: aPackage\x0a\x09package := aPackage",
  25049. referencedClasses: [],
  25050. messageSends: []
  25051. }),
  25052. $globals.PackageAnnouncement);
  25053. $core.addClass("PackageAdded", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25054. $globals.PackageAdded.comment="I am emitted when a `Package` is added to the system.";
  25055. $core.addClass("PackageClean", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25056. $globals.PackageClean.comment="I am emitted when a package is committed and becomes clean.";
  25057. $core.addClass("PackageDirty", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25058. $globals.PackageDirty.comment="I am emitted when a package becomes dirty.";
  25059. $core.addClass("PackageRemoved", $globals.PackageAnnouncement, [], "Kernel-Announcements");
  25060. $globals.PackageRemoved.comment="I am emitted when a `Package` is removed from the system.";
  25061. $core.addClass("ProtocolAnnouncement", $globals.SystemAnnouncement, ["theClass", "protocol"], "Kernel-Announcements");
  25062. $globals.ProtocolAnnouncement.comment="I am the abstract superclass of protocol-related announcements.";
  25063. $core.addMethod(
  25064. $core.method({
  25065. selector: "package",
  25066. protocol: "accessing",
  25067. fn: function (){
  25068. var self=this,$self=this;
  25069. return $core.withContext(function($ctx1) {
  25070. var $1,$receiver;
  25071. $1=$self._theClass();
  25072. if(($receiver = $1) == null || $receiver.a$nil){
  25073. return $1;
  25074. } else {
  25075. var class_;
  25076. class_=$receiver;
  25077. return $recv(class_)._packageOfProtocol_($self._protocol());
  25078. }
  25079. }, function($ctx1) {$ctx1.fill(self,"package",{},$globals.ProtocolAnnouncement)});
  25080. },
  25081. args: [],
  25082. source: "package\x0a\x09\x0a\x09^ self theClass ifNotNil: [ :class | class packageOfProtocol: self protocol ]",
  25083. referencedClasses: [],
  25084. messageSends: ["ifNotNil:", "theClass", "packageOfProtocol:", "protocol"]
  25085. }),
  25086. $globals.ProtocolAnnouncement);
  25087. $core.addMethod(
  25088. $core.method({
  25089. selector: "protocol",
  25090. protocol: "accessing",
  25091. fn: function (){
  25092. var self=this,$self=this;
  25093. return $self["@protocol"];
  25094. },
  25095. args: [],
  25096. source: "protocol\x0a\x09^ protocol",
  25097. referencedClasses: [],
  25098. messageSends: []
  25099. }),
  25100. $globals.ProtocolAnnouncement);
  25101. $core.addMethod(
  25102. $core.method({
  25103. selector: "protocol:",
  25104. protocol: "accessing",
  25105. fn: function (aString){
  25106. var self=this,$self=this;
  25107. $self["@protocol"]=aString;
  25108. return self;
  25109. },
  25110. args: ["aString"],
  25111. source: "protocol: aString\x0a\x09protocol := aString",
  25112. referencedClasses: [],
  25113. messageSends: []
  25114. }),
  25115. $globals.ProtocolAnnouncement);
  25116. $core.addMethod(
  25117. $core.method({
  25118. selector: "theClass",
  25119. protocol: "accessing",
  25120. fn: function (){
  25121. var self=this,$self=this;
  25122. return $self["@theClass"];
  25123. },
  25124. args: [],
  25125. source: "theClass\x0a\x09^ theClass",
  25126. referencedClasses: [],
  25127. messageSends: []
  25128. }),
  25129. $globals.ProtocolAnnouncement);
  25130. $core.addMethod(
  25131. $core.method({
  25132. selector: "theClass:",
  25133. protocol: "accessing",
  25134. fn: function (aClass){
  25135. var self=this,$self=this;
  25136. $self["@theClass"]=aClass;
  25137. return self;
  25138. },
  25139. args: ["aClass"],
  25140. source: "theClass: aClass\x0a\x09theClass := aClass",
  25141. referencedClasses: [],
  25142. messageSends: []
  25143. }),
  25144. $globals.ProtocolAnnouncement);
  25145. $core.addClass("ProtocolAdded", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25146. $globals.ProtocolAdded.comment="I am emitted when a protocol is added to a class.";
  25147. $core.addClass("ProtocolRemoved", $globals.ProtocolAnnouncement, [], "Kernel-Announcements");
  25148. $globals.ProtocolRemoved.comment="I am emitted when a protocol is removed from a class.";
  25149. });
  25150. 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";
  25151. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  25152. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  25153. $core.addPackage("Platform-Services");
  25154. ($core.packageDescriptors||$core.packages)["Platform-Services"].innerEval = function (expr) { return eval(expr); };
  25155. ($core.packageDescriptors||$core.packages)["Platform-Services"].transport = {"type":"amd","amdNamespace":"amber_core"};
  25156. $core.addClass("ConsoleErrorHandler", $globals.Object, [], "Platform-Services");
  25157. $globals.ConsoleErrorHandler.comment="I am manage Smalltalk errors, displaying the stack in the console.";
  25158. $core.addMethod(
  25159. $core.method({
  25160. selector: "handleError:",
  25161. protocol: "error handling",
  25162. fn: function (anError){
  25163. var self=this,$self=this;
  25164. return $core.withContext(function($ctx1) {
  25165. var $1,$receiver;
  25166. $1=$recv(anError)._context();
  25167. $ctx1.sendIdx["context"]=1;
  25168. if(($receiver = $1) == null || $receiver.a$nil){
  25169. $1;
  25170. } else {
  25171. $self._logErrorContext_($recv(anError)._context());
  25172. }
  25173. $self._logError_(anError);
  25174. return self;
  25175. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25176. },
  25177. args: ["anError"],
  25178. source: "handleError: anError\x0a\x09anError context ifNotNil: [ self logErrorContext: anError context ].\x0a\x09self logError: anError",
  25179. referencedClasses: [],
  25180. messageSends: ["ifNotNil:", "context", "logErrorContext:", "logError:"]
  25181. }),
  25182. $globals.ConsoleErrorHandler);
  25183. $core.addMethod(
  25184. $core.method({
  25185. selector: "log:",
  25186. protocol: "private",
  25187. fn: function (aString){
  25188. var self=this,$self=this;
  25189. return $core.withContext(function($ctx1) {
  25190. $recv(console)._log_(aString);
  25191. return self;
  25192. }, function($ctx1) {$ctx1.fill(self,"log:",{aString:aString},$globals.ConsoleErrorHandler)});
  25193. },
  25194. args: ["aString"],
  25195. source: "log: aString\x0a\x09console log: aString",
  25196. referencedClasses: [],
  25197. messageSends: ["log:"]
  25198. }),
  25199. $globals.ConsoleErrorHandler);
  25200. $core.addMethod(
  25201. $core.method({
  25202. selector: "logContext:",
  25203. protocol: "private",
  25204. fn: function (aContext){
  25205. var self=this,$self=this;
  25206. return $core.withContext(function($ctx1) {
  25207. var $1,$receiver;
  25208. $1=$recv(aContext)._home();
  25209. $ctx1.sendIdx["home"]=1;
  25210. if(($receiver = $1) == null || $receiver.a$nil){
  25211. $1;
  25212. } else {
  25213. $self._logContext_($recv(aContext)._home());
  25214. }
  25215. $self._log_($recv(aContext)._asString());
  25216. return self;
  25217. }, function($ctx1) {$ctx1.fill(self,"logContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25218. },
  25219. args: ["aContext"],
  25220. source: "logContext: aContext\x0a\x09aContext home ifNotNil: [\x0a\x09\x09self logContext: aContext home ].\x0a\x09self log: aContext asString",
  25221. referencedClasses: [],
  25222. messageSends: ["ifNotNil:", "home", "logContext:", "log:", "asString"]
  25223. }),
  25224. $globals.ConsoleErrorHandler);
  25225. $core.addMethod(
  25226. $core.method({
  25227. selector: "logError:",
  25228. protocol: "private",
  25229. fn: function (anError){
  25230. var self=this,$self=this;
  25231. return $core.withContext(function($ctx1) {
  25232. $self._log_($recv(anError)._messageText());
  25233. return self;
  25234. }, function($ctx1) {$ctx1.fill(self,"logError:",{anError:anError},$globals.ConsoleErrorHandler)});
  25235. },
  25236. args: ["anError"],
  25237. source: "logError: anError\x0a\x09self log: anError messageText",
  25238. referencedClasses: [],
  25239. messageSends: ["log:", "messageText"]
  25240. }),
  25241. $globals.ConsoleErrorHandler);
  25242. $core.addMethod(
  25243. $core.method({
  25244. selector: "logErrorContext:",
  25245. protocol: "private",
  25246. fn: function (aContext){
  25247. var self=this,$self=this;
  25248. return $core.withContext(function($ctx1) {
  25249. var $1,$receiver;
  25250. if(($receiver = aContext) == null || $receiver.a$nil){
  25251. aContext;
  25252. } else {
  25253. $1=$recv(aContext)._home();
  25254. $ctx1.sendIdx["home"]=1;
  25255. if(($receiver = $1) == null || $receiver.a$nil){
  25256. $1;
  25257. } else {
  25258. $self._logContext_($recv(aContext)._home());
  25259. }
  25260. }
  25261. return self;
  25262. }, function($ctx1) {$ctx1.fill(self,"logErrorContext:",{aContext:aContext},$globals.ConsoleErrorHandler)});
  25263. },
  25264. args: ["aContext"],
  25265. source: "logErrorContext: aContext\x0a\x09aContext ifNotNil: [\x0a\x09\x09aContext home ifNotNil: [\x0a\x09\x09\x09self logContext: aContext home ]]",
  25266. referencedClasses: [],
  25267. messageSends: ["ifNotNil:", "home", "logContext:"]
  25268. }),
  25269. $globals.ConsoleErrorHandler);
  25270. $globals.ConsoleErrorHandler.a$cls.iVarNames = ["current"];
  25271. $core.addMethod(
  25272. $core.method({
  25273. selector: "initialize",
  25274. protocol: "initialization",
  25275. fn: function (){
  25276. var self=this,$self=this;
  25277. return $core.withContext(function($ctx1) {
  25278. $recv($globals.ErrorHandler)._registerIfNone_($self._new());
  25279. return self;
  25280. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleErrorHandler.a$cls)});
  25281. },
  25282. args: [],
  25283. source: "initialize\x0a\x09ErrorHandler registerIfNone: self new",
  25284. referencedClasses: ["ErrorHandler"],
  25285. messageSends: ["registerIfNone:", "new"]
  25286. }),
  25287. $globals.ConsoleErrorHandler.a$cls);
  25288. $core.addClass("ConsoleTranscript", $globals.Object, ["textarea"], "Platform-Services");
  25289. $globals.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  25290. $core.addMethod(
  25291. $core.method({
  25292. selector: "clear",
  25293. protocol: "printing",
  25294. fn: function (){
  25295. var self=this,$self=this;
  25296. return self;
  25297. },
  25298. args: [],
  25299. source: "clear\x0a\x09\x22no op\x22",
  25300. referencedClasses: [],
  25301. messageSends: []
  25302. }),
  25303. $globals.ConsoleTranscript);
  25304. $core.addMethod(
  25305. $core.method({
  25306. selector: "cr",
  25307. protocol: "printing",
  25308. fn: function (){
  25309. var self=this,$self=this;
  25310. return self;
  25311. },
  25312. args: [],
  25313. source: "cr\x0a\x09\x22no op\x22",
  25314. referencedClasses: [],
  25315. messageSends: []
  25316. }),
  25317. $globals.ConsoleTranscript);
  25318. $core.addMethod(
  25319. $core.method({
  25320. selector: "open",
  25321. protocol: "actions",
  25322. fn: function (){
  25323. var self=this,$self=this;
  25324. return self;
  25325. },
  25326. args: [],
  25327. source: "open",
  25328. referencedClasses: [],
  25329. messageSends: []
  25330. }),
  25331. $globals.ConsoleTranscript);
  25332. $core.addMethod(
  25333. $core.method({
  25334. selector: "show:",
  25335. protocol: "printing",
  25336. fn: function (anObject){
  25337. var self=this,$self=this;
  25338. return $core.withContext(function($ctx1) {
  25339. console.log(String($recv(anObject)._asString()));
  25340. return self;
  25341. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.ConsoleTranscript)});
  25342. },
  25343. args: ["anObject"],
  25344. 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()))'>",
  25345. referencedClasses: [],
  25346. messageSends: []
  25347. }),
  25348. $globals.ConsoleTranscript);
  25349. $core.addMethod(
  25350. $core.method({
  25351. selector: "initialize",
  25352. protocol: "initialization",
  25353. fn: function (){
  25354. var self=this,$self=this;
  25355. return $core.withContext(function($ctx1) {
  25356. $recv($globals.Transcript)._registerIfNone_($self._new());
  25357. return self;
  25358. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ConsoleTranscript.a$cls)});
  25359. },
  25360. args: [],
  25361. source: "initialize\x0a\x09Transcript registerIfNone: self new",
  25362. referencedClasses: ["Transcript"],
  25363. messageSends: ["registerIfNone:", "new"]
  25364. }),
  25365. $globals.ConsoleTranscript.a$cls);
  25366. $core.addClass("Environment", $globals.Object, [], "Platform-Services");
  25367. $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.";
  25368. $core.addMethod(
  25369. $core.method({
  25370. selector: "addInstVarNamed:to:",
  25371. protocol: "compiling",
  25372. fn: function (aString,aClass){
  25373. var self=this,$self=this;
  25374. var newInstVars;
  25375. return $core.withContext(function($ctx1) {
  25376. var $1,$2,$3,$4,$5;
  25377. newInstVars=$recv($recv(aClass)._instanceVariableNames())._copyWith_(aString);
  25378. $1=$recv(aClass)._isMetaclass();
  25379. if($core.assert($1)){
  25380. $2=$self._classBuilder();
  25381. $ctx1.sendIdx["classBuilder"]=1;
  25382. $recv($2)._class_instanceVariables_(aClass,newInstVars);
  25383. } else {
  25384. $3=$self._classBuilder();
  25385. $4=$recv(aClass)._superclass();
  25386. $5=$recv(aClass)._name();
  25387. $ctx1.sendIdx["name"]=1;
  25388. $recv($3)._addSubclassOf_named_instanceVariableNames_package_($4,$5,newInstVars,$recv($recv(aClass)._package())._name());
  25389. }
  25390. return self;
  25391. }, function($ctx1) {$ctx1.fill(self,"addInstVarNamed:to:",{aString:aString,aClass:aClass,newInstVars:newInstVars},$globals.Environment)});
  25392. },
  25393. args: ["aString", "aClass"],
  25394. 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 ]",
  25395. referencedClasses: [],
  25396. messageSends: ["copyWith:", "instanceVariableNames", "ifTrue:ifFalse:", "isMetaclass", "class:instanceVariables:", "classBuilder", "addSubclassOf:named:instanceVariableNames:package:", "superclass", "name", "package"]
  25397. }),
  25398. $globals.Environment);
  25399. $core.addMethod(
  25400. $core.method({
  25401. selector: "allSelectors",
  25402. protocol: "accessing",
  25403. fn: function (){
  25404. var self=this,$self=this;
  25405. return $core.withContext(function($ctx1) {
  25406. return $recv($recv($globals.Smalltalk)._core())._allSelectors();
  25407. }, function($ctx1) {$ctx1.fill(self,"allSelectors",{},$globals.Environment)});
  25408. },
  25409. args: [],
  25410. source: "allSelectors\x0a\x09^ Smalltalk core allSelectors",
  25411. referencedClasses: ["Smalltalk"],
  25412. messageSends: ["allSelectors", "core"]
  25413. }),
  25414. $globals.Environment);
  25415. $core.addMethod(
  25416. $core.method({
  25417. selector: "availableClassNames",
  25418. protocol: "accessing",
  25419. fn: function (){
  25420. var self=this,$self=this;
  25421. return $core.withContext(function($ctx1) {
  25422. return $recv($recv($globals.Smalltalk)._classes())._collect_((function(each){
  25423. return $core.withContext(function($ctx2) {
  25424. return $recv(each)._name();
  25425. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25426. }));
  25427. }, function($ctx1) {$ctx1.fill(self,"availableClassNames",{},$globals.Environment)});
  25428. },
  25429. args: [],
  25430. source: "availableClassNames\x0a\x09^ Smalltalk classes \x0a\x09\x09collect: [ :each | each name ]",
  25431. referencedClasses: ["Smalltalk"],
  25432. messageSends: ["collect:", "classes", "name"]
  25433. }),
  25434. $globals.Environment);
  25435. $core.addMethod(
  25436. $core.method({
  25437. selector: "availablePackageNames",
  25438. protocol: "accessing",
  25439. fn: function (){
  25440. var self=this,$self=this;
  25441. return $core.withContext(function($ctx1) {
  25442. return $recv($recv($globals.Smalltalk)._packages())._collect_((function(each){
  25443. return $core.withContext(function($ctx2) {
  25444. return $recv(each)._name();
  25445. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25446. }));
  25447. }, function($ctx1) {$ctx1.fill(self,"availablePackageNames",{},$globals.Environment)});
  25448. },
  25449. args: [],
  25450. source: "availablePackageNames\x0a\x09^ Smalltalk packages \x0a\x09\x09collect: [ :each | each name ]",
  25451. referencedClasses: ["Smalltalk"],
  25452. messageSends: ["collect:", "packages", "name"]
  25453. }),
  25454. $globals.Environment);
  25455. $core.addMethod(
  25456. $core.method({
  25457. selector: "availableProtocolsFor:",
  25458. protocol: "accessing",
  25459. fn: function (aClass){
  25460. var self=this,$self=this;
  25461. var protocols;
  25462. return $core.withContext(function($ctx1) {
  25463. var $1,$receiver;
  25464. protocols=$recv(aClass)._protocols();
  25465. $1=$recv(aClass)._superclass();
  25466. $ctx1.sendIdx["superclass"]=1;
  25467. if(($receiver = $1) == null || $receiver.a$nil){
  25468. $1;
  25469. } else {
  25470. $recv(protocols)._addAll_($self._availableProtocolsFor_($recv(aClass)._superclass()));
  25471. }
  25472. return $recv($recv($recv(protocols)._asSet())._asArray())._sort();
  25473. }, function($ctx1) {$ctx1.fill(self,"availableProtocolsFor:",{aClass:aClass,protocols:protocols},$globals.Environment)});
  25474. },
  25475. args: ["aClass"],
  25476. 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",
  25477. referencedClasses: [],
  25478. messageSends: ["protocols", "ifNotNil:", "superclass", "addAll:", "availableProtocolsFor:", "sort", "asArray", "asSet"]
  25479. }),
  25480. $globals.Environment);
  25481. $core.addMethod(
  25482. $core.method({
  25483. selector: "classBuilder",
  25484. protocol: "accessing",
  25485. fn: function (){
  25486. var self=this,$self=this;
  25487. return $core.withContext(function($ctx1) {
  25488. return $recv($globals.ClassBuilder)._new();
  25489. }, function($ctx1) {$ctx1.fill(self,"classBuilder",{},$globals.Environment)});
  25490. },
  25491. args: [],
  25492. source: "classBuilder\x0a\x09^ ClassBuilder new",
  25493. referencedClasses: ["ClassBuilder"],
  25494. messageSends: ["new"]
  25495. }),
  25496. $globals.Environment);
  25497. $core.addMethod(
  25498. $core.method({
  25499. selector: "classNamed:",
  25500. protocol: "accessing",
  25501. fn: function (aString){
  25502. var self=this,$self=this;
  25503. return $core.withContext(function($ctx1) {
  25504. var $1,$receiver;
  25505. $1=$recv($recv($globals.Smalltalk)._globals())._at_($recv(aString)._asSymbol());
  25506. if(($receiver = $1) == null || $receiver.a$nil){
  25507. return $self._error_("Invalid class name");
  25508. } else {
  25509. return $1;
  25510. }
  25511. }, function($ctx1) {$ctx1.fill(self,"classNamed:",{aString:aString},$globals.Environment)});
  25512. },
  25513. args: ["aString"],
  25514. source: "classNamed: aString\x0a\x09^ (Smalltalk globals at: aString asSymbol)\x0a\x09\x09ifNil: [ self error: 'Invalid class name' ]",
  25515. referencedClasses: ["Smalltalk"],
  25516. messageSends: ["ifNil:", "at:", "globals", "asSymbol", "error:"]
  25517. }),
  25518. $globals.Environment);
  25519. $core.addMethod(
  25520. $core.method({
  25521. selector: "classes",
  25522. protocol: "accessing",
  25523. fn: function (){
  25524. var self=this,$self=this;
  25525. return $core.withContext(function($ctx1) {
  25526. return $recv($globals.Smalltalk)._classes();
  25527. }, function($ctx1) {$ctx1.fill(self,"classes",{},$globals.Environment)});
  25528. },
  25529. args: [],
  25530. source: "classes\x0a\x09^ Smalltalk classes",
  25531. referencedClasses: ["Smalltalk"],
  25532. messageSends: ["classes"]
  25533. }),
  25534. $globals.Environment);
  25535. $core.addMethod(
  25536. $core.method({
  25537. selector: "commitPackage:onSuccess:onError:",
  25538. protocol: "actions",
  25539. fn: function (aPackage,aBlock,anotherBlock){
  25540. var self=this,$self=this;
  25541. return $core.withContext(function($ctx1) {
  25542. $recv($recv(aPackage)._transport())._commitOnSuccess_onError_(aBlock,anotherBlock);
  25543. return self;
  25544. }, function($ctx1) {$ctx1.fill(self,"commitPackage:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.Environment)});
  25545. },
  25546. args: ["aPackage", "aBlock", "anotherBlock"],
  25547. source: "commitPackage: aPackage onSuccess: aBlock onError: anotherBlock\x0a\x09aPackage transport\x0a\x09\x09commitOnSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  25548. referencedClasses: [],
  25549. messageSends: ["commitOnSuccess:onError:", "transport"]
  25550. }),
  25551. $globals.Environment);
  25552. $core.addMethod(
  25553. $core.method({
  25554. selector: "compileClassComment:for:",
  25555. protocol: "compiling",
  25556. fn: function (aString,aClass){
  25557. var self=this,$self=this;
  25558. return $core.withContext(function($ctx1) {
  25559. $recv(aClass)._comment_(aString);
  25560. return self;
  25561. }, function($ctx1) {$ctx1.fill(self,"compileClassComment:for:",{aString:aString,aClass:aClass},$globals.Environment)});
  25562. },
  25563. args: ["aString", "aClass"],
  25564. source: "compileClassComment: aString for: aClass\x0a\x09aClass comment: aString",
  25565. referencedClasses: [],
  25566. messageSends: ["comment:"]
  25567. }),
  25568. $globals.Environment);
  25569. $core.addMethod(
  25570. $core.method({
  25571. selector: "compileClassDefinition:",
  25572. protocol: "compiling",
  25573. fn: function (aString){
  25574. var self=this,$self=this;
  25575. return $core.withContext(function($ctx1) {
  25576. $recv((function(){
  25577. return $core.withContext(function($ctx2) {
  25578. return $self._evaluate_for_(aString,$recv($globals.DoIt)._new());
  25579. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  25580. }))._on_do_($globals.Error,(function(error){
  25581. return $core.withContext(function($ctx2) {
  25582. return $recv($globals.Terminal)._alert_($recv(error)._messageText());
  25583. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  25584. }));
  25585. return self;
  25586. }, function($ctx1) {$ctx1.fill(self,"compileClassDefinition:",{aString:aString},$globals.Environment)});
  25587. },
  25588. args: ["aString"],
  25589. source: "compileClassDefinition: aString\x0a\x09[ self evaluate: aString for: DoIt new ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error | Terminal alert: error messageText ]",
  25590. referencedClasses: ["DoIt", "Error", "Terminal"],
  25591. messageSends: ["on:do:", "evaluate:for:", "new", "alert:", "messageText"]
  25592. }),
  25593. $globals.Environment);
  25594. $core.addMethod(
  25595. $core.method({
  25596. selector: "compileMethod:for:protocol:",
  25597. protocol: "compiling",
  25598. fn: function (sourceCode,class_,protocol){
  25599. var self=this,$self=this;
  25600. return $core.withContext(function($ctx1) {
  25601. return $recv(class_)._compile_protocol_(sourceCode,protocol);
  25602. }, function($ctx1) {$ctx1.fill(self,"compileMethod:for:protocol:",{sourceCode:sourceCode,class_:class_,protocol:protocol},$globals.Environment)});
  25603. },
  25604. args: ["sourceCode", "class", "protocol"],
  25605. source: "compileMethod: sourceCode for: class protocol: protocol\x0a\x09^ class\x0a\x09\x09compile: sourceCode\x0a\x09\x09protocol: protocol",
  25606. referencedClasses: [],
  25607. messageSends: ["compile:protocol:"]
  25608. }),
  25609. $globals.Environment);
  25610. $core.addMethod(
  25611. $core.method({
  25612. selector: "copyClass:to:",
  25613. protocol: "actions",
  25614. fn: function (aClass,aClassName){
  25615. var self=this,$self=this;
  25616. return $core.withContext(function($ctx1) {
  25617. var $1,$2,$receiver;
  25618. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25619. if(($receiver = $1) == null || $receiver.a$nil){
  25620. $1;
  25621. } else {
  25622. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25623. $ctx1.sendIdx[","]=1;
  25624. $self._error_($2);
  25625. }
  25626. $recv($recv($globals.ClassBuilder)._new())._copyClass_named_(aClass,aClassName);
  25627. return self;
  25628. }, function($ctx1) {$ctx1.fill(self,"copyClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25629. },
  25630. args: ["aClass", "aClassName"],
  25631. 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",
  25632. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25633. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "copyClass:named:", "new"]
  25634. }),
  25635. $globals.Environment);
  25636. $core.addMethod(
  25637. $core.method({
  25638. selector: "doItReceiver",
  25639. protocol: "accessing",
  25640. fn: function (){
  25641. var self=this,$self=this;
  25642. return $core.withContext(function($ctx1) {
  25643. return $recv($globals.DoIt)._new();
  25644. }, function($ctx1) {$ctx1.fill(self,"doItReceiver",{},$globals.Environment)});
  25645. },
  25646. args: [],
  25647. source: "doItReceiver\x0a\x09^ DoIt new",
  25648. referencedClasses: ["DoIt"],
  25649. messageSends: ["new"]
  25650. }),
  25651. $globals.Environment);
  25652. $core.addMethod(
  25653. $core.method({
  25654. selector: "evaluate:for:",
  25655. protocol: "evaluating",
  25656. fn: function (aString,anObject){
  25657. var self=this,$self=this;
  25658. return $core.withContext(function($ctx1) {
  25659. return $recv($globals.Evaluator)._evaluate_for_(aString,anObject);
  25660. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Environment)});
  25661. },
  25662. args: ["aString", "anObject"],
  25663. source: "evaluate: aString for: anObject\x0a\x09^ Evaluator evaluate: aString for: anObject",
  25664. referencedClasses: ["Evaluator"],
  25665. messageSends: ["evaluate:for:"]
  25666. }),
  25667. $globals.Environment);
  25668. $core.addMethod(
  25669. $core.method({
  25670. selector: "evaluate:on:do:",
  25671. protocol: "error handling",
  25672. fn: function (aBlock,anErrorClass,exceptionBlock){
  25673. var self=this,$self=this;
  25674. return $core.withContext(function($ctx1) {
  25675. var $1;
  25676. $recv(aBlock)._tryCatch_((function(exception){
  25677. return $core.withContext(function($ctx2) {
  25678. $1=$recv(exception)._isKindOf_($self._classNamed_($recv(anErrorClass)._name()));
  25679. if($core.assert($1)){
  25680. return $recv(exceptionBlock)._value_(exception);
  25681. } else {
  25682. return $recv(exception)._pass();
  25683. }
  25684. }, function($ctx2) {$ctx2.fillBlock({exception:exception},$ctx1,1)});
  25685. }));
  25686. return self;
  25687. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:do:",{aBlock:aBlock,anErrorClass:anErrorClass,exceptionBlock:exceptionBlock},$globals.Environment)});
  25688. },
  25689. args: ["aBlock", "anErrorClass", "exceptionBlock"],
  25690. 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 ] ]",
  25691. referencedClasses: [],
  25692. messageSends: ["tryCatch:", "ifTrue:ifFalse:", "isKindOf:", "classNamed:", "name", "value:", "pass"]
  25693. }),
  25694. $globals.Environment);
  25695. $core.addMethod(
  25696. $core.method({
  25697. selector: "inspect:",
  25698. protocol: "actions",
  25699. fn: function (anObject){
  25700. var self=this,$self=this;
  25701. return $core.withContext(function($ctx1) {
  25702. $recv($globals.Inspector)._inspect_(anObject);
  25703. return self;
  25704. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Environment)});
  25705. },
  25706. args: ["anObject"],
  25707. source: "inspect: anObject\x0a\x09Inspector inspect: anObject",
  25708. referencedClasses: ["Inspector"],
  25709. messageSends: ["inspect:"]
  25710. }),
  25711. $globals.Environment);
  25712. $core.addMethod(
  25713. $core.method({
  25714. selector: "moveClass:toPackage:",
  25715. protocol: "actions",
  25716. fn: function (aClass,aPackageName){
  25717. var self=this,$self=this;
  25718. var package_;
  25719. return $core.withContext(function($ctx1) {
  25720. var $1,$2,$receiver;
  25721. package_=$recv($globals.Package)._named_(aPackageName);
  25722. $1=package_;
  25723. if(($receiver = $1) == null || $receiver.a$nil){
  25724. $self._error_("Invalid package name");
  25725. } else {
  25726. $1;
  25727. }
  25728. $2=$recv(package_).__eq_eq($recv(aClass)._package());
  25729. if($core.assert($2)){
  25730. return self;
  25731. }
  25732. $recv(aClass)._package_(package_);
  25733. $recv(aClass)._recompile();
  25734. return self;
  25735. }, function($ctx1) {$ctx1.fill(self,"moveClass:toPackage:",{aClass:aClass,aPackageName:aPackageName,package_:package_},$globals.Environment)});
  25736. },
  25737. args: ["aClass", "aPackageName"],
  25738. 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",
  25739. referencedClasses: ["Package"],
  25740. messageSends: ["named:", "ifNil:", "error:", "ifTrue:", "==", "package", "package:", "recompile"]
  25741. }),
  25742. $globals.Environment);
  25743. $core.addMethod(
  25744. $core.method({
  25745. selector: "moveMethod:toClass:",
  25746. protocol: "actions",
  25747. fn: function (aMethod,aClassName){
  25748. var self=this,$self=this;
  25749. var destinationClass;
  25750. return $core.withContext(function($ctx1) {
  25751. var $2,$3,$1,$5,$4;
  25752. destinationClass=$self._classNamed_(aClassName);
  25753. $2=destinationClass;
  25754. $3=$recv(aMethod)._methodClass();
  25755. $ctx1.sendIdx["methodClass"]=1;
  25756. $1=$recv($2).__eq_eq($3);
  25757. if($core.assert($1)){
  25758. return self;
  25759. }
  25760. $5=$recv(aMethod)._methodClass();
  25761. $ctx1.sendIdx["methodClass"]=2;
  25762. $4=$recv($5)._isMetaclass();
  25763. if($core.assert($4)){
  25764. destinationClass=$recv(destinationClass)._theMetaClass();
  25765. destinationClass;
  25766. }
  25767. $recv(destinationClass)._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25768. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25769. return self;
  25770. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toClass:",{aMethod:aMethod,aClassName:aClassName,destinationClass:destinationClass},$globals.Environment)});
  25771. },
  25772. args: ["aMethod", "aClassName"],
  25773. 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",
  25774. referencedClasses: [],
  25775. messageSends: ["classNamed:", "ifTrue:", "==", "methodClass", "isMetaclass", "theMetaClass", "compile:protocol:", "source", "protocol", "removeCompiledMethod:"]
  25776. }),
  25777. $globals.Environment);
  25778. $core.addMethod(
  25779. $core.method({
  25780. selector: "moveMethod:toProtocol:",
  25781. protocol: "actions",
  25782. fn: function (aMethod,aProtocol){
  25783. var self=this,$self=this;
  25784. return $core.withContext(function($ctx1) {
  25785. $recv(aMethod)._protocol_(aProtocol);
  25786. $recv($recv(aMethod)._methodClass())._compile_protocol_($recv(aMethod)._source(),$recv(aMethod)._protocol());
  25787. return self;
  25788. }, function($ctx1) {$ctx1.fill(self,"moveMethod:toProtocol:",{aMethod:aMethod,aProtocol:aProtocol},$globals.Environment)});
  25789. },
  25790. args: ["aMethod", "aProtocol"],
  25791. source: "moveMethod: aMethod toProtocol: aProtocol\x0a\x09aMethod protocol: aProtocol.\x0a\x0a\x09aMethod methodClass\x0a\x09\x09compile: aMethod source\x0a\x09\x09protocol: aMethod protocol",
  25792. referencedClasses: [],
  25793. messageSends: ["protocol:", "compile:protocol:", "methodClass", "source", "protocol"]
  25794. }),
  25795. $globals.Environment);
  25796. $core.addMethod(
  25797. $core.method({
  25798. selector: "packages",
  25799. protocol: "accessing",
  25800. fn: function (){
  25801. var self=this,$self=this;
  25802. return $core.withContext(function($ctx1) {
  25803. return $recv($globals.Smalltalk)._packages();
  25804. }, function($ctx1) {$ctx1.fill(self,"packages",{},$globals.Environment)});
  25805. },
  25806. args: [],
  25807. source: "packages\x0a\x09^ Smalltalk packages",
  25808. referencedClasses: ["Smalltalk"],
  25809. messageSends: ["packages"]
  25810. }),
  25811. $globals.Environment);
  25812. $core.addMethod(
  25813. $core.method({
  25814. selector: "registerErrorHandler:",
  25815. protocol: "services",
  25816. fn: function (anErrorHandler){
  25817. var self=this,$self=this;
  25818. return $core.withContext(function($ctx1) {
  25819. $recv($globals.ErrorHandler)._register_(anErrorHandler);
  25820. return self;
  25821. }, function($ctx1) {$ctx1.fill(self,"registerErrorHandler:",{anErrorHandler:anErrorHandler},$globals.Environment)});
  25822. },
  25823. args: ["anErrorHandler"],
  25824. source: "registerErrorHandler: anErrorHandler\x0a\x09ErrorHandler register: anErrorHandler",
  25825. referencedClasses: ["ErrorHandler"],
  25826. messageSends: ["register:"]
  25827. }),
  25828. $globals.Environment);
  25829. $core.addMethod(
  25830. $core.method({
  25831. selector: "registerFinder:",
  25832. protocol: "services",
  25833. fn: function (aFinder){
  25834. var self=this,$self=this;
  25835. return $core.withContext(function($ctx1) {
  25836. $recv($globals.Finder)._register_(aFinder);
  25837. return self;
  25838. }, function($ctx1) {$ctx1.fill(self,"registerFinder:",{aFinder:aFinder},$globals.Environment)});
  25839. },
  25840. args: ["aFinder"],
  25841. source: "registerFinder: aFinder\x0a\x09Finder register: aFinder",
  25842. referencedClasses: ["Finder"],
  25843. messageSends: ["register:"]
  25844. }),
  25845. $globals.Environment);
  25846. $core.addMethod(
  25847. $core.method({
  25848. selector: "registerInspector:",
  25849. protocol: "services",
  25850. fn: function (anInspector){
  25851. var self=this,$self=this;
  25852. return $core.withContext(function($ctx1) {
  25853. $recv($globals.Inspector)._register_(anInspector);
  25854. return self;
  25855. }, function($ctx1) {$ctx1.fill(self,"registerInspector:",{anInspector:anInspector},$globals.Environment)});
  25856. },
  25857. args: ["anInspector"],
  25858. source: "registerInspector: anInspector\x0a\x09Inspector register: anInspector",
  25859. referencedClasses: ["Inspector"],
  25860. messageSends: ["register:"]
  25861. }),
  25862. $globals.Environment);
  25863. $core.addMethod(
  25864. $core.method({
  25865. selector: "registerProgressHandler:",
  25866. protocol: "services",
  25867. fn: function (aProgressHandler){
  25868. var self=this,$self=this;
  25869. return $core.withContext(function($ctx1) {
  25870. $recv($globals.ProgressHandler)._register_(aProgressHandler);
  25871. return self;
  25872. }, function($ctx1) {$ctx1.fill(self,"registerProgressHandler:",{aProgressHandler:aProgressHandler},$globals.Environment)});
  25873. },
  25874. args: ["aProgressHandler"],
  25875. source: "registerProgressHandler: aProgressHandler\x0a\x09ProgressHandler register: aProgressHandler",
  25876. referencedClasses: ["ProgressHandler"],
  25877. messageSends: ["register:"]
  25878. }),
  25879. $globals.Environment);
  25880. $core.addMethod(
  25881. $core.method({
  25882. selector: "registerTranscript:",
  25883. protocol: "services",
  25884. fn: function (aTranscript){
  25885. var self=this,$self=this;
  25886. return $core.withContext(function($ctx1) {
  25887. $recv($globals.Transcript)._register_(aTranscript);
  25888. return self;
  25889. }, function($ctx1) {$ctx1.fill(self,"registerTranscript:",{aTranscript:aTranscript},$globals.Environment)});
  25890. },
  25891. args: ["aTranscript"],
  25892. source: "registerTranscript: aTranscript\x0a\x09Transcript register: aTranscript",
  25893. referencedClasses: ["Transcript"],
  25894. messageSends: ["register:"]
  25895. }),
  25896. $globals.Environment);
  25897. $core.addMethod(
  25898. $core.method({
  25899. selector: "removeClass:",
  25900. protocol: "actions",
  25901. fn: function (aClass){
  25902. var self=this,$self=this;
  25903. return $core.withContext(function($ctx1) {
  25904. $recv($globals.Smalltalk)._removeClass_(aClass);
  25905. return self;
  25906. }, function($ctx1) {$ctx1.fill(self,"removeClass:",{aClass:aClass},$globals.Environment)});
  25907. },
  25908. args: ["aClass"],
  25909. source: "removeClass: aClass\x0a\x09Smalltalk removeClass: aClass",
  25910. referencedClasses: ["Smalltalk"],
  25911. messageSends: ["removeClass:"]
  25912. }),
  25913. $globals.Environment);
  25914. $core.addMethod(
  25915. $core.method({
  25916. selector: "removeMethod:",
  25917. protocol: "actions",
  25918. fn: function (aMethod){
  25919. var self=this,$self=this;
  25920. return $core.withContext(function($ctx1) {
  25921. $recv($recv(aMethod)._methodClass())._removeCompiledMethod_(aMethod);
  25922. return self;
  25923. }, function($ctx1) {$ctx1.fill(self,"removeMethod:",{aMethod:aMethod},$globals.Environment)});
  25924. },
  25925. args: ["aMethod"],
  25926. source: "removeMethod: aMethod\x0a\x09aMethod methodClass removeCompiledMethod: aMethod",
  25927. referencedClasses: [],
  25928. messageSends: ["removeCompiledMethod:", "methodClass"]
  25929. }),
  25930. $globals.Environment);
  25931. $core.addMethod(
  25932. $core.method({
  25933. selector: "removeProtocol:from:",
  25934. protocol: "actions",
  25935. fn: function (aString,aClass){
  25936. var self=this,$self=this;
  25937. return $core.withContext(function($ctx1) {
  25938. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  25939. return $core.withContext(function($ctx2) {
  25940. return $recv(aClass)._removeCompiledMethod_(each);
  25941. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  25942. }));
  25943. return self;
  25944. }, function($ctx1) {$ctx1.fill(self,"removeProtocol:from:",{aString:aString,aClass:aClass},$globals.Environment)});
  25945. },
  25946. args: ["aString", "aClass"],
  25947. source: "removeProtocol: aString from: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | aClass removeCompiledMethod: each ]",
  25948. referencedClasses: [],
  25949. messageSends: ["do:", "methodsInProtocol:", "removeCompiledMethod:"]
  25950. }),
  25951. $globals.Environment);
  25952. $core.addMethod(
  25953. $core.method({
  25954. selector: "renameClass:to:",
  25955. protocol: "actions",
  25956. fn: function (aClass,aClassName){
  25957. var self=this,$self=this;
  25958. return $core.withContext(function($ctx1) {
  25959. var $1,$2,$receiver;
  25960. $1=$recv($recv($globals.Smalltalk)._globals())._at_(aClassName);
  25961. if(($receiver = $1) == null || $receiver.a$nil){
  25962. $1;
  25963. } else {
  25964. $2=$recv("A class named ".__comma(aClassName)).__comma(" already exists");
  25965. $ctx1.sendIdx[","]=1;
  25966. $self._error_($2);
  25967. }
  25968. $recv($recv($globals.ClassBuilder)._new())._renameClass_to_(aClass,aClassName);
  25969. return self;
  25970. }, function($ctx1) {$ctx1.fill(self,"renameClass:to:",{aClass:aClass,aClassName:aClassName},$globals.Environment)});
  25971. },
  25972. args: ["aClass", "aClassName"],
  25973. 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",
  25974. referencedClasses: ["Smalltalk", "ClassBuilder"],
  25975. messageSends: ["ifNotNil:", "at:", "globals", "error:", ",", "renameClass:to:", "new"]
  25976. }),
  25977. $globals.Environment);
  25978. $core.addMethod(
  25979. $core.method({
  25980. selector: "renamePackage:to:",
  25981. protocol: "actions",
  25982. fn: function (aPackageName,aNewPackageName){
  25983. var self=this,$self=this;
  25984. return $core.withContext(function($ctx1) {
  25985. $recv($globals.Smalltalk)._renamePackage_to_(aPackageName,aNewPackageName);
  25986. return self;
  25987. }, function($ctx1) {$ctx1.fill(self,"renamePackage:to:",{aPackageName:aPackageName,aNewPackageName:aNewPackageName},$globals.Environment)});
  25988. },
  25989. args: ["aPackageName", "aNewPackageName"],
  25990. source: "renamePackage: aPackageName to: aNewPackageName\x0a Smalltalk renamePackage: aPackageName to: aNewPackageName",
  25991. referencedClasses: ["Smalltalk"],
  25992. messageSends: ["renamePackage:to:"]
  25993. }),
  25994. $globals.Environment);
  25995. $core.addMethod(
  25996. $core.method({
  25997. selector: "renameProtocol:to:in:",
  25998. protocol: "actions",
  25999. fn: function (aString,anotherString,aClass){
  26000. var self=this,$self=this;
  26001. return $core.withContext(function($ctx1) {
  26002. $recv($recv(aClass)._methodsInProtocol_(aString))._do_((function(each){
  26003. return $core.withContext(function($ctx2) {
  26004. return $recv(each)._protocol_(anotherString);
  26005. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26006. }));
  26007. return self;
  26008. }, function($ctx1) {$ctx1.fill(self,"renameProtocol:to:in:",{aString:aString,anotherString:anotherString,aClass:aClass},$globals.Environment)});
  26009. },
  26010. args: ["aString", "anotherString", "aClass"],
  26011. source: "renameProtocol: aString to: anotherString in: aClass\x0a\x09(aClass methodsInProtocol: aString)\x0a\x09\x09do: [ :each | each protocol: anotherString ]",
  26012. referencedClasses: [],
  26013. messageSends: ["do:", "methodsInProtocol:", "protocol:"]
  26014. }),
  26015. $globals.Environment);
  26016. $core.addMethod(
  26017. $core.method({
  26018. selector: "setClassCommentOf:to:",
  26019. protocol: "actions",
  26020. fn: function (aClass,aString){
  26021. var self=this,$self=this;
  26022. return $core.withContext(function($ctx1) {
  26023. $recv(aClass)._comment_(aString);
  26024. return self;
  26025. }, function($ctx1) {$ctx1.fill(self,"setClassCommentOf:to:",{aClass:aClass,aString:aString},$globals.Environment)});
  26026. },
  26027. args: ["aClass", "aString"],
  26028. source: "setClassCommentOf: aClass to: aString\x0a\x09aClass comment: aString",
  26029. referencedClasses: [],
  26030. messageSends: ["comment:"]
  26031. }),
  26032. $globals.Environment);
  26033. $core.addMethod(
  26034. $core.method({
  26035. selector: "systemAnnouncer",
  26036. protocol: "accessing",
  26037. fn: function (){
  26038. var self=this,$self=this;
  26039. return $core.withContext(function($ctx1) {
  26040. return $recv($recv($recv($globals.Smalltalk)._globals())._at_("SystemAnnouncer"))._current();
  26041. }, function($ctx1) {$ctx1.fill(self,"systemAnnouncer",{},$globals.Environment)});
  26042. },
  26043. args: [],
  26044. source: "systemAnnouncer\x0a\x09^ (Smalltalk globals at: #SystemAnnouncer) current",
  26045. referencedClasses: ["Smalltalk"],
  26046. messageSends: ["current", "at:", "globals"]
  26047. }),
  26048. $globals.Environment);
  26049. $core.addClass("NullProgressHandler", $globals.Object, [], "Platform-Services");
  26050. $globals.NullProgressHandler.comment="I am the default progress handler. I do not display any progress, and simply iterate over the collection.";
  26051. $core.addMethod(
  26052. $core.method({
  26053. selector: "do:on:displaying:",
  26054. protocol: "progress handling",
  26055. fn: function (aBlock,aCollection,aString){
  26056. var self=this,$self=this;
  26057. return $core.withContext(function($ctx1) {
  26058. $recv(aCollection)._do_(aBlock);
  26059. return self;
  26060. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.NullProgressHandler)});
  26061. },
  26062. args: ["aBlock", "aCollection", "aString"],
  26063. source: "do: aBlock on: aCollection displaying: aString\x0a\x09aCollection do: aBlock",
  26064. referencedClasses: [],
  26065. messageSends: ["do:"]
  26066. }),
  26067. $globals.NullProgressHandler);
  26068. $globals.NullProgressHandler.a$cls.iVarNames = ["current"];
  26069. $core.addMethod(
  26070. $core.method({
  26071. selector: "initialize",
  26072. protocol: "initialization",
  26073. fn: function (){
  26074. var self=this,$self=this;
  26075. return $core.withContext(function($ctx1) {
  26076. $recv($globals.ProgressHandler)._registerIfNone_($self._new());
  26077. return self;
  26078. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NullProgressHandler.a$cls)});
  26079. },
  26080. args: [],
  26081. source: "initialize\x0a\x09ProgressHandler registerIfNone: self new",
  26082. referencedClasses: ["ProgressHandler"],
  26083. messageSends: ["registerIfNone:", "new"]
  26084. }),
  26085. $globals.NullProgressHandler.a$cls);
  26086. $core.addClass("Service", $globals.Object, [], "Platform-Services");
  26087. $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.";
  26088. $globals.Service.a$cls.iVarNames = ["current"];
  26089. $core.addMethod(
  26090. $core.method({
  26091. selector: "current",
  26092. protocol: "accessing",
  26093. fn: function (){
  26094. var self=this,$self=this;
  26095. return $self["@current"];
  26096. },
  26097. args: [],
  26098. source: "current\x0a\x09^ current",
  26099. referencedClasses: [],
  26100. messageSends: []
  26101. }),
  26102. $globals.Service.a$cls);
  26103. $core.addMethod(
  26104. $core.method({
  26105. selector: "new",
  26106. protocol: "instance creation",
  26107. fn: function (){
  26108. var self=this,$self=this;
  26109. return $core.withContext(function($ctx1) {
  26110. $self._shouldNotImplement();
  26111. return self;
  26112. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.Service.a$cls)});
  26113. },
  26114. args: [],
  26115. source: "new\x0a\x09self shouldNotImplement",
  26116. referencedClasses: [],
  26117. messageSends: ["shouldNotImplement"]
  26118. }),
  26119. $globals.Service.a$cls);
  26120. $core.addMethod(
  26121. $core.method({
  26122. selector: "register:",
  26123. protocol: "registration",
  26124. fn: function (anObject){
  26125. var self=this,$self=this;
  26126. $self["@current"]=anObject;
  26127. return self;
  26128. },
  26129. args: ["anObject"],
  26130. source: "register: anObject\x0a\x09current := anObject",
  26131. referencedClasses: [],
  26132. messageSends: []
  26133. }),
  26134. $globals.Service.a$cls);
  26135. $core.addMethod(
  26136. $core.method({
  26137. selector: "registerIfNone:",
  26138. protocol: "registration",
  26139. fn: function (anObject){
  26140. var self=this,$self=this;
  26141. return $core.withContext(function($ctx1) {
  26142. var $1,$receiver;
  26143. $1=$self._current();
  26144. if(($receiver = $1) == null || $receiver.a$nil){
  26145. $self._register_(anObject);
  26146. } else {
  26147. $1;
  26148. }
  26149. return self;
  26150. }, function($ctx1) {$ctx1.fill(self,"registerIfNone:",{anObject:anObject},$globals.Service.a$cls)});
  26151. },
  26152. args: ["anObject"],
  26153. source: "registerIfNone: anObject\x0a\x09self current ifNil: [ self register: anObject ]",
  26154. referencedClasses: [],
  26155. messageSends: ["ifNil:", "current", "register:"]
  26156. }),
  26157. $globals.Service.a$cls);
  26158. $core.addClass("ErrorHandler", $globals.Service, [], "Platform-Services");
  26159. $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.";
  26160. $core.addMethod(
  26161. $core.method({
  26162. selector: "handleError:",
  26163. protocol: "error handling",
  26164. fn: function (anError){
  26165. var self=this,$self=this;
  26166. return $core.withContext(function($ctx1) {
  26167. var $1;
  26168. $1=$recv((function(){
  26169. return $core.withContext(function($ctx2) {
  26170. return $recv(anError)._isSmalltalkError();
  26171. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  26172. }))._tryCatch_((function(){
  26173. return false;
  26174. }));
  26175. if($core.assert($1)){
  26176. $self._handleUnhandledError_(anError);
  26177. $ctx1.sendIdx["handleUnhandledError:"]=1;
  26178. } else {
  26179. var smalltalkError;
  26180. smalltalkError=$recv($globals.JavaScriptException)._on_(anError);
  26181. $recv(smalltalkError)._wrap();
  26182. $self._handleUnhandledError_(smalltalkError);
  26183. }
  26184. return self;
  26185. }, function($ctx1) {$ctx1.fill(self,"handleError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26186. },
  26187. args: ["anError"],
  26188. 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 ]",
  26189. referencedClasses: ["JavaScriptException"],
  26190. messageSends: ["ifTrue:ifFalse:", "tryCatch:", "isSmalltalkError", "handleUnhandledError:", "on:", "wrap"]
  26191. }),
  26192. $globals.ErrorHandler.a$cls);
  26193. $core.addMethod(
  26194. $core.method({
  26195. selector: "handleUnhandledError:",
  26196. protocol: "error handling",
  26197. fn: function (anError){
  26198. var self=this,$self=this;
  26199. return $core.withContext(function($ctx1) {
  26200. var $1;
  26201. $1=$recv(anError)._wasHandled();
  26202. if(!$core.assert($1)){
  26203. $recv($self._current())._handleError_(anError);
  26204. $recv(anError)._beHandled();
  26205. }
  26206. return self;
  26207. }, function($ctx1) {$ctx1.fill(self,"handleUnhandledError:",{anError:anError},$globals.ErrorHandler.a$cls)});
  26208. },
  26209. args: ["anError"],
  26210. source: "handleUnhandledError: anError\x0a\x09anError wasHandled ifFalse: [\x0a\x09\x09self current handleError: anError.\x0a\x09\x09anError beHandled ]",
  26211. referencedClasses: [],
  26212. messageSends: ["ifFalse:", "wasHandled", "handleError:", "current", "beHandled"]
  26213. }),
  26214. $globals.ErrorHandler.a$cls);
  26215. $core.addClass("Finder", $globals.Service, [], "Platform-Services");
  26216. $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.";
  26217. $core.addMethod(
  26218. $core.method({
  26219. selector: "findClass:",
  26220. protocol: "finding",
  26221. fn: function (aClass){
  26222. var self=this,$self=this;
  26223. return $core.withContext(function($ctx1) {
  26224. return $recv($self._current())._findClass_(aClass);
  26225. }, function($ctx1) {$ctx1.fill(self,"findClass:",{aClass:aClass},$globals.Finder.a$cls)});
  26226. },
  26227. args: ["aClass"],
  26228. source: "findClass: aClass\x0a\x09^ self current findClass: aClass",
  26229. referencedClasses: [],
  26230. messageSends: ["findClass:", "current"]
  26231. }),
  26232. $globals.Finder.a$cls);
  26233. $core.addMethod(
  26234. $core.method({
  26235. selector: "findMethod:",
  26236. protocol: "finding",
  26237. fn: function (aCompiledMethod){
  26238. var self=this,$self=this;
  26239. return $core.withContext(function($ctx1) {
  26240. return $recv($self._current())._findMethod_(aCompiledMethod);
  26241. }, function($ctx1) {$ctx1.fill(self,"findMethod:",{aCompiledMethod:aCompiledMethod},$globals.Finder.a$cls)});
  26242. },
  26243. args: ["aCompiledMethod"],
  26244. source: "findMethod: aCompiledMethod\x0a\x09^ self current findMethod: aCompiledMethod",
  26245. referencedClasses: [],
  26246. messageSends: ["findMethod:", "current"]
  26247. }),
  26248. $globals.Finder.a$cls);
  26249. $core.addMethod(
  26250. $core.method({
  26251. selector: "findString:",
  26252. protocol: "finding",
  26253. fn: function (aString){
  26254. var self=this,$self=this;
  26255. return $core.withContext(function($ctx1) {
  26256. return $recv($self._current())._findString_(aString);
  26257. }, function($ctx1) {$ctx1.fill(self,"findString:",{aString:aString},$globals.Finder.a$cls)});
  26258. },
  26259. args: ["aString"],
  26260. source: "findString: aString\x0a\x09^ self current findString: aString",
  26261. referencedClasses: [],
  26262. messageSends: ["findString:", "current"]
  26263. }),
  26264. $globals.Finder.a$cls);
  26265. $core.addClass("Inspector", $globals.Service, [], "Platform-Services");
  26266. $globals.Inspector.comment="I am the service responsible for inspecting objects.\x0a\x0aThe default inspector object is the transcript.";
  26267. $core.addMethod(
  26268. $core.method({
  26269. selector: "inspect:",
  26270. protocol: "inspecting",
  26271. fn: function (anObject){
  26272. var self=this,$self=this;
  26273. return $core.withContext(function($ctx1) {
  26274. return $recv($self._current())._inspect_(anObject);
  26275. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Inspector.a$cls)});
  26276. },
  26277. args: ["anObject"],
  26278. source: "inspect: anObject\x0a\x09^ self current inspect: anObject",
  26279. referencedClasses: [],
  26280. messageSends: ["inspect:", "current"]
  26281. }),
  26282. $globals.Inspector.a$cls);
  26283. $core.addClass("Platform", $globals.Service, [], "Platform-Services");
  26284. $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";
  26285. $core.addMethod(
  26286. $core.method({
  26287. selector: "globals",
  26288. protocol: "accessing",
  26289. fn: function (){
  26290. var self=this,$self=this;
  26291. return $core.withContext(function($ctx1) {
  26292. return $recv($self._current())._globals();
  26293. }, function($ctx1) {$ctx1.fill(self,"globals",{},$globals.Platform.a$cls)});
  26294. },
  26295. args: [],
  26296. source: "globals\x0a\x09^ self current globals",
  26297. referencedClasses: [],
  26298. messageSends: ["globals", "current"]
  26299. }),
  26300. $globals.Platform.a$cls);
  26301. $core.addMethod(
  26302. $core.method({
  26303. selector: "includesGlobal:",
  26304. protocol: "testing",
  26305. fn: function (aString){
  26306. var self=this,$self=this;
  26307. return $core.withContext(function($ctx1) {
  26308. return $recv($self._globals())._at_ifPresent_ifAbsent_(aString,(function(){
  26309. return true;
  26310. }),(function(){
  26311. return false;
  26312. }));
  26313. }, function($ctx1) {$ctx1.fill(self,"includesGlobal:",{aString:aString},$globals.Platform.a$cls)});
  26314. },
  26315. args: ["aString"],
  26316. source: "includesGlobal: aString\x0a\x09^ self globals \x0a\x09\x09at: aString \x0a\x09\x09ifPresent: [ true ] \x0a\x09\x09ifAbsent: [ false ]",
  26317. referencedClasses: [],
  26318. messageSends: ["at:ifPresent:ifAbsent:", "globals"]
  26319. }),
  26320. $globals.Platform.a$cls);
  26321. $core.addMethod(
  26322. $core.method({
  26323. selector: "newXhr",
  26324. protocol: "accessing",
  26325. fn: function (){
  26326. var self=this,$self=this;
  26327. return $core.withContext(function($ctx1) {
  26328. return $recv($self._current())._newXhr();
  26329. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.Platform.a$cls)});
  26330. },
  26331. args: [],
  26332. source: "newXhr\x0a\x09^ self current newXhr",
  26333. referencedClasses: [],
  26334. messageSends: ["newXhr", "current"]
  26335. }),
  26336. $globals.Platform.a$cls);
  26337. $core.addClass("ProgressHandler", $globals.Service, [], "Platform-Services");
  26338. $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`.";
  26339. $core.addMethod(
  26340. $core.method({
  26341. selector: "do:on:displaying:",
  26342. protocol: "progress handling",
  26343. fn: function (aBlock,aCollection,aString){
  26344. var self=this,$self=this;
  26345. return $core.withContext(function($ctx1) {
  26346. $recv($self._current())._do_on_displaying_(aBlock,aCollection,aString);
  26347. return self;
  26348. }, function($ctx1) {$ctx1.fill(self,"do:on:displaying:",{aBlock:aBlock,aCollection:aCollection,aString:aString},$globals.ProgressHandler.a$cls)});
  26349. },
  26350. args: ["aBlock", "aCollection", "aString"],
  26351. source: "do: aBlock on: aCollection displaying: aString\x0a\x09self current do: aBlock on: aCollection displaying: aString",
  26352. referencedClasses: [],
  26353. messageSends: ["do:on:displaying:", "current"]
  26354. }),
  26355. $globals.ProgressHandler.a$cls);
  26356. $core.addClass("Terminal", $globals.Service, [], "Platform-Services");
  26357. $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:'.";
  26358. $core.addMethod(
  26359. $core.method({
  26360. selector: "alert:",
  26361. protocol: "dialogs",
  26362. fn: function (aString){
  26363. var self=this,$self=this;
  26364. return $core.withContext(function($ctx1) {
  26365. return $recv($self._current())._alert_(aString);
  26366. }, function($ctx1) {$ctx1.fill(self,"alert:",{aString:aString},$globals.Terminal.a$cls)});
  26367. },
  26368. args: ["aString"],
  26369. source: "alert: aString\x0a\x09^ self current alert: aString",
  26370. referencedClasses: [],
  26371. messageSends: ["alert:", "current"]
  26372. }),
  26373. $globals.Terminal.a$cls);
  26374. $core.addMethod(
  26375. $core.method({
  26376. selector: "confirm:",
  26377. protocol: "dialogs",
  26378. fn: function (aString){
  26379. var self=this,$self=this;
  26380. return $core.withContext(function($ctx1) {
  26381. return $recv($self._current())._confirm_(aString);
  26382. }, function($ctx1) {$ctx1.fill(self,"confirm:",{aString:aString},$globals.Terminal.a$cls)});
  26383. },
  26384. args: ["aString"],
  26385. source: "confirm: aString\x0a\x09^ self current confirm: aString",
  26386. referencedClasses: [],
  26387. messageSends: ["confirm:", "current"]
  26388. }),
  26389. $globals.Terminal.a$cls);
  26390. $core.addMethod(
  26391. $core.method({
  26392. selector: "prompt:",
  26393. protocol: "dialogs",
  26394. fn: function (aString){
  26395. var self=this,$self=this;
  26396. return $core.withContext(function($ctx1) {
  26397. return $recv($self._current())._prompt_(aString);
  26398. }, function($ctx1) {$ctx1.fill(self,"prompt:",{aString:aString},$globals.Terminal.a$cls)});
  26399. },
  26400. args: ["aString"],
  26401. source: "prompt: aString\x0a\x09^ self current prompt: aString",
  26402. referencedClasses: [],
  26403. messageSends: ["prompt:", "current"]
  26404. }),
  26405. $globals.Terminal.a$cls);
  26406. $core.addMethod(
  26407. $core.method({
  26408. selector: "prompt:default:",
  26409. protocol: "dialogs",
  26410. fn: function (aString,defaultString){
  26411. var self=this,$self=this;
  26412. return $core.withContext(function($ctx1) {
  26413. return $recv($self._current())._prompt_default_(aString,defaultString);
  26414. }, function($ctx1) {$ctx1.fill(self,"prompt:default:",{aString:aString,defaultString:defaultString},$globals.Terminal.a$cls)});
  26415. },
  26416. args: ["aString", "defaultString"],
  26417. source: "prompt: aString default: defaultString\x0a\x09^ self current prompt: aString default: defaultString",
  26418. referencedClasses: [],
  26419. messageSends: ["prompt:default:", "current"]
  26420. }),
  26421. $globals.Terminal.a$cls);
  26422. $core.addClass("Transcript", $globals.Service, [], "Platform-Services");
  26423. $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.";
  26424. $core.addMethod(
  26425. $core.method({
  26426. selector: "clear",
  26427. protocol: "printing",
  26428. fn: function (){
  26429. var self=this,$self=this;
  26430. return $core.withContext(function($ctx1) {
  26431. $recv($self._current())._clear();
  26432. return self;
  26433. }, function($ctx1) {$ctx1.fill(self,"clear",{},$globals.Transcript.a$cls)});
  26434. },
  26435. args: [],
  26436. source: "clear\x0a\x09self current clear",
  26437. referencedClasses: [],
  26438. messageSends: ["clear", "current"]
  26439. }),
  26440. $globals.Transcript.a$cls);
  26441. $core.addMethod(
  26442. $core.method({
  26443. selector: "cr",
  26444. protocol: "printing",
  26445. fn: function (){
  26446. var self=this,$self=this;
  26447. return $core.withContext(function($ctx1) {
  26448. $recv($self._current())._show_($recv($globals.String)._cr());
  26449. return self;
  26450. }, function($ctx1) {$ctx1.fill(self,"cr",{},$globals.Transcript.a$cls)});
  26451. },
  26452. args: [],
  26453. source: "cr\x0a\x09self current show: String cr",
  26454. referencedClasses: ["String"],
  26455. messageSends: ["show:", "current", "cr"]
  26456. }),
  26457. $globals.Transcript.a$cls);
  26458. $core.addMethod(
  26459. $core.method({
  26460. selector: "inspect:",
  26461. protocol: "printing",
  26462. fn: function (anObject){
  26463. var self=this,$self=this;
  26464. return $core.withContext(function($ctx1) {
  26465. $self._show_(anObject);
  26466. return self;
  26467. }, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},$globals.Transcript.a$cls)});
  26468. },
  26469. args: ["anObject"],
  26470. source: "inspect: anObject\x0a\x09self show: anObject",
  26471. referencedClasses: [],
  26472. messageSends: ["show:"]
  26473. }),
  26474. $globals.Transcript.a$cls);
  26475. $core.addMethod(
  26476. $core.method({
  26477. selector: "open",
  26478. protocol: "instance creation",
  26479. fn: function (){
  26480. var self=this,$self=this;
  26481. return $core.withContext(function($ctx1) {
  26482. $recv($self._current())._open();
  26483. return self;
  26484. }, function($ctx1) {$ctx1.fill(self,"open",{},$globals.Transcript.a$cls)});
  26485. },
  26486. args: [],
  26487. source: "open\x0a\x09self current open",
  26488. referencedClasses: [],
  26489. messageSends: ["open", "current"]
  26490. }),
  26491. $globals.Transcript.a$cls);
  26492. $core.addMethod(
  26493. $core.method({
  26494. selector: "show:",
  26495. protocol: "printing",
  26496. fn: function (anObject){
  26497. var self=this,$self=this;
  26498. return $core.withContext(function($ctx1) {
  26499. $recv($self._current())._show_(anObject);
  26500. return self;
  26501. }, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},$globals.Transcript.a$cls)});
  26502. },
  26503. args: ["anObject"],
  26504. source: "show: anObject\x0a\x09self current show: anObject",
  26505. referencedClasses: [],
  26506. messageSends: ["show:", "current"]
  26507. }),
  26508. $globals.Transcript.a$cls);
  26509. $core.addMethod(
  26510. $core.method({
  26511. selector: "inspectOn:",
  26512. protocol: "*Platform-Services",
  26513. fn: function (anInspector){
  26514. var self=this,$self=this;
  26515. var variables;
  26516. return $core.withContext(function($ctx1) {
  26517. variables=$recv($globals.Dictionary)._new();
  26518. $recv(variables)._at_put_("#self",self);
  26519. $ctx1.sendIdx["at:put:"]=1;
  26520. $recv(variables)._at_put_("#keys",$self._keys());
  26521. $ctx1.sendIdx["at:put:"]=2;
  26522. $self._keysAndValuesDo_((function(key,value){
  26523. return $core.withContext(function($ctx2) {
  26524. return $recv(variables)._at_put_(key,value);
  26525. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,1)});
  26526. }));
  26527. $recv(anInspector)._setLabel_($self._printString());
  26528. $recv(anInspector)._setVariables_(variables);
  26529. return self;
  26530. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.AssociativeCollection)});
  26531. },
  26532. args: ["anInspector"],
  26533. 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",
  26534. referencedClasses: ["Dictionary"],
  26535. messageSends: ["new", "at:put:", "keys", "keysAndValuesDo:", "setLabel:", "printString", "setVariables:"]
  26536. }),
  26537. $globals.AssociativeCollection);
  26538. $core.addMethod(
  26539. $core.method({
  26540. selector: "inspectOn:",
  26541. protocol: "*Platform-Services",
  26542. fn: function (anInspector){
  26543. var self=this,$self=this;
  26544. var variables;
  26545. return $core.withContext(function($ctx1) {
  26546. variables=$recv($globals.Dictionary)._new();
  26547. $recv(variables)._at_put_("#self",self);
  26548. $ctx1.sendIdx["at:put:"]=1;
  26549. $self._withIndexDo_((function(each,i){
  26550. return $core.withContext(function($ctx2) {
  26551. return $recv(variables)._at_put_(i,each);
  26552. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  26553. }));
  26554. $recv(anInspector)._setLabel_($self._printString());
  26555. $recv(anInspector)._setVariables_(variables);
  26556. return self;
  26557. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Collection)});
  26558. },
  26559. args: ["anInspector"],
  26560. 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",
  26561. referencedClasses: ["Dictionary"],
  26562. messageSends: ["new", "at:put:", "withIndexDo:", "setLabel:", "printString", "setVariables:"]
  26563. }),
  26564. $globals.Collection);
  26565. $core.addMethod(
  26566. $core.method({
  26567. selector: "inspectOn:",
  26568. protocol: "*Platform-Services",
  26569. fn: function (anInspector){
  26570. var self=this,$self=this;
  26571. var variables;
  26572. return $core.withContext(function($ctx1) {
  26573. variables=$recv($globals.Dictionary)._new();
  26574. $recv(variables)._at_put_("#self",self);
  26575. $ctx1.sendIdx["at:put:"]=1;
  26576. $recv(variables)._at_put_("#year",$self._year());
  26577. $ctx1.sendIdx["at:put:"]=2;
  26578. $recv(variables)._at_put_("#month",$self._month());
  26579. $ctx1.sendIdx["at:put:"]=3;
  26580. $recv(variables)._at_put_("#day",$self._day());
  26581. $ctx1.sendIdx["at:put:"]=4;
  26582. $recv(variables)._at_put_("#hours",$self._hours());
  26583. $ctx1.sendIdx["at:put:"]=5;
  26584. $recv(variables)._at_put_("#minutes",$self._minutes());
  26585. $ctx1.sendIdx["at:put:"]=6;
  26586. $recv(variables)._at_put_("#seconds",$self._seconds());
  26587. $ctx1.sendIdx["at:put:"]=7;
  26588. $recv(variables)._at_put_("#milliseconds",$self._milliseconds());
  26589. $recv(anInspector)._setLabel_($self._printString());
  26590. $recv(anInspector)._setVariables_(variables);
  26591. return self;
  26592. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Date)});
  26593. },
  26594. args: ["anInspector"],
  26595. 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",
  26596. referencedClasses: ["Dictionary"],
  26597. messageSends: ["new", "at:put:", "year", "month", "day", "hours", "minutes", "seconds", "milliseconds", "setLabel:", "printString", "setVariables:"]
  26598. }),
  26599. $globals.Date);
  26600. $core.addMethod(
  26601. $core.method({
  26602. selector: "inspectOn:",
  26603. protocol: "*Platform-Services",
  26604. fn: function (anInspector){
  26605. var self=this,$self=this;
  26606. var variables;
  26607. return $core.withContext(function($ctx1) {
  26608. variables=$recv($globals.Dictionary)._new();
  26609. $recv(variables)._at_put_("#self",$self._jsObject());
  26610. $recv(anInspector)._setLabel_($self._printString());
  26611. $recv($globals.JSObjectProxy)._addObjectVariablesTo_ofProxy_(variables,self);
  26612. $recv(anInspector)._setVariables_(variables);
  26613. return self;
  26614. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.JSObjectProxy)});
  26615. },
  26616. args: ["anInspector"],
  26617. 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",
  26618. referencedClasses: ["Dictionary", "JSObjectProxy"],
  26619. messageSends: ["new", "at:put:", "jsObject", "setLabel:", "printString", "addObjectVariablesTo:ofProxy:", "setVariables:"]
  26620. }),
  26621. $globals.JSObjectProxy);
  26622. $core.addMethod(
  26623. $core.method({
  26624. selector: "inspectOn:",
  26625. protocol: "*Platform-Services",
  26626. fn: function (anInspector){
  26627. var self=this,$self=this;
  26628. var variables;
  26629. return $core.withContext(function($ctx1) {
  26630. variables=$recv($globals.Dictionary)._new();
  26631. $recv(variables)._at_put_("#self",self);
  26632. $ctx1.sendIdx["at:put:"]=1;
  26633. $recv(variables)._at_put_("#home",$self._home());
  26634. $ctx1.sendIdx["at:put:"]=2;
  26635. $recv(variables)._at_put_("#receiver",$self._receiver());
  26636. $ctx1.sendIdx["at:put:"]=3;
  26637. $recv(variables)._at_put_("#selector",$self._selector());
  26638. $ctx1.sendIdx["at:put:"]=4;
  26639. $recv(variables)._at_put_("#locals",$self._locals());
  26640. $ctx1.sendIdx["at:put:"]=5;
  26641. $recv($recv($self._class())._instanceVariableNames())._do_((function(each){
  26642. return $core.withContext(function($ctx2) {
  26643. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26644. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26645. }));
  26646. $recv(anInspector)._setLabel_($self._printString());
  26647. $recv(anInspector)._setVariables_(variables);
  26648. return self;
  26649. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.MethodContext)});
  26650. },
  26651. args: ["anInspector"],
  26652. 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",
  26653. referencedClasses: ["Dictionary"],
  26654. messageSends: ["new", "at:put:", "home", "receiver", "selector", "locals", "do:", "instanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26655. }),
  26656. $globals.MethodContext);
  26657. $core.addMethod(
  26658. $core.method({
  26659. selector: "inspectOn:",
  26660. protocol: "*Platform-Services",
  26661. fn: function (anInspector){
  26662. var self=this,$self=this;
  26663. var variables;
  26664. return $core.withContext(function($ctx1) {
  26665. variables=$recv($globals.Dictionary)._new();
  26666. $recv(variables)._at_put_("#self",self);
  26667. $ctx1.sendIdx["at:put:"]=1;
  26668. $recv($recv($self._class())._allInstanceVariableNames())._do_((function(each){
  26669. return $core.withContext(function($ctx2) {
  26670. return $recv(variables)._at_put_(each,$self._instVarAt_(each));
  26671. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26672. }));
  26673. $recv(anInspector)._setLabel_($self._printString());
  26674. $recv(anInspector)._setVariables_(variables);
  26675. return self;
  26676. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables},$globals.Object)});
  26677. },
  26678. args: ["anInspector"],
  26679. 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",
  26680. referencedClasses: ["Dictionary"],
  26681. messageSends: ["new", "at:put:", "do:", "allInstanceVariableNames", "class", "instVarAt:", "setLabel:", "printString", "setVariables:"]
  26682. }),
  26683. $globals.Object);
  26684. $core.addMethod(
  26685. $core.method({
  26686. selector: "do:displayingProgress:",
  26687. protocol: "*Platform-Services",
  26688. fn: function (aBlock,aString){
  26689. var self=this,$self=this;
  26690. return $core.withContext(function($ctx1) {
  26691. $recv($globals.ProgressHandler)._do_on_displaying_(aBlock,self,aString);
  26692. return self;
  26693. }, function($ctx1) {$ctx1.fill(self,"do:displayingProgress:",{aBlock:aBlock,aString:aString},$globals.SequenceableCollection)});
  26694. },
  26695. args: ["aBlock", "aString"],
  26696. source: "do: aBlock displayingProgress: aString\x0a\x09ProgressHandler \x0a\x09\x09do: aBlock \x0a\x09\x09on: self \x0a\x09\x09displaying: aString",
  26697. referencedClasses: ["ProgressHandler"],
  26698. messageSends: ["do:on:displaying:"]
  26699. }),
  26700. $globals.SequenceableCollection);
  26701. $core.addMethod(
  26702. $core.method({
  26703. selector: "inspectOn:",
  26704. protocol: "*Platform-Services",
  26705. fn: function (anInspector){
  26706. var self=this,$self=this;
  26707. var variables,i;
  26708. return $core.withContext(function($ctx1) {
  26709. variables=$recv($globals.Dictionary)._new();
  26710. $recv(variables)._at_put_("#self",self);
  26711. $ctx1.sendIdx["at:put:"]=1;
  26712. i=(1);
  26713. $self._do_((function(each){
  26714. return $core.withContext(function($ctx2) {
  26715. $recv(variables)._at_put_(i,each);
  26716. i=$recv(i).__plus((1));
  26717. return i;
  26718. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  26719. }));
  26720. $recv(anInspector)._setLabel_($self._printString());
  26721. $recv(anInspector)._setVariables_(variables);
  26722. return self;
  26723. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,variables:variables,i:i},$globals.Set)});
  26724. },
  26725. args: ["anInspector"],
  26726. 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",
  26727. referencedClasses: ["Dictionary"],
  26728. messageSends: ["new", "at:put:", "do:", "+", "setLabel:", "printString", "setVariables:"]
  26729. }),
  26730. $globals.Set);
  26731. $core.addMethod(
  26732. $core.method({
  26733. selector: "inspectOn:",
  26734. protocol: "*Platform-Services",
  26735. fn: function (anInspector){
  26736. var self=this,$self=this;
  26737. var label;
  26738. return $core.withContext(function($ctx1) {
  26739. var $3,$2,$1,$5,$4;
  26740. (
  26741. $ctx1.supercall = true,
  26742. ($globals.String.superclass||$boot.nilAsClass).fn.prototype._inspectOn_.apply($self, [anInspector]));
  26743. $ctx1.supercall = false;
  26744. $3=$self._printString();
  26745. $ctx1.sendIdx["printString"]=1;
  26746. $2=$recv($3)._size();
  26747. $1=$recv($2).__gt((30));
  26748. if($core.assert($1)){
  26749. $5=$self._printString();
  26750. $ctx1.sendIdx["printString"]=2;
  26751. $4=$recv($5)._copyFrom_to_((1),(30));
  26752. label=$recv($4).__comma("...'");
  26753. label;
  26754. } else {
  26755. label=$self._printString();
  26756. label;
  26757. }
  26758. $recv(anInspector)._setLabel_(label);
  26759. return self;
  26760. }, function($ctx1) {$ctx1.fill(self,"inspectOn:",{anInspector:anInspector,label:label},$globals.String)});
  26761. },
  26762. args: ["anInspector"],
  26763. 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",
  26764. referencedClasses: [],
  26765. messageSends: ["inspectOn:", "ifTrue:ifFalse:", ">", "size", "printString", ",", "copyFrom:to:", "setLabel:"]
  26766. }),
  26767. $globals.String);
  26768. });
  26769. define('amber/deploy',[
  26770. './helpers',
  26771. './boot', // pre-fetch, dep of ./helpers
  26772. // --- packages of the core Amber begin here ---
  26773. 'amber_core/Kernel-Helpers',
  26774. 'amber_core/Kernel-Objects',
  26775. 'amber_core/Kernel-Classes',
  26776. 'amber_core/Kernel-Methods',
  26777. 'amber_core/Kernel-Collections',
  26778. 'amber_core/Kernel-Dag',
  26779. 'amber_core/Kernel-Infrastructure',
  26780. 'amber_core/Kernel-Promises',
  26781. 'amber_core/Kernel-Exceptions',
  26782. 'amber_core/Kernel-Announcements',
  26783. 'amber_core/Platform-Services',
  26784. // --- packages of the core Amber end here ---
  26785. ], function (amber) {
  26786. return amber;
  26787. });
  26788. // jshint ignore:start
  26789. define('amber/parser',['./boot'], function($boot) {
  26790. var $globals = $boot.globals;
  26791. $globals.SmalltalkParser = (function() {
  26792. "use strict";
  26793. /*
  26794. * Generated by PEG.js 0.9.0.
  26795. *
  26796. * http://pegjs.org/
  26797. */
  26798. function peg$subclass(child, parent) {
  26799. function ctor() { this.constructor = child; }
  26800. ctor.prototype = parent.prototype;
  26801. child.prototype = new ctor();
  26802. }
  26803. function peg$SyntaxError(message, expected, found, location) {
  26804. this.message = message;
  26805. this.expected = expected;
  26806. this.found = found;
  26807. this.location = location;
  26808. this.name = "SyntaxError";
  26809. if (typeof Error.captureStackTrace === "function") {
  26810. Error.captureStackTrace(this, peg$SyntaxError);
  26811. }
  26812. }
  26813. peg$subclass(peg$SyntaxError, Error);
  26814. function peg$parse(input) {
  26815. var options = arguments.length > 1 ? arguments[1] : {},
  26816. parser = this,
  26817. peg$FAILED = {},
  26818. peg$startRuleFunctions = { start: peg$parsestart },
  26819. peg$startRuleFunction = peg$parsestart,
  26820. peg$c0 = /^[ \t\x0B\f\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF\n\r\u2028\u2029]/,
  26821. 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]" },
  26822. peg$c2 = "\"",
  26823. peg$c3 = { type: "literal", value: "\"", description: "\"\\\"\"" },
  26824. peg$c4 = /^[^"]/,
  26825. peg$c5 = { type: "class", value: "[^\"]", description: "[^\"]" },
  26826. peg$c6 = ".",
  26827. peg$c7 = { type: "literal", value: ".", description: "\".\"" },
  26828. peg$c8 = /^[a-zA-Z]/,
  26829. peg$c9 = { type: "class", value: "[a-zA-Z]", description: "[a-zA-Z]" },
  26830. peg$c10 = /^[a-zA-Z0-9]/,
  26831. peg$c11 = { type: "class", value: "[a-zA-Z0-9]", description: "[a-zA-Z0-9]" },
  26832. peg$c12 = ":",
  26833. peg$c13 = { type: "literal", value: ":", description: "\":\"" },
  26834. peg$c14 = /^[A-Z]/,
  26835. peg$c15 = { type: "class", value: "[A-Z]", description: "[A-Z]" },
  26836. peg$c16 = function(val) {
  26837. return $globals.ValueNode._new()
  26838. ._location_(location())
  26839. ._source_(text())
  26840. ._value_(val);
  26841. },
  26842. peg$c17 = "'",
  26843. peg$c18 = { type: "literal", value: "'", description: "\"'\"" },
  26844. peg$c19 = "''",
  26845. peg$c20 = { type: "literal", value: "''", description: "\"''\"" },
  26846. peg$c21 = function() {return '\'';},
  26847. peg$c22 = /^[^']/,
  26848. peg$c23 = { type: "class", value: "[^']", description: "[^']" },
  26849. peg$c24 = function(val) {return val.join('');},
  26850. peg$c25 = "$",
  26851. peg$c26 = { type: "literal", value: "$", description: "\"$\"" },
  26852. peg$c27 = { type: "any", description: "any character" },
  26853. peg$c28 = function(char) {
  26854. return $globals.ValueNode._new()
  26855. ._location_(location())
  26856. ._source_(text())
  26857. ._value_(char);
  26858. },
  26859. peg$c29 = "#",
  26860. peg$c30 = { type: "literal", value: "#", description: "\"#\"" },
  26861. peg$c31 = function(rest) {return rest;},
  26862. peg$c32 = "e",
  26863. peg$c33 = { type: "literal", value: "e", description: "\"e\"" },
  26864. peg$c34 = function(n) {return parseFloat(n);},
  26865. peg$c35 = "-",
  26866. peg$c36 = { type: "literal", value: "-", description: "\"-\"" },
  26867. peg$c37 = "16r",
  26868. peg$c38 = { type: "literal", value: "16r", description: "\"16r\"" },
  26869. peg$c39 = /^[0-9a-fA-F]/,
  26870. peg$c40 = { type: "class", value: "[0-9a-fA-F]", description: "[0-9a-fA-F]" },
  26871. peg$c41 = function(neg, num) {
  26872. return parseInt(((neg || '') + num), 16);
  26873. },
  26874. peg$c42 = /^[0-9]/,
  26875. peg$c43 = { type: "class", value: "[0-9]", description: "[0-9]" },
  26876. peg$c44 = function(n) {return parseFloat(n, 10);},
  26877. peg$c45 = function(n) {return parseInt(n, 10);},
  26878. peg$c46 = "#(",
  26879. peg$c47 = { type: "literal", value: "#(", description: "\"#(\"" },
  26880. peg$c48 = ")",
  26881. peg$c49 = { type: "literal", value: ")", description: "\")\"" },
  26882. peg$c50 = function(rest) {
  26883. return rest
  26884. ._location_(location())
  26885. ._source_(text());
  26886. },
  26887. peg$c51 = "(",
  26888. peg$c52 = { type: "literal", value: "(", description: "\"(\"" },
  26889. peg$c53 = function(lit) {return lit._value();},
  26890. peg$c54 = function(lits) {
  26891. return $globals.ValueNode._new()
  26892. ._value_(lits);
  26893. },
  26894. peg$c55 = "{",
  26895. peg$c56 = { type: "literal", value: "{", description: "\"{\"" },
  26896. peg$c57 = "}",
  26897. peg$c58 = { type: "literal", value: "}", description: "\"}\"" },
  26898. peg$c59 = function(expressions) {
  26899. return $globals.DynamicArrayNode._new()
  26900. ._location_(location())
  26901. ._source_(text())
  26902. ._dagChildren_(expressions || []);
  26903. },
  26904. peg$c60 = "#{",
  26905. peg$c61 = { type: "literal", value: "#{", description: "\"#{\"" },
  26906. peg$c62 = function(expressions) {
  26907. return $globals.DynamicDictionaryNode._new()
  26908. ._location_(location())
  26909. ._source_(text())
  26910. ._dagChildren_(expressions || []);
  26911. },
  26912. peg$c63 = "true",
  26913. peg$c64 = { type: "literal", value: "true", description: "\"true\"" },
  26914. peg$c65 = function() {return true;},
  26915. peg$c66 = "false",
  26916. peg$c67 = { type: "literal", value: "false", description: "\"false\"" },
  26917. peg$c68 = function() {return false;},
  26918. peg$c69 = "nil",
  26919. peg$c70 = { type: "literal", value: "nil", description: "\"nil\"" },
  26920. peg$c71 = function() {return null;},
  26921. peg$c72 = function(identifier) {
  26922. return $globals.VariableNode._new()
  26923. ._location_(location())
  26924. ._source_(text())
  26925. ._value_(identifier);
  26926. },
  26927. peg$c73 = /^[\\+*\/=><,@%~|&\-]/,
  26928. peg$c74 = { type: "class", value: "[\\\\+*/=><,@%~|&-]", description: "[\\\\+*/=><,@%~|&-]" },
  26929. peg$c75 = function(key, arg) {return {key:key, arg:arg};},
  26930. peg$c76 = function(pairs) {
  26931. var selector = '';
  26932. var params = [];
  26933. for(var i = 0; i < pairs.length; i++) {
  26934. selector += pairs[i].key;
  26935. params.push(pairs[i].arg);
  26936. }
  26937. return [selector, params];
  26938. },
  26939. peg$c77 = function(selector, arg) {
  26940. return [selector, [arg]];
  26941. },
  26942. peg$c78 = function(selector) {return [selector, []];},
  26943. peg$c79 = function(expression) {
  26944. return expression;
  26945. },
  26946. peg$c80 = function(first, others) {
  26947. return [first].concat(others);
  26948. },
  26949. peg$c81 = function(selector) {
  26950. return $globals.Message._selector_arguments_(selector, []);
  26951. },
  26952. peg$c82 = function(pairs) {
  26953. var selector = '';
  26954. var args = [];
  26955. for(var i = 0; i < pairs.length; i++) {
  26956. selector += pairs[i].key;
  26957. args.push(pairs[i].arg._value());
  26958. }
  26959. return $globals.Message._selector_arguments_(selector, args)
  26960. },
  26961. peg$c83 = "<",
  26962. peg$c84 = { type: "literal", value: "<", description: "\"<\"" },
  26963. peg$c85 = ">",
  26964. peg$c86 = { type: "literal", value: ">", description: "\">\"" },
  26965. peg$c87 = function(message) {return message;},
  26966. peg$c88 = ":=",
  26967. peg$c89 = { type: "literal", value: ":=", description: "\":=\"" },
  26968. peg$c90 = function(variable, expression) {
  26969. return $globals.AssignmentNode._new()
  26970. ._location_(location())
  26971. ._source_(text())
  26972. ._left_(variable)
  26973. ._right_(expression);
  26974. },
  26975. peg$c91 = "^",
  26976. peg$c92 = { type: "literal", value: "^", description: "\"^\"" },
  26977. peg$c93 = function(expression) {
  26978. return $globals.ReturnNode._new()
  26979. ._location_(location())
  26980. ._source_(text())
  26981. ._dagChildren_([expression]);
  26982. },
  26983. peg$c94 = "|",
  26984. peg$c95 = { type: "literal", value: "|", description: "\"|\"" },
  26985. peg$c96 = function(variable) {return variable;},
  26986. peg$c97 = function(vars) {
  26987. return vars;
  26988. },
  26989. peg$c98 = function(param) {return param;},
  26990. peg$c99 = function(params) {
  26991. return params;
  26992. },
  26993. peg$c100 = function(ret) {return [ret];},
  26994. peg$c101 = function(exps, ret) {
  26995. var expressions = exps;
  26996. expressions.push(ret);
  26997. return expressions;
  26998. },
  26999. peg$c102 = function(expressions) {return expressions || [];},
  27000. peg$c103 = function(aPragmas, temps, zPragmas, statements) {
  27001. return $globals.SequenceNode._new()
  27002. ._location_(location())
  27003. ._source_(text())
  27004. ._temps_(temps || [])
  27005. ._pragmas_((aPragmas || []).concat(zPragmas || []))
  27006. ._dagChildren_(statements || []);
  27007. },
  27008. peg$c104 = "[",
  27009. peg$c105 = { type: "literal", value: "[", description: "\"[\"" },
  27010. peg$c106 = "]",
  27011. peg$c107 = { type: "literal", value: "]", description: "\"]\"" },
  27012. peg$c108 = function(params, sequence) {
  27013. return $globals.BlockNode._new()
  27014. ._location_(location())
  27015. ._source_(text())
  27016. ._parameters_(params || [])
  27017. ._dagChildren_([sequence._asBlockSequenceNode()]);
  27018. },
  27019. peg$c109 = function(selector) {
  27020. return $globals.SendNode._new()
  27021. ._location_(location())
  27022. ._source_(text())
  27023. ._selector_(selector);
  27024. },
  27025. peg$c110 = function(receiver, tail) {
  27026. return receiver._withTail_(tail);
  27027. },
  27028. peg$c111 = function(selector, arg) {
  27029. return $globals.SendNode._new()
  27030. ._location_(location())
  27031. ._source_(text())
  27032. ._selector_(selector)
  27033. ._arguments_([arg]);
  27034. },
  27035. peg$c112 = function(unarys, binarys) { return unarys.concat(binarys); },
  27036. peg$c113 = function(pairs) {
  27037. var selector = '';
  27038. var args = [];
  27039. for(var i = 0; i < pairs.length; i++) {
  27040. selector += pairs[i].key;
  27041. args.push(pairs[i].arg);
  27042. }
  27043. return $globals.SendNode._new()
  27044. ._location_(location())
  27045. ._source_(text())
  27046. ._selector_(selector)
  27047. ._arguments_(args);
  27048. },
  27049. peg$c114 = function(binarys, final) {
  27050. if (final) binarys.push(final);
  27051. return binarys;
  27052. },
  27053. peg$c115 = function(receiver, tail) {return tail.length > 0;},
  27054. peg$c116 = ";",
  27055. peg$c117 = { type: "literal", value: ";", description: "\";\"" },
  27056. peg$c118 = function(receiver, tail, mess) {return mess;},
  27057. peg$c119 = function(receiver, tail, messages) {
  27058. messages.unshift(receiver._withTail_(tail));
  27059. return $globals.CascadeNode._new()
  27060. ._location_(location())
  27061. ._source_(text())
  27062. ._dagChildren_(messages);
  27063. },
  27064. peg$c120 = function(pattern, sequence) {
  27065. return $globals.MethodNode._new()
  27066. ._location_(location())
  27067. ._source_(text())
  27068. ._selector_(pattern[0])
  27069. ._arguments_(pattern[1])
  27070. ._dagChildren_([sequence]);
  27071. },
  27072. peg$c121 = function(receiver, tail) { return tail.length > 0 && tail[tail.length-1]._selector() === '->' },
  27073. peg$c122 = function(receiver, tail) {
  27074. var last = tail.pop();
  27075. return [receiver._withTail_(tail), last._arguments()[0]];
  27076. },
  27077. peg$c123 = function(first, others) {
  27078. return first.concat.apply(first, others);
  27079. },
  27080. peg$currPos = 0,
  27081. peg$savedPos = 0,
  27082. peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }],
  27083. peg$maxFailPos = 0,
  27084. peg$maxFailExpected = [],
  27085. peg$silentFails = 0,
  27086. peg$resultsCache = {},
  27087. peg$result;
  27088. if ("startRule" in options) {
  27089. if (!(options.startRule in peg$startRuleFunctions)) {
  27090. throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
  27091. }
  27092. peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
  27093. }
  27094. function text() {
  27095. return input.substring(peg$savedPos, peg$currPos);
  27096. }
  27097. function location() {
  27098. return peg$computeLocation(peg$savedPos, peg$currPos);
  27099. }
  27100. function expected(description) {
  27101. throw peg$buildException(
  27102. null,
  27103. [{ type: "other", description: description }],
  27104. input.substring(peg$savedPos, peg$currPos),
  27105. peg$computeLocation(peg$savedPos, peg$currPos)
  27106. );
  27107. }
  27108. function error(message) {
  27109. throw peg$buildException(
  27110. message,
  27111. null,
  27112. input.substring(peg$savedPos, peg$currPos),
  27113. peg$computeLocation(peg$savedPos, peg$currPos)
  27114. );
  27115. }
  27116. function peg$computePosDetails(pos) {
  27117. var details = peg$posDetailsCache[pos],
  27118. p, ch;
  27119. if (details) {
  27120. return details;
  27121. } else {
  27122. p = pos - 1;
  27123. while (!peg$posDetailsCache[p]) {
  27124. p--;
  27125. }
  27126. details = peg$posDetailsCache[p];
  27127. details = {
  27128. line: details.line,
  27129. column: details.column,
  27130. seenCR: details.seenCR
  27131. };
  27132. while (p < pos) {
  27133. ch = input.charAt(p);
  27134. if (ch === "\n") {
  27135. if (!details.seenCR) { details.line++; }
  27136. details.column = 1;
  27137. details.seenCR = false;
  27138. } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
  27139. details.line++;
  27140. details.column = 1;
  27141. details.seenCR = true;
  27142. } else {
  27143. details.column++;
  27144. details.seenCR = false;
  27145. }
  27146. p++;
  27147. }
  27148. peg$posDetailsCache[pos] = details;
  27149. return details;
  27150. }
  27151. }
  27152. function peg$computeLocation(startPos, endPos) {
  27153. var startPosDetails = peg$computePosDetails(startPos),
  27154. endPosDetails = peg$computePosDetails(endPos);
  27155. return {
  27156. start: {
  27157. offset: startPos,
  27158. line: startPosDetails.line,
  27159. column: startPosDetails.column
  27160. },
  27161. end: {
  27162. offset: endPos,
  27163. line: endPosDetails.line,
  27164. column: endPosDetails.column
  27165. }
  27166. };
  27167. }
  27168. function peg$fail(expected) {
  27169. if (peg$currPos < peg$maxFailPos) { return; }
  27170. if (peg$currPos > peg$maxFailPos) {
  27171. peg$maxFailPos = peg$currPos;
  27172. peg$maxFailExpected = [];
  27173. }
  27174. peg$maxFailExpected.push(expected);
  27175. }
  27176. function peg$buildException(message, expected, found, location) {
  27177. function cleanupExpected(expected) {
  27178. var i = 1;
  27179. expected.sort(function(a, b) {
  27180. if (a.description < b.description) {
  27181. return -1;
  27182. } else if (a.description > b.description) {
  27183. return 1;
  27184. } else {
  27185. return 0;
  27186. }
  27187. });
  27188. while (i < expected.length) {
  27189. if (expected[i - 1] === expected[i]) {
  27190. expected.splice(i, 1);
  27191. } else {
  27192. i++;
  27193. }
  27194. }
  27195. }
  27196. function buildMessage(expected, found) {
  27197. function stringEscape(s) {
  27198. function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
  27199. return s
  27200. .replace(/\\/g, '\\\\')
  27201. .replace(/"/g, '\\"')
  27202. .replace(/\x08/g, '\\b')
  27203. .replace(/\t/g, '\\t')
  27204. .replace(/\n/g, '\\n')
  27205. .replace(/\f/g, '\\f')
  27206. .replace(/\r/g, '\\r')
  27207. .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
  27208. .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
  27209. .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
  27210. .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
  27211. }
  27212. var expectedDescs = new Array(expected.length),
  27213. expectedDesc, foundDesc, i;
  27214. for (i = 0; i < expected.length; i++) {
  27215. expectedDescs[i] = expected[i].description;
  27216. }
  27217. expectedDesc = expected.length > 1
  27218. ? expectedDescs.slice(0, -1).join(", ")
  27219. + " or "
  27220. + expectedDescs[expected.length - 1]
  27221. : expectedDescs[0];
  27222. foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
  27223. return "Expected " + expectedDesc + " but " + foundDesc + " found.";
  27224. }
  27225. if (expected !== null) {
  27226. cleanupExpected(expected);
  27227. }
  27228. return new peg$SyntaxError(
  27229. message !== null ? message : buildMessage(expected, found),
  27230. expected,
  27231. found,
  27232. location
  27233. );
  27234. }
  27235. function peg$parsestart() {
  27236. var s0;
  27237. var key = peg$currPos * 66 + 0,
  27238. cached = peg$resultsCache[key];
  27239. if (cached) {
  27240. peg$currPos = cached.nextPos;
  27241. return cached.result;
  27242. }
  27243. s0 = peg$parsemethod();
  27244. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27245. return s0;
  27246. }
  27247. function peg$parseseparator() {
  27248. var s0, s1;
  27249. var key = peg$currPos * 66 + 1,
  27250. cached = peg$resultsCache[key];
  27251. if (cached) {
  27252. peg$currPos = cached.nextPos;
  27253. return cached.result;
  27254. }
  27255. s0 = [];
  27256. if (peg$c0.test(input.charAt(peg$currPos))) {
  27257. s1 = input.charAt(peg$currPos);
  27258. peg$currPos++;
  27259. } else {
  27260. s1 = peg$FAILED;
  27261. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27262. }
  27263. if (s1 !== peg$FAILED) {
  27264. while (s1 !== peg$FAILED) {
  27265. s0.push(s1);
  27266. if (peg$c0.test(input.charAt(peg$currPos))) {
  27267. s1 = input.charAt(peg$currPos);
  27268. peg$currPos++;
  27269. } else {
  27270. s1 = peg$FAILED;
  27271. if (peg$silentFails === 0) { peg$fail(peg$c1); }
  27272. }
  27273. }
  27274. } else {
  27275. s0 = peg$FAILED;
  27276. }
  27277. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27278. return s0;
  27279. }
  27280. function peg$parsecomments() {
  27281. var s0, s1, s2, s3, s4;
  27282. var key = peg$currPos * 66 + 2,
  27283. cached = peg$resultsCache[key];
  27284. if (cached) {
  27285. peg$currPos = cached.nextPos;
  27286. return cached.result;
  27287. }
  27288. s0 = [];
  27289. s1 = peg$currPos;
  27290. if (input.charCodeAt(peg$currPos) === 34) {
  27291. s2 = peg$c2;
  27292. peg$currPos++;
  27293. } else {
  27294. s2 = peg$FAILED;
  27295. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27296. }
  27297. if (s2 !== peg$FAILED) {
  27298. s3 = [];
  27299. if (peg$c4.test(input.charAt(peg$currPos))) {
  27300. s4 = input.charAt(peg$currPos);
  27301. peg$currPos++;
  27302. } else {
  27303. s4 = peg$FAILED;
  27304. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27305. }
  27306. while (s4 !== peg$FAILED) {
  27307. s3.push(s4);
  27308. if (peg$c4.test(input.charAt(peg$currPos))) {
  27309. s4 = input.charAt(peg$currPos);
  27310. peg$currPos++;
  27311. } else {
  27312. s4 = peg$FAILED;
  27313. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27314. }
  27315. }
  27316. if (s3 !== peg$FAILED) {
  27317. if (input.charCodeAt(peg$currPos) === 34) {
  27318. s4 = peg$c2;
  27319. peg$currPos++;
  27320. } else {
  27321. s4 = peg$FAILED;
  27322. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27323. }
  27324. if (s4 !== peg$FAILED) {
  27325. s2 = [s2, s3, s4];
  27326. s1 = s2;
  27327. } else {
  27328. peg$currPos = s1;
  27329. s1 = peg$FAILED;
  27330. }
  27331. } else {
  27332. peg$currPos = s1;
  27333. s1 = peg$FAILED;
  27334. }
  27335. } else {
  27336. peg$currPos = s1;
  27337. s1 = peg$FAILED;
  27338. }
  27339. if (s1 !== peg$FAILED) {
  27340. while (s1 !== peg$FAILED) {
  27341. s0.push(s1);
  27342. s1 = peg$currPos;
  27343. if (input.charCodeAt(peg$currPos) === 34) {
  27344. s2 = peg$c2;
  27345. peg$currPos++;
  27346. } else {
  27347. s2 = peg$FAILED;
  27348. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27349. }
  27350. if (s2 !== peg$FAILED) {
  27351. s3 = [];
  27352. if (peg$c4.test(input.charAt(peg$currPos))) {
  27353. s4 = input.charAt(peg$currPos);
  27354. peg$currPos++;
  27355. } else {
  27356. s4 = peg$FAILED;
  27357. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27358. }
  27359. while (s4 !== peg$FAILED) {
  27360. s3.push(s4);
  27361. if (peg$c4.test(input.charAt(peg$currPos))) {
  27362. s4 = input.charAt(peg$currPos);
  27363. peg$currPos++;
  27364. } else {
  27365. s4 = peg$FAILED;
  27366. if (peg$silentFails === 0) { peg$fail(peg$c5); }
  27367. }
  27368. }
  27369. if (s3 !== peg$FAILED) {
  27370. if (input.charCodeAt(peg$currPos) === 34) {
  27371. s4 = peg$c2;
  27372. peg$currPos++;
  27373. } else {
  27374. s4 = peg$FAILED;
  27375. if (peg$silentFails === 0) { peg$fail(peg$c3); }
  27376. }
  27377. if (s4 !== peg$FAILED) {
  27378. s2 = [s2, s3, s4];
  27379. s1 = s2;
  27380. } else {
  27381. peg$currPos = s1;
  27382. s1 = peg$FAILED;
  27383. }
  27384. } else {
  27385. peg$currPos = s1;
  27386. s1 = peg$FAILED;
  27387. }
  27388. } else {
  27389. peg$currPos = s1;
  27390. s1 = peg$FAILED;
  27391. }
  27392. }
  27393. } else {
  27394. s0 = peg$FAILED;
  27395. }
  27396. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27397. return s0;
  27398. }
  27399. function peg$parsews() {
  27400. var s0, s1;
  27401. var key = peg$currPos * 66 + 3,
  27402. cached = peg$resultsCache[key];
  27403. if (cached) {
  27404. peg$currPos = cached.nextPos;
  27405. return cached.result;
  27406. }
  27407. s0 = [];
  27408. s1 = peg$parseseparator();
  27409. if (s1 === peg$FAILED) {
  27410. s1 = peg$parsecomments();
  27411. }
  27412. while (s1 !== peg$FAILED) {
  27413. s0.push(s1);
  27414. s1 = peg$parseseparator();
  27415. if (s1 === peg$FAILED) {
  27416. s1 = peg$parsecomments();
  27417. }
  27418. }
  27419. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27420. return s0;
  27421. }
  27422. function peg$parsemaybeDotsWs() {
  27423. var s0, s1;
  27424. var key = peg$currPos * 66 + 4,
  27425. cached = peg$resultsCache[key];
  27426. if (cached) {
  27427. peg$currPos = cached.nextPos;
  27428. return cached.result;
  27429. }
  27430. s0 = [];
  27431. if (input.charCodeAt(peg$currPos) === 46) {
  27432. s1 = peg$c6;
  27433. peg$currPos++;
  27434. } else {
  27435. s1 = peg$FAILED;
  27436. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27437. }
  27438. if (s1 === peg$FAILED) {
  27439. s1 = peg$parseseparator();
  27440. if (s1 === peg$FAILED) {
  27441. s1 = peg$parsecomments();
  27442. }
  27443. }
  27444. while (s1 !== peg$FAILED) {
  27445. s0.push(s1);
  27446. if (input.charCodeAt(peg$currPos) === 46) {
  27447. s1 = peg$c6;
  27448. peg$currPos++;
  27449. } else {
  27450. s1 = peg$FAILED;
  27451. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27452. }
  27453. if (s1 === peg$FAILED) {
  27454. s1 = peg$parseseparator();
  27455. if (s1 === peg$FAILED) {
  27456. s1 = peg$parsecomments();
  27457. }
  27458. }
  27459. }
  27460. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27461. return s0;
  27462. }
  27463. function peg$parsesomeDotsWs() {
  27464. var s0, s1, s2, s3;
  27465. var key = peg$currPos * 66 + 5,
  27466. cached = peg$resultsCache[key];
  27467. if (cached) {
  27468. peg$currPos = cached.nextPos;
  27469. return cached.result;
  27470. }
  27471. s0 = peg$currPos;
  27472. s1 = peg$parsews();
  27473. if (s1 !== peg$FAILED) {
  27474. if (input.charCodeAt(peg$currPos) === 46) {
  27475. s2 = peg$c6;
  27476. peg$currPos++;
  27477. } else {
  27478. s2 = peg$FAILED;
  27479. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  27480. }
  27481. if (s2 !== peg$FAILED) {
  27482. s3 = peg$parsemaybeDotsWs();
  27483. if (s3 !== peg$FAILED) {
  27484. s1 = [s1, s2, s3];
  27485. s0 = s1;
  27486. } else {
  27487. peg$currPos = s0;
  27488. s0 = peg$FAILED;
  27489. }
  27490. } else {
  27491. peg$currPos = s0;
  27492. s0 = peg$FAILED;
  27493. }
  27494. } else {
  27495. peg$currPos = s0;
  27496. s0 = peg$FAILED;
  27497. }
  27498. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27499. return s0;
  27500. }
  27501. function peg$parseidentifier() {
  27502. var s0, s1, s2, s3, s4;
  27503. var key = peg$currPos * 66 + 6,
  27504. cached = peg$resultsCache[key];
  27505. if (cached) {
  27506. peg$currPos = cached.nextPos;
  27507. return cached.result;
  27508. }
  27509. s0 = peg$currPos;
  27510. s1 = peg$currPos;
  27511. if (peg$c8.test(input.charAt(peg$currPos))) {
  27512. s2 = input.charAt(peg$currPos);
  27513. peg$currPos++;
  27514. } else {
  27515. s2 = peg$FAILED;
  27516. if (peg$silentFails === 0) { peg$fail(peg$c9); }
  27517. }
  27518. if (s2 !== peg$FAILED) {
  27519. s3 = [];
  27520. if (peg$c10.test(input.charAt(peg$currPos))) {
  27521. s4 = input.charAt(peg$currPos);
  27522. peg$currPos++;
  27523. } else {
  27524. s4 = peg$FAILED;
  27525. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27526. }
  27527. while (s4 !== peg$FAILED) {
  27528. s3.push(s4);
  27529. if (peg$c10.test(input.charAt(peg$currPos))) {
  27530. s4 = input.charAt(peg$currPos);
  27531. peg$currPos++;
  27532. } else {
  27533. s4 = peg$FAILED;
  27534. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27535. }
  27536. }
  27537. if (s3 !== peg$FAILED) {
  27538. s2 = [s2, s3];
  27539. s1 = s2;
  27540. } else {
  27541. peg$currPos = s1;
  27542. s1 = peg$FAILED;
  27543. }
  27544. } else {
  27545. peg$currPos = s1;
  27546. s1 = peg$FAILED;
  27547. }
  27548. if (s1 !== peg$FAILED) {
  27549. s0 = input.substring(s0, peg$currPos);
  27550. } else {
  27551. s0 = s1;
  27552. }
  27553. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27554. return s0;
  27555. }
  27556. function peg$parsekeyword() {
  27557. var s0, s1, s2, s3;
  27558. var key = peg$currPos * 66 + 7,
  27559. cached = peg$resultsCache[key];
  27560. if (cached) {
  27561. peg$currPos = cached.nextPos;
  27562. return cached.result;
  27563. }
  27564. s0 = peg$currPos;
  27565. s1 = peg$currPos;
  27566. s2 = peg$parseidentifier();
  27567. if (s2 !== peg$FAILED) {
  27568. if (input.charCodeAt(peg$currPos) === 58) {
  27569. s3 = peg$c12;
  27570. peg$currPos++;
  27571. } else {
  27572. s3 = peg$FAILED;
  27573. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  27574. }
  27575. if (s3 !== peg$FAILED) {
  27576. s2 = [s2, s3];
  27577. s1 = s2;
  27578. } else {
  27579. peg$currPos = s1;
  27580. s1 = peg$FAILED;
  27581. }
  27582. } else {
  27583. peg$currPos = s1;
  27584. s1 = peg$FAILED;
  27585. }
  27586. if (s1 !== peg$FAILED) {
  27587. s0 = input.substring(s0, peg$currPos);
  27588. } else {
  27589. s0 = s1;
  27590. }
  27591. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27592. return s0;
  27593. }
  27594. function peg$parseclassName() {
  27595. var s0, s1, s2, s3, s4;
  27596. var key = peg$currPos * 66 + 8,
  27597. cached = peg$resultsCache[key];
  27598. if (cached) {
  27599. peg$currPos = cached.nextPos;
  27600. return cached.result;
  27601. }
  27602. s0 = peg$currPos;
  27603. s1 = peg$currPos;
  27604. if (peg$c14.test(input.charAt(peg$currPos))) {
  27605. s2 = input.charAt(peg$currPos);
  27606. peg$currPos++;
  27607. } else {
  27608. s2 = peg$FAILED;
  27609. if (peg$silentFails === 0) { peg$fail(peg$c15); }
  27610. }
  27611. if (s2 !== peg$FAILED) {
  27612. s3 = [];
  27613. if (peg$c10.test(input.charAt(peg$currPos))) {
  27614. s4 = input.charAt(peg$currPos);
  27615. peg$currPos++;
  27616. } else {
  27617. s4 = peg$FAILED;
  27618. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27619. }
  27620. while (s4 !== peg$FAILED) {
  27621. s3.push(s4);
  27622. if (peg$c10.test(input.charAt(peg$currPos))) {
  27623. s4 = input.charAt(peg$currPos);
  27624. peg$currPos++;
  27625. } else {
  27626. s4 = peg$FAILED;
  27627. if (peg$silentFails === 0) { peg$fail(peg$c11); }
  27628. }
  27629. }
  27630. if (s3 !== peg$FAILED) {
  27631. s2 = [s2, s3];
  27632. s1 = s2;
  27633. } else {
  27634. peg$currPos = s1;
  27635. s1 = peg$FAILED;
  27636. }
  27637. } else {
  27638. peg$currPos = s1;
  27639. s1 = peg$FAILED;
  27640. }
  27641. if (s1 !== peg$FAILED) {
  27642. s0 = input.substring(s0, peg$currPos);
  27643. } else {
  27644. s0 = s1;
  27645. }
  27646. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27647. return s0;
  27648. }
  27649. function peg$parsestring() {
  27650. var s0, s1;
  27651. var key = peg$currPos * 66 + 9,
  27652. cached = peg$resultsCache[key];
  27653. if (cached) {
  27654. peg$currPos = cached.nextPos;
  27655. return cached.result;
  27656. }
  27657. s0 = peg$currPos;
  27658. s1 = peg$parserawString();
  27659. if (s1 !== peg$FAILED) {
  27660. peg$savedPos = s0;
  27661. s1 = peg$c16(s1);
  27662. }
  27663. s0 = s1;
  27664. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27665. return s0;
  27666. }
  27667. function peg$parserawString() {
  27668. var s0, s1, s2, s3, s4;
  27669. var key = peg$currPos * 66 + 10,
  27670. cached = peg$resultsCache[key];
  27671. if (cached) {
  27672. peg$currPos = cached.nextPos;
  27673. return cached.result;
  27674. }
  27675. s0 = peg$currPos;
  27676. if (input.charCodeAt(peg$currPos) === 39) {
  27677. s1 = peg$c17;
  27678. peg$currPos++;
  27679. } else {
  27680. s1 = peg$FAILED;
  27681. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27682. }
  27683. if (s1 !== peg$FAILED) {
  27684. s2 = [];
  27685. s3 = peg$currPos;
  27686. if (input.substr(peg$currPos, 2) === peg$c19) {
  27687. s4 = peg$c19;
  27688. peg$currPos += 2;
  27689. } else {
  27690. s4 = peg$FAILED;
  27691. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27692. }
  27693. if (s4 !== peg$FAILED) {
  27694. peg$savedPos = s3;
  27695. s4 = peg$c21();
  27696. }
  27697. s3 = s4;
  27698. if (s3 === peg$FAILED) {
  27699. if (peg$c22.test(input.charAt(peg$currPos))) {
  27700. s3 = input.charAt(peg$currPos);
  27701. peg$currPos++;
  27702. } else {
  27703. s3 = peg$FAILED;
  27704. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27705. }
  27706. }
  27707. while (s3 !== peg$FAILED) {
  27708. s2.push(s3);
  27709. s3 = peg$currPos;
  27710. if (input.substr(peg$currPos, 2) === peg$c19) {
  27711. s4 = peg$c19;
  27712. peg$currPos += 2;
  27713. } else {
  27714. s4 = peg$FAILED;
  27715. if (peg$silentFails === 0) { peg$fail(peg$c20); }
  27716. }
  27717. if (s4 !== peg$FAILED) {
  27718. peg$savedPos = s3;
  27719. s4 = peg$c21();
  27720. }
  27721. s3 = s4;
  27722. if (s3 === peg$FAILED) {
  27723. if (peg$c22.test(input.charAt(peg$currPos))) {
  27724. s3 = input.charAt(peg$currPos);
  27725. peg$currPos++;
  27726. } else {
  27727. s3 = peg$FAILED;
  27728. if (peg$silentFails === 0) { peg$fail(peg$c23); }
  27729. }
  27730. }
  27731. }
  27732. if (s2 !== peg$FAILED) {
  27733. if (input.charCodeAt(peg$currPos) === 39) {
  27734. s3 = peg$c17;
  27735. peg$currPos++;
  27736. } else {
  27737. s3 = peg$FAILED;
  27738. if (peg$silentFails === 0) { peg$fail(peg$c18); }
  27739. }
  27740. if (s3 !== peg$FAILED) {
  27741. peg$savedPos = s0;
  27742. s1 = peg$c24(s2);
  27743. s0 = s1;
  27744. } else {
  27745. peg$currPos = s0;
  27746. s0 = peg$FAILED;
  27747. }
  27748. } else {
  27749. peg$currPos = s0;
  27750. s0 = peg$FAILED;
  27751. }
  27752. } else {
  27753. peg$currPos = s0;
  27754. s0 = peg$FAILED;
  27755. }
  27756. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27757. return s0;
  27758. }
  27759. function peg$parsecharacter() {
  27760. var s0, s1, s2;
  27761. var key = peg$currPos * 66 + 11,
  27762. cached = peg$resultsCache[key];
  27763. if (cached) {
  27764. peg$currPos = cached.nextPos;
  27765. return cached.result;
  27766. }
  27767. s0 = peg$currPos;
  27768. if (input.charCodeAt(peg$currPos) === 36) {
  27769. s1 = peg$c25;
  27770. peg$currPos++;
  27771. } else {
  27772. s1 = peg$FAILED;
  27773. if (peg$silentFails === 0) { peg$fail(peg$c26); }
  27774. }
  27775. if (s1 !== peg$FAILED) {
  27776. if (input.length > peg$currPos) {
  27777. s2 = input.charAt(peg$currPos);
  27778. peg$currPos++;
  27779. } else {
  27780. s2 = peg$FAILED;
  27781. if (peg$silentFails === 0) { peg$fail(peg$c27); }
  27782. }
  27783. if (s2 !== peg$FAILED) {
  27784. peg$savedPos = s0;
  27785. s1 = peg$c28(s2);
  27786. s0 = s1;
  27787. } else {
  27788. peg$currPos = s0;
  27789. s0 = peg$FAILED;
  27790. }
  27791. } else {
  27792. peg$currPos = s0;
  27793. s0 = peg$FAILED;
  27794. }
  27795. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27796. return s0;
  27797. }
  27798. function peg$parsesymbol() {
  27799. var s0, s1, s2;
  27800. var key = peg$currPos * 66 + 12,
  27801. cached = peg$resultsCache[key];
  27802. if (cached) {
  27803. peg$currPos = cached.nextPos;
  27804. return cached.result;
  27805. }
  27806. s0 = peg$currPos;
  27807. if (input.charCodeAt(peg$currPos) === 35) {
  27808. s1 = peg$c29;
  27809. peg$currPos++;
  27810. } else {
  27811. s1 = peg$FAILED;
  27812. if (peg$silentFails === 0) { peg$fail(peg$c30); }
  27813. }
  27814. if (s1 !== peg$FAILED) {
  27815. s2 = peg$parsebareSymbol();
  27816. if (s2 !== peg$FAILED) {
  27817. peg$savedPos = s0;
  27818. s1 = peg$c31(s2);
  27819. s0 = s1;
  27820. } else {
  27821. peg$currPos = s0;
  27822. s0 = peg$FAILED;
  27823. }
  27824. } else {
  27825. peg$currPos = s0;
  27826. s0 = peg$FAILED;
  27827. }
  27828. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27829. return s0;
  27830. }
  27831. function peg$parsebareSymbol() {
  27832. var s0, s1, s2, s3;
  27833. var key = peg$currPos * 66 + 13,
  27834. cached = peg$resultsCache[key];
  27835. if (cached) {
  27836. peg$currPos = cached.nextPos;
  27837. return cached.result;
  27838. }
  27839. s0 = peg$currPos;
  27840. s1 = peg$currPos;
  27841. s2 = [];
  27842. s3 = peg$parsekeyword();
  27843. if (s3 !== peg$FAILED) {
  27844. while (s3 !== peg$FAILED) {
  27845. s2.push(s3);
  27846. s3 = peg$parsekeyword();
  27847. }
  27848. } else {
  27849. s2 = peg$FAILED;
  27850. }
  27851. if (s2 !== peg$FAILED) {
  27852. s1 = input.substring(s1, peg$currPos);
  27853. } else {
  27854. s1 = s2;
  27855. }
  27856. if (s1 === peg$FAILED) {
  27857. s1 = peg$parsebinarySelector();
  27858. if (s1 === peg$FAILED) {
  27859. s1 = peg$parseidentifier();
  27860. if (s1 === peg$FAILED) {
  27861. s1 = peg$parserawString();
  27862. }
  27863. }
  27864. }
  27865. if (s1 !== peg$FAILED) {
  27866. peg$savedPos = s0;
  27867. s1 = peg$c16(s1);
  27868. }
  27869. s0 = s1;
  27870. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27871. return s0;
  27872. }
  27873. function peg$parsenumber() {
  27874. var s0, s1;
  27875. var key = peg$currPos * 66 + 14,
  27876. cached = peg$resultsCache[key];
  27877. if (cached) {
  27878. peg$currPos = cached.nextPos;
  27879. return cached.result;
  27880. }
  27881. s0 = peg$currPos;
  27882. s1 = peg$parserawNumber();
  27883. if (s1 !== peg$FAILED) {
  27884. peg$savedPos = s0;
  27885. s1 = peg$c16(s1);
  27886. }
  27887. s0 = s1;
  27888. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27889. return s0;
  27890. }
  27891. function peg$parserawNumber() {
  27892. var s0;
  27893. var key = peg$currPos * 66 + 15,
  27894. cached = peg$resultsCache[key];
  27895. if (cached) {
  27896. peg$currPos = cached.nextPos;
  27897. return cached.result;
  27898. }
  27899. s0 = peg$parsenumberExp();
  27900. if (s0 === peg$FAILED) {
  27901. s0 = peg$parsehex();
  27902. if (s0 === peg$FAILED) {
  27903. s0 = peg$parsefloat();
  27904. if (s0 === peg$FAILED) {
  27905. s0 = peg$parseinteger();
  27906. }
  27907. }
  27908. }
  27909. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27910. return s0;
  27911. }
  27912. function peg$parsenumberExp() {
  27913. var s0, s1, s2, s3, s4, s5;
  27914. var key = peg$currPos * 66 + 16,
  27915. cached = peg$resultsCache[key];
  27916. if (cached) {
  27917. peg$currPos = cached.nextPos;
  27918. return cached.result;
  27919. }
  27920. s0 = peg$currPos;
  27921. s1 = peg$currPos;
  27922. s2 = peg$currPos;
  27923. s3 = peg$parsefloat();
  27924. if (s3 === peg$FAILED) {
  27925. s3 = peg$parseinteger();
  27926. }
  27927. if (s3 !== peg$FAILED) {
  27928. if (input.charCodeAt(peg$currPos) === 101) {
  27929. s4 = peg$c32;
  27930. peg$currPos++;
  27931. } else {
  27932. s4 = peg$FAILED;
  27933. if (peg$silentFails === 0) { peg$fail(peg$c33); }
  27934. }
  27935. if (s4 !== peg$FAILED) {
  27936. s5 = peg$parseinteger();
  27937. if (s5 !== peg$FAILED) {
  27938. s3 = [s3, s4, s5];
  27939. s2 = s3;
  27940. } else {
  27941. peg$currPos = s2;
  27942. s2 = peg$FAILED;
  27943. }
  27944. } else {
  27945. peg$currPos = s2;
  27946. s2 = peg$FAILED;
  27947. }
  27948. } else {
  27949. peg$currPos = s2;
  27950. s2 = peg$FAILED;
  27951. }
  27952. if (s2 !== peg$FAILED) {
  27953. s1 = input.substring(s1, peg$currPos);
  27954. } else {
  27955. s1 = s2;
  27956. }
  27957. if (s1 !== peg$FAILED) {
  27958. peg$savedPos = s0;
  27959. s1 = peg$c34(s1);
  27960. }
  27961. s0 = s1;
  27962. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  27963. return s0;
  27964. }
  27965. function peg$parsehex() {
  27966. var s0, s1, s2, s3, s4, s5;
  27967. var key = peg$currPos * 66 + 17,
  27968. cached = peg$resultsCache[key];
  27969. if (cached) {
  27970. peg$currPos = cached.nextPos;
  27971. return cached.result;
  27972. }
  27973. s0 = peg$currPos;
  27974. if (input.charCodeAt(peg$currPos) === 45) {
  27975. s1 = peg$c35;
  27976. peg$currPos++;
  27977. } else {
  27978. s1 = peg$FAILED;
  27979. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  27980. }
  27981. if (s1 === peg$FAILED) {
  27982. s1 = null;
  27983. }
  27984. if (s1 !== peg$FAILED) {
  27985. if (input.substr(peg$currPos, 3) === peg$c37) {
  27986. s2 = peg$c37;
  27987. peg$currPos += 3;
  27988. } else {
  27989. s2 = peg$FAILED;
  27990. if (peg$silentFails === 0) { peg$fail(peg$c38); }
  27991. }
  27992. if (s2 !== peg$FAILED) {
  27993. s3 = peg$currPos;
  27994. s4 = [];
  27995. if (peg$c39.test(input.charAt(peg$currPos))) {
  27996. s5 = input.charAt(peg$currPos);
  27997. peg$currPos++;
  27998. } else {
  27999. s5 = peg$FAILED;
  28000. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  28001. }
  28002. if (s5 !== peg$FAILED) {
  28003. while (s5 !== peg$FAILED) {
  28004. s4.push(s5);
  28005. if (peg$c39.test(input.charAt(peg$currPos))) {
  28006. s5 = input.charAt(peg$currPos);
  28007. peg$currPos++;
  28008. } else {
  28009. s5 = peg$FAILED;
  28010. if (peg$silentFails === 0) { peg$fail(peg$c40); }
  28011. }
  28012. }
  28013. } else {
  28014. s4 = peg$FAILED;
  28015. }
  28016. if (s4 !== peg$FAILED) {
  28017. s3 = input.substring(s3, peg$currPos);
  28018. } else {
  28019. s3 = s4;
  28020. }
  28021. if (s3 !== peg$FAILED) {
  28022. peg$savedPos = s0;
  28023. s1 = peg$c41(s1, s3);
  28024. s0 = s1;
  28025. } else {
  28026. peg$currPos = s0;
  28027. s0 = peg$FAILED;
  28028. }
  28029. } else {
  28030. peg$currPos = s0;
  28031. s0 = peg$FAILED;
  28032. }
  28033. } else {
  28034. peg$currPos = s0;
  28035. s0 = peg$FAILED;
  28036. }
  28037. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28038. return s0;
  28039. }
  28040. function peg$parsefloat() {
  28041. var s0, s1, s2, s3, s4, s5, s6, s7;
  28042. var key = peg$currPos * 66 + 18,
  28043. cached = peg$resultsCache[key];
  28044. if (cached) {
  28045. peg$currPos = cached.nextPos;
  28046. return cached.result;
  28047. }
  28048. s0 = peg$currPos;
  28049. s1 = peg$currPos;
  28050. s2 = peg$currPos;
  28051. if (input.charCodeAt(peg$currPos) === 45) {
  28052. s3 = peg$c35;
  28053. peg$currPos++;
  28054. } else {
  28055. s3 = peg$FAILED;
  28056. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28057. }
  28058. if (s3 === peg$FAILED) {
  28059. s3 = null;
  28060. }
  28061. if (s3 !== peg$FAILED) {
  28062. s4 = [];
  28063. if (peg$c42.test(input.charAt(peg$currPos))) {
  28064. s5 = input.charAt(peg$currPos);
  28065. peg$currPos++;
  28066. } else {
  28067. s5 = peg$FAILED;
  28068. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28069. }
  28070. if (s5 !== peg$FAILED) {
  28071. while (s5 !== peg$FAILED) {
  28072. s4.push(s5);
  28073. if (peg$c42.test(input.charAt(peg$currPos))) {
  28074. s5 = input.charAt(peg$currPos);
  28075. peg$currPos++;
  28076. } else {
  28077. s5 = peg$FAILED;
  28078. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28079. }
  28080. }
  28081. } else {
  28082. s4 = peg$FAILED;
  28083. }
  28084. if (s4 !== peg$FAILED) {
  28085. if (input.charCodeAt(peg$currPos) === 46) {
  28086. s5 = peg$c6;
  28087. peg$currPos++;
  28088. } else {
  28089. s5 = peg$FAILED;
  28090. if (peg$silentFails === 0) { peg$fail(peg$c7); }
  28091. }
  28092. if (s5 !== peg$FAILED) {
  28093. s6 = [];
  28094. if (peg$c42.test(input.charAt(peg$currPos))) {
  28095. s7 = input.charAt(peg$currPos);
  28096. peg$currPos++;
  28097. } else {
  28098. s7 = peg$FAILED;
  28099. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28100. }
  28101. if (s7 !== peg$FAILED) {
  28102. while (s7 !== peg$FAILED) {
  28103. s6.push(s7);
  28104. if (peg$c42.test(input.charAt(peg$currPos))) {
  28105. s7 = input.charAt(peg$currPos);
  28106. peg$currPos++;
  28107. } else {
  28108. s7 = peg$FAILED;
  28109. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28110. }
  28111. }
  28112. } else {
  28113. s6 = peg$FAILED;
  28114. }
  28115. if (s6 !== peg$FAILED) {
  28116. s3 = [s3, s4, s5, s6];
  28117. s2 = s3;
  28118. } else {
  28119. peg$currPos = s2;
  28120. s2 = peg$FAILED;
  28121. }
  28122. } else {
  28123. peg$currPos = s2;
  28124. s2 = peg$FAILED;
  28125. }
  28126. } else {
  28127. peg$currPos = s2;
  28128. s2 = peg$FAILED;
  28129. }
  28130. } else {
  28131. peg$currPos = s2;
  28132. s2 = peg$FAILED;
  28133. }
  28134. if (s2 !== peg$FAILED) {
  28135. s1 = input.substring(s1, peg$currPos);
  28136. } else {
  28137. s1 = s2;
  28138. }
  28139. if (s1 !== peg$FAILED) {
  28140. peg$savedPos = s0;
  28141. s1 = peg$c44(s1);
  28142. }
  28143. s0 = s1;
  28144. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28145. return s0;
  28146. }
  28147. function peg$parseinteger() {
  28148. var s0, s1, s2, s3, s4, s5;
  28149. var key = peg$currPos * 66 + 19,
  28150. cached = peg$resultsCache[key];
  28151. if (cached) {
  28152. peg$currPos = cached.nextPos;
  28153. return cached.result;
  28154. }
  28155. s0 = peg$currPos;
  28156. s1 = peg$currPos;
  28157. s2 = peg$currPos;
  28158. if (input.charCodeAt(peg$currPos) === 45) {
  28159. s3 = peg$c35;
  28160. peg$currPos++;
  28161. } else {
  28162. s3 = peg$FAILED;
  28163. if (peg$silentFails === 0) { peg$fail(peg$c36); }
  28164. }
  28165. if (s3 === peg$FAILED) {
  28166. s3 = null;
  28167. }
  28168. if (s3 !== peg$FAILED) {
  28169. s4 = [];
  28170. if (peg$c42.test(input.charAt(peg$currPos))) {
  28171. s5 = input.charAt(peg$currPos);
  28172. peg$currPos++;
  28173. } else {
  28174. s5 = peg$FAILED;
  28175. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28176. }
  28177. if (s5 !== peg$FAILED) {
  28178. while (s5 !== peg$FAILED) {
  28179. s4.push(s5);
  28180. if (peg$c42.test(input.charAt(peg$currPos))) {
  28181. s5 = input.charAt(peg$currPos);
  28182. peg$currPos++;
  28183. } else {
  28184. s5 = peg$FAILED;
  28185. if (peg$silentFails === 0) { peg$fail(peg$c43); }
  28186. }
  28187. }
  28188. } else {
  28189. s4 = peg$FAILED;
  28190. }
  28191. if (s4 !== peg$FAILED) {
  28192. s3 = [s3, s4];
  28193. s2 = s3;
  28194. } else {
  28195. peg$currPos = s2;
  28196. s2 = peg$FAILED;
  28197. }
  28198. } else {
  28199. peg$currPos = s2;
  28200. s2 = peg$FAILED;
  28201. }
  28202. if (s2 !== peg$FAILED) {
  28203. s1 = input.substring(s1, peg$currPos);
  28204. } else {
  28205. s1 = s2;
  28206. }
  28207. if (s1 !== peg$FAILED) {
  28208. peg$savedPos = s0;
  28209. s1 = peg$c45(s1);
  28210. }
  28211. s0 = s1;
  28212. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28213. return s0;
  28214. }
  28215. function peg$parseliteralArray() {
  28216. var s0, s1, s2, s3, s4;
  28217. var key = peg$currPos * 66 + 20,
  28218. cached = peg$resultsCache[key];
  28219. if (cached) {
  28220. peg$currPos = cached.nextPos;
  28221. return cached.result;
  28222. }
  28223. s0 = peg$currPos;
  28224. if (input.substr(peg$currPos, 2) === peg$c46) {
  28225. s1 = peg$c46;
  28226. peg$currPos += 2;
  28227. } else {
  28228. s1 = peg$FAILED;
  28229. if (peg$silentFails === 0) { peg$fail(peg$c47); }
  28230. }
  28231. if (s1 !== peg$FAILED) {
  28232. s2 = peg$parsewsLiteralArrayContents();
  28233. if (s2 !== peg$FAILED) {
  28234. s3 = peg$parsews();
  28235. if (s3 !== peg$FAILED) {
  28236. if (input.charCodeAt(peg$currPos) === 41) {
  28237. s4 = peg$c48;
  28238. peg$currPos++;
  28239. } else {
  28240. s4 = peg$FAILED;
  28241. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28242. }
  28243. if (s4 !== peg$FAILED) {
  28244. peg$savedPos = s0;
  28245. s1 = peg$c50(s2);
  28246. s0 = s1;
  28247. } else {
  28248. peg$currPos = s0;
  28249. s0 = peg$FAILED;
  28250. }
  28251. } else {
  28252. peg$currPos = s0;
  28253. s0 = peg$FAILED;
  28254. }
  28255. } else {
  28256. peg$currPos = s0;
  28257. s0 = peg$FAILED;
  28258. }
  28259. } else {
  28260. peg$currPos = s0;
  28261. s0 = peg$FAILED;
  28262. }
  28263. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28264. return s0;
  28265. }
  28266. function peg$parsebareLiteralArray() {
  28267. var s0, s1, s2, s3, s4;
  28268. var key = peg$currPos * 66 + 21,
  28269. cached = peg$resultsCache[key];
  28270. if (cached) {
  28271. peg$currPos = cached.nextPos;
  28272. return cached.result;
  28273. }
  28274. s0 = peg$currPos;
  28275. if (input.charCodeAt(peg$currPos) === 40) {
  28276. s1 = peg$c51;
  28277. peg$currPos++;
  28278. } else {
  28279. s1 = peg$FAILED;
  28280. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  28281. }
  28282. if (s1 !== peg$FAILED) {
  28283. s2 = peg$parsewsLiteralArrayContents();
  28284. if (s2 !== peg$FAILED) {
  28285. s3 = peg$parsews();
  28286. if (s3 !== peg$FAILED) {
  28287. if (input.charCodeAt(peg$currPos) === 41) {
  28288. s4 = peg$c48;
  28289. peg$currPos++;
  28290. } else {
  28291. s4 = peg$FAILED;
  28292. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  28293. }
  28294. if (s4 !== peg$FAILED) {
  28295. peg$savedPos = s0;
  28296. s1 = peg$c50(s2);
  28297. s0 = s1;
  28298. } else {
  28299. peg$currPos = s0;
  28300. s0 = peg$FAILED;
  28301. }
  28302. } else {
  28303. peg$currPos = s0;
  28304. s0 = peg$FAILED;
  28305. }
  28306. } else {
  28307. peg$currPos = s0;
  28308. s0 = peg$FAILED;
  28309. }
  28310. } else {
  28311. peg$currPos = s0;
  28312. s0 = peg$FAILED;
  28313. }
  28314. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28315. return s0;
  28316. }
  28317. function peg$parseliteralArrayElement() {
  28318. var s0;
  28319. var key = peg$currPos * 66 + 22,
  28320. cached = peg$resultsCache[key];
  28321. if (cached) {
  28322. peg$currPos = cached.nextPos;
  28323. return cached.result;
  28324. }
  28325. s0 = peg$parseparseTimeLiteral();
  28326. if (s0 === peg$FAILED) {
  28327. s0 = peg$parsebareLiteralArray();
  28328. if (s0 === peg$FAILED) {
  28329. s0 = peg$parsebareSymbol();
  28330. }
  28331. }
  28332. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28333. return s0;
  28334. }
  28335. function peg$parsewsLiteralArrayContents() {
  28336. var s0, s1, s2, s3, s4;
  28337. var key = peg$currPos * 66 + 23,
  28338. cached = peg$resultsCache[key];
  28339. if (cached) {
  28340. peg$currPos = cached.nextPos;
  28341. return cached.result;
  28342. }
  28343. s0 = peg$currPos;
  28344. s1 = [];
  28345. s2 = peg$currPos;
  28346. s3 = peg$parsews();
  28347. if (s3 !== peg$FAILED) {
  28348. s4 = peg$parseliteralArrayElement();
  28349. if (s4 !== peg$FAILED) {
  28350. peg$savedPos = s2;
  28351. s3 = peg$c53(s4);
  28352. s2 = s3;
  28353. } else {
  28354. peg$currPos = s2;
  28355. s2 = peg$FAILED;
  28356. }
  28357. } else {
  28358. peg$currPos = s2;
  28359. s2 = peg$FAILED;
  28360. }
  28361. while (s2 !== peg$FAILED) {
  28362. s1.push(s2);
  28363. s2 = peg$currPos;
  28364. s3 = peg$parsews();
  28365. if (s3 !== peg$FAILED) {
  28366. s4 = peg$parseliteralArrayElement();
  28367. if (s4 !== peg$FAILED) {
  28368. peg$savedPos = s2;
  28369. s3 = peg$c53(s4);
  28370. s2 = s3;
  28371. } else {
  28372. peg$currPos = s2;
  28373. s2 = peg$FAILED;
  28374. }
  28375. } else {
  28376. peg$currPos = s2;
  28377. s2 = peg$FAILED;
  28378. }
  28379. }
  28380. if (s1 !== peg$FAILED) {
  28381. peg$savedPos = s0;
  28382. s1 = peg$c54(s1);
  28383. }
  28384. s0 = s1;
  28385. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28386. return s0;
  28387. }
  28388. function peg$parsedynamicArray() {
  28389. var s0, s1, s2, s3, s4;
  28390. var key = peg$currPos * 66 + 24,
  28391. cached = peg$resultsCache[key];
  28392. if (cached) {
  28393. peg$currPos = cached.nextPos;
  28394. return cached.result;
  28395. }
  28396. s0 = peg$currPos;
  28397. if (input.charCodeAt(peg$currPos) === 123) {
  28398. s1 = peg$c55;
  28399. peg$currPos++;
  28400. } else {
  28401. s1 = peg$FAILED;
  28402. if (peg$silentFails === 0) { peg$fail(peg$c56); }
  28403. }
  28404. if (s1 !== peg$FAILED) {
  28405. s2 = peg$parsewsExpressions();
  28406. if (s2 === peg$FAILED) {
  28407. s2 = null;
  28408. }
  28409. if (s2 !== peg$FAILED) {
  28410. s3 = peg$parsemaybeDotsWs();
  28411. if (s3 !== peg$FAILED) {
  28412. if (input.charCodeAt(peg$currPos) === 125) {
  28413. s4 = peg$c57;
  28414. peg$currPos++;
  28415. } else {
  28416. s4 = peg$FAILED;
  28417. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28418. }
  28419. if (s4 !== peg$FAILED) {
  28420. peg$savedPos = s0;
  28421. s1 = peg$c59(s2);
  28422. s0 = s1;
  28423. } else {
  28424. peg$currPos = s0;
  28425. s0 = peg$FAILED;
  28426. }
  28427. } else {
  28428. peg$currPos = s0;
  28429. s0 = peg$FAILED;
  28430. }
  28431. } else {
  28432. peg$currPos = s0;
  28433. s0 = peg$FAILED;
  28434. }
  28435. } else {
  28436. peg$currPos = s0;
  28437. s0 = peg$FAILED;
  28438. }
  28439. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28440. return s0;
  28441. }
  28442. function peg$parsedynamicDictionary() {
  28443. var s0, s1, s2, s3, s4;
  28444. var key = peg$currPos * 66 + 25,
  28445. cached = peg$resultsCache[key];
  28446. if (cached) {
  28447. peg$currPos = cached.nextPos;
  28448. return cached.result;
  28449. }
  28450. s0 = peg$currPos;
  28451. if (input.substr(peg$currPos, 2) === peg$c60) {
  28452. s1 = peg$c60;
  28453. peg$currPos += 2;
  28454. } else {
  28455. s1 = peg$FAILED;
  28456. if (peg$silentFails === 0) { peg$fail(peg$c61); }
  28457. }
  28458. if (s1 !== peg$FAILED) {
  28459. s2 = peg$parsewsAssociations();
  28460. if (s2 === peg$FAILED) {
  28461. s2 = null;
  28462. }
  28463. if (s2 !== peg$FAILED) {
  28464. s3 = peg$parsemaybeDotsWs();
  28465. if (s3 !== peg$FAILED) {
  28466. if (input.charCodeAt(peg$currPos) === 125) {
  28467. s4 = peg$c57;
  28468. peg$currPos++;
  28469. } else {
  28470. s4 = peg$FAILED;
  28471. if (peg$silentFails === 0) { peg$fail(peg$c58); }
  28472. }
  28473. if (s4 !== peg$FAILED) {
  28474. peg$savedPos = s0;
  28475. s1 = peg$c62(s2);
  28476. s0 = s1;
  28477. } else {
  28478. peg$currPos = s0;
  28479. s0 = peg$FAILED;
  28480. }
  28481. } else {
  28482. peg$currPos = s0;
  28483. s0 = peg$FAILED;
  28484. }
  28485. } else {
  28486. peg$currPos = s0;
  28487. s0 = peg$FAILED;
  28488. }
  28489. } else {
  28490. peg$currPos = s0;
  28491. s0 = peg$FAILED;
  28492. }
  28493. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28494. return s0;
  28495. }
  28496. function peg$parsepseudoVariable() {
  28497. var s0, s1, s2;
  28498. var key = peg$currPos * 66 + 26,
  28499. cached = peg$resultsCache[key];
  28500. if (cached) {
  28501. peg$currPos = cached.nextPos;
  28502. return cached.result;
  28503. }
  28504. s0 = peg$currPos;
  28505. s1 = peg$currPos;
  28506. if (input.substr(peg$currPos, 4) === peg$c63) {
  28507. s2 = peg$c63;
  28508. peg$currPos += 4;
  28509. } else {
  28510. s2 = peg$FAILED;
  28511. if (peg$silentFails === 0) { peg$fail(peg$c64); }
  28512. }
  28513. if (s2 !== peg$FAILED) {
  28514. peg$savedPos = s1;
  28515. s2 = peg$c65();
  28516. }
  28517. s1 = s2;
  28518. if (s1 === peg$FAILED) {
  28519. s1 = peg$currPos;
  28520. if (input.substr(peg$currPos, 5) === peg$c66) {
  28521. s2 = peg$c66;
  28522. peg$currPos += 5;
  28523. } else {
  28524. s2 = peg$FAILED;
  28525. if (peg$silentFails === 0) { peg$fail(peg$c67); }
  28526. }
  28527. if (s2 !== peg$FAILED) {
  28528. peg$savedPos = s1;
  28529. s2 = peg$c68();
  28530. }
  28531. s1 = s2;
  28532. if (s1 === peg$FAILED) {
  28533. s1 = peg$currPos;
  28534. if (input.substr(peg$currPos, 3) === peg$c69) {
  28535. s2 = peg$c69;
  28536. peg$currPos += 3;
  28537. } else {
  28538. s2 = peg$FAILED;
  28539. if (peg$silentFails === 0) { peg$fail(peg$c70); }
  28540. }
  28541. if (s2 !== peg$FAILED) {
  28542. peg$savedPos = s1;
  28543. s2 = peg$c71();
  28544. }
  28545. s1 = s2;
  28546. }
  28547. }
  28548. if (s1 !== peg$FAILED) {
  28549. peg$savedPos = s0;
  28550. s1 = peg$c16(s1);
  28551. }
  28552. s0 = s1;
  28553. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28554. return s0;
  28555. }
  28556. function peg$parseparseTimeLiteral() {
  28557. var s0;
  28558. var key = peg$currPos * 66 + 27,
  28559. cached = peg$resultsCache[key];
  28560. if (cached) {
  28561. peg$currPos = cached.nextPos;
  28562. return cached.result;
  28563. }
  28564. s0 = peg$parsepseudoVariable();
  28565. if (s0 === peg$FAILED) {
  28566. s0 = peg$parsenumber();
  28567. if (s0 === peg$FAILED) {
  28568. s0 = peg$parseliteralArray();
  28569. if (s0 === peg$FAILED) {
  28570. s0 = peg$parsestring();
  28571. if (s0 === peg$FAILED) {
  28572. s0 = peg$parsesymbol();
  28573. if (s0 === peg$FAILED) {
  28574. s0 = peg$parsecharacter();
  28575. }
  28576. }
  28577. }
  28578. }
  28579. }
  28580. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28581. return s0;
  28582. }
  28583. function peg$parseruntimeLiteral() {
  28584. var s0;
  28585. var key = peg$currPos * 66 + 28,
  28586. cached = peg$resultsCache[key];
  28587. if (cached) {
  28588. peg$currPos = cached.nextPos;
  28589. return cached.result;
  28590. }
  28591. s0 = peg$parsedynamicDictionary();
  28592. if (s0 === peg$FAILED) {
  28593. s0 = peg$parsedynamicArray();
  28594. if (s0 === peg$FAILED) {
  28595. s0 = peg$parseblock();
  28596. }
  28597. }
  28598. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28599. return s0;
  28600. }
  28601. function peg$parseliteral() {
  28602. var s0;
  28603. var key = peg$currPos * 66 + 29,
  28604. cached = peg$resultsCache[key];
  28605. if (cached) {
  28606. peg$currPos = cached.nextPos;
  28607. return cached.result;
  28608. }
  28609. s0 = peg$parseruntimeLiteral();
  28610. if (s0 === peg$FAILED) {
  28611. s0 = peg$parseparseTimeLiteral();
  28612. }
  28613. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28614. return s0;
  28615. }
  28616. function peg$parsevariable() {
  28617. var s0, s1;
  28618. var key = peg$currPos * 66 + 30,
  28619. cached = peg$resultsCache[key];
  28620. if (cached) {
  28621. peg$currPos = cached.nextPos;
  28622. return cached.result;
  28623. }
  28624. s0 = peg$currPos;
  28625. s1 = peg$parseidentifier();
  28626. if (s1 !== peg$FAILED) {
  28627. peg$savedPos = s0;
  28628. s1 = peg$c72(s1);
  28629. }
  28630. s0 = s1;
  28631. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28632. return s0;
  28633. }
  28634. function peg$parsebinarySelector() {
  28635. var s0, s1, s2;
  28636. var key = peg$currPos * 66 + 31,
  28637. cached = peg$resultsCache[key];
  28638. if (cached) {
  28639. peg$currPos = cached.nextPos;
  28640. return cached.result;
  28641. }
  28642. s0 = peg$currPos;
  28643. s1 = [];
  28644. if (peg$c73.test(input.charAt(peg$currPos))) {
  28645. s2 = input.charAt(peg$currPos);
  28646. peg$currPos++;
  28647. } else {
  28648. s2 = peg$FAILED;
  28649. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28650. }
  28651. if (s2 !== peg$FAILED) {
  28652. while (s2 !== peg$FAILED) {
  28653. s1.push(s2);
  28654. if (peg$c73.test(input.charAt(peg$currPos))) {
  28655. s2 = input.charAt(peg$currPos);
  28656. peg$currPos++;
  28657. } else {
  28658. s2 = peg$FAILED;
  28659. if (peg$silentFails === 0) { peg$fail(peg$c74); }
  28660. }
  28661. }
  28662. } else {
  28663. s1 = peg$FAILED;
  28664. }
  28665. if (s1 !== peg$FAILED) {
  28666. s0 = input.substring(s0, peg$currPos);
  28667. } else {
  28668. s0 = s1;
  28669. }
  28670. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28671. return s0;
  28672. }
  28673. function peg$parsewsKeywordPattern() {
  28674. var s0, s1, s2, s3, s4, s5, s6;
  28675. var key = peg$currPos * 66 + 32,
  28676. cached = peg$resultsCache[key];
  28677. if (cached) {
  28678. peg$currPos = cached.nextPos;
  28679. return cached.result;
  28680. }
  28681. s0 = peg$currPos;
  28682. s1 = [];
  28683. s2 = peg$currPos;
  28684. s3 = peg$parsews();
  28685. if (s3 !== peg$FAILED) {
  28686. s4 = peg$parsekeyword();
  28687. if (s4 !== peg$FAILED) {
  28688. s5 = peg$parsews();
  28689. if (s5 !== peg$FAILED) {
  28690. s6 = peg$parseidentifier();
  28691. if (s6 !== peg$FAILED) {
  28692. peg$savedPos = s2;
  28693. s3 = peg$c75(s4, s6);
  28694. s2 = s3;
  28695. } else {
  28696. peg$currPos = s2;
  28697. s2 = peg$FAILED;
  28698. }
  28699. } else {
  28700. peg$currPos = s2;
  28701. s2 = peg$FAILED;
  28702. }
  28703. } else {
  28704. peg$currPos = s2;
  28705. s2 = peg$FAILED;
  28706. }
  28707. } else {
  28708. peg$currPos = s2;
  28709. s2 = peg$FAILED;
  28710. }
  28711. if (s2 !== peg$FAILED) {
  28712. while (s2 !== peg$FAILED) {
  28713. s1.push(s2);
  28714. s2 = peg$currPos;
  28715. s3 = peg$parsews();
  28716. if (s3 !== peg$FAILED) {
  28717. s4 = peg$parsekeyword();
  28718. if (s4 !== peg$FAILED) {
  28719. s5 = peg$parsews();
  28720. if (s5 !== peg$FAILED) {
  28721. s6 = peg$parseidentifier();
  28722. if (s6 !== peg$FAILED) {
  28723. peg$savedPos = s2;
  28724. s3 = peg$c75(s4, s6);
  28725. s2 = s3;
  28726. } else {
  28727. peg$currPos = s2;
  28728. s2 = peg$FAILED;
  28729. }
  28730. } else {
  28731. peg$currPos = s2;
  28732. s2 = peg$FAILED;
  28733. }
  28734. } else {
  28735. peg$currPos = s2;
  28736. s2 = peg$FAILED;
  28737. }
  28738. } else {
  28739. peg$currPos = s2;
  28740. s2 = peg$FAILED;
  28741. }
  28742. }
  28743. } else {
  28744. s1 = peg$FAILED;
  28745. }
  28746. if (s1 !== peg$FAILED) {
  28747. peg$savedPos = s0;
  28748. s1 = peg$c76(s1);
  28749. }
  28750. s0 = s1;
  28751. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28752. return s0;
  28753. }
  28754. function peg$parsewsBinaryPattern() {
  28755. var s0, s1, s2, s3, s4;
  28756. var key = peg$currPos * 66 + 33,
  28757. cached = peg$resultsCache[key];
  28758. if (cached) {
  28759. peg$currPos = cached.nextPos;
  28760. return cached.result;
  28761. }
  28762. s0 = peg$currPos;
  28763. s1 = peg$parsews();
  28764. if (s1 !== peg$FAILED) {
  28765. s2 = peg$parsebinarySelector();
  28766. if (s2 !== peg$FAILED) {
  28767. s3 = peg$parsews();
  28768. if (s3 !== peg$FAILED) {
  28769. s4 = peg$parseidentifier();
  28770. if (s4 !== peg$FAILED) {
  28771. peg$savedPos = s0;
  28772. s1 = peg$c77(s2, s4);
  28773. s0 = s1;
  28774. } else {
  28775. peg$currPos = s0;
  28776. s0 = peg$FAILED;
  28777. }
  28778. } else {
  28779. peg$currPos = s0;
  28780. s0 = peg$FAILED;
  28781. }
  28782. } else {
  28783. peg$currPos = s0;
  28784. s0 = peg$FAILED;
  28785. }
  28786. } else {
  28787. peg$currPos = s0;
  28788. s0 = peg$FAILED;
  28789. }
  28790. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28791. return s0;
  28792. }
  28793. function peg$parsewsUnaryPattern() {
  28794. var s0, s1, s2;
  28795. var key = peg$currPos * 66 + 34,
  28796. cached = peg$resultsCache[key];
  28797. if (cached) {
  28798. peg$currPos = cached.nextPos;
  28799. return cached.result;
  28800. }
  28801. s0 = peg$currPos;
  28802. s1 = peg$parsews();
  28803. if (s1 !== peg$FAILED) {
  28804. s2 = peg$parseidentifier();
  28805. if (s2 !== peg$FAILED) {
  28806. peg$savedPos = s0;
  28807. s1 = peg$c78(s2);
  28808. s0 = s1;
  28809. } else {
  28810. peg$currPos = s0;
  28811. s0 = peg$FAILED;
  28812. }
  28813. } else {
  28814. peg$currPos = s0;
  28815. s0 = peg$FAILED;
  28816. }
  28817. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28818. return s0;
  28819. }
  28820. function peg$parseexpression() {
  28821. var s0;
  28822. var key = peg$currPos * 66 + 35,
  28823. cached = peg$resultsCache[key];
  28824. if (cached) {
  28825. peg$currPos = cached.nextPos;
  28826. return cached.result;
  28827. }
  28828. s0 = peg$parseassignment();
  28829. if (s0 === peg$FAILED) {
  28830. s0 = peg$parsecascade();
  28831. if (s0 === peg$FAILED) {
  28832. s0 = peg$parsekeywordSend();
  28833. }
  28834. }
  28835. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28836. return s0;
  28837. }
  28838. function peg$parsewsExpressionsRest() {
  28839. var s0, s1, s2;
  28840. var key = peg$currPos * 66 + 36,
  28841. cached = peg$resultsCache[key];
  28842. if (cached) {
  28843. peg$currPos = cached.nextPos;
  28844. return cached.result;
  28845. }
  28846. s0 = peg$currPos;
  28847. s1 = peg$parsesomeDotsWs();
  28848. if (s1 !== peg$FAILED) {
  28849. s2 = peg$parseexpression();
  28850. if (s2 !== peg$FAILED) {
  28851. peg$savedPos = s0;
  28852. s1 = peg$c79(s2);
  28853. s0 = s1;
  28854. } else {
  28855. peg$currPos = s0;
  28856. s0 = peg$FAILED;
  28857. }
  28858. } else {
  28859. peg$currPos = s0;
  28860. s0 = peg$FAILED;
  28861. }
  28862. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28863. return s0;
  28864. }
  28865. function peg$parsewsExpressions() {
  28866. var s0, s1, s2, s3, s4;
  28867. var key = peg$currPos * 66 + 37,
  28868. cached = peg$resultsCache[key];
  28869. if (cached) {
  28870. peg$currPos = cached.nextPos;
  28871. return cached.result;
  28872. }
  28873. s0 = peg$currPos;
  28874. s1 = peg$parsemaybeDotsWs();
  28875. if (s1 !== peg$FAILED) {
  28876. s2 = peg$parseexpression();
  28877. if (s2 !== peg$FAILED) {
  28878. s3 = [];
  28879. s4 = peg$parsewsExpressionsRest();
  28880. while (s4 !== peg$FAILED) {
  28881. s3.push(s4);
  28882. s4 = peg$parsewsExpressionsRest();
  28883. }
  28884. if (s3 !== peg$FAILED) {
  28885. peg$savedPos = s0;
  28886. s1 = peg$c80(s2, s3);
  28887. s0 = s1;
  28888. } else {
  28889. peg$currPos = s0;
  28890. s0 = peg$FAILED;
  28891. }
  28892. } else {
  28893. peg$currPos = s0;
  28894. s0 = peg$FAILED;
  28895. }
  28896. } else {
  28897. peg$currPos = s0;
  28898. s0 = peg$FAILED;
  28899. }
  28900. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28901. return s0;
  28902. }
  28903. function peg$parsewsUnaryPragmaMessage() {
  28904. var s0, s1, s2, s3, s4;
  28905. var key = peg$currPos * 66 + 38,
  28906. cached = peg$resultsCache[key];
  28907. if (cached) {
  28908. peg$currPos = cached.nextPos;
  28909. return cached.result;
  28910. }
  28911. s0 = peg$currPos;
  28912. s1 = peg$parsews();
  28913. if (s1 !== peg$FAILED) {
  28914. s2 = peg$parseidentifier();
  28915. if (s2 !== peg$FAILED) {
  28916. s3 = peg$currPos;
  28917. peg$silentFails++;
  28918. if (input.charCodeAt(peg$currPos) === 58) {
  28919. s4 = peg$c12;
  28920. peg$currPos++;
  28921. } else {
  28922. s4 = peg$FAILED;
  28923. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  28924. }
  28925. peg$silentFails--;
  28926. if (s4 === peg$FAILED) {
  28927. s3 = void 0;
  28928. } else {
  28929. peg$currPos = s3;
  28930. s3 = peg$FAILED;
  28931. }
  28932. if (s3 !== peg$FAILED) {
  28933. peg$savedPos = s0;
  28934. s1 = peg$c81(s2);
  28935. s0 = s1;
  28936. } else {
  28937. peg$currPos = s0;
  28938. s0 = peg$FAILED;
  28939. }
  28940. } else {
  28941. peg$currPos = s0;
  28942. s0 = peg$FAILED;
  28943. }
  28944. } else {
  28945. peg$currPos = s0;
  28946. s0 = peg$FAILED;
  28947. }
  28948. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  28949. return s0;
  28950. }
  28951. function peg$parsewsKeywordPragmaMessage() {
  28952. var s0, s1, s2, s3, s4, s5, s6;
  28953. var key = peg$currPos * 66 + 39,
  28954. cached = peg$resultsCache[key];
  28955. if (cached) {
  28956. peg$currPos = cached.nextPos;
  28957. return cached.result;
  28958. }
  28959. s0 = peg$currPos;
  28960. s1 = [];
  28961. s2 = peg$currPos;
  28962. s3 = peg$parsews();
  28963. if (s3 !== peg$FAILED) {
  28964. s4 = peg$parsekeyword();
  28965. if (s4 !== peg$FAILED) {
  28966. s5 = peg$parsews();
  28967. if (s5 !== peg$FAILED) {
  28968. s6 = peg$parseparseTimeLiteral();
  28969. if (s6 !== peg$FAILED) {
  28970. peg$savedPos = s2;
  28971. s3 = peg$c75(s4, s6);
  28972. s2 = s3;
  28973. } else {
  28974. peg$currPos = s2;
  28975. s2 = peg$FAILED;
  28976. }
  28977. } else {
  28978. peg$currPos = s2;
  28979. s2 = peg$FAILED;
  28980. }
  28981. } else {
  28982. peg$currPos = s2;
  28983. s2 = peg$FAILED;
  28984. }
  28985. } else {
  28986. peg$currPos = s2;
  28987. s2 = peg$FAILED;
  28988. }
  28989. if (s2 !== peg$FAILED) {
  28990. while (s2 !== peg$FAILED) {
  28991. s1.push(s2);
  28992. s2 = peg$currPos;
  28993. s3 = peg$parsews();
  28994. if (s3 !== peg$FAILED) {
  28995. s4 = peg$parsekeyword();
  28996. if (s4 !== peg$FAILED) {
  28997. s5 = peg$parsews();
  28998. if (s5 !== peg$FAILED) {
  28999. s6 = peg$parseparseTimeLiteral();
  29000. if (s6 !== peg$FAILED) {
  29001. peg$savedPos = s2;
  29002. s3 = peg$c75(s4, s6);
  29003. s2 = s3;
  29004. } else {
  29005. peg$currPos = s2;
  29006. s2 = peg$FAILED;
  29007. }
  29008. } else {
  29009. peg$currPos = s2;
  29010. s2 = peg$FAILED;
  29011. }
  29012. } else {
  29013. peg$currPos = s2;
  29014. s2 = peg$FAILED;
  29015. }
  29016. } else {
  29017. peg$currPos = s2;
  29018. s2 = peg$FAILED;
  29019. }
  29020. }
  29021. } else {
  29022. s1 = peg$FAILED;
  29023. }
  29024. if (s1 !== peg$FAILED) {
  29025. peg$savedPos = s0;
  29026. s1 = peg$c82(s1);
  29027. }
  29028. s0 = s1;
  29029. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29030. return s0;
  29031. }
  29032. function peg$parsewsPragmaMessage() {
  29033. var s0;
  29034. var key = peg$currPos * 66 + 40,
  29035. cached = peg$resultsCache[key];
  29036. if (cached) {
  29037. peg$currPos = cached.nextPos;
  29038. return cached.result;
  29039. }
  29040. s0 = peg$parsewsUnaryPragmaMessage();
  29041. if (s0 === peg$FAILED) {
  29042. s0 = peg$parsewsKeywordPragmaMessage();
  29043. }
  29044. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29045. return s0;
  29046. }
  29047. function peg$parsewsPragmas() {
  29048. var s0, s1, s2, s3, s4, s5, s6;
  29049. var key = peg$currPos * 66 + 41,
  29050. cached = peg$resultsCache[key];
  29051. if (cached) {
  29052. peg$currPos = cached.nextPos;
  29053. return cached.result;
  29054. }
  29055. s0 = [];
  29056. s1 = peg$currPos;
  29057. s2 = peg$parsews();
  29058. if (s2 !== peg$FAILED) {
  29059. if (input.charCodeAt(peg$currPos) === 60) {
  29060. s3 = peg$c83;
  29061. peg$currPos++;
  29062. } else {
  29063. s3 = peg$FAILED;
  29064. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29065. }
  29066. if (s3 !== peg$FAILED) {
  29067. s4 = peg$parsewsPragmaMessage();
  29068. if (s4 !== peg$FAILED) {
  29069. s5 = peg$parsews();
  29070. if (s5 !== peg$FAILED) {
  29071. if (input.charCodeAt(peg$currPos) === 62) {
  29072. s6 = peg$c85;
  29073. peg$currPos++;
  29074. } else {
  29075. s6 = peg$FAILED;
  29076. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29077. }
  29078. if (s6 !== peg$FAILED) {
  29079. peg$savedPos = s1;
  29080. s2 = peg$c87(s4);
  29081. s1 = s2;
  29082. } else {
  29083. peg$currPos = s1;
  29084. s1 = peg$FAILED;
  29085. }
  29086. } else {
  29087. peg$currPos = s1;
  29088. s1 = peg$FAILED;
  29089. }
  29090. } else {
  29091. peg$currPos = s1;
  29092. s1 = peg$FAILED;
  29093. }
  29094. } else {
  29095. peg$currPos = s1;
  29096. s1 = peg$FAILED;
  29097. }
  29098. } else {
  29099. peg$currPos = s1;
  29100. s1 = peg$FAILED;
  29101. }
  29102. while (s1 !== peg$FAILED) {
  29103. s0.push(s1);
  29104. s1 = peg$currPos;
  29105. s2 = peg$parsews();
  29106. if (s2 !== peg$FAILED) {
  29107. if (input.charCodeAt(peg$currPos) === 60) {
  29108. s3 = peg$c83;
  29109. peg$currPos++;
  29110. } else {
  29111. s3 = peg$FAILED;
  29112. if (peg$silentFails === 0) { peg$fail(peg$c84); }
  29113. }
  29114. if (s3 !== peg$FAILED) {
  29115. s4 = peg$parsewsPragmaMessage();
  29116. if (s4 !== peg$FAILED) {
  29117. s5 = peg$parsews();
  29118. if (s5 !== peg$FAILED) {
  29119. if (input.charCodeAt(peg$currPos) === 62) {
  29120. s6 = peg$c85;
  29121. peg$currPos++;
  29122. } else {
  29123. s6 = peg$FAILED;
  29124. if (peg$silentFails === 0) { peg$fail(peg$c86); }
  29125. }
  29126. if (s6 !== peg$FAILED) {
  29127. peg$savedPos = s1;
  29128. s2 = peg$c87(s4);
  29129. s1 = s2;
  29130. } else {
  29131. peg$currPos = s1;
  29132. s1 = peg$FAILED;
  29133. }
  29134. } else {
  29135. peg$currPos = s1;
  29136. s1 = peg$FAILED;
  29137. }
  29138. } else {
  29139. peg$currPos = s1;
  29140. s1 = peg$FAILED;
  29141. }
  29142. } else {
  29143. peg$currPos = s1;
  29144. s1 = peg$FAILED;
  29145. }
  29146. } else {
  29147. peg$currPos = s1;
  29148. s1 = peg$FAILED;
  29149. }
  29150. }
  29151. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29152. return s0;
  29153. }
  29154. function peg$parseassignment() {
  29155. var s0, s1, s2, s3, s4, s5;
  29156. var key = peg$currPos * 66 + 42,
  29157. cached = peg$resultsCache[key];
  29158. if (cached) {
  29159. peg$currPos = cached.nextPos;
  29160. return cached.result;
  29161. }
  29162. s0 = peg$currPos;
  29163. s1 = peg$parsevariable();
  29164. if (s1 !== peg$FAILED) {
  29165. s2 = peg$parsews();
  29166. if (s2 !== peg$FAILED) {
  29167. if (input.substr(peg$currPos, 2) === peg$c88) {
  29168. s3 = peg$c88;
  29169. peg$currPos += 2;
  29170. } else {
  29171. s3 = peg$FAILED;
  29172. if (peg$silentFails === 0) { peg$fail(peg$c89); }
  29173. }
  29174. if (s3 !== peg$FAILED) {
  29175. s4 = peg$parsews();
  29176. if (s4 !== peg$FAILED) {
  29177. s5 = peg$parseexpression();
  29178. if (s5 !== peg$FAILED) {
  29179. peg$savedPos = s0;
  29180. s1 = peg$c90(s1, s5);
  29181. s0 = s1;
  29182. } else {
  29183. peg$currPos = s0;
  29184. s0 = peg$FAILED;
  29185. }
  29186. } else {
  29187. peg$currPos = s0;
  29188. s0 = peg$FAILED;
  29189. }
  29190. } else {
  29191. peg$currPos = s0;
  29192. s0 = peg$FAILED;
  29193. }
  29194. } else {
  29195. peg$currPos = s0;
  29196. s0 = peg$FAILED;
  29197. }
  29198. } else {
  29199. peg$currPos = s0;
  29200. s0 = peg$FAILED;
  29201. }
  29202. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29203. return s0;
  29204. }
  29205. function peg$parseret() {
  29206. var s0, s1, s2, s3;
  29207. var key = peg$currPos * 66 + 43,
  29208. cached = peg$resultsCache[key];
  29209. if (cached) {
  29210. peg$currPos = cached.nextPos;
  29211. return cached.result;
  29212. }
  29213. s0 = peg$currPos;
  29214. if (input.charCodeAt(peg$currPos) === 94) {
  29215. s1 = peg$c91;
  29216. peg$currPos++;
  29217. } else {
  29218. s1 = peg$FAILED;
  29219. if (peg$silentFails === 0) { peg$fail(peg$c92); }
  29220. }
  29221. if (s1 !== peg$FAILED) {
  29222. s2 = peg$parsews();
  29223. if (s2 !== peg$FAILED) {
  29224. s3 = peg$parseexpression();
  29225. if (s3 !== peg$FAILED) {
  29226. peg$savedPos = s0;
  29227. s1 = peg$c93(s3);
  29228. s0 = s1;
  29229. } else {
  29230. peg$currPos = s0;
  29231. s0 = peg$FAILED;
  29232. }
  29233. } else {
  29234. peg$currPos = s0;
  29235. s0 = peg$FAILED;
  29236. }
  29237. } else {
  29238. peg$currPos = s0;
  29239. s0 = peg$FAILED;
  29240. }
  29241. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29242. return s0;
  29243. }
  29244. function peg$parsetemps() {
  29245. var s0, s1, s2, s3, s4, s5;
  29246. var key = peg$currPos * 66 + 44,
  29247. cached = peg$resultsCache[key];
  29248. if (cached) {
  29249. peg$currPos = cached.nextPos;
  29250. return cached.result;
  29251. }
  29252. s0 = peg$currPos;
  29253. if (input.charCodeAt(peg$currPos) === 124) {
  29254. s1 = peg$c94;
  29255. peg$currPos++;
  29256. } else {
  29257. s1 = peg$FAILED;
  29258. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29259. }
  29260. if (s1 !== peg$FAILED) {
  29261. s2 = [];
  29262. s3 = peg$currPos;
  29263. s4 = peg$parsews();
  29264. if (s4 !== peg$FAILED) {
  29265. s5 = peg$parseidentifier();
  29266. if (s5 !== peg$FAILED) {
  29267. peg$savedPos = s3;
  29268. s4 = peg$c96(s5);
  29269. s3 = s4;
  29270. } else {
  29271. peg$currPos = s3;
  29272. s3 = peg$FAILED;
  29273. }
  29274. } else {
  29275. peg$currPos = s3;
  29276. s3 = peg$FAILED;
  29277. }
  29278. while (s3 !== peg$FAILED) {
  29279. s2.push(s3);
  29280. s3 = peg$currPos;
  29281. s4 = peg$parsews();
  29282. if (s4 !== peg$FAILED) {
  29283. s5 = peg$parseidentifier();
  29284. if (s5 !== peg$FAILED) {
  29285. peg$savedPos = s3;
  29286. s4 = peg$c96(s5);
  29287. s3 = s4;
  29288. } else {
  29289. peg$currPos = s3;
  29290. s3 = peg$FAILED;
  29291. }
  29292. } else {
  29293. peg$currPos = s3;
  29294. s3 = peg$FAILED;
  29295. }
  29296. }
  29297. if (s2 !== peg$FAILED) {
  29298. s3 = peg$parsews();
  29299. if (s3 !== peg$FAILED) {
  29300. if (input.charCodeAt(peg$currPos) === 124) {
  29301. s4 = peg$c94;
  29302. peg$currPos++;
  29303. } else {
  29304. s4 = peg$FAILED;
  29305. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29306. }
  29307. if (s4 !== peg$FAILED) {
  29308. peg$savedPos = s0;
  29309. s1 = peg$c97(s2);
  29310. s0 = s1;
  29311. } else {
  29312. peg$currPos = s0;
  29313. s0 = peg$FAILED;
  29314. }
  29315. } else {
  29316. peg$currPos = s0;
  29317. s0 = peg$FAILED;
  29318. }
  29319. } else {
  29320. peg$currPos = s0;
  29321. s0 = peg$FAILED;
  29322. }
  29323. } else {
  29324. peg$currPos = s0;
  29325. s0 = peg$FAILED;
  29326. }
  29327. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29328. return s0;
  29329. }
  29330. function peg$parsewsBlockParamList() {
  29331. var s0, s1, s2, s3, s4, s5, s6;
  29332. var key = peg$currPos * 66 + 45,
  29333. cached = peg$resultsCache[key];
  29334. if (cached) {
  29335. peg$currPos = cached.nextPos;
  29336. return cached.result;
  29337. }
  29338. s0 = peg$currPos;
  29339. s1 = [];
  29340. s2 = peg$currPos;
  29341. s3 = peg$parsews();
  29342. if (s3 !== peg$FAILED) {
  29343. if (input.charCodeAt(peg$currPos) === 58) {
  29344. s4 = peg$c12;
  29345. peg$currPos++;
  29346. } else {
  29347. s4 = peg$FAILED;
  29348. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29349. }
  29350. if (s4 !== peg$FAILED) {
  29351. s5 = peg$parsews();
  29352. if (s5 !== peg$FAILED) {
  29353. s6 = peg$parseidentifier();
  29354. if (s6 !== peg$FAILED) {
  29355. peg$savedPos = s2;
  29356. s3 = peg$c98(s6);
  29357. s2 = s3;
  29358. } else {
  29359. peg$currPos = s2;
  29360. s2 = peg$FAILED;
  29361. }
  29362. } else {
  29363. peg$currPos = s2;
  29364. s2 = peg$FAILED;
  29365. }
  29366. } else {
  29367. peg$currPos = s2;
  29368. s2 = peg$FAILED;
  29369. }
  29370. } else {
  29371. peg$currPos = s2;
  29372. s2 = peg$FAILED;
  29373. }
  29374. if (s2 !== peg$FAILED) {
  29375. while (s2 !== peg$FAILED) {
  29376. s1.push(s2);
  29377. s2 = peg$currPos;
  29378. s3 = peg$parsews();
  29379. if (s3 !== peg$FAILED) {
  29380. if (input.charCodeAt(peg$currPos) === 58) {
  29381. s4 = peg$c12;
  29382. peg$currPos++;
  29383. } else {
  29384. s4 = peg$FAILED;
  29385. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29386. }
  29387. if (s4 !== peg$FAILED) {
  29388. s5 = peg$parsews();
  29389. if (s5 !== peg$FAILED) {
  29390. s6 = peg$parseidentifier();
  29391. if (s6 !== peg$FAILED) {
  29392. peg$savedPos = s2;
  29393. s3 = peg$c98(s6);
  29394. s2 = s3;
  29395. } else {
  29396. peg$currPos = s2;
  29397. s2 = peg$FAILED;
  29398. }
  29399. } else {
  29400. peg$currPos = s2;
  29401. s2 = peg$FAILED;
  29402. }
  29403. } else {
  29404. peg$currPos = s2;
  29405. s2 = peg$FAILED;
  29406. }
  29407. } else {
  29408. peg$currPos = s2;
  29409. s2 = peg$FAILED;
  29410. }
  29411. }
  29412. } else {
  29413. s1 = peg$FAILED;
  29414. }
  29415. if (s1 !== peg$FAILED) {
  29416. s2 = peg$parsews();
  29417. if (s2 !== peg$FAILED) {
  29418. if (input.charCodeAt(peg$currPos) === 124) {
  29419. s3 = peg$c94;
  29420. peg$currPos++;
  29421. } else {
  29422. s3 = peg$FAILED;
  29423. if (peg$silentFails === 0) { peg$fail(peg$c95); }
  29424. }
  29425. if (s3 !== peg$FAILED) {
  29426. peg$savedPos = s0;
  29427. s1 = peg$c99(s1);
  29428. s0 = s1;
  29429. } else {
  29430. peg$currPos = s0;
  29431. s0 = peg$FAILED;
  29432. }
  29433. } else {
  29434. peg$currPos = s0;
  29435. s0 = peg$FAILED;
  29436. }
  29437. } else {
  29438. peg$currPos = s0;
  29439. s0 = peg$FAILED;
  29440. }
  29441. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29442. return s0;
  29443. }
  29444. function peg$parsesubexpression() {
  29445. var s0, s1, s2, s3, s4, s5;
  29446. var key = peg$currPos * 66 + 46,
  29447. cached = peg$resultsCache[key];
  29448. if (cached) {
  29449. peg$currPos = cached.nextPos;
  29450. return cached.result;
  29451. }
  29452. s0 = peg$currPos;
  29453. if (input.charCodeAt(peg$currPos) === 40) {
  29454. s1 = peg$c51;
  29455. peg$currPos++;
  29456. } else {
  29457. s1 = peg$FAILED;
  29458. if (peg$silentFails === 0) { peg$fail(peg$c52); }
  29459. }
  29460. if (s1 !== peg$FAILED) {
  29461. s2 = peg$parsews();
  29462. if (s2 !== peg$FAILED) {
  29463. s3 = peg$parseexpression();
  29464. if (s3 !== peg$FAILED) {
  29465. s4 = peg$parsews();
  29466. if (s4 !== peg$FAILED) {
  29467. if (input.charCodeAt(peg$currPos) === 41) {
  29468. s5 = peg$c48;
  29469. peg$currPos++;
  29470. } else {
  29471. s5 = peg$FAILED;
  29472. if (peg$silentFails === 0) { peg$fail(peg$c49); }
  29473. }
  29474. if (s5 !== peg$FAILED) {
  29475. peg$savedPos = s0;
  29476. s1 = peg$c79(s3);
  29477. s0 = s1;
  29478. } else {
  29479. peg$currPos = s0;
  29480. s0 = peg$FAILED;
  29481. }
  29482. } else {
  29483. peg$currPos = s0;
  29484. s0 = peg$FAILED;
  29485. }
  29486. } else {
  29487. peg$currPos = s0;
  29488. s0 = peg$FAILED;
  29489. }
  29490. } else {
  29491. peg$currPos = s0;
  29492. s0 = peg$FAILED;
  29493. }
  29494. } else {
  29495. peg$currPos = s0;
  29496. s0 = peg$FAILED;
  29497. }
  29498. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29499. return s0;
  29500. }
  29501. function peg$parsewsStatements() {
  29502. var s0, s1, s2, s3;
  29503. var key = peg$currPos * 66 + 47,
  29504. cached = peg$resultsCache[key];
  29505. if (cached) {
  29506. peg$currPos = cached.nextPos;
  29507. return cached.result;
  29508. }
  29509. s0 = peg$currPos;
  29510. s1 = peg$parsemaybeDotsWs();
  29511. if (s1 !== peg$FAILED) {
  29512. s2 = peg$parseret();
  29513. if (s2 !== peg$FAILED) {
  29514. peg$savedPos = s0;
  29515. s1 = peg$c100(s2);
  29516. s0 = s1;
  29517. } else {
  29518. peg$currPos = s0;
  29519. s0 = peg$FAILED;
  29520. }
  29521. } else {
  29522. peg$currPos = s0;
  29523. s0 = peg$FAILED;
  29524. }
  29525. if (s0 === peg$FAILED) {
  29526. s0 = peg$currPos;
  29527. s1 = peg$parsewsExpressions();
  29528. if (s1 !== peg$FAILED) {
  29529. s2 = peg$parsesomeDotsWs();
  29530. if (s2 !== peg$FAILED) {
  29531. s3 = peg$parseret();
  29532. if (s3 !== peg$FAILED) {
  29533. peg$savedPos = s0;
  29534. s1 = peg$c101(s1, s3);
  29535. s0 = s1;
  29536. } else {
  29537. peg$currPos = s0;
  29538. s0 = peg$FAILED;
  29539. }
  29540. } else {
  29541. peg$currPos = s0;
  29542. s0 = peg$FAILED;
  29543. }
  29544. } else {
  29545. peg$currPos = s0;
  29546. s0 = peg$FAILED;
  29547. }
  29548. if (s0 === peg$FAILED) {
  29549. s0 = peg$currPos;
  29550. s1 = peg$parsewsExpressions();
  29551. if (s1 === peg$FAILED) {
  29552. s1 = null;
  29553. }
  29554. if (s1 !== peg$FAILED) {
  29555. peg$savedPos = s0;
  29556. s1 = peg$c102(s1);
  29557. }
  29558. s0 = s1;
  29559. }
  29560. }
  29561. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29562. return s0;
  29563. }
  29564. function peg$parsewsSequenceWs() {
  29565. var s0, s1, s2, s3, s4, s5, s6;
  29566. var key = peg$currPos * 66 + 48,
  29567. cached = peg$resultsCache[key];
  29568. if (cached) {
  29569. peg$currPos = cached.nextPos;
  29570. return cached.result;
  29571. }
  29572. s0 = peg$currPos;
  29573. s1 = peg$parsewsPragmas();
  29574. if (s1 === peg$FAILED) {
  29575. s1 = null;
  29576. }
  29577. if (s1 !== peg$FAILED) {
  29578. s2 = peg$parsews();
  29579. if (s2 !== peg$FAILED) {
  29580. s3 = peg$parsetemps();
  29581. if (s3 === peg$FAILED) {
  29582. s3 = null;
  29583. }
  29584. if (s3 !== peg$FAILED) {
  29585. s4 = peg$parsewsPragmas();
  29586. if (s4 === peg$FAILED) {
  29587. s4 = null;
  29588. }
  29589. if (s4 !== peg$FAILED) {
  29590. s5 = peg$parsewsStatements();
  29591. if (s5 === peg$FAILED) {
  29592. s5 = null;
  29593. }
  29594. if (s5 !== peg$FAILED) {
  29595. s6 = peg$parsemaybeDotsWs();
  29596. if (s6 !== peg$FAILED) {
  29597. peg$savedPos = s0;
  29598. s1 = peg$c103(s1, s3, s4, s5);
  29599. s0 = s1;
  29600. } else {
  29601. peg$currPos = s0;
  29602. s0 = peg$FAILED;
  29603. }
  29604. } else {
  29605. peg$currPos = s0;
  29606. s0 = peg$FAILED;
  29607. }
  29608. } else {
  29609. peg$currPos = s0;
  29610. s0 = peg$FAILED;
  29611. }
  29612. } else {
  29613. peg$currPos = s0;
  29614. s0 = peg$FAILED;
  29615. }
  29616. } else {
  29617. peg$currPos = s0;
  29618. s0 = peg$FAILED;
  29619. }
  29620. } else {
  29621. peg$currPos = s0;
  29622. s0 = peg$FAILED;
  29623. }
  29624. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29625. return s0;
  29626. }
  29627. function peg$parseblock() {
  29628. var s0, s1, s2, s3, s4;
  29629. var key = peg$currPos * 66 + 49,
  29630. cached = peg$resultsCache[key];
  29631. if (cached) {
  29632. peg$currPos = cached.nextPos;
  29633. return cached.result;
  29634. }
  29635. s0 = peg$currPos;
  29636. if (input.charCodeAt(peg$currPos) === 91) {
  29637. s1 = peg$c104;
  29638. peg$currPos++;
  29639. } else {
  29640. s1 = peg$FAILED;
  29641. if (peg$silentFails === 0) { peg$fail(peg$c105); }
  29642. }
  29643. if (s1 !== peg$FAILED) {
  29644. s2 = peg$parsewsBlockParamList();
  29645. if (s2 === peg$FAILED) {
  29646. s2 = null;
  29647. }
  29648. if (s2 !== peg$FAILED) {
  29649. s3 = peg$parsewsSequenceWs();
  29650. if (s3 !== peg$FAILED) {
  29651. if (input.charCodeAt(peg$currPos) === 93) {
  29652. s4 = peg$c106;
  29653. peg$currPos++;
  29654. } else {
  29655. s4 = peg$FAILED;
  29656. if (peg$silentFails === 0) { peg$fail(peg$c107); }
  29657. }
  29658. if (s4 !== peg$FAILED) {
  29659. peg$savedPos = s0;
  29660. s1 = peg$c108(s2, s3);
  29661. s0 = s1;
  29662. } else {
  29663. peg$currPos = s0;
  29664. s0 = peg$FAILED;
  29665. }
  29666. } else {
  29667. peg$currPos = s0;
  29668. s0 = peg$FAILED;
  29669. }
  29670. } else {
  29671. peg$currPos = s0;
  29672. s0 = peg$FAILED;
  29673. }
  29674. } else {
  29675. peg$currPos = s0;
  29676. s0 = peg$FAILED;
  29677. }
  29678. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29679. return s0;
  29680. }
  29681. function peg$parseoperand() {
  29682. var s0;
  29683. var key = peg$currPos * 66 + 50,
  29684. cached = peg$resultsCache[key];
  29685. if (cached) {
  29686. peg$currPos = cached.nextPos;
  29687. return cached.result;
  29688. }
  29689. s0 = peg$parseliteral();
  29690. if (s0 === peg$FAILED) {
  29691. s0 = peg$parsevariable();
  29692. if (s0 === peg$FAILED) {
  29693. s0 = peg$parsesubexpression();
  29694. }
  29695. }
  29696. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29697. return s0;
  29698. }
  29699. function peg$parsewsUnaryMessage() {
  29700. var s0, s1, s2, s3, s4;
  29701. var key = peg$currPos * 66 + 51,
  29702. cached = peg$resultsCache[key];
  29703. if (cached) {
  29704. peg$currPos = cached.nextPos;
  29705. return cached.result;
  29706. }
  29707. s0 = peg$currPos;
  29708. s1 = peg$parsews();
  29709. if (s1 !== peg$FAILED) {
  29710. s2 = peg$parseidentifier();
  29711. if (s2 !== peg$FAILED) {
  29712. s3 = peg$currPos;
  29713. peg$silentFails++;
  29714. if (input.charCodeAt(peg$currPos) === 58) {
  29715. s4 = peg$c12;
  29716. peg$currPos++;
  29717. } else {
  29718. s4 = peg$FAILED;
  29719. if (peg$silentFails === 0) { peg$fail(peg$c13); }
  29720. }
  29721. peg$silentFails--;
  29722. if (s4 === peg$FAILED) {
  29723. s3 = void 0;
  29724. } else {
  29725. peg$currPos = s3;
  29726. s3 = peg$FAILED;
  29727. }
  29728. if (s3 !== peg$FAILED) {
  29729. peg$savedPos = s0;
  29730. s1 = peg$c109(s2);
  29731. s0 = s1;
  29732. } else {
  29733. peg$currPos = s0;
  29734. s0 = peg$FAILED;
  29735. }
  29736. } else {
  29737. peg$currPos = s0;
  29738. s0 = peg$FAILED;
  29739. }
  29740. } else {
  29741. peg$currPos = s0;
  29742. s0 = peg$FAILED;
  29743. }
  29744. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29745. return s0;
  29746. }
  29747. function peg$parsewsUnaryTail() {
  29748. var s0, s1;
  29749. var key = peg$currPos * 66 + 52,
  29750. cached = peg$resultsCache[key];
  29751. if (cached) {
  29752. peg$currPos = cached.nextPos;
  29753. return cached.result;
  29754. }
  29755. s0 = [];
  29756. s1 = peg$parsewsUnaryMessage();
  29757. while (s1 !== peg$FAILED) {
  29758. s0.push(s1);
  29759. s1 = peg$parsewsUnaryMessage();
  29760. }
  29761. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29762. return s0;
  29763. }
  29764. function peg$parseunarySend() {
  29765. var s0, s1, s2;
  29766. var key = peg$currPos * 66 + 53,
  29767. cached = peg$resultsCache[key];
  29768. if (cached) {
  29769. peg$currPos = cached.nextPos;
  29770. return cached.result;
  29771. }
  29772. s0 = peg$currPos;
  29773. s1 = peg$parseoperand();
  29774. if (s1 !== peg$FAILED) {
  29775. s2 = peg$parsewsUnaryTail();
  29776. if (s2 !== peg$FAILED) {
  29777. peg$savedPos = s0;
  29778. s1 = peg$c110(s1, s2);
  29779. s0 = s1;
  29780. } else {
  29781. peg$currPos = s0;
  29782. s0 = peg$FAILED;
  29783. }
  29784. } else {
  29785. peg$currPos = s0;
  29786. s0 = peg$FAILED;
  29787. }
  29788. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29789. return s0;
  29790. }
  29791. function peg$parsewsBinaryMessage() {
  29792. var s0, s1, s2, s3, s4;
  29793. var key = peg$currPos * 66 + 54,
  29794. cached = peg$resultsCache[key];
  29795. if (cached) {
  29796. peg$currPos = cached.nextPos;
  29797. return cached.result;
  29798. }
  29799. s0 = peg$currPos;
  29800. s1 = peg$parsews();
  29801. if (s1 !== peg$FAILED) {
  29802. s2 = peg$parsebinarySelector();
  29803. if (s2 !== peg$FAILED) {
  29804. s3 = peg$parsews();
  29805. if (s3 !== peg$FAILED) {
  29806. s4 = peg$parseunarySend();
  29807. if (s4 !== peg$FAILED) {
  29808. peg$savedPos = s0;
  29809. s1 = peg$c111(s2, s4);
  29810. s0 = s1;
  29811. } else {
  29812. peg$currPos = s0;
  29813. s0 = peg$FAILED;
  29814. }
  29815. } else {
  29816. peg$currPos = s0;
  29817. s0 = peg$FAILED;
  29818. }
  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$parsewsBinaryTail() {
  29831. var s0, s1, s2, s3;
  29832. var key = peg$currPos * 66 + 55,
  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$parsewsUnaryTail();
  29840. if (s1 !== peg$FAILED) {
  29841. s2 = [];
  29842. s3 = peg$parsewsBinaryMessage();
  29843. while (s3 !== peg$FAILED) {
  29844. s2.push(s3);
  29845. s3 = peg$parsewsBinaryMessage();
  29846. }
  29847. if (s2 !== peg$FAILED) {
  29848. peg$savedPos = s0;
  29849. s1 = peg$c112(s1, s2);
  29850. s0 = s1;
  29851. } else {
  29852. peg$currPos = s0;
  29853. s0 = peg$FAILED;
  29854. }
  29855. } else {
  29856. peg$currPos = s0;
  29857. s0 = peg$FAILED;
  29858. }
  29859. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29860. return s0;
  29861. }
  29862. function peg$parsebinarySend() {
  29863. var s0, s1, s2;
  29864. var key = peg$currPos * 66 + 56,
  29865. cached = peg$resultsCache[key];
  29866. if (cached) {
  29867. peg$currPos = cached.nextPos;
  29868. return cached.result;
  29869. }
  29870. s0 = peg$currPos;
  29871. s1 = peg$parseoperand();
  29872. if (s1 !== peg$FAILED) {
  29873. s2 = peg$parsewsBinaryTail();
  29874. if (s2 !== peg$FAILED) {
  29875. peg$savedPos = s0;
  29876. s1 = peg$c110(s1, s2);
  29877. s0 = s1;
  29878. } else {
  29879. peg$currPos = s0;
  29880. s0 = peg$FAILED;
  29881. }
  29882. } else {
  29883. peg$currPos = s0;
  29884. s0 = peg$FAILED;
  29885. }
  29886. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29887. return s0;
  29888. }
  29889. function peg$parsewsKeywordMessage() {
  29890. var s0, s1, s2, s3, s4, s5, s6;
  29891. var key = peg$currPos * 66 + 57,
  29892. cached = peg$resultsCache[key];
  29893. if (cached) {
  29894. peg$currPos = cached.nextPos;
  29895. return cached.result;
  29896. }
  29897. s0 = peg$currPos;
  29898. s1 = [];
  29899. s2 = peg$currPos;
  29900. s3 = peg$parsews();
  29901. if (s3 !== peg$FAILED) {
  29902. s4 = peg$parsekeyword();
  29903. if (s4 !== peg$FAILED) {
  29904. s5 = peg$parsews();
  29905. if (s5 !== peg$FAILED) {
  29906. s6 = peg$parsebinarySend();
  29907. if (s6 !== peg$FAILED) {
  29908. peg$savedPos = s2;
  29909. s3 = peg$c75(s4, s6);
  29910. s2 = s3;
  29911. } else {
  29912. peg$currPos = s2;
  29913. s2 = peg$FAILED;
  29914. }
  29915. } else {
  29916. peg$currPos = s2;
  29917. s2 = peg$FAILED;
  29918. }
  29919. } else {
  29920. peg$currPos = s2;
  29921. s2 = peg$FAILED;
  29922. }
  29923. } else {
  29924. peg$currPos = s2;
  29925. s2 = peg$FAILED;
  29926. }
  29927. if (s2 !== peg$FAILED) {
  29928. while (s2 !== peg$FAILED) {
  29929. s1.push(s2);
  29930. s2 = peg$currPos;
  29931. s3 = peg$parsews();
  29932. if (s3 !== peg$FAILED) {
  29933. s4 = peg$parsekeyword();
  29934. if (s4 !== peg$FAILED) {
  29935. s5 = peg$parsews();
  29936. if (s5 !== peg$FAILED) {
  29937. s6 = peg$parsebinarySend();
  29938. if (s6 !== peg$FAILED) {
  29939. peg$savedPos = s2;
  29940. s3 = peg$c75(s4, s6);
  29941. s2 = s3;
  29942. } else {
  29943. peg$currPos = s2;
  29944. s2 = peg$FAILED;
  29945. }
  29946. } else {
  29947. peg$currPos = s2;
  29948. s2 = peg$FAILED;
  29949. }
  29950. } else {
  29951. peg$currPos = s2;
  29952. s2 = peg$FAILED;
  29953. }
  29954. } else {
  29955. peg$currPos = s2;
  29956. s2 = peg$FAILED;
  29957. }
  29958. }
  29959. } else {
  29960. s1 = peg$FAILED;
  29961. }
  29962. if (s1 !== peg$FAILED) {
  29963. peg$savedPos = s0;
  29964. s1 = peg$c113(s1);
  29965. }
  29966. s0 = s1;
  29967. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29968. return s0;
  29969. }
  29970. function peg$parsewsKeywordTail() {
  29971. var s0, s1, s2;
  29972. var key = peg$currPos * 66 + 58,
  29973. cached = peg$resultsCache[key];
  29974. if (cached) {
  29975. peg$currPos = cached.nextPos;
  29976. return cached.result;
  29977. }
  29978. s0 = peg$currPos;
  29979. s1 = peg$parsewsBinaryTail();
  29980. if (s1 !== peg$FAILED) {
  29981. s2 = peg$parsewsKeywordMessage();
  29982. if (s2 === peg$FAILED) {
  29983. s2 = null;
  29984. }
  29985. if (s2 !== peg$FAILED) {
  29986. peg$savedPos = s0;
  29987. s1 = peg$c114(s1, s2);
  29988. s0 = s1;
  29989. } else {
  29990. peg$currPos = s0;
  29991. s0 = peg$FAILED;
  29992. }
  29993. } else {
  29994. peg$currPos = s0;
  29995. s0 = peg$FAILED;
  29996. }
  29997. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  29998. return s0;
  29999. }
  30000. function peg$parsekeywordSend() {
  30001. var s0, s1, s2;
  30002. var key = peg$currPos * 66 + 59,
  30003. cached = peg$resultsCache[key];
  30004. if (cached) {
  30005. peg$currPos = cached.nextPos;
  30006. return cached.result;
  30007. }
  30008. s0 = peg$currPos;
  30009. s1 = peg$parseoperand();
  30010. if (s1 !== peg$FAILED) {
  30011. s2 = peg$parsewsKeywordTail();
  30012. if (s2 !== peg$FAILED) {
  30013. peg$savedPos = s0;
  30014. s1 = peg$c110(s1, s2);
  30015. s0 = s1;
  30016. } else {
  30017. peg$currPos = s0;
  30018. s0 = peg$FAILED;
  30019. }
  30020. } else {
  30021. peg$currPos = s0;
  30022. s0 = peg$FAILED;
  30023. }
  30024. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30025. return s0;
  30026. }
  30027. function peg$parsewsMessage() {
  30028. var s0;
  30029. var key = peg$currPos * 66 + 60,
  30030. cached = peg$resultsCache[key];
  30031. if (cached) {
  30032. peg$currPos = cached.nextPos;
  30033. return cached.result;
  30034. }
  30035. s0 = peg$parsewsBinaryMessage();
  30036. if (s0 === peg$FAILED) {
  30037. s0 = peg$parsewsUnaryMessage();
  30038. if (s0 === peg$FAILED) {
  30039. s0 = peg$parsewsKeywordMessage();
  30040. }
  30041. }
  30042. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30043. return s0;
  30044. }
  30045. function peg$parsecascade() {
  30046. var s0, s1, s2, s3, s4, s5, s6, s7, s8;
  30047. var key = peg$currPos * 66 + 61,
  30048. cached = peg$resultsCache[key];
  30049. if (cached) {
  30050. peg$currPos = cached.nextPos;
  30051. return cached.result;
  30052. }
  30053. s0 = peg$currPos;
  30054. s1 = peg$parseoperand();
  30055. if (s1 !== peg$FAILED) {
  30056. s2 = peg$parsewsKeywordTail();
  30057. if (s2 !== peg$FAILED) {
  30058. peg$savedPos = peg$currPos;
  30059. s3 = peg$c115(s1, s2);
  30060. if (s3) {
  30061. s3 = void 0;
  30062. } else {
  30063. s3 = peg$FAILED;
  30064. }
  30065. if (s3 !== peg$FAILED) {
  30066. s4 = [];
  30067. s5 = peg$currPos;
  30068. s6 = peg$parsews();
  30069. if (s6 !== peg$FAILED) {
  30070. if (input.charCodeAt(peg$currPos) === 59) {
  30071. s7 = peg$c116;
  30072. peg$currPos++;
  30073. } else {
  30074. s7 = peg$FAILED;
  30075. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  30076. }
  30077. if (s7 !== peg$FAILED) {
  30078. s8 = peg$parsewsMessage();
  30079. if (s8 !== peg$FAILED) {
  30080. peg$savedPos = s5;
  30081. s6 = peg$c118(s1, s2, s8);
  30082. s5 = s6;
  30083. } else {
  30084. peg$currPos = s5;
  30085. s5 = peg$FAILED;
  30086. }
  30087. } else {
  30088. peg$currPos = s5;
  30089. s5 = peg$FAILED;
  30090. }
  30091. } else {
  30092. peg$currPos = s5;
  30093. s5 = peg$FAILED;
  30094. }
  30095. if (s5 !== peg$FAILED) {
  30096. while (s5 !== peg$FAILED) {
  30097. s4.push(s5);
  30098. s5 = peg$currPos;
  30099. s6 = peg$parsews();
  30100. if (s6 !== peg$FAILED) {
  30101. if (input.charCodeAt(peg$currPos) === 59) {
  30102. s7 = peg$c116;
  30103. peg$currPos++;
  30104. } else {
  30105. s7 = peg$FAILED;
  30106. if (peg$silentFails === 0) { peg$fail(peg$c117); }
  30107. }
  30108. if (s7 !== peg$FAILED) {
  30109. s8 = peg$parsewsMessage();
  30110. if (s8 !== peg$FAILED) {
  30111. peg$savedPos = s5;
  30112. s6 = peg$c118(s1, s2, s8);
  30113. s5 = s6;
  30114. } else {
  30115. peg$currPos = s5;
  30116. s5 = peg$FAILED;
  30117. }
  30118. } else {
  30119. peg$currPos = s5;
  30120. s5 = peg$FAILED;
  30121. }
  30122. } else {
  30123. peg$currPos = s5;
  30124. s5 = peg$FAILED;
  30125. }
  30126. }
  30127. } else {
  30128. s4 = peg$FAILED;
  30129. }
  30130. if (s4 !== peg$FAILED) {
  30131. peg$savedPos = s0;
  30132. s1 = peg$c119(s1, s2, s4);
  30133. s0 = s1;
  30134. } else {
  30135. peg$currPos = s0;
  30136. s0 = peg$FAILED;
  30137. }
  30138. } else {
  30139. peg$currPos = s0;
  30140. s0 = peg$FAILED;
  30141. }
  30142. } else {
  30143. peg$currPos = s0;
  30144. s0 = peg$FAILED;
  30145. }
  30146. } else {
  30147. peg$currPos = s0;
  30148. s0 = peg$FAILED;
  30149. }
  30150. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30151. return s0;
  30152. }
  30153. function peg$parsemethod() {
  30154. var s0, s1, s2;
  30155. var key = peg$currPos * 66 + 62,
  30156. cached = peg$resultsCache[key];
  30157. if (cached) {
  30158. peg$currPos = cached.nextPos;
  30159. return cached.result;
  30160. }
  30161. s0 = peg$currPos;
  30162. s1 = peg$parsewsKeywordPattern();
  30163. if (s1 === peg$FAILED) {
  30164. s1 = peg$parsewsBinaryPattern();
  30165. if (s1 === peg$FAILED) {
  30166. s1 = peg$parsewsUnaryPattern();
  30167. }
  30168. }
  30169. if (s1 !== peg$FAILED) {
  30170. s2 = peg$parsewsSequenceWs();
  30171. if (s2 !== peg$FAILED) {
  30172. peg$savedPos = s0;
  30173. s1 = peg$c120(s1, s2);
  30174. s0 = s1;
  30175. } else {
  30176. peg$currPos = s0;
  30177. s0 = peg$FAILED;
  30178. }
  30179. } else {
  30180. peg$currPos = s0;
  30181. s0 = peg$FAILED;
  30182. }
  30183. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30184. return s0;
  30185. }
  30186. function peg$parseassociationSend() {
  30187. var s0, s1, s2, s3;
  30188. var key = peg$currPos * 66 + 63,
  30189. cached = peg$resultsCache[key];
  30190. if (cached) {
  30191. peg$currPos = cached.nextPos;
  30192. return cached.result;
  30193. }
  30194. s0 = peg$currPos;
  30195. s1 = peg$parseoperand();
  30196. if (s1 !== peg$FAILED) {
  30197. s2 = peg$parsewsBinaryTail();
  30198. if (s2 !== peg$FAILED) {
  30199. peg$savedPos = peg$currPos;
  30200. s3 = peg$c121(s1, s2);
  30201. if (s3) {
  30202. s3 = void 0;
  30203. } else {
  30204. s3 = peg$FAILED;
  30205. }
  30206. if (s3 !== peg$FAILED) {
  30207. peg$savedPos = s0;
  30208. s1 = peg$c122(s1, s2);
  30209. s0 = s1;
  30210. } else {
  30211. peg$currPos = s0;
  30212. s0 = peg$FAILED;
  30213. }
  30214. } else {
  30215. peg$currPos = s0;
  30216. s0 = peg$FAILED;
  30217. }
  30218. } else {
  30219. peg$currPos = s0;
  30220. s0 = peg$FAILED;
  30221. }
  30222. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30223. return s0;
  30224. }
  30225. function peg$parsewsAssociationsRest() {
  30226. var s0, s1, s2;
  30227. var key = peg$currPos * 66 + 64,
  30228. cached = peg$resultsCache[key];
  30229. if (cached) {
  30230. peg$currPos = cached.nextPos;
  30231. return cached.result;
  30232. }
  30233. s0 = peg$currPos;
  30234. s1 = peg$parsesomeDotsWs();
  30235. if (s1 !== peg$FAILED) {
  30236. s2 = peg$parseassociationSend();
  30237. if (s2 !== peg$FAILED) {
  30238. peg$savedPos = s0;
  30239. s1 = peg$c79(s2);
  30240. s0 = s1;
  30241. } else {
  30242. peg$currPos = s0;
  30243. s0 = peg$FAILED;
  30244. }
  30245. } else {
  30246. peg$currPos = s0;
  30247. s0 = peg$FAILED;
  30248. }
  30249. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30250. return s0;
  30251. }
  30252. function peg$parsewsAssociations() {
  30253. var s0, s1, s2, s3, s4;
  30254. var key = peg$currPos * 66 + 65,
  30255. cached = peg$resultsCache[key];
  30256. if (cached) {
  30257. peg$currPos = cached.nextPos;
  30258. return cached.result;
  30259. }
  30260. s0 = peg$currPos;
  30261. s1 = peg$parsemaybeDotsWs();
  30262. if (s1 !== peg$FAILED) {
  30263. s2 = peg$parseassociationSend();
  30264. if (s2 !== peg$FAILED) {
  30265. s3 = [];
  30266. s4 = peg$parsewsAssociationsRest();
  30267. while (s4 !== peg$FAILED) {
  30268. s3.push(s4);
  30269. s4 = peg$parsewsAssociationsRest();
  30270. }
  30271. if (s3 !== peg$FAILED) {
  30272. peg$savedPos = s0;
  30273. s1 = peg$c123(s2, s3);
  30274. s0 = s1;
  30275. } else {
  30276. peg$currPos = s0;
  30277. s0 = peg$FAILED;
  30278. }
  30279. } else {
  30280. peg$currPos = s0;
  30281. s0 = peg$FAILED;
  30282. }
  30283. } else {
  30284. peg$currPos = s0;
  30285. s0 = peg$FAILED;
  30286. }
  30287. peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 };
  30288. return s0;
  30289. }
  30290. peg$result = peg$startRuleFunction();
  30291. if (peg$result !== peg$FAILED && peg$currPos === input.length) {
  30292. return peg$result;
  30293. } else {
  30294. if (peg$result !== peg$FAILED && peg$currPos < input.length) {
  30295. peg$fail({ type: "end", description: "end of input" });
  30296. }
  30297. throw peg$buildException(
  30298. null,
  30299. peg$maxFailExpected,
  30300. peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
  30301. peg$maxFailPos < input.length
  30302. ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
  30303. : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
  30304. );
  30305. }
  30306. }
  30307. return {
  30308. SyntaxError: peg$SyntaxError,
  30309. parse: peg$parse
  30310. };
  30311. })();
  30312. });
  30313. 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";
  30314. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  30315. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  30316. $core.addPackage("Platform-ImportExport");
  30317. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].innerEval = function (expr) { return eval(expr); };
  30318. ($core.packageDescriptors||$core.packages)["Platform-ImportExport"].transport = {"type":"amd","amdNamespace":"amber_core"};
  30319. $core.addClass("AbstractExporter", $globals.Object, [], "Platform-ImportExport");
  30320. $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.";
  30321. $core.addMethod(
  30322. $core.method({
  30323. selector: "exportPackage:on:",
  30324. protocol: "output",
  30325. fn: function (aPackage,aStream){
  30326. var self=this,$self=this;
  30327. return $core.withContext(function($ctx1) {
  30328. $self._subclassResponsibility();
  30329. return self;
  30330. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.AbstractExporter)});
  30331. },
  30332. args: ["aPackage", "aStream"],
  30333. source: "exportPackage: aPackage on: aStream\x0a\x09self subclassResponsibility",
  30334. referencedClasses: [],
  30335. messageSends: ["subclassResponsibility"]
  30336. }),
  30337. $globals.AbstractExporter);
  30338. $core.addMethod(
  30339. $core.method({
  30340. selector: "extensionMethodsOfPackage:",
  30341. protocol: "accessing",
  30342. fn: function (aPackage){
  30343. var self=this,$self=this;
  30344. var result;
  30345. return $core.withContext(function($ctx1) {
  30346. result=$recv($globals.OrderedCollection)._new();
  30347. $recv($self._extensionProtocolsOfPackage_(aPackage))._do_((function(each){
  30348. return $core.withContext(function($ctx2) {
  30349. return $recv(result)._addAll_($recv(each)._ownMethods());
  30350. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30351. }));
  30352. return result;
  30353. }, function($ctx1) {$ctx1.fill(self,"extensionMethodsOfPackage:",{aPackage:aPackage,result:result},$globals.AbstractExporter)});
  30354. },
  30355. args: ["aPackage"],
  30356. 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",
  30357. referencedClasses: ["OrderedCollection"],
  30358. messageSends: ["new", "do:", "extensionProtocolsOfPackage:", "addAll:", "ownMethods"]
  30359. }),
  30360. $globals.AbstractExporter);
  30361. $core.addMethod(
  30362. $core.method({
  30363. selector: "extensionProtocolsOfPackage:",
  30364. protocol: "accessing",
  30365. fn: function (aPackage){
  30366. var self=this,$self=this;
  30367. var extensionName,result;
  30368. return $core.withContext(function($ctx1) {
  30369. var $1,$2,$3;
  30370. $1=$recv(aPackage)._name();
  30371. $ctx1.sendIdx["name"]=1;
  30372. extensionName="*".__comma($1);
  30373. result=$recv($globals.OrderedCollection)._new();
  30374. $recv($recv($recv($recv($globals.Smalltalk)._classes())._asArray())._sorted_((function(a,b){
  30375. return $core.withContext(function($ctx2) {
  30376. $2=$recv(a)._name();
  30377. $ctx2.sendIdx["name"]=2;
  30378. return $recv($2).__lt($recv(b)._name());
  30379. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  30380. })))._do_((function(each){
  30381. return $core.withContext(function($ctx2) {
  30382. return $recv($recv([each,$recv(each)._theMetaClass()])._copyWithout_(nil))._do_((function(behavior){
  30383. return $core.withContext(function($ctx3) {
  30384. $3=$recv($recv(behavior)._protocols())._includes_(extensionName);
  30385. if($core.assert($3)){
  30386. return $recv(result)._add_($recv($globals.ExportMethodProtocol)._name_theClass_(extensionName,behavior));
  30387. }
  30388. }, function($ctx3) {$ctx3.fillBlock({behavior:behavior},$ctx2,3)});
  30389. }));
  30390. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  30391. }));
  30392. $ctx1.sendIdx["do:"]=1;
  30393. return result;
  30394. }, function($ctx1) {$ctx1.fill(self,"extensionProtocolsOfPackage:",{aPackage:aPackage,extensionName:extensionName,result:result},$globals.AbstractExporter)});
  30395. },
  30396. args: ["aPackage"],
  30397. 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",
  30398. referencedClasses: ["OrderedCollection", "Smalltalk", "ExportMethodProtocol"],
  30399. messageSends: [",", "name", "new", "do:", "sorted:", "asArray", "classes", "<", "copyWithout:", "theMetaClass", "ifTrue:", "includes:", "protocols", "add:", "name:theClass:"]
  30400. }),
  30401. $globals.AbstractExporter);
  30402. $core.addClass("ChunkExporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  30403. $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.";
  30404. $core.addMethod(
  30405. $core.method({
  30406. selector: "chunkEscape:",
  30407. protocol: "convenience",
  30408. fn: function (aString){
  30409. var self=this,$self=this;
  30410. return $core.withContext(function($ctx1) {
  30411. return $recv($recv(aString)._replace_with_("!","!!"))._trimBoth();
  30412. }, function($ctx1) {$ctx1.fill(self,"chunkEscape:",{aString:aString},$globals.ChunkExporter)});
  30413. },
  30414. args: ["aString"],
  30415. source: "chunkEscape: aString\x0a\x09\x22Replace all occurrences of ! with !! and trim at both ends.\x22\x0a\x0a\x09^ (aString replace: '!' with: '!!') trimBoth",
  30416. referencedClasses: [],
  30417. messageSends: ["trimBoth", "replace:with:"]
  30418. }),
  30419. $globals.ChunkExporter);
  30420. $core.addMethod(
  30421. $core.method({
  30422. selector: "exportBehavior:on:",
  30423. protocol: "output",
  30424. fn: function (aBehavior,aStream){
  30425. var self=this,$self=this;
  30426. return $core.withContext(function($ctx1) {
  30427. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  30428. $self._exportProtocols_on_($self._ownMethodProtocolsOfClass_(aBehavior),aStream);
  30429. return self;
  30430. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30431. },
  30432. args: ["aBehavior", "aStream"],
  30433. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09self \x0a\x09\x09exportProtocols: (self ownMethodProtocolsOfClass: aBehavior)\x0a\x09\x09on: aStream",
  30434. referencedClasses: [],
  30435. messageSends: ["exportBehaviorDefinitionTo:using:", "exportProtocols:on:", "ownMethodProtocolsOfClass:"]
  30436. }),
  30437. $globals.ChunkExporter);
  30438. $core.addMethod(
  30439. $core.method({
  30440. selector: "exportCategoryEpilogueOf:on:",
  30441. protocol: "output",
  30442. fn: function (aCategory,aStream){
  30443. var self=this,$self=this;
  30444. return $core.withContext(function($ctx1) {
  30445. $recv(aStream)._write_(" !");
  30446. $recv(aStream)._lf();
  30447. $ctx1.sendIdx["lf"]=1;
  30448. $recv(aStream)._lf();
  30449. return self;
  30450. }, function($ctx1) {$ctx1.fill(self,"exportCategoryEpilogueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30451. },
  30452. args: ["aCategory", "aStream"],
  30453. source: "exportCategoryEpilogueOf: aCategory on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30454. referencedClasses: [],
  30455. messageSends: ["write:", "lf"]
  30456. }),
  30457. $globals.ChunkExporter);
  30458. $core.addMethod(
  30459. $core.method({
  30460. selector: "exportCategoryPrologueOf:on:",
  30461. protocol: "output",
  30462. fn: function (aCategory,aStream){
  30463. var self=this,$self=this;
  30464. return $core.withContext(function($ctx1) {
  30465. $recv(aStream)._write_("!");
  30466. $ctx1.sendIdx["write:"]=1;
  30467. $recv(aStream)._print_($recv(aCategory)._theClass());
  30468. $ctx1.sendIdx["print:"]=1;
  30469. $recv(aStream)._write_(" methodsFor: ");
  30470. $ctx1.sendIdx["write:"]=2;
  30471. $recv(aStream)._print_(aCategory);
  30472. $recv(aStream)._write_("!");
  30473. return self;
  30474. }, function($ctx1) {$ctx1.fill(self,"exportCategoryPrologueOf:on:",{aCategory:aCategory,aStream:aStream},$globals.ChunkExporter)});
  30475. },
  30476. args: ["aCategory", "aStream"],
  30477. 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: '!'",
  30478. referencedClasses: [],
  30479. messageSends: ["write:", "print:", "theClass"]
  30480. }),
  30481. $globals.ChunkExporter);
  30482. $core.addMethod(
  30483. $core.method({
  30484. selector: "exportDefinitionOf:on:",
  30485. protocol: "output",
  30486. fn: function (aClass,aStream){
  30487. var self=this,$self=this;
  30488. return $core.withContext(function($ctx1) {
  30489. var $1,$2,$3,$4;
  30490. $recv(aStream)._print_($recv(aClass)._superclass());
  30491. $ctx1.sendIdx["print:"]=1;
  30492. $recv(aStream)._write_(" subclass: ");
  30493. $ctx1.sendIdx["write:"]=1;
  30494. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30495. $1=$recv(aStream)._lf();
  30496. $ctx1.sendIdx["lf"]=1;
  30497. $recv(aStream)._tab();
  30498. $ctx1.sendIdx["tab"]=1;
  30499. $recv(aStream)._write_("instanceVariableNames: ");
  30500. $ctx1.sendIdx["write:"]=2;
  30501. $recv(aStream)._print_(" "._join_($recv(aClass)._instanceVariableNames()));
  30502. $ctx1.sendIdx["print:"]=2;
  30503. $recv(aStream)._lf();
  30504. $ctx1.sendIdx["lf"]=2;
  30505. $recv(aStream)._tab();
  30506. $recv(aStream)._write_("package: ");
  30507. $ctx1.sendIdx["write:"]=3;
  30508. $recv(aStream)._print_($recv(aClass)._category());
  30509. $ctx1.sendIdx["print:"]=3;
  30510. $recv(aStream)._write_("!");
  30511. $ctx1.sendIdx["write:"]=4;
  30512. $2=$recv(aStream)._lf();
  30513. $ctx1.sendIdx["lf"]=3;
  30514. $3=$recv(aClass)._comment();
  30515. $ctx1.sendIdx["comment"]=1;
  30516. $recv($3)._ifNotEmpty_((function(){
  30517. return $core.withContext(function($ctx2) {
  30518. $recv(aStream)._write_("!");
  30519. $ctx2.sendIdx["write:"]=5;
  30520. $recv(aStream)._print_(aClass);
  30521. $recv(aStream)._write_(" commentStamp!");
  30522. $ctx2.sendIdx["write:"]=6;
  30523. $recv(aStream)._lf();
  30524. $ctx2.sendIdx["lf"]=4;
  30525. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30526. $4=$recv(aStream)._lf();
  30527. $ctx2.sendIdx["lf"]=5;
  30528. return $4;
  30529. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30530. }));
  30531. $recv(aStream)._lf();
  30532. return self;
  30533. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30534. },
  30535. args: ["aClass", "aStream"],
  30536. 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",
  30537. referencedClasses: [],
  30538. messageSends: ["print:", "superclass", "write:", "printSymbol:", "name", "lf", "tab", "join:", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30539. }),
  30540. $globals.ChunkExporter);
  30541. $core.addMethod(
  30542. $core.method({
  30543. selector: "exportMetaDefinitionOf:on:",
  30544. protocol: "output",
  30545. fn: function (aClass,aStream){
  30546. var self=this,$self=this;
  30547. var classIvars,classTraitComposition;
  30548. return $core.withContext(function($ctx1) {
  30549. var $1,$2;
  30550. $1=$recv(aClass)._class();
  30551. $ctx1.sendIdx["class"]=1;
  30552. classIvars=$recv($1)._instanceVariableNames();
  30553. classTraitComposition=$recv($recv(aClass)._class())._traitComposition();
  30554. $2=$recv(classIvars)._notEmpty();
  30555. if($core.assert($2)){
  30556. $recv(aStream)._print_($recv(aClass)._theMetaClass());
  30557. $ctx1.sendIdx["print:"]=1;
  30558. $recv(aStream)._space();
  30559. $recv(aStream)._write_("instanceVariableNames: ");
  30560. $ctx1.sendIdx["write:"]=1;
  30561. $recv(aStream)._print_(" "._join_(classIvars));
  30562. $recv(aStream)._write_("!");
  30563. $recv(aStream)._lf();
  30564. $ctx1.sendIdx["lf"]=1;
  30565. $recv(aStream)._lf();
  30566. }
  30567. return self;
  30568. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream,classIvars:classIvars,classTraitComposition:classTraitComposition},$globals.ChunkExporter)});
  30569. },
  30570. args: ["aClass", "aStream"],
  30571. 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 ]",
  30572. referencedClasses: [],
  30573. messageSends: ["instanceVariableNames", "class", "traitComposition", "ifTrue:", "notEmpty", "print:", "theMetaClass", "space", "write:", "join:", "lf"]
  30574. }),
  30575. $globals.ChunkExporter);
  30576. $core.addMethod(
  30577. $core.method({
  30578. selector: "exportMethod:on:",
  30579. protocol: "output",
  30580. fn: function (aMethod,aStream){
  30581. var self=this,$self=this;
  30582. return $core.withContext(function($ctx1) {
  30583. $recv(aStream)._lf();
  30584. $ctx1.sendIdx["lf"]=1;
  30585. $recv(aStream)._lf();
  30586. $ctx1.sendIdx["lf"]=2;
  30587. $recv(aStream)._write_($self._chunkEscape_($recv(aMethod)._source()));
  30588. $ctx1.sendIdx["write:"]=1;
  30589. $recv(aStream)._lf();
  30590. $recv(aStream)._write_("!");
  30591. return self;
  30592. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.ChunkExporter)});
  30593. },
  30594. args: ["aMethod", "aStream"],
  30595. source: "exportMethod: aMethod on: aStream\x0a\x09aStream\x0a\x09\x09lf; lf; write: (self chunkEscape: aMethod source); lf;\x0a\x09\x09write: '!'",
  30596. referencedClasses: [],
  30597. messageSends: ["lf", "write:", "chunkEscape:", "source"]
  30598. }),
  30599. $globals.ChunkExporter);
  30600. $core.addMethod(
  30601. $core.method({
  30602. selector: "exportPackage:on:",
  30603. protocol: "output",
  30604. fn: function (aPackage,aStream){
  30605. var self=this,$self=this;
  30606. return $core.withContext(function($ctx1) {
  30607. var $1,$receiver;
  30608. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  30609. $self._exportPackageImportsOf_on_(aPackage,aStream);
  30610. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  30611. return $core.withContext(function($ctx2) {
  30612. $self._exportBehavior_on_(each,aStream);
  30613. $ctx2.sendIdx["exportBehavior:on:"]=1;
  30614. $1=$recv(each)._theMetaClass();
  30615. if(($receiver = $1) == null || $receiver.a$nil){
  30616. return $1;
  30617. } else {
  30618. var meta;
  30619. meta=$receiver;
  30620. return $self._exportBehavior_on_(meta,aStream);
  30621. }
  30622. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30623. }));
  30624. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  30625. $self._exportProtocols_on_($self._extensionProtocolsOfPackage_(aPackage),aStream);
  30626. return self;
  30627. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30628. },
  30629. args: ["aPackage", "aStream"],
  30630. 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",
  30631. referencedClasses: [],
  30632. messageSends: ["exportPackageDefinitionOf:on:", "exportPackageImportsOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "exportProtocols:on:", "extensionProtocolsOfPackage:"]
  30633. }),
  30634. $globals.ChunkExporter);
  30635. $core.addMethod(
  30636. $core.method({
  30637. selector: "exportPackageDefinitionOf:on:",
  30638. protocol: "output",
  30639. fn: function (aPackage,aStream){
  30640. var self=this,$self=this;
  30641. return $core.withContext(function($ctx1) {
  30642. $recv(aStream)._write_("Smalltalk createPackage: ");
  30643. $ctx1.sendIdx["write:"]=1;
  30644. $recv(aStream)._print_($recv(aPackage)._name());
  30645. $recv(aStream)._write_("!");
  30646. $recv(aStream)._lf();
  30647. return self;
  30648. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30649. },
  30650. args: ["aPackage", "aStream"],
  30651. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: 'Smalltalk createPackage: ';\x0a\x09\x09print: aPackage name;\x0a\x09\x09write: '!';\x0a\x09\x09lf",
  30652. referencedClasses: [],
  30653. messageSends: ["write:", "print:", "name", "lf"]
  30654. }),
  30655. $globals.ChunkExporter);
  30656. $core.addMethod(
  30657. $core.method({
  30658. selector: "exportPackageImportsOf:on:",
  30659. protocol: "output",
  30660. fn: function (aPackage,aStream){
  30661. var self=this,$self=this;
  30662. return $core.withContext(function($ctx1) {
  30663. var $1;
  30664. $recv($recv(aPackage)._imports())._ifNotEmpty_((function(imports){
  30665. return $core.withContext(function($ctx2) {
  30666. $recv(aStream)._write_("(Smalltalk packageAt: ");
  30667. $ctx2.sendIdx["write:"]=1;
  30668. $1=$recv(aPackage)._name();
  30669. $ctx2.sendIdx["name"]=1;
  30670. $recv(aStream)._print_($1);
  30671. $ctx2.sendIdx["print:"]=1;
  30672. $recv(aStream)._write_(" ifAbsent: [ self error: ");
  30673. $ctx2.sendIdx["write:"]=2;
  30674. $recv(aStream)._print_("Package not created: ".__comma($recv(aPackage)._name()));
  30675. $recv(aStream)._write_([" ]) imports: ",$self._chunkEscape_($recv(aPackage)._importsDefinition()),"!"]);
  30676. return $recv(aStream)._lf();
  30677. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  30678. }));
  30679. return self;
  30680. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30681. },
  30682. args: ["aPackage", "aStream"],
  30683. 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 ]",
  30684. referencedClasses: [],
  30685. messageSends: ["ifNotEmpty:", "imports", "write:", "print:", "name", ",", "chunkEscape:", "importsDefinition", "lf"]
  30686. }),
  30687. $globals.ChunkExporter);
  30688. $core.addMethod(
  30689. $core.method({
  30690. selector: "exportPackageTraitCompositionsOf:on:",
  30691. protocol: "output",
  30692. fn: function (aPackage,aStream){
  30693. var self=this,$self=this;
  30694. return $core.withContext(function($ctx1) {
  30695. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  30696. return $core.withContext(function($ctx2) {
  30697. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  30698. return $core.withContext(function($ctx3) {
  30699. return $self._exportTraitComposition_of_on_(value,key,aStream);
  30700. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  30701. }));
  30702. $recv(aStream)._write_("! !");
  30703. $recv(aStream)._lf();
  30704. $ctx2.sendIdx["lf"]=1;
  30705. return $recv(aStream)._lf();
  30706. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  30707. }));
  30708. return self;
  30709. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.ChunkExporter)});
  30710. },
  30711. args: ["aPackage", "aStream"],
  30712. 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 ]",
  30713. referencedClasses: [],
  30714. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "write:", "lf"]
  30715. }),
  30716. $globals.ChunkExporter);
  30717. $core.addMethod(
  30718. $core.method({
  30719. selector: "exportProtocol:on:",
  30720. protocol: "output",
  30721. fn: function (aProtocol,aStream){
  30722. var self=this,$self=this;
  30723. return $core.withContext(function($ctx1) {
  30724. $recv($recv(aProtocol)._ownMethods())._ifNotEmpty_((function(methods){
  30725. return $core.withContext(function($ctx2) {
  30726. $self._exportProtocolPrologueOf_on_(aProtocol,aStream);
  30727. $recv(methods)._do_((function(method){
  30728. return $core.withContext(function($ctx3) {
  30729. return $self._exportMethod_on_(method,aStream);
  30730. }, function($ctx3) {$ctx3.fillBlock({method:method},$ctx2,2)});
  30731. }));
  30732. return $self._exportProtocolEpilogueOf_on_(aProtocol,aStream);
  30733. }, function($ctx2) {$ctx2.fillBlock({methods:methods},$ctx1,1)});
  30734. }));
  30735. return self;
  30736. }, function($ctx1) {$ctx1.fill(self,"exportProtocol:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30737. },
  30738. args: ["aProtocol", "aStream"],
  30739. 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 ]",
  30740. referencedClasses: [],
  30741. messageSends: ["ifNotEmpty:", "ownMethods", "exportProtocolPrologueOf:on:", "do:", "exportMethod:on:", "exportProtocolEpilogueOf:on:"]
  30742. }),
  30743. $globals.ChunkExporter);
  30744. $core.addMethod(
  30745. $core.method({
  30746. selector: "exportProtocolEpilogueOf:on:",
  30747. protocol: "output",
  30748. fn: function (aProtocol,aStream){
  30749. var self=this,$self=this;
  30750. return $core.withContext(function($ctx1) {
  30751. $recv(aStream)._write_(" !");
  30752. $recv(aStream)._lf();
  30753. $ctx1.sendIdx["lf"]=1;
  30754. $recv(aStream)._lf();
  30755. return self;
  30756. }, function($ctx1) {$ctx1.fill(self,"exportProtocolEpilogueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30757. },
  30758. args: ["aProtocol", "aStream"],
  30759. source: "exportProtocolEpilogueOf: aProtocol on: aStream\x0a\x09aStream write: ' !'; lf; lf",
  30760. referencedClasses: [],
  30761. messageSends: ["write:", "lf"]
  30762. }),
  30763. $globals.ChunkExporter);
  30764. $core.addMethod(
  30765. $core.method({
  30766. selector: "exportProtocolPrologueOf:on:",
  30767. protocol: "output",
  30768. fn: function (aProtocol,aStream){
  30769. var self=this,$self=this;
  30770. return $core.withContext(function($ctx1) {
  30771. $recv(aStream)._write_("!");
  30772. $ctx1.sendIdx["write:"]=1;
  30773. $recv(aStream)._print_($recv(aProtocol)._theClass());
  30774. $ctx1.sendIdx["print:"]=1;
  30775. $recv(aStream)._write_(" methodsFor: ");
  30776. $ctx1.sendIdx["write:"]=2;
  30777. $recv(aStream)._print_($recv(aProtocol)._name());
  30778. $recv(aStream)._write_("!");
  30779. return self;
  30780. }, function($ctx1) {$ctx1.fill(self,"exportProtocolPrologueOf:on:",{aProtocol:aProtocol,aStream:aStream},$globals.ChunkExporter)});
  30781. },
  30782. args: ["aProtocol", "aStream"],
  30783. 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: '!'",
  30784. referencedClasses: [],
  30785. messageSends: ["write:", "print:", "theClass", "name"]
  30786. }),
  30787. $globals.ChunkExporter);
  30788. $core.addMethod(
  30789. $core.method({
  30790. selector: "exportProtocols:on:",
  30791. protocol: "output",
  30792. fn: function (aCollection,aStream){
  30793. var self=this,$self=this;
  30794. return $core.withContext(function($ctx1) {
  30795. $recv(aCollection)._do_((function(each){
  30796. return $core.withContext(function($ctx2) {
  30797. return $self._exportProtocol_on_(each,aStream);
  30798. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30799. }));
  30800. return self;
  30801. }, function($ctx1) {$ctx1.fill(self,"exportProtocols:on:",{aCollection:aCollection,aStream:aStream},$globals.ChunkExporter)});
  30802. },
  30803. args: ["aCollection", "aStream"],
  30804. source: "exportProtocols: aCollection on: aStream\x0a\x09aCollection do: [ :each |\x0a\x09\x09self exportProtocol: each on: aStream ]",
  30805. referencedClasses: [],
  30806. messageSends: ["do:", "exportProtocol:on:"]
  30807. }),
  30808. $globals.ChunkExporter);
  30809. $core.addMethod(
  30810. $core.method({
  30811. selector: "exportTraitComposition:of:on:",
  30812. protocol: "output",
  30813. fn: function (aTraitComposition,aBehavior,aStream){
  30814. var self=this,$self=this;
  30815. return $core.withContext(function($ctx1) {
  30816. $recv(aStream)._print_(aBehavior);
  30817. $recv(aStream)._write_(" setTraitComposition: ");
  30818. $ctx1.sendIdx["write:"]=1;
  30819. $recv(aStream)._write_($recv(aBehavior)._traitCompositionDefinition());
  30820. $ctx1.sendIdx["write:"]=2;
  30821. $recv(aStream)._write_(" asTraitComposition!");
  30822. $recv(aStream)._lf();
  30823. return self;
  30824. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.ChunkExporter)});
  30825. },
  30826. args: ["aTraitComposition", "aBehavior", "aStream"],
  30827. 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",
  30828. referencedClasses: [],
  30829. messageSends: ["print:", "write:", "traitCompositionDefinition", "lf"]
  30830. }),
  30831. $globals.ChunkExporter);
  30832. $core.addMethod(
  30833. $core.method({
  30834. selector: "exportTraitDefinitionOf:on:",
  30835. protocol: "output",
  30836. fn: function (aClass,aStream){
  30837. var self=this,$self=this;
  30838. return $core.withContext(function($ctx1) {
  30839. var $1,$2,$3,$4;
  30840. $recv(aStream)._write_("Trait named: ");
  30841. $ctx1.sendIdx["write:"]=1;
  30842. $recv(aStream)._printSymbol_($recv(aClass)._name());
  30843. $1=$recv(aStream)._lf();
  30844. $ctx1.sendIdx["lf"]=1;
  30845. $recv(aStream)._tab();
  30846. $recv(aStream)._write_("package: ");
  30847. $ctx1.sendIdx["write:"]=2;
  30848. $recv(aStream)._print_($recv(aClass)._category());
  30849. $ctx1.sendIdx["print:"]=1;
  30850. $recv(aStream)._write_("!");
  30851. $ctx1.sendIdx["write:"]=3;
  30852. $2=$recv(aStream)._lf();
  30853. $ctx1.sendIdx["lf"]=2;
  30854. $3=$recv(aClass)._comment();
  30855. $ctx1.sendIdx["comment"]=1;
  30856. $recv($3)._ifNotEmpty_((function(){
  30857. return $core.withContext(function($ctx2) {
  30858. $recv(aStream)._write_("!");
  30859. $ctx2.sendIdx["write:"]=4;
  30860. $recv(aStream)._print_(aClass);
  30861. $recv(aStream)._write_(" commentStamp!");
  30862. $ctx2.sendIdx["write:"]=5;
  30863. $recv(aStream)._lf();
  30864. $ctx2.sendIdx["lf"]=3;
  30865. $recv(aStream)._write_([$self._chunkEscape_($recv(aClass)._comment()),"!"]);
  30866. $4=$recv(aStream)._lf();
  30867. $ctx2.sendIdx["lf"]=4;
  30868. return $4;
  30869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  30870. }));
  30871. $recv(aStream)._lf();
  30872. return self;
  30873. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.ChunkExporter)});
  30874. },
  30875. args: ["aClass", "aStream"],
  30876. 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",
  30877. referencedClasses: [],
  30878. messageSends: ["write:", "printSymbol:", "name", "lf", "tab", "print:", "category", "ifNotEmpty:", "comment", "chunkEscape:"]
  30879. }),
  30880. $globals.ChunkExporter);
  30881. $core.addMethod(
  30882. $core.method({
  30883. selector: "extensionCategoriesOfPackage:",
  30884. protocol: "accessing",
  30885. fn: function (aPackage){
  30886. var self=this,$self=this;
  30887. var name,map,result;
  30888. return $core.withContext(function($ctx1) {
  30889. var $1;
  30890. name=$recv(aPackage)._name();
  30891. result=$recv($globals.OrderedCollection)._new();
  30892. $ctx1.sendIdx["new"]=1;
  30893. $recv($recv($globals.Package)._sortedClasses_($recv($globals.Smalltalk)._classes()))._do_((function(each){
  30894. return $core.withContext(function($ctx2) {
  30895. return $recv([each,$recv(each)._theMetaClass()])._do_((function(aClass){
  30896. return $core.withContext(function($ctx3) {
  30897. map=$recv($globals.Dictionary)._new();
  30898. $recv(aClass)._protocolsDo_((function(category,methods){
  30899. return $core.withContext(function($ctx4) {
  30900. $1=$recv(category).__eq("*".__comma(name));
  30901. if($core.assert($1)){
  30902. return $recv(map)._at_put_(category,methods);
  30903. }
  30904. }, function($ctx4) {$ctx4.fillBlock({category:category,methods:methods},$ctx3,3)});
  30905. }));
  30906. return $recv(result)._addAll_($recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30907. return $core.withContext(function($ctx4) {
  30908. return $recv(a).__lt_eq(b);
  30909. }, function($ctx4) {$ctx4.fillBlock({a:a,b:b},$ctx3,5)});
  30910. })))._collect_((function(category){
  30911. return $core.withContext(function($ctx4) {
  30912. return $recv($globals.MethodCategory)._name_theClass_methods_(category,aClass,$recv(map)._at_(category));
  30913. }, function($ctx4) {$ctx4.fillBlock({category:category},$ctx3,6)});
  30914. })));
  30915. }, function($ctx3) {$ctx3.fillBlock({aClass:aClass},$ctx2,2)});
  30916. }));
  30917. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30918. }));
  30919. $ctx1.sendIdx["do:"]=1;
  30920. return result;
  30921. }, function($ctx1) {$ctx1.fill(self,"extensionCategoriesOfPackage:",{aPackage:aPackage,name:name,map:map,result:result},$globals.ChunkExporter)});
  30922. },
  30923. args: ["aPackage"],
  30924. 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",
  30925. referencedClasses: ["OrderedCollection", "Package", "Smalltalk", "Dictionary", "MethodCategory"],
  30926. messageSends: ["name", "new", "do:", "sortedClasses:", "classes", "theMetaClass", "protocolsDo:", "ifTrue:", "=", ",", "at:put:", "addAll:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30927. }),
  30928. $globals.ChunkExporter);
  30929. $core.addMethod(
  30930. $core.method({
  30931. selector: "ownCategoriesOfClass:",
  30932. protocol: "accessing",
  30933. fn: function (aClass){
  30934. var self=this,$self=this;
  30935. var map;
  30936. return $core.withContext(function($ctx1) {
  30937. var $1;
  30938. map=$recv($globals.Dictionary)._new();
  30939. $recv(aClass)._protocolsDo_((function(each,methods){
  30940. return $core.withContext(function($ctx2) {
  30941. $1=$recv(each)._match_("^\x5c*");
  30942. if(!$core.assert($1)){
  30943. return $recv(map)._at_put_(each,methods);
  30944. }
  30945. }, function($ctx2) {$ctx2.fillBlock({each:each,methods:methods},$ctx1,1)});
  30946. }));
  30947. return $recv($recv($recv(map)._keys())._sorted_((function(a,b){
  30948. return $core.withContext(function($ctx2) {
  30949. return $recv(a).__lt_eq(b);
  30950. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  30951. })))._collect_((function(each){
  30952. return $core.withContext(function($ctx2) {
  30953. return $recv($globals.MethodCategory)._name_theClass_methods_(each,aClass,$recv(map)._at_(each));
  30954. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  30955. }));
  30956. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfClass:",{aClass:aClass,map:map},$globals.ChunkExporter)});
  30957. },
  30958. args: ["aClass"],
  30959. 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) ]",
  30960. referencedClasses: ["Dictionary", "MethodCategory"],
  30961. messageSends: ["new", "protocolsDo:", "ifFalse:", "match:", "at:put:", "collect:", "sorted:", "keys", "<=", "name:theClass:methods:", "at:"]
  30962. }),
  30963. $globals.ChunkExporter);
  30964. $core.addMethod(
  30965. $core.method({
  30966. selector: "ownCategoriesOfMetaClass:",
  30967. protocol: "accessing",
  30968. fn: function (aClass){
  30969. var self=this,$self=this;
  30970. return $core.withContext(function($ctx1) {
  30971. return $self._ownCategoriesOfClass_($recv(aClass)._theMetaClass());
  30972. }, function($ctx1) {$ctx1.fill(self,"ownCategoriesOfMetaClass:",{aClass:aClass},$globals.ChunkExporter)});
  30973. },
  30974. args: ["aClass"],
  30975. source: "ownCategoriesOfMetaClass: aClass\x0a\x09\x22Issue #143: sort protocol alphabetically\x22\x0a\x0a\x09^ self ownCategoriesOfClass: aClass theMetaClass",
  30976. referencedClasses: [],
  30977. messageSends: ["ownCategoriesOfClass:", "theMetaClass"]
  30978. }),
  30979. $globals.ChunkExporter);
  30980. $core.addMethod(
  30981. $core.method({
  30982. selector: "ownMethodProtocolsOfClass:",
  30983. protocol: "accessing",
  30984. fn: function (aClass){
  30985. var self=this,$self=this;
  30986. return $core.withContext(function($ctx1) {
  30987. return $recv($recv(aClass)._ownProtocols())._collect_((function(each){
  30988. return $core.withContext(function($ctx2) {
  30989. return $recv($globals.ExportMethodProtocol)._name_theClass_(each,aClass);
  30990. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  30991. }));
  30992. }, function($ctx1) {$ctx1.fill(self,"ownMethodProtocolsOfClass:",{aClass:aClass},$globals.ChunkExporter)});
  30993. },
  30994. args: ["aClass"],
  30995. 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 ]",
  30996. referencedClasses: ["ExportMethodProtocol"],
  30997. messageSends: ["collect:", "ownProtocols", "name:theClass:"]
  30998. }),
  30999. $globals.ChunkExporter);
  31000. $core.addClass("Exporter", $globals.AbstractExporter, [], "Platform-ImportExport");
  31001. $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.).";
  31002. $core.addMethod(
  31003. $core.method({
  31004. selector: "exportBehavior:on:",
  31005. protocol: "output",
  31006. fn: function (aBehavior,aStream){
  31007. var self=this,$self=this;
  31008. return $core.withContext(function($ctx1) {
  31009. $recv(aBehavior)._exportBehaviorDefinitionTo_using_(aStream,self);
  31010. $recv($recv(aBehavior)._ownMethods())._do_((function(method){
  31011. return $core.withContext(function($ctx2) {
  31012. return $self._exportMethod_on_(method,aStream);
  31013. }, function($ctx2) {$ctx2.fillBlock({method:method},$ctx1,1)});
  31014. }));
  31015. return self;
  31016. }, function($ctx1) {$ctx1.fill(self,"exportBehavior:on:",{aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31017. },
  31018. args: ["aBehavior", "aStream"],
  31019. source: "exportBehavior: aBehavior on: aStream\x0a\x09aBehavior exportBehaviorDefinitionTo: aStream using: self.\x0a\x09aBehavior ownMethods do: [ :method |\x0a\x09\x09self exportMethod: method on: aStream ]",
  31020. referencedClasses: [],
  31021. messageSends: ["exportBehaviorDefinitionTo:using:", "do:", "ownMethods", "exportMethod:on:"]
  31022. }),
  31023. $globals.Exporter);
  31024. $core.addMethod(
  31025. $core.method({
  31026. selector: "exportDefinitionOf:on:",
  31027. protocol: "output",
  31028. fn: function (aClass,aStream){
  31029. var self=this,$self=this;
  31030. return $core.withContext(function($ctx1) {
  31031. var $3,$5,$4,$6,$7,$2,$1,$8,$10,$9,$receiver;
  31032. $recv(aStream)._lf();
  31033. $ctx1.sendIdx["lf"]=1;
  31034. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31035. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31036. $5=$recv(aClass)._superclass();
  31037. if(($receiver = $5) == null || $receiver.a$nil){
  31038. $4="null";
  31039. } else {
  31040. var superclass;
  31041. superclass=$receiver;
  31042. $4=$recv(superclass)._asJavaScriptSource();
  31043. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31044. }
  31045. $6=$recv($recv(aClass)._instanceVariableNames())._asJavaScriptSource();
  31046. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31047. $7=$recv($recv(aClass)._category())._asJavaScriptSource();
  31048. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31049. $2=["$core.addClass(",$3,", ",$4,", ",$6,", ",$7,");"];
  31050. $1=$recv(aStream)._write_($2);
  31051. $ctx1.sendIdx["write:"]=1;
  31052. $8=$recv(aClass)._comment();
  31053. $ctx1.sendIdx["comment"]=1;
  31054. $recv($8)._ifNotEmpty_((function(){
  31055. return $core.withContext(function($ctx2) {
  31056. $recv(aStream)._lf();
  31057. $ctx2.sendIdx["lf"]=2;
  31058. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31059. $ctx2.sendIdx["write:"]=2;
  31060. $recv(aStream)._lf();
  31061. $ctx2.sendIdx["lf"]=3;
  31062. $10=$recv(aClass)._asJavaScriptSource();
  31063. $ctx2.sendIdx["asJavaScriptSource"]=5;
  31064. $9=[$10,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31065. $recv(aStream)._write_($9);
  31066. $ctx2.sendIdx["write:"]=3;
  31067. $recv(aStream)._lf();
  31068. $ctx2.sendIdx["lf"]=4;
  31069. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  31071. }));
  31072. $recv(aStream)._lf();
  31073. return self;
  31074. }, function($ctx1) {$ctx1.fill(self,"exportDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31075. },
  31076. args: ["aClass", "aStream"],
  31077. 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",
  31078. referencedClasses: [],
  31079. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "ifNil:ifNotNil:", "superclass", "instanceVariableNames", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31080. }),
  31081. $globals.Exporter);
  31082. $core.addMethod(
  31083. $core.method({
  31084. selector: "exportMetaDefinitionOf:on:",
  31085. protocol: "output",
  31086. fn: function (aClass,aStream){
  31087. var self=this,$self=this;
  31088. return $core.withContext(function($ctx1) {
  31089. var $2,$1,$4,$3;
  31090. $recv(aStream)._lf();
  31091. $ctx1.sendIdx["lf"]=1;
  31092. $2=$recv(aClass)._theMetaClass();
  31093. $ctx1.sendIdx["theMetaClass"]=1;
  31094. $1=$recv($2)._instanceVariableNames();
  31095. $recv($1)._ifNotEmpty_((function(classIvars){
  31096. return $core.withContext(function($ctx2) {
  31097. $4=$recv($recv(aClass)._theMetaClass())._asJavaScriptSource();
  31098. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31099. $3=[$4,".iVarNames = ",$recv(classIvars)._asJavaScriptSource(),";"];
  31100. $recv(aStream)._write_($3);
  31101. return $recv(aStream)._lf();
  31102. }, function($ctx2) {$ctx2.fillBlock({classIvars:classIvars},$ctx1,1)});
  31103. }));
  31104. return self;
  31105. }, function($ctx1) {$ctx1.fill(self,"exportMetaDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31106. },
  31107. args: ["aClass", "aStream"],
  31108. 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 ]",
  31109. referencedClasses: [],
  31110. messageSends: ["lf", "ifNotEmpty:", "instanceVariableNames", "theMetaClass", "write:", "asJavaScriptSource"]
  31111. }),
  31112. $globals.Exporter);
  31113. $core.addMethod(
  31114. $core.method({
  31115. selector: "exportMethod:on:",
  31116. protocol: "output",
  31117. fn: function (aMethod,aStream){
  31118. var self=this,$self=this;
  31119. return $core.withContext(function($ctx1) {
  31120. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11;
  31121. $recv(aStream)._write_("$core.addMethod(");
  31122. $ctx1.sendIdx["write:"]=1;
  31123. $recv(aStream)._lf();
  31124. $ctx1.sendIdx["lf"]=1;
  31125. $recv(aStream)._write_("$core.method({");
  31126. $ctx1.sendIdx["write:"]=2;
  31127. $recv(aStream)._lf();
  31128. $ctx1.sendIdx["lf"]=2;
  31129. $2=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  31130. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31131. $1=["selector: ",$2,","];
  31132. $recv(aStream)._write_($1);
  31133. $ctx1.sendIdx["write:"]=3;
  31134. $recv(aStream)._lf();
  31135. $ctx1.sendIdx["lf"]=3;
  31136. $4=$recv($recv(aMethod)._protocol())._asJavaScriptSource();
  31137. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31138. $3=["protocol: ",$4,","];
  31139. $recv(aStream)._write_($3);
  31140. $ctx1.sendIdx["write:"]=4;
  31141. $recv(aStream)._lf();
  31142. $ctx1.sendIdx["lf"]=4;
  31143. $recv(aStream)._write_(["fn: ",$recv($recv(aMethod)._fn())._compiledSource(),","]);
  31144. $ctx1.sendIdx["write:"]=5;
  31145. $recv(aStream)._lf();
  31146. $ctx1.sendIdx["lf"]=5;
  31147. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31148. $ctx1.sendIdx["write:"]=6;
  31149. $recv(aStream)._lf();
  31150. $ctx1.sendIdx["lf"]=6;
  31151. $6=$recv($recv(aMethod)._arguments())._asJavaScriptSource();
  31152. $ctx1.sendIdx["asJavaScriptSource"]=3;
  31153. $5=["args: ",$6,","];
  31154. $recv(aStream)._write_($5);
  31155. $ctx1.sendIdx["write:"]=7;
  31156. $recv(aStream)._lf();
  31157. $ctx1.sendIdx["lf"]=7;
  31158. $8=$recv($recv(aMethod)._source())._asJavaScriptSource();
  31159. $ctx1.sendIdx["asJavaScriptSource"]=4;
  31160. $7=["source: ",$8,","];
  31161. $recv(aStream)._write_($7);
  31162. $ctx1.sendIdx["write:"]=8;
  31163. $recv(aStream)._lf();
  31164. $ctx1.sendIdx["lf"]=8;
  31165. $10=$recv($recv(aMethod)._referencedClasses())._asJavaScriptSource();
  31166. $ctx1.sendIdx["asJavaScriptSource"]=5;
  31167. $9=["referencedClasses: ",$10,","];
  31168. $recv(aStream)._write_($9);
  31169. $ctx1.sendIdx["write:"]=9;
  31170. $recv(aStream)._lf();
  31171. $ctx1.sendIdx["lf"]=9;
  31172. $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31173. $ctx1.sendIdx["write:"]=10;
  31174. $recv(aStream)._lf();
  31175. $ctx1.sendIdx["lf"]=10;
  31176. $12=$recv($recv(aMethod)._messageSends())._asJavaScriptSource();
  31177. $ctx1.sendIdx["asJavaScriptSource"]=6;
  31178. $11=["messageSends: ",$12];
  31179. $recv(aStream)._write_($11);
  31180. $ctx1.sendIdx["write:"]=11;
  31181. $recv(aStream)._lf();
  31182. $ctx1.sendIdx["lf"]=11;
  31183. $recv(aStream)._write_("}),");
  31184. $ctx1.sendIdx["write:"]=12;
  31185. $recv(aStream)._lf();
  31186. $ctx1.sendIdx["lf"]=12;
  31187. $recv(aStream)._write_([$recv($recv(aMethod)._methodClass())._asJavaScriptSource(),");"]);
  31188. $recv(aStream)._lf();
  31189. $ctx1.sendIdx["lf"]=13;
  31190. $recv(aStream)._lf();
  31191. return self;
  31192. }, function($ctx1) {$ctx1.fill(self,"exportMethod:on:",{aMethod:aMethod,aStream:aStream},$globals.Exporter)});
  31193. },
  31194. args: ["aMethod", "aStream"],
  31195. 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",
  31196. referencedClasses: [],
  31197. messageSends: ["write:", "lf", "asJavaScriptSource", "selector", "protocol", "compiledSource", "fn", "arguments", "source", "referencedClasses", "messageSends", "methodClass"]
  31198. }),
  31199. $globals.Exporter);
  31200. $core.addMethod(
  31201. $core.method({
  31202. selector: "exportPackage:on:",
  31203. protocol: "output",
  31204. fn: function (aPackage,aStream){
  31205. var self=this,$self=this;
  31206. return $core.withContext(function($ctx1) {
  31207. var $1,$receiver;
  31208. $self._exportPackagePrologueOf_on_(aPackage,aStream);
  31209. $self._exportPackageDefinitionOf_on_(aPackage,aStream);
  31210. $self._exportPackageContextOf_on_(aPackage,aStream);
  31211. $self._exportPackageImportsOf_on_(aPackage,aStream);
  31212. $self._exportPackageTransportOf_on_(aPackage,aStream);
  31213. $recv($recv(aPackage)._sortedClasses())._do_((function(each){
  31214. return $core.withContext(function($ctx2) {
  31215. $self._exportBehavior_on_(each,aStream);
  31216. $ctx2.sendIdx["exportBehavior:on:"]=1;
  31217. $1=$recv(each)._theMetaClass();
  31218. if(($receiver = $1) == null || $receiver.a$nil){
  31219. return $1;
  31220. } else {
  31221. var meta;
  31222. meta=$receiver;
  31223. return $self._exportBehavior_on_(meta,aStream);
  31224. }
  31225. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31226. }));
  31227. $ctx1.sendIdx["do:"]=1;
  31228. $self._exportPackageTraitCompositionsOf_on_(aPackage,aStream);
  31229. $recv($self._extensionMethodsOfPackage_(aPackage))._do_((function(each){
  31230. return $core.withContext(function($ctx2) {
  31231. return $self._exportMethod_on_(each,aStream);
  31232. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  31233. }));
  31234. $self._exportPackageEpilogueOf_on_(aPackage,aStream);
  31235. return self;
  31236. }, function($ctx1) {$ctx1.fill(self,"exportPackage:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31237. },
  31238. args: ["aPackage", "aStream"],
  31239. 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",
  31240. referencedClasses: [],
  31241. messageSends: ["exportPackagePrologueOf:on:", "exportPackageDefinitionOf:on:", "exportPackageContextOf:on:", "exportPackageImportsOf:on:", "exportPackageTransportOf:on:", "do:", "sortedClasses", "exportBehavior:on:", "ifNotNil:", "theMetaClass", "exportPackageTraitCompositionsOf:on:", "extensionMethodsOfPackage:", "exportMethod:on:", "exportPackageEpilogueOf:on:"]
  31242. }),
  31243. $globals.Exporter);
  31244. $core.addMethod(
  31245. $core.method({
  31246. selector: "exportPackageBodyBlockPrologueOf:on:",
  31247. protocol: "output",
  31248. fn: function (aPackage,aStream){
  31249. var self=this,$self=this;
  31250. return $core.withContext(function($ctx1) {
  31251. $recv(aStream)._write_("if(!(\x22nilAsValue\x22 in $boot))$boot.nilAsValue=$boot.nilAsReceiver;");
  31252. $ctx1.sendIdx["write:"]=1;
  31253. $recv(aStream)._lf();
  31254. $ctx1.sendIdx["lf"]=1;
  31255. $recv(aStream)._write_("var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;");
  31256. $recv(aStream)._lf();
  31257. return self;
  31258. }, function($ctx1) {$ctx1.fill(self,"exportPackageBodyBlockPrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31259. },
  31260. args: ["aPackage", "aStream"],
  31261. 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",
  31262. referencedClasses: [],
  31263. messageSends: ["write:", "lf"]
  31264. }),
  31265. $globals.Exporter);
  31266. $core.addMethod(
  31267. $core.method({
  31268. selector: "exportPackageContextOf:on:",
  31269. protocol: "output",
  31270. fn: function (aPackage,aStream){
  31271. var self=this,$self=this;
  31272. return $core.withContext(function($ctx1) {
  31273. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].innerEval = ","function (expr) { return eval(expr); }",";"]);
  31274. $recv(aStream)._lf();
  31275. return self;
  31276. }, function($ctx1) {$ctx1.fill(self,"exportPackageContextOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31277. },
  31278. args: ["aPackage", "aStream"],
  31279. 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",
  31280. referencedClasses: [],
  31281. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31282. }),
  31283. $globals.Exporter);
  31284. $core.addMethod(
  31285. $core.method({
  31286. selector: "exportPackageDefinitionOf:on:",
  31287. protocol: "output",
  31288. fn: function (aPackage,aStream){
  31289. var self=this,$self=this;
  31290. return $core.withContext(function($ctx1) {
  31291. $recv(aStream)._write_(["$core.addPackage(",$recv($recv(aPackage)._name())._asJavaScriptSource(),");"]);
  31292. $recv(aStream)._lf();
  31293. return self;
  31294. }, function($ctx1) {$ctx1.fill(self,"exportPackageDefinitionOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31295. },
  31296. args: ["aPackage", "aStream"],
  31297. source: "exportPackageDefinitionOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: { '$core.addPackage('. aPackage name asJavaScriptSource. ');' };\x0a\x09\x09lf",
  31298. referencedClasses: [],
  31299. messageSends: ["write:", "asJavaScriptSource", "name", "lf"]
  31300. }),
  31301. $globals.Exporter);
  31302. $core.addMethod(
  31303. $core.method({
  31304. selector: "exportPackageEpilogueOf:on:",
  31305. protocol: "output",
  31306. fn: function (aPackage,aStream){
  31307. var self=this,$self=this;
  31308. return $core.withContext(function($ctx1) {
  31309. $self._subclassResponsibility();
  31310. return self;
  31311. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31312. },
  31313. args: ["aPackage", "aStream"],
  31314. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31315. referencedClasses: [],
  31316. messageSends: ["subclassResponsibility"]
  31317. }),
  31318. $globals.Exporter);
  31319. $core.addMethod(
  31320. $core.method({
  31321. selector: "exportPackageImportsOf:on:",
  31322. protocol: "output",
  31323. fn: function (aPackage,aStream){
  31324. var self=this,$self=this;
  31325. return $core.withContext(function($ctx1) {
  31326. var $2,$1;
  31327. $recv($recv(aPackage)._importsAsJson())._ifNotEmpty_((function(imports){
  31328. return $core.withContext(function($ctx2) {
  31329. $2=$recv($recv(aPackage)._name())._asJavaScriptSource();
  31330. $ctx2.sendIdx["asJavaScriptSource"]=1;
  31331. $1=["($core.packageDescriptors||$core.packages)[",$2,"].imports = ",$recv(imports)._asJavaScriptSource(),";"];
  31332. $recv(aStream)._write_($1);
  31333. return $recv(aStream)._lf();
  31334. }, function($ctx2) {$ctx2.fillBlock({imports:imports},$ctx1,1)});
  31335. }));
  31336. return self;
  31337. }, function($ctx1) {$ctx1.fill(self,"exportPackageImportsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31338. },
  31339. args: ["aPackage", "aStream"],
  31340. 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 ]",
  31341. referencedClasses: [],
  31342. messageSends: ["ifNotEmpty:", "importsAsJson", "write:", "asJavaScriptSource", "name", "lf"]
  31343. }),
  31344. $globals.Exporter);
  31345. $core.addMethod(
  31346. $core.method({
  31347. selector: "exportPackagePrologueOf:on:",
  31348. protocol: "output",
  31349. fn: function (aPackage,aStream){
  31350. var self=this,$self=this;
  31351. return $core.withContext(function($ctx1) {
  31352. $self._subclassResponsibility();
  31353. return self;
  31354. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31355. },
  31356. args: ["aPackage", "aStream"],
  31357. source: "exportPackagePrologueOf: aPackage on: aStream\x0a\x09self subclassResponsibility",
  31358. referencedClasses: [],
  31359. messageSends: ["subclassResponsibility"]
  31360. }),
  31361. $globals.Exporter);
  31362. $core.addMethod(
  31363. $core.method({
  31364. selector: "exportPackageTraitCompositionsOf:on:",
  31365. protocol: "output",
  31366. fn: function (aPackage,aStream){
  31367. var self=this,$self=this;
  31368. return $core.withContext(function($ctx1) {
  31369. $recv($recv(aPackage)._traitCompositions())._ifNotEmpty_((function(traitCompositions){
  31370. return $core.withContext(function($ctx2) {
  31371. $recv(traitCompositions)._keysAndValuesDo_((function(key,value){
  31372. return $core.withContext(function($ctx3) {
  31373. return $self._exportTraitComposition_of_on_(value,key,aStream);
  31374. }, function($ctx3) {$ctx3.fillBlock({key:key,value:value},$ctx2,2)});
  31375. }));
  31376. return $recv(aStream)._lf();
  31377. }, function($ctx2) {$ctx2.fillBlock({traitCompositions:traitCompositions},$ctx1,1)});
  31378. }));
  31379. return self;
  31380. }, function($ctx1) {$ctx1.fill(self,"exportPackageTraitCompositionsOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31381. },
  31382. args: ["aPackage", "aStream"],
  31383. 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 ]",
  31384. referencedClasses: [],
  31385. messageSends: ["ifNotEmpty:", "traitCompositions", "keysAndValuesDo:", "exportTraitComposition:of:on:", "lf"]
  31386. }),
  31387. $globals.Exporter);
  31388. $core.addMethod(
  31389. $core.method({
  31390. selector: "exportPackageTransportOf:on:",
  31391. protocol: "output",
  31392. fn: function (aPackage,aStream){
  31393. var self=this,$self=this;
  31394. return $core.withContext(function($ctx1) {
  31395. $recv(aStream)._write_(["($core.packageDescriptors||$core.packages)[",$recv($recv(aPackage)._name())._asJavaScriptSource(),"].transport = ",$recv($recv(aPackage)._transport())._asJSONString(),";"]);
  31396. $recv(aStream)._lf();
  31397. return self;
  31398. }, function($ctx1) {$ctx1.fill(self,"exportPackageTransportOf:on:",{aPackage:aPackage,aStream:aStream},$globals.Exporter)});
  31399. },
  31400. args: ["aPackage", "aStream"],
  31401. 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",
  31402. referencedClasses: [],
  31403. messageSends: ["write:", "asJavaScriptSource", "name", "asJSONString", "transport", "lf"]
  31404. }),
  31405. $globals.Exporter);
  31406. $core.addMethod(
  31407. $core.method({
  31408. selector: "exportTraitComposition:of:on:",
  31409. protocol: "output",
  31410. fn: function (aTraitComposition,aBehavior,aStream){
  31411. var self=this,$self=this;
  31412. return $core.withContext(function($ctx1) {
  31413. var $2,$1;
  31414. $2=$recv(aTraitComposition)._asJavaScriptSource();
  31415. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31416. $1=["$core.setTraitComposition(",$2,", ",$recv(aBehavior)._asJavaScriptSource(),");"];
  31417. $recv(aStream)._write_($1);
  31418. $recv(aStream)._lf();
  31419. return self;
  31420. }, function($ctx1) {$ctx1.fill(self,"exportTraitComposition:of:on:",{aTraitComposition:aTraitComposition,aBehavior:aBehavior,aStream:aStream},$globals.Exporter)});
  31421. },
  31422. args: ["aTraitComposition", "aBehavior", "aStream"],
  31423. 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",
  31424. referencedClasses: [],
  31425. messageSends: ["write:", "asJavaScriptSource", "lf"]
  31426. }),
  31427. $globals.Exporter);
  31428. $core.addMethod(
  31429. $core.method({
  31430. selector: "exportTraitDefinitionOf:on:",
  31431. protocol: "output",
  31432. fn: function (aClass,aStream){
  31433. var self=this,$self=this;
  31434. return $core.withContext(function($ctx1) {
  31435. var $3,$4,$2,$1,$5,$7,$6;
  31436. $recv(aStream)._lf();
  31437. $ctx1.sendIdx["lf"]=1;
  31438. $3=$recv($recv(aClass)._name())._asJavaScriptSource();
  31439. $ctx1.sendIdx["asJavaScriptSource"]=1;
  31440. $4=$recv($recv(aClass)._category())._asJavaScriptSource();
  31441. $ctx1.sendIdx["asJavaScriptSource"]=2;
  31442. $2=["$core.addTrait(",$3,", ",$4,");"];
  31443. $1=$recv(aStream)._write_($2);
  31444. $ctx1.sendIdx["write:"]=1;
  31445. $5=$recv(aClass)._comment();
  31446. $ctx1.sendIdx["comment"]=1;
  31447. $recv($5)._ifNotEmpty_((function(){
  31448. return $core.withContext(function($ctx2) {
  31449. $recv(aStream)._lf();
  31450. $ctx2.sendIdx["lf"]=2;
  31451. $recv(aStream)._write_("//>>excludeStart(\x22ide\x22, pragmas.excludeIdeData);");
  31452. $ctx2.sendIdx["write:"]=2;
  31453. $recv(aStream)._lf();
  31454. $ctx2.sendIdx["lf"]=3;
  31455. $7=$recv(aClass)._asJavaScriptSource();
  31456. $ctx2.sendIdx["asJavaScriptSource"]=3;
  31457. $6=[$7,".comment=",$recv($recv($recv(aClass)._comment())._crlfSanitized())._asJavaScriptSource(),";"];
  31458. $recv(aStream)._write_($6);
  31459. $ctx2.sendIdx["write:"]=3;
  31460. $recv(aStream)._lf();
  31461. $ctx2.sendIdx["lf"]=4;
  31462. return $recv(aStream)._write_("//>>excludeEnd(\x22ide\x22);");
  31463. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31464. }));
  31465. $recv(aStream)._lf();
  31466. return self;
  31467. }, function($ctx1) {$ctx1.fill(self,"exportTraitDefinitionOf:on:",{aClass:aClass,aStream:aStream},$globals.Exporter)});
  31468. },
  31469. args: ["aClass", "aStream"],
  31470. 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",
  31471. referencedClasses: [],
  31472. messageSends: ["lf", "write:", "asJavaScriptSource", "name", "category", "ifNotEmpty:", "comment", "crlfSanitized"]
  31473. }),
  31474. $globals.Exporter);
  31475. $core.addMethod(
  31476. $core.method({
  31477. selector: "ownMethodsOfClass:",
  31478. protocol: "accessing",
  31479. fn: function (aClass){
  31480. var self=this,$self=this;
  31481. return $core.withContext(function($ctx1) {
  31482. var $1;
  31483. return $recv($recv($recv($recv(aClass)._methodDictionary())._values())._sorted_((function(a,b){
  31484. return $core.withContext(function($ctx2) {
  31485. $1=$recv(a)._selector();
  31486. $ctx2.sendIdx["selector"]=1;
  31487. return $recv($1).__lt_eq($recv(b)._selector());
  31488. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31489. })))._reject_((function(each){
  31490. return $core.withContext(function($ctx2) {
  31491. return $recv($recv(each)._protocol())._match_("^\x5c*");
  31492. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31493. }));
  31494. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfClass:",{aClass:aClass},$globals.Exporter)});
  31495. },
  31496. args: ["aClass"],
  31497. 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*') ]",
  31498. referencedClasses: [],
  31499. messageSends: ["reject:", "sorted:", "values", "methodDictionary", "<=", "selector", "match:", "protocol"]
  31500. }),
  31501. $globals.Exporter);
  31502. $core.addMethod(
  31503. $core.method({
  31504. selector: "ownMethodsOfMetaClass:",
  31505. protocol: "accessing",
  31506. fn: function (aClass){
  31507. var self=this,$self=this;
  31508. return $core.withContext(function($ctx1) {
  31509. return $self._ownMethodsOfClass_($recv(aClass)._theMetaClass());
  31510. }, function($ctx1) {$ctx1.fill(self,"ownMethodsOfMetaClass:",{aClass:aClass},$globals.Exporter)});
  31511. },
  31512. args: ["aClass"],
  31513. source: "ownMethodsOfMetaClass: aClass\x0a\x09\x22Issue #143: sort methods alphabetically\x22\x0a\x0a\x09^ self ownMethodsOfClass: aClass theMetaClass",
  31514. referencedClasses: [],
  31515. messageSends: ["ownMethodsOfClass:", "theMetaClass"]
  31516. }),
  31517. $globals.Exporter);
  31518. $core.addClass("AmdExporter", $globals.Exporter, ["namespace"], "Platform-ImportExport");
  31519. $globals.AmdExporter.comment="I am used to export Packages in an AMD (Asynchronous Module Definition) JavaScript format.";
  31520. $core.addMethod(
  31521. $core.method({
  31522. selector: "amdNamesOfPackages:",
  31523. protocol: "private",
  31524. fn: function (anArray){
  31525. var self=this,$self=this;
  31526. return $core.withContext(function($ctx1) {
  31527. var $1;
  31528. return $recv($recv(anArray)._select_((function(each){
  31529. return $core.withContext(function($ctx2) {
  31530. $1=$self._amdNamespaceOfPackage_(each);
  31531. $ctx2.sendIdx["amdNamespaceOfPackage:"]=1;
  31532. return $recv($1)._notNil();
  31533. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31534. })))._collect_((function(each){
  31535. return $core.withContext(function($ctx2) {
  31536. return $recv($recv($self._amdNamespaceOfPackage_(each)).__comma("/")).__comma($recv(each)._name());
  31537. $ctx2.sendIdx[","]=1;
  31538. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  31539. }));
  31540. }, function($ctx1) {$ctx1.fill(self,"amdNamesOfPackages:",{anArray:anArray},$globals.AmdExporter)});
  31541. },
  31542. args: ["anArray"],
  31543. source: "amdNamesOfPackages: anArray\x0a\x09^ (anArray\x0a\x09\x09select: [ :each | (self amdNamespaceOfPackage: each) notNil ])\x0a\x09\x09collect: [ :each | (self amdNamespaceOfPackage: each), '/', each name ]",
  31544. referencedClasses: [],
  31545. messageSends: ["collect:", "select:", "notNil", "amdNamespaceOfPackage:", ",", "name"]
  31546. }),
  31547. $globals.AmdExporter);
  31548. $core.addMethod(
  31549. $core.method({
  31550. selector: "amdNamespaceOfPackage:",
  31551. protocol: "private",
  31552. fn: function (aPackage){
  31553. var self=this,$self=this;
  31554. return $core.withContext(function($ctx1) {
  31555. var $3,$2,$1;
  31556. $3=$recv(aPackage)._transport();
  31557. $ctx1.sendIdx["transport"]=1;
  31558. $2=$recv($3)._type();
  31559. $1=$recv($2).__eq("amd");
  31560. if($core.assert($1)){
  31561. return $recv($recv(aPackage)._transport())._namespace();
  31562. } else {
  31563. return nil;
  31564. }
  31565. }, function($ctx1) {$ctx1.fill(self,"amdNamespaceOfPackage:",{aPackage:aPackage},$globals.AmdExporter)});
  31566. },
  31567. args: ["aPackage"],
  31568. source: "amdNamespaceOfPackage: aPackage\x0a\x09^ (aPackage transport type = 'amd')\x0a\x09\x09ifTrue: [ aPackage transport namespace ]\x0a\x09\x09ifFalse: [ nil ]",
  31569. referencedClasses: [],
  31570. messageSends: ["ifTrue:ifFalse:", "=", "type", "transport", "namespace"]
  31571. }),
  31572. $globals.AmdExporter);
  31573. $core.addMethod(
  31574. $core.method({
  31575. selector: "exportPackageEpilogueOf:on:",
  31576. protocol: "output",
  31577. fn: function (aPackage,aStream){
  31578. var self=this,$self=this;
  31579. return $core.withContext(function($ctx1) {
  31580. $recv(aStream)._write_("});");
  31581. $recv(aStream)._lf();
  31582. return self;
  31583. }, function($ctx1) {$ctx1.fill(self,"exportPackageEpilogueOf:on:",{aPackage:aPackage,aStream:aStream},$globals.AmdExporter)});
  31584. },
  31585. args: ["aPackage", "aStream"],
  31586. source: "exportPackageEpilogueOf: aPackage on: aStream\x0a\x09aStream\x0a\x09\x09write: '});';\x0a\x09\x09lf",
  31587. referencedClasses: [],
  31588. messageSends: ["write:", "lf"]
  31589. }),
  31590. $globals.AmdExporter);
  31591. $core.addMethod(
  31592. $core.method({
  31593. selector: "exportPackagePrologueOf:on:",
  31594. protocol: "output",
  31595. fn: function (aPackage,aStream){
  31596. var self=this,$self=this;
  31597. var importsForOutput,loadDependencies,pragmaStart,pragmaEnd;
  31598. return $core.withContext(function($ctx1) {
  31599. var $1,$3,$2,$4,$6,$5,$7,$14,$13,$12,$11,$10,$9,$18,$17,$16,$15,$8;
  31600. pragmaStart="";
  31601. pragmaEnd="";
  31602. importsForOutput=$self._importsForOutput_(aPackage);
  31603. loadDependencies=$self._amdNamesOfPackages_($recv(aPackage)._loadDependencies());
  31604. $1=$recv(importsForOutput)._value();
  31605. $ctx1.sendIdx["value"]=1;
  31606. $recv($1)._ifNotEmpty_((function(){
  31607. return $core.withContext(function($ctx2) {
  31608. $3=$recv($globals.String)._lf();
  31609. $ctx2.sendIdx["lf"]=1;
  31610. $2=$recv($3).__comma("//>>excludeStart(\x22imports\x22, pragmas.excludeImports);");
  31611. $ctx2.sendIdx[","]=2;
  31612. $4=$recv($globals.String)._lf();
  31613. $ctx2.sendIdx["lf"]=2;
  31614. pragmaStart=$recv($2).__comma($4);
  31615. $ctx2.sendIdx[","]=1;
  31616. $6=$recv($globals.String)._lf();
  31617. $ctx2.sendIdx["lf"]=3;
  31618. $5=$recv($6).__comma("//>>excludeEnd(\x22imports\x22);");
  31619. $ctx2.sendIdx[","]=4;
  31620. $7=$recv($globals.String)._lf();
  31621. $ctx2.sendIdx["lf"]=4;
  31622. pragmaEnd=$recv($5).__comma($7);
  31623. $ctx2.sendIdx[","]=3;
  31624. return pragmaEnd;
  31625. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31626. }));
  31627. $14=["amber/boot", ":1:"].__comma($recv(importsForOutput)._value());
  31628. $ctx1.sendIdx[","]=7;
  31629. $13=$recv($14).__comma([":2:"]);
  31630. $ctx1.sendIdx[","]=6;
  31631. $12=$recv($13).__comma($recv($recv(loadDependencies)._asArray())._sorted());
  31632. $ctx1.sendIdx[","]=5;
  31633. $11=$recv($12)._asJavaScriptSource();
  31634. $10=$recv($11)._replace_with_(",\x5cs*[\x22']:1:[\x22']",pragmaStart);
  31635. $ctx1.sendIdx["replace:with:"]=2;
  31636. $9=$recv($10)._replace_with_(",\x5cs*[\x22']:2:[\x22']",pragmaEnd);
  31637. $ctx1.sendIdx["replace:with:"]=1;
  31638. $18=$recv(["$boot", ":1:"].__comma($recv(importsForOutput)._key())).__comma([":2:"]);
  31639. $ctx1.sendIdx[","]=8;
  31640. $17=$recv($18)._join_(",");
  31641. $16=$recv($17)._replace_with_(",\x5cs*:1:",pragmaStart);
  31642. $15=$recv($16)._replace_with_(",\x5cs*:2:",pragmaEnd);
  31643. $ctx1.sendIdx["replace:with:"]=3;
  31644. $8=["define(",$9,", function(",$15,"){\x22use strict\x22;"];
  31645. $recv(aStream)._write_($8);
  31646. $recv(aStream)._lf();
  31647. $self._exportPackageBodyBlockPrologueOf_on_(aPackage,aStream);
  31648. return self;
  31649. }, function($ctx1) {$ctx1.fill(self,"exportPackagePrologueOf:on:",{aPackage:aPackage,aStream:aStream,importsForOutput:importsForOutput,loadDependencies:loadDependencies,pragmaStart:pragmaStart,pragmaEnd:pragmaEnd},$globals.AmdExporter)});
  31650. },
  31651. args: ["aPackage", "aStream"],
  31652. 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",
  31653. referencedClasses: ["String"],
  31654. messageSends: ["importsForOutput:", "amdNamesOfPackages:", "loadDependencies", "ifNotEmpty:", "value", ",", "lf", "write:", "replace:with:", "asJavaScriptSource", "sorted", "asArray", "join:", "key", "exportPackageBodyBlockPrologueOf:on:"]
  31655. }),
  31656. $globals.AmdExporter);
  31657. $core.addMethod(
  31658. $core.method({
  31659. selector: "importsForOutput:",
  31660. protocol: "private",
  31661. fn: function (aPackage){
  31662. var self=this,$self=this;
  31663. var namedImports,anonImports,importVarNames;
  31664. return $core.withContext(function($ctx1) {
  31665. var $1;
  31666. namedImports=[];
  31667. anonImports=[];
  31668. importVarNames=[];
  31669. $recv($recv(aPackage)._imports())._do_((function(each){
  31670. return $core.withContext(function($ctx2) {
  31671. $1=$recv(each)._isString();
  31672. if($core.assert($1)){
  31673. return $recv(anonImports)._add_(each);
  31674. $ctx2.sendIdx["add:"]=1;
  31675. } else {
  31676. $recv(namedImports)._add_($recv(each)._value());
  31677. $ctx2.sendIdx["add:"]=2;
  31678. return $recv(importVarNames)._add_($recv(each)._key());
  31679. }
  31680. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  31681. }));
  31682. return $recv(importVarNames).__minus_gt($recv(namedImports).__comma(anonImports));
  31683. }, function($ctx1) {$ctx1.fill(self,"importsForOutput:",{aPackage:aPackage,namedImports:namedImports,anonImports:anonImports,importVarNames:importVarNames},$globals.AmdExporter)});
  31684. },
  31685. args: ["aPackage"],
  31686. 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)",
  31687. referencedClasses: [],
  31688. messageSends: ["do:", "imports", "ifTrue:ifFalse:", "isString", "add:", "value", "key", "->", ","]
  31689. }),
  31690. $globals.AmdExporter);
  31691. $core.addClass("ChunkParser", $globals.Object, ["stream", "last"], "Platform-ImportExport");
  31692. $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";
  31693. $core.addMethod(
  31694. $core.method({
  31695. selector: "last",
  31696. protocol: "accessing",
  31697. fn: function (){
  31698. var self=this,$self=this;
  31699. return $self["@last"];
  31700. },
  31701. args: [],
  31702. source: "last\x0a\x09^ last",
  31703. referencedClasses: [],
  31704. messageSends: []
  31705. }),
  31706. $globals.ChunkParser);
  31707. $core.addMethod(
  31708. $core.method({
  31709. selector: "nextChunk",
  31710. protocol: "reading",
  31711. fn: function (){
  31712. var self=this,$self=this;
  31713. var char,result,chunk;
  31714. return $core.withContext(function($ctx1) {
  31715. var $1,$2,$3,$4;
  31716. var $early={};
  31717. try {
  31718. result=""._writeStream();
  31719. $recv((function(){
  31720. return $core.withContext(function($ctx2) {
  31721. char=$recv($self["@stream"])._next();
  31722. $ctx2.sendIdx["next"]=1;
  31723. return $recv(char)._notNil();
  31724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31725. }))._whileTrue_((function(){
  31726. return $core.withContext(function($ctx2) {
  31727. $1=$recv(char).__eq("!");
  31728. $ctx2.sendIdx["="]=1;
  31729. if($core.assert($1)){
  31730. $2=$recv($recv($self["@stream"])._peek()).__eq("!");
  31731. if($core.assert($2)){
  31732. $recv($self["@stream"])._next();
  31733. } else {
  31734. $self["@last"]=$recv($recv(result)._contents())._trimBoth();
  31735. $3=$self["@last"];
  31736. throw $early=[$3];
  31737. }
  31738. }
  31739. return $recv(result)._nextPut_(char);
  31740. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31741. }));
  31742. $self["@last"]=nil;
  31743. $4=$self["@last"];
  31744. return $4;
  31745. }
  31746. catch(e) {if(e===$early)return e[0]; throw e}
  31747. }, function($ctx1) {$ctx1.fill(self,"nextChunk",{char:char,result:result,chunk:chunk},$globals.ChunkParser)});
  31748. },
  31749. args: [],
  31750. 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",
  31751. referencedClasses: [],
  31752. messageSends: ["writeStream", "whileTrue:", "next", "notNil", "ifTrue:", "=", "ifTrue:ifFalse:", "peek", "trimBoth", "contents", "nextPut:"]
  31753. }),
  31754. $globals.ChunkParser);
  31755. $core.addMethod(
  31756. $core.method({
  31757. selector: "stream:",
  31758. protocol: "accessing",
  31759. fn: function (aStream){
  31760. var self=this,$self=this;
  31761. $self["@stream"]=aStream;
  31762. return self;
  31763. },
  31764. args: ["aStream"],
  31765. source: "stream: aStream\x0a\x09stream := aStream",
  31766. referencedClasses: [],
  31767. messageSends: []
  31768. }),
  31769. $globals.ChunkParser);
  31770. $core.addMethod(
  31771. $core.method({
  31772. selector: "on:",
  31773. protocol: "instance creation",
  31774. fn: function (aStream){
  31775. var self=this,$self=this;
  31776. return $core.withContext(function($ctx1) {
  31777. return $recv($self._new())._stream_(aStream);
  31778. }, function($ctx1) {$ctx1.fill(self,"on:",{aStream:aStream},$globals.ChunkParser.a$cls)});
  31779. },
  31780. args: ["aStream"],
  31781. source: "on: aStream\x0a\x09^ self new stream: aStream",
  31782. referencedClasses: [],
  31783. messageSends: ["stream:", "new"]
  31784. }),
  31785. $globals.ChunkParser.a$cls);
  31786. $core.addClass("ClassCommentReader", $globals.Object, ["class"], "Platform-ImportExport");
  31787. $globals.ClassCommentReader.comment="I provide a mechanism for retrieving class comments stored on a file.\x0a\x0aSee also `ClassCategoryReader`.";
  31788. $core.addMethod(
  31789. $core.method({
  31790. selector: "class:",
  31791. protocol: "accessing",
  31792. fn: function (aClass){
  31793. var self=this,$self=this;
  31794. $self["@class"]=aClass;
  31795. return self;
  31796. },
  31797. args: ["aClass"],
  31798. source: "class: aClass\x0a\x09class := aClass",
  31799. referencedClasses: [],
  31800. messageSends: []
  31801. }),
  31802. $globals.ClassCommentReader);
  31803. $core.addMethod(
  31804. $core.method({
  31805. selector: "initialize",
  31806. protocol: "initialization",
  31807. fn: function (){
  31808. var self=this,$self=this;
  31809. return $core.withContext(function($ctx1) {
  31810. (
  31811. $ctx1.supercall = true,
  31812. ($globals.ClassCommentReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31813. $ctx1.supercall = false;
  31814. return self;
  31815. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassCommentReader)});
  31816. },
  31817. args: [],
  31818. source: "initialize\x0a\x09super initialize.",
  31819. referencedClasses: [],
  31820. messageSends: ["initialize"]
  31821. }),
  31822. $globals.ClassCommentReader);
  31823. $core.addMethod(
  31824. $core.method({
  31825. selector: "scanFrom:",
  31826. protocol: "fileIn",
  31827. fn: function (aChunkParser){
  31828. var self=this,$self=this;
  31829. var chunk;
  31830. return $core.withContext(function($ctx1) {
  31831. chunk=$recv(aChunkParser)._nextChunk();
  31832. $recv(chunk)._ifNotEmpty_((function(){
  31833. return $core.withContext(function($ctx2) {
  31834. return $self._setComment_(chunk);
  31835. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31836. }));
  31837. return self;
  31838. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassCommentReader)});
  31839. },
  31840. args: ["aChunkParser"],
  31841. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09chunk := aChunkParser nextChunk.\x0a\x09chunk ifNotEmpty: [\x0a\x09\x09self setComment: chunk ].",
  31842. referencedClasses: [],
  31843. messageSends: ["nextChunk", "ifNotEmpty:", "setComment:"]
  31844. }),
  31845. $globals.ClassCommentReader);
  31846. $core.addMethod(
  31847. $core.method({
  31848. selector: "setComment:",
  31849. protocol: "private",
  31850. fn: function (aString){
  31851. var self=this,$self=this;
  31852. return $core.withContext(function($ctx1) {
  31853. $recv($self["@class"])._comment_(aString);
  31854. return self;
  31855. }, function($ctx1) {$ctx1.fill(self,"setComment:",{aString:aString},$globals.ClassCommentReader)});
  31856. },
  31857. args: ["aString"],
  31858. source: "setComment: aString\x0a\x09class comment: aString",
  31859. referencedClasses: [],
  31860. messageSends: ["comment:"]
  31861. }),
  31862. $globals.ClassCommentReader);
  31863. $core.addClass("ClassProtocolReader", $globals.Object, ["class", "category"], "Platform-ImportExport");
  31864. $globals.ClassProtocolReader.comment="I provide a mechanism for retrieving class descriptions stored on a file in the Smalltalk chunk format.";
  31865. $core.addMethod(
  31866. $core.method({
  31867. selector: "class:category:",
  31868. protocol: "accessing",
  31869. fn: function (aClass,aString){
  31870. var self=this,$self=this;
  31871. $self["@class"]=aClass;
  31872. $self["@category"]=aString;
  31873. return self;
  31874. },
  31875. args: ["aClass", "aString"],
  31876. source: "class: aClass category: aString\x0a\x09class := aClass.\x0a\x09category := aString",
  31877. referencedClasses: [],
  31878. messageSends: []
  31879. }),
  31880. $globals.ClassProtocolReader);
  31881. $core.addMethod(
  31882. $core.method({
  31883. selector: "compileMethod:",
  31884. protocol: "private",
  31885. fn: function (aString){
  31886. var self=this,$self=this;
  31887. return $core.withContext(function($ctx1) {
  31888. $recv($recv($globals.Compiler)._new())._install_forClass_protocol_(aString,$self["@class"],$self["@category"]);
  31889. return self;
  31890. }, function($ctx1) {$ctx1.fill(self,"compileMethod:",{aString:aString},$globals.ClassProtocolReader)});
  31891. },
  31892. args: ["aString"],
  31893. source: "compileMethod: aString\x0a\x09Compiler new install: aString forClass: class protocol: category",
  31894. referencedClasses: ["Compiler"],
  31895. messageSends: ["install:forClass:protocol:", "new"]
  31896. }),
  31897. $globals.ClassProtocolReader);
  31898. $core.addMethod(
  31899. $core.method({
  31900. selector: "initialize",
  31901. protocol: "initialization",
  31902. fn: function (){
  31903. var self=this,$self=this;
  31904. return $core.withContext(function($ctx1) {
  31905. (
  31906. $ctx1.supercall = true,
  31907. ($globals.ClassProtocolReader.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  31908. $ctx1.supercall = false;
  31909. return self;
  31910. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ClassProtocolReader)});
  31911. },
  31912. args: [],
  31913. source: "initialize\x0a\x09super initialize.",
  31914. referencedClasses: [],
  31915. messageSends: ["initialize"]
  31916. }),
  31917. $globals.ClassProtocolReader);
  31918. $core.addMethod(
  31919. $core.method({
  31920. selector: "scanFrom:",
  31921. protocol: "fileIn",
  31922. fn: function (aChunkParser){
  31923. var self=this,$self=this;
  31924. var chunk;
  31925. return $core.withContext(function($ctx1) {
  31926. $recv((function(){
  31927. return $core.withContext(function($ctx2) {
  31928. chunk=$recv(aChunkParser)._nextChunk();
  31929. return $recv(chunk)._isEmpty();
  31930. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  31931. }))._whileFalse_((function(){
  31932. return $core.withContext(function($ctx2) {
  31933. return $self._compileMethod_(chunk);
  31934. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  31935. }));
  31936. return self;
  31937. }, function($ctx1) {$ctx1.fill(self,"scanFrom:",{aChunkParser:aChunkParser,chunk:chunk},$globals.ClassProtocolReader)});
  31938. },
  31939. args: ["aChunkParser"],
  31940. source: "scanFrom: aChunkParser\x0a\x09| chunk |\x0a\x09[ chunk := aChunkParser nextChunk.\x0a\x09chunk isEmpty ] whileFalse: [\x0a\x09\x09self compileMethod: chunk ]",
  31941. referencedClasses: [],
  31942. messageSends: ["whileFalse:", "nextChunk", "isEmpty", "compileMethod:"]
  31943. }),
  31944. $globals.ClassProtocolReader);
  31945. $core.addClass("ExportMethodProtocol", $globals.Object, ["name", "theClass"], "Platform-ImportExport");
  31946. $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.";
  31947. $core.addMethod(
  31948. $core.method({
  31949. selector: "methods",
  31950. protocol: "accessing",
  31951. fn: function (){
  31952. var self=this,$self=this;
  31953. return $core.withContext(function($ctx1) {
  31954. var $1;
  31955. return $recv($recv($self._theClass())._methodsInProtocol_($self._name()))._sorted_((function(a,b){
  31956. return $core.withContext(function($ctx2) {
  31957. $1=$recv(a)._selector();
  31958. $ctx2.sendIdx["selector"]=1;
  31959. return $recv($1).__lt_eq($recv(b)._selector());
  31960. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  31961. }));
  31962. }, function($ctx1) {$ctx1.fill(self,"methods",{},$globals.ExportMethodProtocol)});
  31963. },
  31964. args: [],
  31965. source: "methods\x0a\x09^ (self theClass methodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  31966. referencedClasses: [],
  31967. messageSends: ["sorted:", "methodsInProtocol:", "theClass", "name", "<=", "selector"]
  31968. }),
  31969. $globals.ExportMethodProtocol);
  31970. $core.addMethod(
  31971. $core.method({
  31972. selector: "name",
  31973. protocol: "accessing",
  31974. fn: function (){
  31975. var self=this,$self=this;
  31976. return $self["@name"];
  31977. },
  31978. args: [],
  31979. source: "name\x0a\x09^ name",
  31980. referencedClasses: [],
  31981. messageSends: []
  31982. }),
  31983. $globals.ExportMethodProtocol);
  31984. $core.addMethod(
  31985. $core.method({
  31986. selector: "name:",
  31987. protocol: "accessing",
  31988. fn: function (aString){
  31989. var self=this,$self=this;
  31990. $self["@name"]=aString;
  31991. return self;
  31992. },
  31993. args: ["aString"],
  31994. source: "name: aString\x0a\x09name := aString",
  31995. referencedClasses: [],
  31996. messageSends: []
  31997. }),
  31998. $globals.ExportMethodProtocol);
  31999. $core.addMethod(
  32000. $core.method({
  32001. selector: "ownMethods",
  32002. protocol: "accessing",
  32003. fn: function (){
  32004. var self=this,$self=this;
  32005. return $core.withContext(function($ctx1) {
  32006. var $1;
  32007. return $recv($recv($self._theClass())._ownMethodsInProtocol_($self._name()))._sorted_((function(a,b){
  32008. return $core.withContext(function($ctx2) {
  32009. $1=$recv(a)._selector();
  32010. $ctx2.sendIdx["selector"]=1;
  32011. return $recv($1).__lt_eq($recv(b)._selector());
  32012. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,1)});
  32013. }));
  32014. }, function($ctx1) {$ctx1.fill(self,"ownMethods",{},$globals.ExportMethodProtocol)});
  32015. },
  32016. args: [],
  32017. source: "ownMethods\x0a\x09^ (self theClass ownMethodsInProtocol: self name)\x0a\x09\x09sorted: [ :a :b | a selector <= b selector ]",
  32018. referencedClasses: [],
  32019. messageSends: ["sorted:", "ownMethodsInProtocol:", "theClass", "name", "<=", "selector"]
  32020. }),
  32021. $globals.ExportMethodProtocol);
  32022. $core.addMethod(
  32023. $core.method({
  32024. selector: "theClass",
  32025. protocol: "accessing",
  32026. fn: function (){
  32027. var self=this,$self=this;
  32028. return $self["@theClass"];
  32029. },
  32030. args: [],
  32031. source: "theClass\x0a\x09^ theClass",
  32032. referencedClasses: [],
  32033. messageSends: []
  32034. }),
  32035. $globals.ExportMethodProtocol);
  32036. $core.addMethod(
  32037. $core.method({
  32038. selector: "theClass:",
  32039. protocol: "accessing",
  32040. fn: function (aClass){
  32041. var self=this,$self=this;
  32042. $self["@theClass"]=aClass;
  32043. return self;
  32044. },
  32045. args: ["aClass"],
  32046. source: "theClass: aClass\x0a\x09theClass := aClass",
  32047. referencedClasses: [],
  32048. messageSends: []
  32049. }),
  32050. $globals.ExportMethodProtocol);
  32051. $core.addMethod(
  32052. $core.method({
  32053. selector: "name:theClass:",
  32054. protocol: "instance creation",
  32055. fn: function (aString,aClass){
  32056. var self=this,$self=this;
  32057. return $core.withContext(function($ctx1) {
  32058. var $1;
  32059. $1=$self._new();
  32060. $recv($1)._name_(aString);
  32061. $recv($1)._theClass_(aClass);
  32062. return $recv($1)._yourself();
  32063. }, function($ctx1) {$ctx1.fill(self,"name:theClass:",{aString:aString,aClass:aClass},$globals.ExportMethodProtocol.a$cls)});
  32064. },
  32065. args: ["aString", "aClass"],
  32066. source: "name: aString theClass: aClass\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  32067. referencedClasses: [],
  32068. messageSends: ["name:", "new", "theClass:", "yourself"]
  32069. }),
  32070. $globals.ExportMethodProtocol.a$cls);
  32071. $core.addClass("Importer", $globals.Object, ["lastSection", "lastChunk"], "Platform-ImportExport");
  32072. $globals.Importer.comment="I can import Amber code from a string in the chunk format.\x0a\x0a## API\x0a\x0a Importer new import: aString";
  32073. $core.addMethod(
  32074. $core.method({
  32075. selector: "import:",
  32076. protocol: "fileIn",
  32077. fn: function (aStream){
  32078. var self=this,$self=this;
  32079. var chunk,result,parser,lastEmpty;
  32080. return $core.withContext(function($ctx1) {
  32081. var $1;
  32082. parser=$recv($globals.ChunkParser)._on_(aStream);
  32083. lastEmpty=false;
  32084. $self["@lastSection"]="n/a, not started";
  32085. $self["@lastChunk"]=nil;
  32086. $recv((function(){
  32087. return $core.withContext(function($ctx2) {
  32088. $recv((function(){
  32089. return $core.withContext(function($ctx3) {
  32090. chunk=$recv(parser)._nextChunk();
  32091. return $recv(chunk)._isNil();
  32092. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32093. }))._whileFalse_((function(){
  32094. return $core.withContext(function($ctx3) {
  32095. return $recv(chunk)._ifEmpty_ifNotEmpty_((function(){
  32096. lastEmpty=true;
  32097. return lastEmpty;
  32098. }),(function(){
  32099. return $core.withContext(function($ctx4) {
  32100. $self["@lastSection"]=chunk;
  32101. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_(chunk);
  32102. $1=lastEmpty;
  32103. if($core.assert($1)){
  32104. lastEmpty=false;
  32105. return $recv(result)._scanFrom_(parser);
  32106. }
  32107. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,5)});
  32108. }));
  32109. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32110. }));
  32111. $self["@lastSection"]="n/a, finished";
  32112. return $self["@lastSection"];
  32113. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32114. }))._on_do_($globals.Error,(function(e){
  32115. return $core.withContext(function($ctx2) {
  32116. $self["@lastChunk"]=$recv(parser)._last();
  32117. return $recv(e)._pass();
  32118. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,7)});
  32119. }));
  32120. return self;
  32121. }, function($ctx1) {$ctx1.fill(self,"import:",{aStream:aStream,chunk:chunk,result:result,parser:parser,lastEmpty:lastEmpty},$globals.Importer)});
  32122. },
  32123. args: ["aStream"],
  32124. 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 ].",
  32125. referencedClasses: ["ChunkParser", "Compiler", "Error"],
  32126. messageSends: ["on:", "on:do:", "whileFalse:", "nextChunk", "isNil", "ifEmpty:ifNotEmpty:", "evaluateExpression:", "new", "ifTrue:", "scanFrom:", "last", "pass"]
  32127. }),
  32128. $globals.Importer);
  32129. $core.addMethod(
  32130. $core.method({
  32131. selector: "lastChunk",
  32132. protocol: "accessing",
  32133. fn: function (){
  32134. var self=this,$self=this;
  32135. return $self["@lastChunk"];
  32136. },
  32137. args: [],
  32138. source: "lastChunk\x0a\x09^ lastChunk",
  32139. referencedClasses: [],
  32140. messageSends: []
  32141. }),
  32142. $globals.Importer);
  32143. $core.addMethod(
  32144. $core.method({
  32145. selector: "lastSection",
  32146. protocol: "accessing",
  32147. fn: function (){
  32148. var self=this,$self=this;
  32149. return $self["@lastSection"];
  32150. },
  32151. args: [],
  32152. source: "lastSection\x0a\x09^ lastSection",
  32153. referencedClasses: [],
  32154. messageSends: []
  32155. }),
  32156. $globals.Importer);
  32157. $core.addClass("PackageCommitError", $globals.Error, [], "Platform-ImportExport");
  32158. $globals.PackageCommitError.comment="I get signaled when an attempt to commit a package has failed.";
  32159. $core.addClass("PackageHandler", $globals.Object, [], "Platform-ImportExport");
  32160. $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.";
  32161. $core.addMethod(
  32162. $core.method({
  32163. selector: "ajaxPutAt:data:onSuccess:onError:",
  32164. protocol: "private",
  32165. fn: function (aURL,aString,aBlock,anotherBlock){
  32166. var self=this,$self=this;
  32167. var xhr;
  32168. return $core.withContext(function($ctx1) {
  32169. var $1,$4,$3,$2;
  32170. xhr=$recv($globals.Platform)._newXhr();
  32171. $recv(xhr)._open_url_async_("PUT",aURL,true);
  32172. $recv(xhr)._onreadystatechange_((function(){
  32173. return $core.withContext(function($ctx2) {
  32174. $1=$recv($recv(xhr)._readyState()).__eq((4));
  32175. if($core.assert($1)){
  32176. $4=$recv(xhr)._status();
  32177. $ctx2.sendIdx["status"]=1;
  32178. $3=$recv($4).__gt_eq((200));
  32179. $2=$recv($3)._and_((function(){
  32180. return $core.withContext(function($ctx3) {
  32181. return $recv($recv(xhr)._status()).__lt((300));
  32182. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  32183. }));
  32184. return $recv($2)._ifTrue_ifFalse_(aBlock,anotherBlock);
  32185. }
  32186. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32187. }));
  32188. $recv(xhr)._send_(aString);
  32189. return self;
  32190. }, function($ctx1) {$ctx1.fill(self,"ajaxPutAt:data:onSuccess:onError:",{aURL:aURL,aString:aString,aBlock:aBlock,anotherBlock:anotherBlock,xhr:xhr},$globals.PackageHandler)});
  32191. },
  32192. args: ["aURL", "aString", "aBlock", "anotherBlock"],
  32193. 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",
  32194. referencedClasses: ["Platform"],
  32195. messageSends: ["newXhr", "open:url:async:", "onreadystatechange:", "ifTrue:", "=", "readyState", "ifTrue:ifFalse:", "and:", ">=", "status", "<", "send:"]
  32196. }),
  32197. $globals.PackageHandler);
  32198. $core.addMethod(
  32199. $core.method({
  32200. selector: "chunkContentsFor:",
  32201. protocol: "accessing",
  32202. fn: function (aPackage){
  32203. var self=this,$self=this;
  32204. return $core.withContext(function($ctx1) {
  32205. return $recv($globals.String)._streamContents_((function(str){
  32206. return $core.withContext(function($ctx2) {
  32207. return $recv($self._chunkExporter())._exportPackage_on_(aPackage,str);
  32208. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32209. }));
  32210. }, function($ctx1) {$ctx1.fill(self,"chunkContentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32211. },
  32212. args: ["aPackage"],
  32213. source: "chunkContentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self chunkExporter exportPackage: aPackage on: str ]",
  32214. referencedClasses: ["String"],
  32215. messageSends: ["streamContents:", "exportPackage:on:", "chunkExporter"]
  32216. }),
  32217. $globals.PackageHandler);
  32218. $core.addMethod(
  32219. $core.method({
  32220. selector: "chunkExporter",
  32221. protocol: "factory",
  32222. fn: function (){
  32223. var self=this,$self=this;
  32224. return $core.withContext(function($ctx1) {
  32225. return $recv($self._chunkExporterClass())._new();
  32226. }, function($ctx1) {$ctx1.fill(self,"chunkExporter",{},$globals.PackageHandler)});
  32227. },
  32228. args: [],
  32229. source: "chunkExporter\x0a\x09^ self chunkExporterClass new",
  32230. referencedClasses: [],
  32231. messageSends: ["new", "chunkExporterClass"]
  32232. }),
  32233. $globals.PackageHandler);
  32234. $core.addMethod(
  32235. $core.method({
  32236. selector: "chunkExporterClass",
  32237. protocol: "accessing",
  32238. fn: function (){
  32239. var self=this,$self=this;
  32240. return $globals.ChunkExporter;
  32241. },
  32242. args: [],
  32243. source: "chunkExporterClass\x0a\x09^ ChunkExporter",
  32244. referencedClasses: ["ChunkExporter"],
  32245. messageSends: []
  32246. }),
  32247. $globals.PackageHandler);
  32248. $core.addMethod(
  32249. $core.method({
  32250. selector: "commit:",
  32251. protocol: "committing",
  32252. fn: function (aPackage){
  32253. var self=this,$self=this;
  32254. return $core.withContext(function($ctx1) {
  32255. var $1,$2;
  32256. $self._commit_onSuccess_onError_(aPackage,(function(){
  32257. }),(function(error){
  32258. return $core.withContext(function($ctx2) {
  32259. $1=$recv($globals.PackageCommitError)._new();
  32260. $2=$recv("Commiting failed with reason: \x22".__comma($recv(error)._responseText())).__comma("\x22");
  32261. $ctx2.sendIdx[","]=1;
  32262. $recv($1)._messageText_($2);
  32263. return $recv($1)._signal();
  32264. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  32265. }));
  32266. return self;
  32267. }, function($ctx1) {$ctx1.fill(self,"commit:",{aPackage:aPackage},$globals.PackageHandler)});
  32268. },
  32269. args: ["aPackage"],
  32270. 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 ]",
  32271. referencedClasses: ["PackageCommitError"],
  32272. messageSends: ["commit:onSuccess:onError:", "messageText:", "new", ",", "responseText", "signal"]
  32273. }),
  32274. $globals.PackageHandler);
  32275. $core.addMethod(
  32276. $core.method({
  32277. selector: "commit:onSuccess:onError:",
  32278. protocol: "committing",
  32279. fn: function (aPackage,aBlock,anotherBlock){
  32280. var self=this,$self=this;
  32281. return $core.withContext(function($ctx1) {
  32282. $self._commitJsFileFor_onSuccess_onError_(aPackage,(function(){
  32283. return $core.withContext(function($ctx2) {
  32284. return $self._commitStFileFor_onSuccess_onError_(aPackage,(function(){
  32285. return $core.withContext(function($ctx3) {
  32286. $recv(aPackage)._beClean();
  32287. return $recv(aBlock)._value();
  32288. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  32289. }),anotherBlock);
  32290. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32291. }),anotherBlock);
  32292. return self;
  32293. }, function($ctx1) {$ctx1.fill(self,"commit:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32294. },
  32295. args: ["aPackage", "aBlock", "anotherBlock"],
  32296. 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",
  32297. referencedClasses: [],
  32298. messageSends: ["commitJsFileFor:onSuccess:onError:", "commitStFileFor:onSuccess:onError:", "beClean", "value"]
  32299. }),
  32300. $globals.PackageHandler);
  32301. $core.addMethod(
  32302. $core.method({
  32303. selector: "commitJsFileFor:onSuccess:onError:",
  32304. protocol: "committing",
  32305. fn: function (aPackage,aBlock,anotherBlock){
  32306. var self=this,$self=this;
  32307. return $core.withContext(function($ctx1) {
  32308. var $2,$1;
  32309. $2=$recv($recv($self._commitPathJsFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32310. $ctx1.sendIdx[","]=2;
  32311. $1=$recv($2).__comma(".js");
  32312. $ctx1.sendIdx[","]=1;
  32313. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._contentsFor_(aPackage),aBlock,anotherBlock);
  32314. return self;
  32315. }, function($ctx1) {$ctx1.fill(self,"commitJsFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32316. },
  32317. args: ["aPackage", "aBlock", "anotherBlock"],
  32318. 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",
  32319. referencedClasses: [],
  32320. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathJsFor:", "name", "contentsFor:"]
  32321. }),
  32322. $globals.PackageHandler);
  32323. $core.addMethod(
  32324. $core.method({
  32325. selector: "commitPathJsFor:",
  32326. protocol: "accessing",
  32327. fn: function (aPackage){
  32328. var self=this,$self=this;
  32329. return $core.withContext(function($ctx1) {
  32330. $self._subclassResponsibility();
  32331. return self;
  32332. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32333. },
  32334. args: ["aPackage"],
  32335. source: "commitPathJsFor: aPackage\x0a\x09self subclassResponsibility",
  32336. referencedClasses: [],
  32337. messageSends: ["subclassResponsibility"]
  32338. }),
  32339. $globals.PackageHandler);
  32340. $core.addMethod(
  32341. $core.method({
  32342. selector: "commitPathStFor:",
  32343. protocol: "accessing",
  32344. fn: function (aPackage){
  32345. var self=this,$self=this;
  32346. return $core.withContext(function($ctx1) {
  32347. $self._subclassResponsibility();
  32348. return self;
  32349. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32350. },
  32351. args: ["aPackage"],
  32352. source: "commitPathStFor: aPackage\x0a\x09self subclassResponsibility",
  32353. referencedClasses: [],
  32354. messageSends: ["subclassResponsibility"]
  32355. }),
  32356. $globals.PackageHandler);
  32357. $core.addMethod(
  32358. $core.method({
  32359. selector: "commitStFileFor:onSuccess:onError:",
  32360. protocol: "committing",
  32361. fn: function (aPackage,aBlock,anotherBlock){
  32362. var self=this,$self=this;
  32363. return $core.withContext(function($ctx1) {
  32364. var $2,$1;
  32365. $2=$recv($recv($self._commitPathStFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32366. $ctx1.sendIdx[","]=2;
  32367. $1=$recv($2).__comma(".st");
  32368. $ctx1.sendIdx[","]=1;
  32369. $self._ajaxPutAt_data_onSuccess_onError_($1,$self._chunkContentsFor_(aPackage),aBlock,anotherBlock);
  32370. return self;
  32371. }, function($ctx1) {$ctx1.fill(self,"commitStFileFor:onSuccess:onError:",{aPackage:aPackage,aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageHandler)});
  32372. },
  32373. args: ["aPackage", "aBlock", "anotherBlock"],
  32374. 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",
  32375. referencedClasses: [],
  32376. messageSends: ["ajaxPutAt:data:onSuccess:onError:", ",", "commitPathStFor:", "name", "chunkContentsFor:"]
  32377. }),
  32378. $globals.PackageHandler);
  32379. $core.addMethod(
  32380. $core.method({
  32381. selector: "contentsFor:",
  32382. protocol: "accessing",
  32383. fn: function (aPackage){
  32384. var self=this,$self=this;
  32385. return $core.withContext(function($ctx1) {
  32386. return $recv($globals.String)._streamContents_((function(str){
  32387. return $core.withContext(function($ctx2) {
  32388. return $recv($self._exporter())._exportPackage_on_(aPackage,str);
  32389. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  32390. }));
  32391. }, function($ctx1) {$ctx1.fill(self,"contentsFor:",{aPackage:aPackage},$globals.PackageHandler)});
  32392. },
  32393. args: ["aPackage"],
  32394. source: "contentsFor: aPackage\x0a\x09^ String streamContents: [ :str |\x0a\x09\x09self exporter exportPackage: aPackage on: str ]",
  32395. referencedClasses: ["String"],
  32396. messageSends: ["streamContents:", "exportPackage:on:", "exporter"]
  32397. }),
  32398. $globals.PackageHandler);
  32399. $core.addMethod(
  32400. $core.method({
  32401. selector: "exporter",
  32402. protocol: "factory",
  32403. fn: function (){
  32404. var self=this,$self=this;
  32405. return $core.withContext(function($ctx1) {
  32406. return $recv($self._exporterClass())._new();
  32407. }, function($ctx1) {$ctx1.fill(self,"exporter",{},$globals.PackageHandler)});
  32408. },
  32409. args: [],
  32410. source: "exporter\x0a\x09^ self exporterClass new",
  32411. referencedClasses: [],
  32412. messageSends: ["new", "exporterClass"]
  32413. }),
  32414. $globals.PackageHandler);
  32415. $core.addMethod(
  32416. $core.method({
  32417. selector: "exporterClass",
  32418. protocol: "accessing",
  32419. fn: function (){
  32420. var self=this,$self=this;
  32421. return $core.withContext(function($ctx1) {
  32422. $self._subclassResponsibility();
  32423. return self;
  32424. }, function($ctx1) {$ctx1.fill(self,"exporterClass",{},$globals.PackageHandler)});
  32425. },
  32426. args: [],
  32427. source: "exporterClass\x0a\x09self subclassResponsibility",
  32428. referencedClasses: [],
  32429. messageSends: ["subclassResponsibility"]
  32430. }),
  32431. $globals.PackageHandler);
  32432. $core.addMethod(
  32433. $core.method({
  32434. selector: "load:",
  32435. protocol: "loading",
  32436. fn: function (aPackage){
  32437. var self=this,$self=this;
  32438. return $core.withContext(function($ctx1) {
  32439. $self._subclassResponsibility();
  32440. return self;
  32441. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.PackageHandler)});
  32442. },
  32443. args: ["aPackage"],
  32444. source: "load: aPackage\x0a\x09\x22Should return a TThenable\x22\x0a\x09self subclassResponsibility",
  32445. referencedClasses: [],
  32446. messageSends: ["subclassResponsibility"]
  32447. }),
  32448. $globals.PackageHandler);
  32449. $core.addMethod(
  32450. $core.method({
  32451. selector: "onCommitError:",
  32452. protocol: "error handling",
  32453. fn: function (anError){
  32454. var self=this,$self=this;
  32455. return $core.withContext(function($ctx1) {
  32456. var $1,$2;
  32457. $1=$recv($globals.PackageCommitError)._new();
  32458. $2=$recv("Commiting failed with reason: \x22".__comma($recv(anError)._responseText())).__comma("\x22");
  32459. $ctx1.sendIdx[","]=1;
  32460. $recv($1)._messageText_($2);
  32461. $recv($1)._signal();
  32462. return self;
  32463. }, function($ctx1) {$ctx1.fill(self,"onCommitError:",{anError:anError},$globals.PackageHandler)});
  32464. },
  32465. args: ["anError"],
  32466. source: "onCommitError: anError\x0a\x09PackageCommitError new\x0a\x09\x09messageText: 'Commiting failed with reason: \x22' , (anError responseText) , '\x22';\x0a\x09\x09signal",
  32467. referencedClasses: ["PackageCommitError"],
  32468. messageSends: ["messageText:", "new", ",", "responseText", "signal"]
  32469. }),
  32470. $globals.PackageHandler);
  32471. $core.addClass("AmdPackageHandler", $globals.PackageHandler, [], "Platform-ImportExport");
  32472. $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.";
  32473. $core.addMethod(
  32474. $core.method({
  32475. selector: "commitPathJsFor:",
  32476. protocol: "accessing",
  32477. fn: function (aPackage){
  32478. var self=this,$self=this;
  32479. return $core.withContext(function($ctx1) {
  32480. return $self._toUrl_($self._namespaceFor_(aPackage));
  32481. }, function($ctx1) {$ctx1.fill(self,"commitPathJsFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32482. },
  32483. args: ["aPackage"],
  32484. source: "commitPathJsFor: aPackage\x0a\x09^ self toUrl: (self namespaceFor: aPackage)",
  32485. referencedClasses: [],
  32486. messageSends: ["toUrl:", "namespaceFor:"]
  32487. }),
  32488. $globals.AmdPackageHandler);
  32489. $core.addMethod(
  32490. $core.method({
  32491. selector: "commitPathStFor:",
  32492. protocol: "accessing",
  32493. fn: function (aPackage){
  32494. var self=this,$self=this;
  32495. var path,pathWithout;
  32496. return $core.withContext(function($ctx1) {
  32497. var $1,$2;
  32498. $1=$recv($self._namespaceFor_(aPackage)).__comma("/_source");
  32499. $ctx1.sendIdx[","]=1;
  32500. path=$self._toUrl_($1);
  32501. pathWithout=$self._commitPathJsFor_(aPackage);
  32502. $2=$recv(path).__eq($recv(pathWithout).__comma("/_source"));
  32503. if($core.assert($2)){
  32504. return pathWithout;
  32505. } else {
  32506. return path;
  32507. }
  32508. }, function($ctx1) {$ctx1.fill(self,"commitPathStFor:",{aPackage:aPackage,path:path,pathWithout:pathWithout},$globals.AmdPackageHandler)});
  32509. },
  32510. args: ["aPackage"],
  32511. 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 ]",
  32512. referencedClasses: [],
  32513. messageSends: ["toUrl:", ",", "namespaceFor:", "commitPathJsFor:", "ifTrue:ifFalse:", "="]
  32514. }),
  32515. $globals.AmdPackageHandler);
  32516. $core.addMethod(
  32517. $core.method({
  32518. selector: "exporterClass",
  32519. protocol: "accessing",
  32520. fn: function (){
  32521. var self=this,$self=this;
  32522. return $globals.AmdExporter;
  32523. },
  32524. args: [],
  32525. source: "exporterClass\x0a\x09^ AmdExporter",
  32526. referencedClasses: ["AmdExporter"],
  32527. messageSends: []
  32528. }),
  32529. $globals.AmdPackageHandler);
  32530. $core.addMethod(
  32531. $core.method({
  32532. selector: "load:",
  32533. protocol: "loading",
  32534. fn: function (aPackage){
  32535. var self=this,$self=this;
  32536. return $core.withContext(function($ctx1) {
  32537. var $1,$3,$2,$receiver;
  32538. return $recv($globals.Promise)._new_((function(model){
  32539. return $core.withContext(function($ctx2) {
  32540. $1=$recv($globals.Smalltalk)._amdRequire();
  32541. if(($receiver = $1) == null || $receiver.a$nil){
  32542. return $self._error_("AMD loader not present");
  32543. } else {
  32544. var require;
  32545. require=$receiver;
  32546. $3=$recv($recv($self._namespaceFor_(aPackage)).__comma("/")).__comma($recv(aPackage)._name());
  32547. $ctx2.sendIdx[","]=1;
  32548. $2=[$3];
  32549. return $recv(require)._value_value_value_($2,(function(result){
  32550. return $core.withContext(function($ctx3) {
  32551. return $recv(model)._value_(result);
  32552. }, function($ctx3) {$ctx3.fillBlock({result:result},$ctx2,4)});
  32553. }),(function(error){
  32554. return $core.withContext(function($ctx3) {
  32555. return $recv(model)._signal_(error);
  32556. }, function($ctx3) {$ctx3.fillBlock({error:error},$ctx2,5)});
  32557. }));
  32558. }
  32559. }, function($ctx2) {$ctx2.fillBlock({model:model},$ctx1,1)});
  32560. }));
  32561. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32562. },
  32563. args: ["aPackage"],
  32564. 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 ] ] ]",
  32565. referencedClasses: ["Promise", "Smalltalk"],
  32566. messageSends: ["new:", "ifNil:ifNotNil:", "amdRequire", "error:", "value:value:value:", ",", "namespaceFor:", "name", "value:", "signal:"]
  32567. }),
  32568. $globals.AmdPackageHandler);
  32569. $core.addMethod(
  32570. $core.method({
  32571. selector: "namespaceFor:",
  32572. protocol: "committing",
  32573. fn: function (aPackage){
  32574. var self=this,$self=this;
  32575. return $core.withContext(function($ctx1) {
  32576. return $recv($recv(aPackage)._transport())._namespace();
  32577. }, function($ctx1) {$ctx1.fill(self,"namespaceFor:",{aPackage:aPackage},$globals.AmdPackageHandler)});
  32578. },
  32579. args: ["aPackage"],
  32580. source: "namespaceFor: aPackage\x0a\x09^ aPackage transport namespace",
  32581. referencedClasses: [],
  32582. messageSends: ["namespace", "transport"]
  32583. }),
  32584. $globals.AmdPackageHandler);
  32585. $core.addMethod(
  32586. $core.method({
  32587. selector: "toUrl:",
  32588. protocol: "private",
  32589. fn: function (aString){
  32590. var self=this,$self=this;
  32591. return $core.withContext(function($ctx1) {
  32592. var $1,$receiver;
  32593. $1=$recv($globals.Smalltalk)._amdRequire();
  32594. if(($receiver = $1) == null || $receiver.a$nil){
  32595. return $self._error_("AMD loader not present");
  32596. } else {
  32597. var require;
  32598. require=$receiver;
  32599. return $recv($recv(require)._provided())._toUrl_(aString);
  32600. }
  32601. }, function($ctx1) {$ctx1.fill(self,"toUrl:",{aString:aString},$globals.AmdPackageHandler)});
  32602. },
  32603. args: ["aString"],
  32604. source: "toUrl: aString\x0a\x09^ Smalltalk amdRequire\x0a\x09\x09ifNil: [ self error: 'AMD loader not present' ]\x0a\x09\x09ifNotNil: [ :require | require provided toUrl: aString ]",
  32605. referencedClasses: ["Smalltalk"],
  32606. messageSends: ["ifNil:ifNotNil:", "amdRequire", "error:", "toUrl:", "provided"]
  32607. }),
  32608. $globals.AmdPackageHandler);
  32609. $core.addMethod(
  32610. $core.method({
  32611. selector: "defaultNamespace",
  32612. protocol: "commit paths",
  32613. fn: function (){
  32614. var self=this,$self=this;
  32615. return $core.withContext(function($ctx1) {
  32616. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  32617. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageHandler.a$cls)});
  32618. },
  32619. args: [],
  32620. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  32621. referencedClasses: ["Smalltalk"],
  32622. messageSends: ["defaultAmdNamespace"]
  32623. }),
  32624. $globals.AmdPackageHandler.a$cls);
  32625. $core.addMethod(
  32626. $core.method({
  32627. selector: "defaultNamespace:",
  32628. protocol: "commit paths",
  32629. fn: function (aString){
  32630. var self=this,$self=this;
  32631. return $core.withContext(function($ctx1) {
  32632. $recv($globals.Smalltalk)._defaultAmdNamespace_(aString);
  32633. return self;
  32634. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace:",{aString:aString},$globals.AmdPackageHandler.a$cls)});
  32635. },
  32636. args: ["aString"],
  32637. source: "defaultNamespace: aString\x0a\x09Smalltalk defaultAmdNamespace: aString",
  32638. referencedClasses: ["Smalltalk"],
  32639. messageSends: ["defaultAmdNamespace:"]
  32640. }),
  32641. $globals.AmdPackageHandler.a$cls);
  32642. $core.addClass("PackageTransport", $globals.Object, ["package"], "Platform-ImportExport");
  32643. $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.";
  32644. $core.addMethod(
  32645. $core.method({
  32646. selector: "asJavaScriptObject",
  32647. protocol: "converting",
  32648. fn: function (){
  32649. var self=this,$self=this;
  32650. return $core.withContext(function($ctx1) {
  32651. return $globals.HashedCollection._newFromPairs_(["type",$self._type()]);
  32652. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.PackageTransport)});
  32653. },
  32654. args: [],
  32655. source: "asJavaScriptObject\x0a\x09^ #{ 'type' -> self type }",
  32656. referencedClasses: [],
  32657. messageSends: ["type"]
  32658. }),
  32659. $globals.PackageTransport);
  32660. $core.addMethod(
  32661. $core.method({
  32662. selector: "commit",
  32663. protocol: "committing",
  32664. fn: function (){
  32665. var self=this,$self=this;
  32666. return $core.withContext(function($ctx1) {
  32667. $recv($self._commitHandler())._commit_($self._package());
  32668. return self;
  32669. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.PackageTransport)});
  32670. },
  32671. args: [],
  32672. source: "commit\x0a\x09self commitHandler commit: self package",
  32673. referencedClasses: [],
  32674. messageSends: ["commit:", "commitHandler", "package"]
  32675. }),
  32676. $globals.PackageTransport);
  32677. $core.addMethod(
  32678. $core.method({
  32679. selector: "commitHandler",
  32680. protocol: "factory",
  32681. fn: function (){
  32682. var self=this,$self=this;
  32683. return $core.withContext(function($ctx1) {
  32684. return $recv($self._commitHandlerClass())._new();
  32685. }, function($ctx1) {$ctx1.fill(self,"commitHandler",{},$globals.PackageTransport)});
  32686. },
  32687. args: [],
  32688. source: "commitHandler\x0a\x09^ self commitHandlerClass new",
  32689. referencedClasses: [],
  32690. messageSends: ["new", "commitHandlerClass"]
  32691. }),
  32692. $globals.PackageTransport);
  32693. $core.addMethod(
  32694. $core.method({
  32695. selector: "commitHandlerClass",
  32696. protocol: "accessing",
  32697. fn: function (){
  32698. var self=this,$self=this;
  32699. return $core.withContext(function($ctx1) {
  32700. $self._subclassResponsibility();
  32701. return self;
  32702. }, function($ctx1) {$ctx1.fill(self,"commitHandlerClass",{},$globals.PackageTransport)});
  32703. },
  32704. args: [],
  32705. source: "commitHandlerClass\x0a\x09self subclassResponsibility",
  32706. referencedClasses: [],
  32707. messageSends: ["subclassResponsibility"]
  32708. }),
  32709. $globals.PackageTransport);
  32710. $core.addMethod(
  32711. $core.method({
  32712. selector: "commitOnSuccess:onError:",
  32713. protocol: "committing",
  32714. fn: function (aBlock,anotherBlock){
  32715. var self=this,$self=this;
  32716. return $core.withContext(function($ctx1) {
  32717. $recv($self._commitHandler())._commit_onSuccess_onError_($self._package(),aBlock,anotherBlock);
  32718. return self;
  32719. }, function($ctx1) {$ctx1.fill(self,"commitOnSuccess:onError:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.PackageTransport)});
  32720. },
  32721. args: ["aBlock", "anotherBlock"],
  32722. source: "commitOnSuccess: aBlock onError: anotherBlock\x0a\x09self commitHandler \x0a\x09\x09commit: self package\x0a\x09\x09onSuccess: aBlock\x0a\x09\x09onError: anotherBlock",
  32723. referencedClasses: [],
  32724. messageSends: ["commit:onSuccess:onError:", "commitHandler", "package"]
  32725. }),
  32726. $globals.PackageTransport);
  32727. $core.addMethod(
  32728. $core.method({
  32729. selector: "definition",
  32730. protocol: "accessing",
  32731. fn: function (){
  32732. var self=this,$self=this;
  32733. return "";
  32734. },
  32735. args: [],
  32736. source: "definition\x0a\x09^ ''",
  32737. referencedClasses: [],
  32738. messageSends: []
  32739. }),
  32740. $globals.PackageTransport);
  32741. $core.addMethod(
  32742. $core.method({
  32743. selector: "load",
  32744. protocol: "loading",
  32745. fn: function (){
  32746. var self=this,$self=this;
  32747. return $core.withContext(function($ctx1) {
  32748. return $recv($recv($self._commitHandler())._load_($self._package()))._then_((function(){
  32749. return $core.withContext(function($ctx2) {
  32750. return $recv($globals.Smalltalk)._postLoad();
  32751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  32752. }));
  32753. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.PackageTransport)});
  32754. },
  32755. args: [],
  32756. source: "load\x0a\x09^ (self commitHandler load: self package)\x0a\x09\x09then: [ Smalltalk postLoad ]",
  32757. referencedClasses: ["Smalltalk"],
  32758. messageSends: ["then:", "load:", "commitHandler", "package", "postLoad"]
  32759. }),
  32760. $globals.PackageTransport);
  32761. $core.addMethod(
  32762. $core.method({
  32763. selector: "package",
  32764. protocol: "accessing",
  32765. fn: function (){
  32766. var self=this,$self=this;
  32767. return $self["@package"];
  32768. },
  32769. args: [],
  32770. source: "package\x0a\x09^ package",
  32771. referencedClasses: [],
  32772. messageSends: []
  32773. }),
  32774. $globals.PackageTransport);
  32775. $core.addMethod(
  32776. $core.method({
  32777. selector: "package:",
  32778. protocol: "accessing",
  32779. fn: function (aPackage){
  32780. var self=this,$self=this;
  32781. $self["@package"]=aPackage;
  32782. return self;
  32783. },
  32784. args: ["aPackage"],
  32785. source: "package: aPackage\x0a\x09package := aPackage",
  32786. referencedClasses: [],
  32787. messageSends: []
  32788. }),
  32789. $globals.PackageTransport);
  32790. $core.addMethod(
  32791. $core.method({
  32792. selector: "setupFromJson:",
  32793. protocol: "initialization",
  32794. fn: function (anObject){
  32795. var self=this,$self=this;
  32796. return self;
  32797. },
  32798. args: ["anObject"],
  32799. source: "setupFromJson: anObject\x0a\x09\x22no op. override if needed in subclasses\x22",
  32800. referencedClasses: [],
  32801. messageSends: []
  32802. }),
  32803. $globals.PackageTransport);
  32804. $core.addMethod(
  32805. $core.method({
  32806. selector: "type",
  32807. protocol: "accessing",
  32808. fn: function (){
  32809. var self=this,$self=this;
  32810. return $core.withContext(function($ctx1) {
  32811. return $recv($self._class())._type();
  32812. }, function($ctx1) {$ctx1.fill(self,"type",{},$globals.PackageTransport)});
  32813. },
  32814. args: [],
  32815. source: "type\x0a\x09^ self class type",
  32816. referencedClasses: [],
  32817. messageSends: ["type", "class"]
  32818. }),
  32819. $globals.PackageTransport);
  32820. $globals.PackageTransport.a$cls.iVarNames = ["registry"];
  32821. $core.addMethod(
  32822. $core.method({
  32823. selector: "classRegisteredFor:",
  32824. protocol: "accessing",
  32825. fn: function (aString){
  32826. var self=this,$self=this;
  32827. return $core.withContext(function($ctx1) {
  32828. return $recv($self["@registry"])._at_(aString);
  32829. }, function($ctx1) {$ctx1.fill(self,"classRegisteredFor:",{aString:aString},$globals.PackageTransport.a$cls)});
  32830. },
  32831. args: ["aString"],
  32832. source: "classRegisteredFor: aString\x0a\x09^ registry at: aString",
  32833. referencedClasses: [],
  32834. messageSends: ["at:"]
  32835. }),
  32836. $globals.PackageTransport.a$cls);
  32837. $core.addMethod(
  32838. $core.method({
  32839. selector: "defaultType",
  32840. protocol: "accessing",
  32841. fn: function (){
  32842. var self=this,$self=this;
  32843. return $core.withContext(function($ctx1) {
  32844. return $recv($globals.AmdPackageTransport)._type();
  32845. }, function($ctx1) {$ctx1.fill(self,"defaultType",{},$globals.PackageTransport.a$cls)});
  32846. },
  32847. args: [],
  32848. source: "defaultType\x0a\x09^ AmdPackageTransport type",
  32849. referencedClasses: ["AmdPackageTransport"],
  32850. messageSends: ["type"]
  32851. }),
  32852. $globals.PackageTransport.a$cls);
  32853. $core.addMethod(
  32854. $core.method({
  32855. selector: "for:",
  32856. protocol: "instance creation",
  32857. fn: function (aString){
  32858. var self=this,$self=this;
  32859. return $core.withContext(function($ctx1) {
  32860. return $recv($self._classRegisteredFor_(aString))._new();
  32861. }, function($ctx1) {$ctx1.fill(self,"for:",{aString:aString},$globals.PackageTransport.a$cls)});
  32862. },
  32863. args: ["aString"],
  32864. source: "for: aString\x0a\x09^ (self classRegisteredFor: aString) new",
  32865. referencedClasses: [],
  32866. messageSends: ["new", "classRegisteredFor:"]
  32867. }),
  32868. $globals.PackageTransport.a$cls);
  32869. $core.addMethod(
  32870. $core.method({
  32871. selector: "fromJson:",
  32872. protocol: "instance creation",
  32873. fn: function (anObject){
  32874. var self=this,$self=this;
  32875. return $core.withContext(function($ctx1) {
  32876. var $1,$2,$receiver;
  32877. if(($receiver = anObject) == null || $receiver.a$nil){
  32878. $1=$self._for_($self._defaultType());
  32879. $ctx1.sendIdx["for:"]=1;
  32880. return $1;
  32881. } else {
  32882. anObject;
  32883. }
  32884. $2=$self._for_($recv(anObject)._type());
  32885. $recv($2)._setupFromJson_(anObject);
  32886. return $recv($2)._yourself();
  32887. }, function($ctx1) {$ctx1.fill(self,"fromJson:",{anObject:anObject},$globals.PackageTransport.a$cls)});
  32888. },
  32889. args: ["anObject"],
  32890. 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",
  32891. referencedClasses: [],
  32892. messageSends: ["ifNil:", "for:", "defaultType", "setupFromJson:", "type", "yourself"]
  32893. }),
  32894. $globals.PackageTransport.a$cls);
  32895. $core.addMethod(
  32896. $core.method({
  32897. selector: "initialize",
  32898. protocol: "initialization",
  32899. fn: function (){
  32900. var self=this,$self=this;
  32901. return $core.withContext(function($ctx1) {
  32902. var $1;
  32903. (
  32904. $ctx1.supercall = true,
  32905. ($globals.PackageTransport.a$cls.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  32906. $ctx1.supercall = false;
  32907. $1=$self.__eq_eq($globals.PackageTransport);
  32908. if($core.assert($1)){
  32909. $self["@registry"]=$globals.HashedCollection._newFromPairs_([]);
  32910. $self["@registry"];
  32911. } else {
  32912. $self._register();
  32913. }
  32914. return self;
  32915. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.PackageTransport.a$cls)});
  32916. },
  32917. args: [],
  32918. source: "initialize\x0a\x09super initialize.\x0a\x09self == PackageTransport\x0a\x09\x09ifTrue: [ registry := #{} ]\x0a\x09\x09ifFalse: [ self register ]",
  32919. referencedClasses: ["PackageTransport"],
  32920. messageSends: ["initialize", "ifTrue:ifFalse:", "==", "register"]
  32921. }),
  32922. $globals.PackageTransport.a$cls);
  32923. $core.addMethod(
  32924. $core.method({
  32925. selector: "register",
  32926. protocol: "registration",
  32927. fn: function (){
  32928. var self=this,$self=this;
  32929. return $core.withContext(function($ctx1) {
  32930. $recv($globals.PackageTransport)._register_(self);
  32931. return self;
  32932. }, function($ctx1) {$ctx1.fill(self,"register",{},$globals.PackageTransport.a$cls)});
  32933. },
  32934. args: [],
  32935. source: "register\x0a\x09PackageTransport register: self",
  32936. referencedClasses: ["PackageTransport"],
  32937. messageSends: ["register:"]
  32938. }),
  32939. $globals.PackageTransport.a$cls);
  32940. $core.addMethod(
  32941. $core.method({
  32942. selector: "register:",
  32943. protocol: "registration",
  32944. fn: function (aClass){
  32945. var self=this,$self=this;
  32946. return $core.withContext(function($ctx1) {
  32947. var $1,$receiver;
  32948. $1=$recv(aClass)._type();
  32949. $ctx1.sendIdx["type"]=1;
  32950. if(($receiver = $1) == null || $receiver.a$nil){
  32951. $1;
  32952. } else {
  32953. $recv($self["@registry"])._at_put_($recv(aClass)._type(),aClass);
  32954. }
  32955. return self;
  32956. }, function($ctx1) {$ctx1.fill(self,"register:",{aClass:aClass},$globals.PackageTransport.a$cls)});
  32957. },
  32958. args: ["aClass"],
  32959. source: "register: aClass\x0a\x09aClass type ifNotNil: [\x0a\x09\x09registry at: aClass type put: aClass ]",
  32960. referencedClasses: [],
  32961. messageSends: ["ifNotNil:", "type", "at:put:"]
  32962. }),
  32963. $globals.PackageTransport.a$cls);
  32964. $core.addMethod(
  32965. $core.method({
  32966. selector: "type",
  32967. protocol: "accessing",
  32968. fn: function (){
  32969. var self=this,$self=this;
  32970. return nil;
  32971. },
  32972. args: [],
  32973. source: "type\x0a\x09\x22Override in subclasses\x22\x0a\x09^ nil",
  32974. referencedClasses: [],
  32975. messageSends: []
  32976. }),
  32977. $globals.PackageTransport.a$cls);
  32978. $core.addClass("AmdPackageTransport", $globals.PackageTransport, ["namespace"], "Platform-ImportExport");
  32979. $globals.AmdPackageTransport.comment="I am the default transport for committing packages.\x0a\x0aSee `AmdExporter` and `AmdPackageHandler`.";
  32980. $core.addMethod(
  32981. $core.method({
  32982. selector: "asJavaScriptObject",
  32983. protocol: "converting",
  32984. fn: function (){
  32985. var self=this,$self=this;
  32986. return $core.withContext(function($ctx1) {
  32987. var $1;
  32988. $1=(
  32989. $ctx1.supercall = true,
  32990. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._asJavaScriptObject.apply($self, []));
  32991. $ctx1.supercall = false;
  32992. $recv($1)._at_put_("amdNamespace",$self._namespace());
  32993. return $recv($1)._yourself();
  32994. }, function($ctx1) {$ctx1.fill(self,"asJavaScriptObject",{},$globals.AmdPackageTransport)});
  32995. },
  32996. args: [],
  32997. source: "asJavaScriptObject\x0a\x09^ super asJavaScriptObject\x0a\x09\x09at: 'amdNamespace' put: self namespace;\x0a\x09\x09yourself",
  32998. referencedClasses: [],
  32999. messageSends: ["at:put:", "asJavaScriptObject", "namespace", "yourself"]
  33000. }),
  33001. $globals.AmdPackageTransport);
  33002. $core.addMethod(
  33003. $core.method({
  33004. selector: "commitHandlerClass",
  33005. protocol: "accessing",
  33006. fn: function (){
  33007. var self=this,$self=this;
  33008. return $globals.AmdPackageHandler;
  33009. },
  33010. args: [],
  33011. source: "commitHandlerClass\x0a\x09^ AmdPackageHandler",
  33012. referencedClasses: ["AmdPackageHandler"],
  33013. messageSends: []
  33014. }),
  33015. $globals.AmdPackageTransport);
  33016. $core.addMethod(
  33017. $core.method({
  33018. selector: "defaultNamespace",
  33019. protocol: "defaults",
  33020. fn: function (){
  33021. var self=this,$self=this;
  33022. return $core.withContext(function($ctx1) {
  33023. return $recv($globals.Smalltalk)._defaultAmdNamespace();
  33024. }, function($ctx1) {$ctx1.fill(self,"defaultNamespace",{},$globals.AmdPackageTransport)});
  33025. },
  33026. args: [],
  33027. source: "defaultNamespace\x0a\x09^ Smalltalk defaultAmdNamespace",
  33028. referencedClasses: ["Smalltalk"],
  33029. messageSends: ["defaultAmdNamespace"]
  33030. }),
  33031. $globals.AmdPackageTransport);
  33032. $core.addMethod(
  33033. $core.method({
  33034. selector: "definition",
  33035. protocol: "accessing",
  33036. fn: function (){
  33037. var self=this,$self=this;
  33038. return $core.withContext(function($ctx1) {
  33039. return $recv($globals.String)._streamContents_((function(stream){
  33040. return $core.withContext(function($ctx2) {
  33041. $recv(stream)._write_([$recv($self._class())._name()," namespace: "]);
  33042. return $recv(stream)._print_($self._namespace());
  33043. }, function($ctx2) {$ctx2.fillBlock({stream:stream},$ctx1,1)});
  33044. }));
  33045. }, function($ctx1) {$ctx1.fill(self,"definition",{},$globals.AmdPackageTransport)});
  33046. },
  33047. args: [],
  33048. source: "definition\x0a\x09^ String streamContents: [ :stream | stream \x0a\x09\x09write: { self class name. ' namespace: ' }; print: self namespace ]",
  33049. referencedClasses: ["String"],
  33050. messageSends: ["streamContents:", "write:", "name", "class", "print:", "namespace"]
  33051. }),
  33052. $globals.AmdPackageTransport);
  33053. $core.addMethod(
  33054. $core.method({
  33055. selector: "namespace",
  33056. protocol: "accessing",
  33057. fn: function (){
  33058. var self=this,$self=this;
  33059. return $core.withContext(function($ctx1) {
  33060. var $1,$receiver;
  33061. $1=$self["@namespace"];
  33062. if(($receiver = $1) == null || $receiver.a$nil){
  33063. return $self._defaultNamespace();
  33064. } else {
  33065. return $1;
  33066. }
  33067. }, function($ctx1) {$ctx1.fill(self,"namespace",{},$globals.AmdPackageTransport)});
  33068. },
  33069. args: [],
  33070. source: "namespace\x0a\x09^ namespace ifNil: [ self defaultNamespace ]",
  33071. referencedClasses: [],
  33072. messageSends: ["ifNil:", "defaultNamespace"]
  33073. }),
  33074. $globals.AmdPackageTransport);
  33075. $core.addMethod(
  33076. $core.method({
  33077. selector: "namespace:",
  33078. protocol: "accessing",
  33079. fn: function (aString){
  33080. var self=this,$self=this;
  33081. $self["@namespace"]=aString;
  33082. return self;
  33083. },
  33084. args: ["aString"],
  33085. source: "namespace: aString\x0a\x09namespace := aString",
  33086. referencedClasses: [],
  33087. messageSends: []
  33088. }),
  33089. $globals.AmdPackageTransport);
  33090. $core.addMethod(
  33091. $core.method({
  33092. selector: "printOn:",
  33093. protocol: "printing",
  33094. fn: function (aStream){
  33095. var self=this,$self=this;
  33096. return $core.withContext(function($ctx1) {
  33097. (
  33098. $ctx1.supercall = true,
  33099. ($globals.AmdPackageTransport.superclass||$boot.nilAsClass).fn.prototype._printOn_.apply($self, [aStream]));
  33100. $ctx1.supercall = false;
  33101. $recv(aStream)._nextPutAll_(" (AMD Namespace: ");
  33102. $ctx1.sendIdx["nextPutAll:"]=1;
  33103. $recv(aStream)._nextPutAll_($self._namespace());
  33104. $ctx1.sendIdx["nextPutAll:"]=2;
  33105. $recv(aStream)._nextPutAll_(")");
  33106. return self;
  33107. }, function($ctx1) {$ctx1.fill(self,"printOn:",{aStream:aStream},$globals.AmdPackageTransport)});
  33108. },
  33109. args: ["aStream"],
  33110. source: "printOn: aStream\x0a\x09super printOn: aStream.\x0a\x09aStream\x0a\x09\x09nextPutAll: ' (AMD Namespace: ';\x0a\x09\x09nextPutAll: self namespace;\x0a\x09\x09nextPutAll: ')'",
  33111. referencedClasses: [],
  33112. messageSends: ["printOn:", "nextPutAll:", "namespace"]
  33113. }),
  33114. $globals.AmdPackageTransport);
  33115. $core.addMethod(
  33116. $core.method({
  33117. selector: "setPath:",
  33118. protocol: "actions",
  33119. fn: function (aString){
  33120. var self=this,$self=this;
  33121. return $core.withContext(function($ctx1) {
  33122. $recv($recv(require)._provided())._config_($globals.HashedCollection._newFromPairs_(["paths",$globals.HashedCollection._newFromPairs_([$self._namespace(),aString])]));
  33123. return self;
  33124. }, function($ctx1) {$ctx1.fill(self,"setPath:",{aString:aString},$globals.AmdPackageTransport)});
  33125. },
  33126. args: ["aString"],
  33127. source: "setPath: aString\x0a\x09\x22Set the path the the receiver's `namespace`\x22\x0a\x09\x0a\x09require provided config: #{\x0a\x09\x09'paths' -> #{\x0a\x09\x09\x09self namespace -> aString\x0a\x09\x09}\x0a\x09}.",
  33128. referencedClasses: [],
  33129. messageSends: ["config:", "provided", "namespace"]
  33130. }),
  33131. $globals.AmdPackageTransport);
  33132. $core.addMethod(
  33133. $core.method({
  33134. selector: "setupFromJson:",
  33135. protocol: "initialization",
  33136. fn: function (anObject){
  33137. var self=this,$self=this;
  33138. return $core.withContext(function($ctx1) {
  33139. $self._namespace_($recv(anObject)._at_("amdNamespace"));
  33140. return self;
  33141. }, function($ctx1) {$ctx1.fill(self,"setupFromJson:",{anObject:anObject},$globals.AmdPackageTransport)});
  33142. },
  33143. args: ["anObject"],
  33144. source: "setupFromJson: anObject\x0a\x09self namespace: (anObject at: 'amdNamespace')",
  33145. referencedClasses: [],
  33146. messageSends: ["namespace:", "at:"]
  33147. }),
  33148. $globals.AmdPackageTransport);
  33149. $core.addMethod(
  33150. $core.method({
  33151. selector: "namespace:",
  33152. protocol: "instance creation",
  33153. fn: function (aString){
  33154. var self=this,$self=this;
  33155. return $core.withContext(function($ctx1) {
  33156. var $1;
  33157. $1=$self._new();
  33158. $recv($1)._namespace_(aString);
  33159. return $recv($1)._yourself();
  33160. }, function($ctx1) {$ctx1.fill(self,"namespace:",{aString:aString},$globals.AmdPackageTransport.a$cls)});
  33161. },
  33162. args: ["aString"],
  33163. source: "namespace: aString\x0a\x09^ self new\x0a\x09\x09namespace: aString;\x0a\x09\x09yourself",
  33164. referencedClasses: [],
  33165. messageSends: ["namespace:", "new", "yourself"]
  33166. }),
  33167. $globals.AmdPackageTransport.a$cls);
  33168. $core.addMethod(
  33169. $core.method({
  33170. selector: "type",
  33171. protocol: "accessing",
  33172. fn: function (){
  33173. var self=this,$self=this;
  33174. return "amd";
  33175. },
  33176. args: [],
  33177. source: "type\x0a\x09^ 'amd'",
  33178. referencedClasses: [],
  33179. messageSends: []
  33180. }),
  33181. $globals.AmdPackageTransport.a$cls);
  33182. $core.addMethod(
  33183. $core.method({
  33184. selector: "exportBehaviorDefinitionTo:using:",
  33185. protocol: "*Platform-ImportExport",
  33186. fn: function (aStream,anExporter){
  33187. var self=this,$self=this;
  33188. return $core.withContext(function($ctx1) {
  33189. $recv(anExporter)._exportDefinitionOf_on_(self,aStream);
  33190. return self;
  33191. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Class)});
  33192. },
  33193. args: ["aStream", "anExporter"],
  33194. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportDefinitionOf: self on: aStream",
  33195. referencedClasses: [],
  33196. messageSends: ["exportDefinitionOf:on:"]
  33197. }),
  33198. $globals.Class);
  33199. $core.addMethod(
  33200. $core.method({
  33201. selector: "exportBehaviorDefinitionTo:using:",
  33202. protocol: "*Platform-ImportExport",
  33203. fn: function (aStream,anExporter){
  33204. var self=this,$self=this;
  33205. return $core.withContext(function($ctx1) {
  33206. $recv(anExporter)._exportMetaDefinitionOf_on_($self._instanceClass(),aStream);
  33207. return self;
  33208. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Metaclass)});
  33209. },
  33210. args: ["aStream", "anExporter"],
  33211. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportMetaDefinitionOf: self instanceClass on: aStream",
  33212. referencedClasses: [],
  33213. messageSends: ["exportMetaDefinitionOf:on:", "instanceClass"]
  33214. }),
  33215. $globals.Metaclass);
  33216. $core.addMethod(
  33217. $core.method({
  33218. selector: "commit",
  33219. protocol: "*Platform-ImportExport",
  33220. fn: function (){
  33221. var self=this,$self=this;
  33222. return $core.withContext(function($ctx1) {
  33223. return $recv($self._transport())._commit();
  33224. }, function($ctx1) {$ctx1.fill(self,"commit",{},$globals.Package)});
  33225. },
  33226. args: [],
  33227. source: "commit\x0a\x09^ self transport commit",
  33228. referencedClasses: [],
  33229. messageSends: ["commit", "transport"]
  33230. }),
  33231. $globals.Package);
  33232. $core.addMethod(
  33233. $core.method({
  33234. selector: "load",
  33235. protocol: "*Platform-ImportExport",
  33236. fn: function (){
  33237. var self=this,$self=this;
  33238. return $core.withContext(function($ctx1) {
  33239. return $recv($self._transport())._load();
  33240. }, function($ctx1) {$ctx1.fill(self,"load",{},$globals.Package)});
  33241. },
  33242. args: [],
  33243. source: "load\x0a\x09^ self transport load",
  33244. referencedClasses: [],
  33245. messageSends: ["load", "transport"]
  33246. }),
  33247. $globals.Package);
  33248. $core.addMethod(
  33249. $core.method({
  33250. selector: "loadFromNamespace:",
  33251. protocol: "*Platform-ImportExport",
  33252. fn: function (aString){
  33253. var self=this,$self=this;
  33254. return $core.withContext(function($ctx1) {
  33255. var $1;
  33256. $1=$self._transport();
  33257. $recv($1)._namespace_(aString);
  33258. return $recv($1)._load();
  33259. }, function($ctx1) {$ctx1.fill(self,"loadFromNamespace:",{aString:aString},$globals.Package)});
  33260. },
  33261. args: ["aString"],
  33262. source: "loadFromNamespace: aString\x0a\x09^ self transport\x0a\x09\x09namespace: aString;\x0a\x09\x09load",
  33263. referencedClasses: [],
  33264. messageSends: ["namespace:", "transport", "load"]
  33265. }),
  33266. $globals.Package);
  33267. $core.addMethod(
  33268. $core.method({
  33269. selector: "load:",
  33270. protocol: "*Platform-ImportExport",
  33271. fn: function (aPackageName){
  33272. var self=this,$self=this;
  33273. return $core.withContext(function($ctx1) {
  33274. return $recv($self._named_(aPackageName))._load();
  33275. }, function($ctx1) {$ctx1.fill(self,"load:",{aPackageName:aPackageName},$globals.Package.a$cls)});
  33276. },
  33277. args: ["aPackageName"],
  33278. source: "load: aPackageName\x0a\x09^ (self named: aPackageName) load",
  33279. referencedClasses: [],
  33280. messageSends: ["load", "named:"]
  33281. }),
  33282. $globals.Package.a$cls);
  33283. $core.addMethod(
  33284. $core.method({
  33285. selector: "load:fromNamespace:",
  33286. protocol: "*Platform-ImportExport",
  33287. fn: function (aPackageName,aString){
  33288. var self=this,$self=this;
  33289. return $core.withContext(function($ctx1) {
  33290. return $recv($self._named_(aPackageName))._loadFromNamespace_(aString);
  33291. }, function($ctx1) {$ctx1.fill(self,"load:fromNamespace:",{aPackageName:aPackageName,aString:aString},$globals.Package.a$cls)});
  33292. },
  33293. args: ["aPackageName", "aString"],
  33294. source: "load: aPackageName fromNamespace: aString\x0a\x09^ (self named: aPackageName) loadFromNamespace: aString",
  33295. referencedClasses: [],
  33296. messageSends: ["loadFromNamespace:", "named:"]
  33297. }),
  33298. $globals.Package.a$cls);
  33299. $core.addMethod(
  33300. $core.method({
  33301. selector: "methodsFor:",
  33302. protocol: "*Platform-ImportExport",
  33303. fn: function (aString){
  33304. var self=this,$self=this;
  33305. return $core.withContext(function($ctx1) {
  33306. var $1;
  33307. $1=$recv($globals.ClassProtocolReader)._new();
  33308. $recv($1)._class_category_(self,aString);
  33309. return $recv($1)._yourself();
  33310. }, function($ctx1) {$ctx1.fill(self,"methodsFor:",{aString:aString},$globals.TBehaviorProvider)});
  33311. },
  33312. args: ["aString"],
  33313. source: "methodsFor: aString\x0a\x09^ ClassProtocolReader new\x0a\x09\x09class: self category: aString;\x0a\x09\x09yourself",
  33314. referencedClasses: ["ClassProtocolReader"],
  33315. messageSends: ["class:category:", "new", "yourself"]
  33316. }),
  33317. $globals.TBehaviorProvider);
  33318. $core.addMethod(
  33319. $core.method({
  33320. selector: "methodsFor:stamp:",
  33321. protocol: "*Platform-ImportExport",
  33322. fn: function (aString,aStamp){
  33323. var self=this,$self=this;
  33324. return $core.withContext(function($ctx1) {
  33325. return $self._methodsFor_(aString);
  33326. }, function($ctx1) {$ctx1.fill(self,"methodsFor:stamp:",{aString:aString,aStamp:aStamp},$globals.TBehaviorProvider)});
  33327. },
  33328. args: ["aString", "aStamp"],
  33329. source: "methodsFor: aString stamp: aStamp\x0a\x09\x22Added for file-in compatibility, ignores stamp.\x22\x0a\x09^ self methodsFor: aString",
  33330. referencedClasses: [],
  33331. messageSends: ["methodsFor:"]
  33332. }),
  33333. $globals.TBehaviorProvider);
  33334. $core.addMethod(
  33335. $core.method({
  33336. selector: "commentStamp",
  33337. protocol: "*Platform-ImportExport",
  33338. fn: function (){
  33339. var self=this,$self=this;
  33340. return $core.withContext(function($ctx1) {
  33341. var $1;
  33342. $1=$recv($globals.ClassCommentReader)._new();
  33343. $recv($1)._class_(self);
  33344. return $recv($1)._yourself();
  33345. }, function($ctx1) {$ctx1.fill(self,"commentStamp",{},$globals.TMasterBehavior)});
  33346. },
  33347. args: [],
  33348. source: "commentStamp\x0a\x09^ ClassCommentReader new\x0a\x09class: self;\x0a\x09yourself",
  33349. referencedClasses: ["ClassCommentReader"],
  33350. messageSends: ["class:", "new", "yourself"]
  33351. }),
  33352. $globals.TMasterBehavior);
  33353. $core.addMethod(
  33354. $core.method({
  33355. selector: "commentStamp:prior:",
  33356. protocol: "*Platform-ImportExport",
  33357. fn: function (aStamp,prior){
  33358. var self=this,$self=this;
  33359. return $core.withContext(function($ctx1) {
  33360. return $self._commentStamp();
  33361. }, function($ctx1) {$ctx1.fill(self,"commentStamp:prior:",{aStamp:aStamp,prior:prior},$globals.TMasterBehavior)});
  33362. },
  33363. args: ["aStamp", "prior"],
  33364. source: "commentStamp: aStamp prior: prior\x0a\x09\x09^ self commentStamp",
  33365. referencedClasses: [],
  33366. messageSends: ["commentStamp"]
  33367. }),
  33368. $globals.TMasterBehavior);
  33369. $core.addMethod(
  33370. $core.method({
  33371. selector: "exportBehaviorDefinitionTo:using:",
  33372. protocol: "*Platform-ImportExport",
  33373. fn: function (aStream,anExporter){
  33374. var self=this,$self=this;
  33375. return $core.withContext(function($ctx1) {
  33376. $recv(anExporter)._exportTraitDefinitionOf_on_(self,aStream);
  33377. return self;
  33378. }, function($ctx1) {$ctx1.fill(self,"exportBehaviorDefinitionTo:using:",{aStream:aStream,anExporter:anExporter},$globals.Trait)});
  33379. },
  33380. args: ["aStream", "anExporter"],
  33381. source: "exportBehaviorDefinitionTo: aStream using: anExporter\x0a\x09anExporter exportTraitDefinitionOf: self on: aStream",
  33382. referencedClasses: [],
  33383. messageSends: ["exportTraitDefinitionOf:on:"]
  33384. }),
  33385. $globals.Trait);
  33386. });
  33387. define('amber_core/Compiler-AST',["amber/boot", "amber_core/Kernel-Dag", "amber_core/Kernel-Exceptions", "amber_core/Kernel-Methods"], function($boot){"use strict";
  33388. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  33389. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  33390. $core.addPackage("Compiler-AST");
  33391. ($core.packageDescriptors||$core.packages)["Compiler-AST"].innerEval = function (expr) { return eval(expr); };
  33392. ($core.packageDescriptors||$core.packages)["Compiler-AST"].transport = {"type":"amd","amdNamespace":"amber_core"};
  33393. $core.addClass("ASTNode", $globals.DagParentNode, ["parent", "position", "source", "shouldBeAliased"], "Compiler-AST");
  33394. $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.";
  33395. $core.addMethod(
  33396. $core.method({
  33397. selector: "inPosition:",
  33398. protocol: "testing",
  33399. fn: function (aPoint){
  33400. var self=this,$self=this;
  33401. return $core.withContext(function($ctx1) {
  33402. return $recv($recv($self._positionStart()).__lt_eq(aPoint))._and_((function(){
  33403. return $core.withContext(function($ctx2) {
  33404. return $recv($self._positionEnd()).__gt_eq(aPoint);
  33405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  33406. }));
  33407. }, function($ctx1) {$ctx1.fill(self,"inPosition:",{aPoint:aPoint},$globals.ASTNode)});
  33408. },
  33409. args: ["aPoint"],
  33410. source: "inPosition: aPoint\x0a\x09^ (self positionStart <= aPoint and: [\x0a\x09\x09self positionEnd >= aPoint ])",
  33411. referencedClasses: [],
  33412. messageSends: ["and:", "<=", "positionStart", ">=", "positionEnd"]
  33413. }),
  33414. $globals.ASTNode);
  33415. $core.addMethod(
  33416. $core.method({
  33417. selector: "isAssignmentNode",
  33418. protocol: "testing",
  33419. fn: function (){
  33420. var self=this,$self=this;
  33421. return false;
  33422. },
  33423. args: [],
  33424. source: "isAssignmentNode\x0a\x09^ false",
  33425. referencedClasses: [],
  33426. messageSends: []
  33427. }),
  33428. $globals.ASTNode);
  33429. $core.addMethod(
  33430. $core.method({
  33431. selector: "isBlockNode",
  33432. protocol: "testing",
  33433. fn: function (){
  33434. var self=this,$self=this;
  33435. return false;
  33436. },
  33437. args: [],
  33438. source: "isBlockNode\x0a\x09^ false",
  33439. referencedClasses: [],
  33440. messageSends: []
  33441. }),
  33442. $globals.ASTNode);
  33443. $core.addMethod(
  33444. $core.method({
  33445. selector: "isBlockSequenceNode",
  33446. protocol: "testing",
  33447. fn: function (){
  33448. var self=this,$self=this;
  33449. return false;
  33450. },
  33451. args: [],
  33452. source: "isBlockSequenceNode\x0a\x09^ false",
  33453. referencedClasses: [],
  33454. messageSends: []
  33455. }),
  33456. $globals.ASTNode);
  33457. $core.addMethod(
  33458. $core.method({
  33459. selector: "isCascadeNode",
  33460. protocol: "testing",
  33461. fn: function (){
  33462. var self=this,$self=this;
  33463. return false;
  33464. },
  33465. args: [],
  33466. source: "isCascadeNode\x0a\x09^ false",
  33467. referencedClasses: [],
  33468. messageSends: []
  33469. }),
  33470. $globals.ASTNode);
  33471. $core.addMethod(
  33472. $core.method({
  33473. selector: "isImmutable",
  33474. protocol: "testing",
  33475. fn: function (){
  33476. var self=this,$self=this;
  33477. return false;
  33478. },
  33479. args: [],
  33480. source: "isImmutable\x0a\x09^ false",
  33481. referencedClasses: [],
  33482. messageSends: []
  33483. }),
  33484. $globals.ASTNode);
  33485. $core.addMethod(
  33486. $core.method({
  33487. selector: "isJSStatementNode",
  33488. protocol: "testing",
  33489. fn: function (){
  33490. var self=this,$self=this;
  33491. return false;
  33492. },
  33493. args: [],
  33494. source: "isJSStatementNode\x0a\x09^ false",
  33495. referencedClasses: [],
  33496. messageSends: []
  33497. }),
  33498. $globals.ASTNode);
  33499. $core.addMethod(
  33500. $core.method({
  33501. selector: "isNavigationNode",
  33502. protocol: "testing",
  33503. fn: function (){
  33504. var self=this,$self=this;
  33505. return false;
  33506. },
  33507. args: [],
  33508. source: "isNavigationNode\x0a\x09\x22Answer true if the node can be navigated to\x22\x0a\x09\x0a\x09^ false",
  33509. referencedClasses: [],
  33510. messageSends: []
  33511. }),
  33512. $globals.ASTNode);
  33513. $core.addMethod(
  33514. $core.method({
  33515. selector: "isReturnNode",
  33516. protocol: "testing",
  33517. fn: function (){
  33518. var self=this,$self=this;
  33519. return false;
  33520. },
  33521. args: [],
  33522. source: "isReturnNode\x0a\x09^ false",
  33523. referencedClasses: [],
  33524. messageSends: []
  33525. }),
  33526. $globals.ASTNode);
  33527. $core.addMethod(
  33528. $core.method({
  33529. selector: "isSendNode",
  33530. protocol: "testing",
  33531. fn: function (){
  33532. var self=this,$self=this;
  33533. return false;
  33534. },
  33535. args: [],
  33536. source: "isSendNode\x0a\x09^ false",
  33537. referencedClasses: [],
  33538. messageSends: []
  33539. }),
  33540. $globals.ASTNode);
  33541. $core.addMethod(
  33542. $core.method({
  33543. selector: "isSequenceNode",
  33544. protocol: "testing",
  33545. fn: function (){
  33546. var self=this,$self=this;
  33547. return false;
  33548. },
  33549. args: [],
  33550. source: "isSequenceNode\x0a\x09^ false",
  33551. referencedClasses: [],
  33552. messageSends: []
  33553. }),
  33554. $globals.ASTNode);
  33555. $core.addMethod(
  33556. $core.method({
  33557. selector: "isSuperKeyword",
  33558. protocol: "testing",
  33559. fn: function (){
  33560. var self=this,$self=this;
  33561. return false;
  33562. },
  33563. args: [],
  33564. source: "isSuperKeyword\x0a\x09^ false",
  33565. referencedClasses: [],
  33566. messageSends: []
  33567. }),
  33568. $globals.ASTNode);
  33569. $core.addMethod(
  33570. $core.method({
  33571. selector: "isValueNode",
  33572. protocol: "testing",
  33573. fn: function (){
  33574. var self=this,$self=this;
  33575. return false;
  33576. },
  33577. args: [],
  33578. source: "isValueNode\x0a\x09^ false",
  33579. referencedClasses: [],
  33580. messageSends: []
  33581. }),
  33582. $globals.ASTNode);
  33583. $core.addMethod(
  33584. $core.method({
  33585. selector: "isVariableNode",
  33586. protocol: "testing",
  33587. fn: function (){
  33588. var self=this,$self=this;
  33589. return false;
  33590. },
  33591. args: [],
  33592. source: "isVariableNode\x0a\x09^ false",
  33593. referencedClasses: [],
  33594. messageSends: []
  33595. }),
  33596. $globals.ASTNode);
  33597. $core.addMethod(
  33598. $core.method({
  33599. selector: "location:",
  33600. protocol: "accessing",
  33601. fn: function (aLocation){
  33602. var self=this,$self=this;
  33603. return $core.withContext(function($ctx1) {
  33604. var $3,$2,$1;
  33605. $3=$recv(aLocation)._start();
  33606. $ctx1.sendIdx["start"]=1;
  33607. $2=$recv($3)._line();
  33608. $1=$recv($2).__at($recv($recv(aLocation)._start())._column());
  33609. $self._position_($1);
  33610. return self;
  33611. }, function($ctx1) {$ctx1.fill(self,"location:",{aLocation:aLocation},$globals.ASTNode)});
  33612. },
  33613. args: ["aLocation"],
  33614. source: "location: aLocation\x0a\x09self position: aLocation start line @ aLocation start column",
  33615. referencedClasses: [],
  33616. messageSends: ["position:", "@", "line", "start", "column"]
  33617. }),
  33618. $globals.ASTNode);
  33619. $core.addMethod(
  33620. $core.method({
  33621. selector: "method",
  33622. protocol: "accessing",
  33623. fn: function (){
  33624. var self=this,$self=this;
  33625. return $core.withContext(function($ctx1) {
  33626. var $1,$receiver;
  33627. $1=$self._parent();
  33628. if(($receiver = $1) == null || $receiver.a$nil){
  33629. return $1;
  33630. } else {
  33631. var node;
  33632. node=$receiver;
  33633. return $recv(node)._method();
  33634. }
  33635. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTNode)});
  33636. },
  33637. args: [],
  33638. source: "method\x0a\x09^ self parent ifNotNil: [ :node | node method ]",
  33639. referencedClasses: [],
  33640. messageSends: ["ifNotNil:", "parent", "method"]
  33641. }),
  33642. $globals.ASTNode);
  33643. $core.addMethod(
  33644. $core.method({
  33645. selector: "navigationNodeAt:ifAbsent:",
  33646. protocol: "accessing",
  33647. fn: function (aPoint,aBlock){
  33648. var self=this,$self=this;
  33649. var children;
  33650. return $core.withContext(function($ctx1) {
  33651. var $2,$1;
  33652. var $early={};
  33653. try {
  33654. children=$recv($self._allDagChildren())._select_((function(each){
  33655. return $core.withContext(function($ctx2) {
  33656. return $recv($recv(each)._isNavigationNode())._and_((function(){
  33657. return $core.withContext(function($ctx3) {
  33658. return $recv(each)._inPosition_(aPoint);
  33659. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  33660. }));
  33661. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33662. }));
  33663. $recv(children)._ifEmpty_((function(){
  33664. return $core.withContext(function($ctx2) {
  33665. throw $early=[$recv(aBlock)._value()];
  33666. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  33667. }));
  33668. return $recv($recv($recv(children)._asArray())._sort_((function(a,b){
  33669. return $core.withContext(function($ctx2) {
  33670. $2=$recv(a)._positionStart();
  33671. $ctx2.sendIdx["positionStart"]=1;
  33672. $1=$recv($2)._dist_(aPoint);
  33673. $ctx2.sendIdx["dist:"]=1;
  33674. return $recv($1).__lt_eq($recv($recv(b)._positionStart())._dist_(aPoint));
  33675. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,4)});
  33676. })))._first();
  33677. }
  33678. catch(e) {if(e===$early)return e[0]; throw e}
  33679. }, function($ctx1) {$ctx1.fill(self,"navigationNodeAt:ifAbsent:",{aPoint:aPoint,aBlock:aBlock,children:children},$globals.ASTNode)});
  33680. },
  33681. args: ["aPoint", "aBlock"],
  33682. 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",
  33683. referencedClasses: [],
  33684. messageSends: ["select:", "allDagChildren", "and:", "isNavigationNode", "inPosition:", "ifEmpty:", "value", "first", "sort:", "asArray", "<=", "dist:", "positionStart"]
  33685. }),
  33686. $globals.ASTNode);
  33687. $core.addMethod(
  33688. $core.method({
  33689. selector: "parent",
  33690. protocol: "accessing",
  33691. fn: function (){
  33692. var self=this,$self=this;
  33693. return $self["@parent"];
  33694. },
  33695. args: [],
  33696. source: "parent\x0a\x09^ parent",
  33697. referencedClasses: [],
  33698. messageSends: []
  33699. }),
  33700. $globals.ASTNode);
  33701. $core.addMethod(
  33702. $core.method({
  33703. selector: "parent:",
  33704. protocol: "accessing",
  33705. fn: function (aNode){
  33706. var self=this,$self=this;
  33707. $self["@parent"]=aNode;
  33708. return self;
  33709. },
  33710. args: ["aNode"],
  33711. source: "parent: aNode\x0a\x09parent := aNode",
  33712. referencedClasses: [],
  33713. messageSends: []
  33714. }),
  33715. $globals.ASTNode);
  33716. $core.addMethod(
  33717. $core.method({
  33718. selector: "position",
  33719. protocol: "accessing",
  33720. fn: function (){
  33721. var self=this,$self=this;
  33722. return $core.withContext(function($ctx1) {
  33723. var $1,$2,$receiver;
  33724. $1=$self["@position"];
  33725. if(($receiver = $1) == null || $receiver.a$nil){
  33726. $2=$self._parent();
  33727. if(($receiver = $2) == null || $receiver.a$nil){
  33728. return $2;
  33729. } else {
  33730. var node;
  33731. node=$receiver;
  33732. return $recv(node)._position();
  33733. }
  33734. } else {
  33735. return $1;
  33736. }
  33737. }, function($ctx1) {$ctx1.fill(self,"position",{},$globals.ASTNode)});
  33738. },
  33739. args: [],
  33740. 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 ] ]",
  33741. referencedClasses: [],
  33742. messageSends: ["ifNil:", "ifNotNil:", "parent", "position"]
  33743. }),
  33744. $globals.ASTNode);
  33745. $core.addMethod(
  33746. $core.method({
  33747. selector: "position:",
  33748. protocol: "accessing",
  33749. fn: function (aPosition){
  33750. var self=this,$self=this;
  33751. $self["@position"]=aPosition;
  33752. return self;
  33753. },
  33754. args: ["aPosition"],
  33755. source: "position: aPosition\x0a\x09position := aPosition",
  33756. referencedClasses: [],
  33757. messageSends: []
  33758. }),
  33759. $globals.ASTNode);
  33760. $core.addMethod(
  33761. $core.method({
  33762. selector: "positionEnd",
  33763. protocol: "accessing",
  33764. fn: function (){
  33765. var self=this,$self=this;
  33766. return $core.withContext(function($ctx1) {
  33767. var $1,$6,$5,$4,$3,$2;
  33768. $1=$self._positionStart();
  33769. $6=$self._source();
  33770. $ctx1.sendIdx["source"]=1;
  33771. $5=$recv($6)._lines();
  33772. $ctx1.sendIdx["lines"]=1;
  33773. $4=$recv($5)._size();
  33774. $ctx1.sendIdx["size"]=1;
  33775. $3=$recv($4).__minus((1));
  33776. $ctx1.sendIdx["-"]=1;
  33777. $2=$recv($3).__at($recv($recv($recv($recv($self._source())._lines())._last())._size()).__minus((1)));
  33778. return $recv($1).__plus($2);
  33779. }, function($ctx1) {$ctx1.fill(self,"positionEnd",{},$globals.ASTNode)});
  33780. },
  33781. args: [],
  33782. source: "positionEnd\x0a\x09^ self positionStart + ((self source lines size - 1) @ (self source lines last size - 1))",
  33783. referencedClasses: [],
  33784. messageSends: ["+", "positionStart", "@", "-", "size", "lines", "source", "last"]
  33785. }),
  33786. $globals.ASTNode);
  33787. $core.addMethod(
  33788. $core.method({
  33789. selector: "positionStart",
  33790. protocol: "accessing",
  33791. fn: function (){
  33792. var self=this,$self=this;
  33793. return $core.withContext(function($ctx1) {
  33794. return $self._position();
  33795. }, function($ctx1) {$ctx1.fill(self,"positionStart",{},$globals.ASTNode)});
  33796. },
  33797. args: [],
  33798. source: "positionStart\x0a\x09^ self position",
  33799. referencedClasses: [],
  33800. messageSends: ["position"]
  33801. }),
  33802. $globals.ASTNode);
  33803. $core.addMethod(
  33804. $core.method({
  33805. selector: "requiresSmalltalkContext",
  33806. protocol: "testing",
  33807. fn: function (){
  33808. var self=this,$self=this;
  33809. return $core.withContext(function($ctx1) {
  33810. return $recv($recv($self._dagChildren())._detect_ifNone_((function(each){
  33811. return $core.withContext(function($ctx2) {
  33812. return $recv(each)._requiresSmalltalkContext();
  33813. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  33814. }),(function(){
  33815. return nil;
  33816. })))._notNil();
  33817. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.ASTNode)});
  33818. },
  33819. args: [],
  33820. 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",
  33821. referencedClasses: [],
  33822. messageSends: ["notNil", "detect:ifNone:", "dagChildren", "requiresSmalltalkContext"]
  33823. }),
  33824. $globals.ASTNode);
  33825. $core.addMethod(
  33826. $core.method({
  33827. selector: "shouldBeAliased",
  33828. protocol: "accessing",
  33829. fn: function (){
  33830. var self=this,$self=this;
  33831. return $core.withContext(function($ctx1) {
  33832. var $1,$receiver;
  33833. $1=$self["@shouldBeAliased"];
  33834. if(($receiver = $1) == null || $receiver.a$nil){
  33835. return false;
  33836. } else {
  33837. return $1;
  33838. }
  33839. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.ASTNode)});
  33840. },
  33841. args: [],
  33842. source: "shouldBeAliased\x0a\x09^ shouldBeAliased ifNil: [ false ]",
  33843. referencedClasses: [],
  33844. messageSends: ["ifNil:"]
  33845. }),
  33846. $globals.ASTNode);
  33847. $core.addMethod(
  33848. $core.method({
  33849. selector: "shouldBeAliased:",
  33850. protocol: "accessing",
  33851. fn: function (aBoolean){
  33852. var self=this,$self=this;
  33853. $self["@shouldBeAliased"]=aBoolean;
  33854. return self;
  33855. },
  33856. args: ["aBoolean"],
  33857. source: "shouldBeAliased: aBoolean\x0a\x09shouldBeAliased := aBoolean",
  33858. referencedClasses: [],
  33859. messageSends: []
  33860. }),
  33861. $globals.ASTNode);
  33862. $core.addMethod(
  33863. $core.method({
  33864. selector: "size",
  33865. protocol: "accessing",
  33866. fn: function (){
  33867. var self=this,$self=this;
  33868. return $core.withContext(function($ctx1) {
  33869. return $recv($self._source())._size();
  33870. }, function($ctx1) {$ctx1.fill(self,"size",{},$globals.ASTNode)});
  33871. },
  33872. args: [],
  33873. source: "size\x0a\x09^ self source size",
  33874. referencedClasses: [],
  33875. messageSends: ["size", "source"]
  33876. }),
  33877. $globals.ASTNode);
  33878. $core.addMethod(
  33879. $core.method({
  33880. selector: "source",
  33881. protocol: "accessing",
  33882. fn: function (){
  33883. var self=this,$self=this;
  33884. return $core.withContext(function($ctx1) {
  33885. var $1,$receiver;
  33886. $1=$self["@source"];
  33887. if(($receiver = $1) == null || $receiver.a$nil){
  33888. return "";
  33889. } else {
  33890. return $1;
  33891. }
  33892. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.ASTNode)});
  33893. },
  33894. args: [],
  33895. source: "source\x0a\x09^ source ifNil: [ '' ]",
  33896. referencedClasses: [],
  33897. messageSends: ["ifNil:"]
  33898. }),
  33899. $globals.ASTNode);
  33900. $core.addMethod(
  33901. $core.method({
  33902. selector: "source:",
  33903. protocol: "accessing",
  33904. fn: function (aString){
  33905. var self=this,$self=this;
  33906. $self["@source"]=aString;
  33907. return self;
  33908. },
  33909. args: ["aString"],
  33910. source: "source: aString\x0a\x09source := aString",
  33911. referencedClasses: [],
  33912. messageSends: []
  33913. }),
  33914. $globals.ASTNode);
  33915. $core.addMethod(
  33916. $core.method({
  33917. selector: "withTail:",
  33918. protocol: "building",
  33919. fn: function (aCollection){
  33920. var self=this,$self=this;
  33921. return $core.withContext(function($ctx1) {
  33922. var $1;
  33923. return $recv(aCollection)._inject_into_(self,(function(receiver,send){
  33924. return $core.withContext(function($ctx2) {
  33925. $1=$recv($globals.SendNode)._new();
  33926. $recv($1)._position_($recv(send)._position());
  33927. $recv($1)._source_($recv(send)._source());
  33928. $recv($1)._receiver_(receiver);
  33929. $recv($1)._selector_($recv(send)._selector());
  33930. $recv($1)._arguments_($recv(send)._arguments());
  33931. return $recv($1)._yourself();
  33932. }, function($ctx2) {$ctx2.fillBlock({receiver:receiver,send:send},$ctx1,1)});
  33933. }));
  33934. }, function($ctx1) {$ctx1.fill(self,"withTail:",{aCollection:aCollection},$globals.ASTNode)});
  33935. },
  33936. args: ["aCollection"],
  33937. 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 ]",
  33938. referencedClasses: ["SendNode"],
  33939. messageSends: ["inject:into:", "position:", "new", "position", "source:", "source", "receiver:", "selector:", "selector", "arguments:", "arguments", "yourself"]
  33940. }),
  33941. $globals.ASTNode);
  33942. $core.addClass("AssignmentNode", $globals.ASTNode, ["left", "right"], "Compiler-AST");
  33943. $globals.AssignmentNode.comment="I represent an assignment node.";
  33944. $core.addMethod(
  33945. $core.method({
  33946. selector: "acceptDagVisitor:",
  33947. protocol: "visiting",
  33948. fn: function (aVisitor){
  33949. var self=this,$self=this;
  33950. return $core.withContext(function($ctx1) {
  33951. return $recv(aVisitor)._visitAssignmentNode_(self);
  33952. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.AssignmentNode)});
  33953. },
  33954. args: ["aVisitor"],
  33955. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitAssignmentNode: self",
  33956. referencedClasses: [],
  33957. messageSends: ["visitAssignmentNode:"]
  33958. }),
  33959. $globals.AssignmentNode);
  33960. $core.addMethod(
  33961. $core.method({
  33962. selector: "dagChildren",
  33963. protocol: "accessing",
  33964. fn: function (){
  33965. var self=this,$self=this;
  33966. return $core.withContext(function($ctx1) {
  33967. return $recv($globals.Array)._with_with_($self._left(),$self._right());
  33968. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.AssignmentNode)});
  33969. },
  33970. args: [],
  33971. source: "dagChildren\x0a\x09^ Array with: self left with: self right",
  33972. referencedClasses: ["Array"],
  33973. messageSends: ["with:with:", "left", "right"]
  33974. }),
  33975. $globals.AssignmentNode);
  33976. $core.addMethod(
  33977. $core.method({
  33978. selector: "isAssignmentNode",
  33979. protocol: "testing",
  33980. fn: function (){
  33981. var self=this,$self=this;
  33982. return true;
  33983. },
  33984. args: [],
  33985. source: "isAssignmentNode\x0a\x09^ true",
  33986. referencedClasses: [],
  33987. messageSends: []
  33988. }),
  33989. $globals.AssignmentNode);
  33990. $core.addMethod(
  33991. $core.method({
  33992. selector: "left",
  33993. protocol: "accessing",
  33994. fn: function (){
  33995. var self=this,$self=this;
  33996. return $self["@left"];
  33997. },
  33998. args: [],
  33999. source: "left\x0a\x09^ left",
  34000. referencedClasses: [],
  34001. messageSends: []
  34002. }),
  34003. $globals.AssignmentNode);
  34004. $core.addMethod(
  34005. $core.method({
  34006. selector: "left:",
  34007. protocol: "accessing",
  34008. fn: function (aNode){
  34009. var self=this,$self=this;
  34010. $self["@left"]=aNode;
  34011. return self;
  34012. },
  34013. args: ["aNode"],
  34014. source: "left: aNode\x0a\x09left := aNode",
  34015. referencedClasses: [],
  34016. messageSends: []
  34017. }),
  34018. $globals.AssignmentNode);
  34019. $core.addMethod(
  34020. $core.method({
  34021. selector: "right",
  34022. protocol: "accessing",
  34023. fn: function (){
  34024. var self=this,$self=this;
  34025. return $self["@right"];
  34026. },
  34027. args: [],
  34028. source: "right\x0a\x09^ right",
  34029. referencedClasses: [],
  34030. messageSends: []
  34031. }),
  34032. $globals.AssignmentNode);
  34033. $core.addMethod(
  34034. $core.method({
  34035. selector: "right:",
  34036. protocol: "accessing",
  34037. fn: function (aNode){
  34038. var self=this,$self=this;
  34039. $self["@right"]=aNode;
  34040. return self;
  34041. },
  34042. args: ["aNode"],
  34043. source: "right: aNode\x0a\x09right := aNode",
  34044. referencedClasses: [],
  34045. messageSends: []
  34046. }),
  34047. $globals.AssignmentNode);
  34048. $core.addClass("BlockNode", $globals.ASTNode, ["parameters", "scope"], "Compiler-AST");
  34049. $globals.BlockNode.comment="I represent an block closure node.";
  34050. $core.addMethod(
  34051. $core.method({
  34052. selector: "acceptDagVisitor:",
  34053. protocol: "visiting",
  34054. fn: function (aVisitor){
  34055. var self=this,$self=this;
  34056. return $core.withContext(function($ctx1) {
  34057. return $recv(aVisitor)._visitBlockNode_(self);
  34058. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockNode)});
  34059. },
  34060. args: ["aVisitor"],
  34061. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockNode: self",
  34062. referencedClasses: [],
  34063. messageSends: ["visitBlockNode:"]
  34064. }),
  34065. $globals.BlockNode);
  34066. $core.addMethod(
  34067. $core.method({
  34068. selector: "isBlockNode",
  34069. protocol: "testing",
  34070. fn: function (){
  34071. var self=this,$self=this;
  34072. return true;
  34073. },
  34074. args: [],
  34075. source: "isBlockNode\x0a\x09^ true",
  34076. referencedClasses: [],
  34077. messageSends: []
  34078. }),
  34079. $globals.BlockNode);
  34080. $core.addMethod(
  34081. $core.method({
  34082. selector: "parameters",
  34083. protocol: "accessing",
  34084. fn: function (){
  34085. var self=this,$self=this;
  34086. return $core.withContext(function($ctx1) {
  34087. var $1,$receiver;
  34088. $1=$self["@parameters"];
  34089. if(($receiver = $1) == null || $receiver.a$nil){
  34090. $self["@parameters"]=$recv($globals.Array)._new();
  34091. return $self["@parameters"];
  34092. } else {
  34093. return $1;
  34094. }
  34095. }, function($ctx1) {$ctx1.fill(self,"parameters",{},$globals.BlockNode)});
  34096. },
  34097. args: [],
  34098. source: "parameters\x0a\x09^ parameters ifNil: [ parameters := Array new ]",
  34099. referencedClasses: ["Array"],
  34100. messageSends: ["ifNil:", "new"]
  34101. }),
  34102. $globals.BlockNode);
  34103. $core.addMethod(
  34104. $core.method({
  34105. selector: "parameters:",
  34106. protocol: "accessing",
  34107. fn: function (aCollection){
  34108. var self=this,$self=this;
  34109. $self["@parameters"]=aCollection;
  34110. return self;
  34111. },
  34112. args: ["aCollection"],
  34113. source: "parameters: aCollection\x0a\x09parameters := aCollection",
  34114. referencedClasses: [],
  34115. messageSends: []
  34116. }),
  34117. $globals.BlockNode);
  34118. $core.addMethod(
  34119. $core.method({
  34120. selector: "scope",
  34121. protocol: "accessing",
  34122. fn: function (){
  34123. var self=this,$self=this;
  34124. return $self["@scope"];
  34125. },
  34126. args: [],
  34127. source: "scope\x0a\x09^ scope",
  34128. referencedClasses: [],
  34129. messageSends: []
  34130. }),
  34131. $globals.BlockNode);
  34132. $core.addMethod(
  34133. $core.method({
  34134. selector: "scope:",
  34135. protocol: "accessing",
  34136. fn: function (aLexicalScope){
  34137. var self=this,$self=this;
  34138. $self["@scope"]=aLexicalScope;
  34139. return self;
  34140. },
  34141. args: ["aLexicalScope"],
  34142. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34143. referencedClasses: [],
  34144. messageSends: []
  34145. }),
  34146. $globals.BlockNode);
  34147. $core.addClass("CascadeNode", $globals.ASTNode, ["receiver"], "Compiler-AST");
  34148. $globals.CascadeNode.comment="I represent an cascade node.";
  34149. $core.addMethod(
  34150. $core.method({
  34151. selector: "acceptDagVisitor:",
  34152. protocol: "visiting",
  34153. fn: function (aVisitor){
  34154. var self=this,$self=this;
  34155. return $core.withContext(function($ctx1) {
  34156. return $recv(aVisitor)._visitCascadeNode_(self);
  34157. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.CascadeNode)});
  34158. },
  34159. args: ["aVisitor"],
  34160. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitCascadeNode: self",
  34161. referencedClasses: [],
  34162. messageSends: ["visitCascadeNode:"]
  34163. }),
  34164. $globals.CascadeNode);
  34165. $core.addMethod(
  34166. $core.method({
  34167. selector: "isCascadeNode",
  34168. protocol: "testing",
  34169. fn: function (){
  34170. var self=this,$self=this;
  34171. return true;
  34172. },
  34173. args: [],
  34174. source: "isCascadeNode\x0a\x09^ true",
  34175. referencedClasses: [],
  34176. messageSends: []
  34177. }),
  34178. $globals.CascadeNode);
  34179. $core.addMethod(
  34180. $core.method({
  34181. selector: "receiver",
  34182. protocol: "accessing",
  34183. fn: function (){
  34184. var self=this,$self=this;
  34185. return $self["@receiver"];
  34186. },
  34187. args: [],
  34188. source: "receiver\x0a\x09^ receiver",
  34189. referencedClasses: [],
  34190. messageSends: []
  34191. }),
  34192. $globals.CascadeNode);
  34193. $core.addMethod(
  34194. $core.method({
  34195. selector: "receiver:",
  34196. protocol: "accessing",
  34197. fn: function (aNode){
  34198. var self=this,$self=this;
  34199. $self["@receiver"]=aNode;
  34200. return self;
  34201. },
  34202. args: ["aNode"],
  34203. source: "receiver: aNode\x0a\x09receiver := aNode",
  34204. referencedClasses: [],
  34205. messageSends: []
  34206. }),
  34207. $globals.CascadeNode);
  34208. $core.addClass("DynamicArrayNode", $globals.ASTNode, [], "Compiler-AST");
  34209. $globals.DynamicArrayNode.comment="I represent an dynamic array node.";
  34210. $core.addMethod(
  34211. $core.method({
  34212. selector: "acceptDagVisitor:",
  34213. protocol: "visiting",
  34214. fn: function (aVisitor){
  34215. var self=this,$self=this;
  34216. return $core.withContext(function($ctx1) {
  34217. return $recv(aVisitor)._visitDynamicArrayNode_(self);
  34218. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicArrayNode)});
  34219. },
  34220. args: ["aVisitor"],
  34221. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicArrayNode: self",
  34222. referencedClasses: [],
  34223. messageSends: ["visitDynamicArrayNode:"]
  34224. }),
  34225. $globals.DynamicArrayNode);
  34226. $core.addClass("DynamicDictionaryNode", $globals.ASTNode, [], "Compiler-AST");
  34227. $globals.DynamicDictionaryNode.comment="I represent an dynamic dictionary node.";
  34228. $core.addMethod(
  34229. $core.method({
  34230. selector: "acceptDagVisitor:",
  34231. protocol: "visiting",
  34232. fn: function (aVisitor){
  34233. var self=this,$self=this;
  34234. return $core.withContext(function($ctx1) {
  34235. return $recv(aVisitor)._visitDynamicDictionaryNode_(self);
  34236. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.DynamicDictionaryNode)});
  34237. },
  34238. args: ["aVisitor"],
  34239. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitDynamicDictionaryNode: self",
  34240. referencedClasses: [],
  34241. messageSends: ["visitDynamicDictionaryNode:"]
  34242. }),
  34243. $globals.DynamicDictionaryNode);
  34244. $core.addClass("JSStatementNode", $globals.ASTNode, [], "Compiler-AST");
  34245. $globals.JSStatementNode.comment="I represent an JavaScript statement node.";
  34246. $core.addMethod(
  34247. $core.method({
  34248. selector: "acceptDagVisitor:",
  34249. protocol: "visiting",
  34250. fn: function (aVisitor){
  34251. var self=this,$self=this;
  34252. return $core.withContext(function($ctx1) {
  34253. return $recv(aVisitor)._visitJSStatementNode_(self);
  34254. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.JSStatementNode)});
  34255. },
  34256. args: ["aVisitor"],
  34257. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitJSStatementNode: self",
  34258. referencedClasses: [],
  34259. messageSends: ["visitJSStatementNode:"]
  34260. }),
  34261. $globals.JSStatementNode);
  34262. $core.addMethod(
  34263. $core.method({
  34264. selector: "isJSStatementNode",
  34265. protocol: "testing",
  34266. fn: function (){
  34267. var self=this,$self=this;
  34268. return true;
  34269. },
  34270. args: [],
  34271. source: "isJSStatementNode\x0a\x09^ true",
  34272. referencedClasses: [],
  34273. messageSends: []
  34274. }),
  34275. $globals.JSStatementNode);
  34276. $core.addMethod(
  34277. $core.method({
  34278. selector: "requiresSmalltalkContext",
  34279. protocol: "testing",
  34280. fn: function (){
  34281. var self=this,$self=this;
  34282. return true;
  34283. },
  34284. args: [],
  34285. source: "requiresSmalltalkContext\x0a\x09^ true",
  34286. referencedClasses: [],
  34287. messageSends: []
  34288. }),
  34289. $globals.JSStatementNode);
  34290. $core.addClass("MethodNode", $globals.ASTNode, ["selector", "arguments", "source", "scope", "classReferences", "sendIndexes"], "Compiler-AST");
  34291. $globals.MethodNode.comment="I represent an method node.\x0a\x0aA method node must be the root and only method node of a valid AST.";
  34292. $core.addMethod(
  34293. $core.method({
  34294. selector: "acceptDagVisitor:",
  34295. protocol: "visiting",
  34296. fn: function (aVisitor){
  34297. var self=this,$self=this;
  34298. return $core.withContext(function($ctx1) {
  34299. return $recv(aVisitor)._visitMethodNode_(self);
  34300. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.MethodNode)});
  34301. },
  34302. args: ["aVisitor"],
  34303. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitMethodNode: self",
  34304. referencedClasses: [],
  34305. messageSends: ["visitMethodNode:"]
  34306. }),
  34307. $globals.MethodNode);
  34308. $core.addMethod(
  34309. $core.method({
  34310. selector: "arguments",
  34311. protocol: "accessing",
  34312. fn: function (){
  34313. var self=this,$self=this;
  34314. return $core.withContext(function($ctx1) {
  34315. var $1,$receiver;
  34316. $1=$self["@arguments"];
  34317. if(($receiver = $1) == null || $receiver.a$nil){
  34318. return [];
  34319. } else {
  34320. return $1;
  34321. }
  34322. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.MethodNode)});
  34323. },
  34324. args: [],
  34325. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  34326. referencedClasses: [],
  34327. messageSends: ["ifNil:"]
  34328. }),
  34329. $globals.MethodNode);
  34330. $core.addMethod(
  34331. $core.method({
  34332. selector: "arguments:",
  34333. protocol: "accessing",
  34334. fn: function (aCollection){
  34335. var self=this,$self=this;
  34336. $self["@arguments"]=aCollection;
  34337. return self;
  34338. },
  34339. args: ["aCollection"],
  34340. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34341. referencedClasses: [],
  34342. messageSends: []
  34343. }),
  34344. $globals.MethodNode);
  34345. $core.addMethod(
  34346. $core.method({
  34347. selector: "classReferences",
  34348. protocol: "accessing",
  34349. fn: function (){
  34350. var self=this,$self=this;
  34351. return $self["@classReferences"];
  34352. },
  34353. args: [],
  34354. source: "classReferences\x0a\x09^ classReferences",
  34355. referencedClasses: [],
  34356. messageSends: []
  34357. }),
  34358. $globals.MethodNode);
  34359. $core.addMethod(
  34360. $core.method({
  34361. selector: "classReferences:",
  34362. protocol: "accessing",
  34363. fn: function (aCollection){
  34364. var self=this,$self=this;
  34365. $self["@classReferences"]=aCollection;
  34366. return self;
  34367. },
  34368. args: ["aCollection"],
  34369. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  34370. referencedClasses: [],
  34371. messageSends: []
  34372. }),
  34373. $globals.MethodNode);
  34374. $core.addMethod(
  34375. $core.method({
  34376. selector: "messageSends",
  34377. protocol: "accessing",
  34378. fn: function (){
  34379. var self=this,$self=this;
  34380. return $core.withContext(function($ctx1) {
  34381. return $recv($self._sendIndexes())._keys();
  34382. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.MethodNode)});
  34383. },
  34384. args: [],
  34385. source: "messageSends\x0a\x09^ self sendIndexes keys",
  34386. referencedClasses: [],
  34387. messageSends: ["keys", "sendIndexes"]
  34388. }),
  34389. $globals.MethodNode);
  34390. $core.addMethod(
  34391. $core.method({
  34392. selector: "method",
  34393. protocol: "accessing",
  34394. fn: function (){
  34395. var self=this,$self=this;
  34396. return self;
  34397. },
  34398. args: [],
  34399. source: "method\x0a\x09^ self",
  34400. referencedClasses: [],
  34401. messageSends: []
  34402. }),
  34403. $globals.MethodNode);
  34404. $core.addMethod(
  34405. $core.method({
  34406. selector: "scope",
  34407. protocol: "accessing",
  34408. fn: function (){
  34409. var self=this,$self=this;
  34410. return $self["@scope"];
  34411. },
  34412. args: [],
  34413. source: "scope\x0a\x09^ scope",
  34414. referencedClasses: [],
  34415. messageSends: []
  34416. }),
  34417. $globals.MethodNode);
  34418. $core.addMethod(
  34419. $core.method({
  34420. selector: "scope:",
  34421. protocol: "accessing",
  34422. fn: function (aMethodScope){
  34423. var self=this,$self=this;
  34424. $self["@scope"]=aMethodScope;
  34425. return self;
  34426. },
  34427. args: ["aMethodScope"],
  34428. source: "scope: aMethodScope\x0a\x09scope := aMethodScope",
  34429. referencedClasses: [],
  34430. messageSends: []
  34431. }),
  34432. $globals.MethodNode);
  34433. $core.addMethod(
  34434. $core.method({
  34435. selector: "selector",
  34436. protocol: "accessing",
  34437. fn: function (){
  34438. var self=this,$self=this;
  34439. return $self["@selector"];
  34440. },
  34441. args: [],
  34442. source: "selector\x0a\x09^ selector",
  34443. referencedClasses: [],
  34444. messageSends: []
  34445. }),
  34446. $globals.MethodNode);
  34447. $core.addMethod(
  34448. $core.method({
  34449. selector: "selector:",
  34450. protocol: "accessing",
  34451. fn: function (aString){
  34452. var self=this,$self=this;
  34453. $self["@selector"]=aString;
  34454. return self;
  34455. },
  34456. args: ["aString"],
  34457. source: "selector: aString\x0a\x09selector := aString",
  34458. referencedClasses: [],
  34459. messageSends: []
  34460. }),
  34461. $globals.MethodNode);
  34462. $core.addMethod(
  34463. $core.method({
  34464. selector: "sendIndexes",
  34465. protocol: "accessing",
  34466. fn: function (){
  34467. var self=this,$self=this;
  34468. return $self["@sendIndexes"];
  34469. },
  34470. args: [],
  34471. source: "sendIndexes\x0a\x09^ sendIndexes",
  34472. referencedClasses: [],
  34473. messageSends: []
  34474. }),
  34475. $globals.MethodNode);
  34476. $core.addMethod(
  34477. $core.method({
  34478. selector: "sendIndexes:",
  34479. protocol: "accessing",
  34480. fn: function (aDictionary){
  34481. var self=this,$self=this;
  34482. $self["@sendIndexes"]=aDictionary;
  34483. return self;
  34484. },
  34485. args: ["aDictionary"],
  34486. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  34487. referencedClasses: [],
  34488. messageSends: []
  34489. }),
  34490. $globals.MethodNode);
  34491. $core.addMethod(
  34492. $core.method({
  34493. selector: "sequenceNode",
  34494. protocol: "accessing",
  34495. fn: function (){
  34496. var self=this,$self=this;
  34497. return $core.withContext(function($ctx1) {
  34498. var $1;
  34499. var $early={};
  34500. try {
  34501. $recv($self._dagChildren())._do_((function(each){
  34502. return $core.withContext(function($ctx2) {
  34503. $1=$recv(each)._isSequenceNode();
  34504. if($core.assert($1)){
  34505. throw $early=[each];
  34506. }
  34507. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  34508. }));
  34509. return nil;
  34510. }
  34511. catch(e) {if(e===$early)return e[0]; throw e}
  34512. }, function($ctx1) {$ctx1.fill(self,"sequenceNode",{},$globals.MethodNode)});
  34513. },
  34514. args: [],
  34515. source: "sequenceNode\x0a\x09self dagChildren do: [ :each |\x0a\x09\x09each isSequenceNode ifTrue: [ ^ each ] ].\x0a\x09\x09\x0a\x09^ nil",
  34516. referencedClasses: [],
  34517. messageSends: ["do:", "dagChildren", "ifTrue:", "isSequenceNode"]
  34518. }),
  34519. $globals.MethodNode);
  34520. $core.addMethod(
  34521. $core.method({
  34522. selector: "source",
  34523. protocol: "accessing",
  34524. fn: function (){
  34525. var self=this,$self=this;
  34526. return $self["@source"];
  34527. },
  34528. args: [],
  34529. source: "source\x0a\x09^ source",
  34530. referencedClasses: [],
  34531. messageSends: []
  34532. }),
  34533. $globals.MethodNode);
  34534. $core.addMethod(
  34535. $core.method({
  34536. selector: "source:",
  34537. protocol: "accessing",
  34538. fn: function (aString){
  34539. var self=this,$self=this;
  34540. $self["@source"]=aString;
  34541. return self;
  34542. },
  34543. args: ["aString"],
  34544. source: "source: aString\x0a\x09source := aString",
  34545. referencedClasses: [],
  34546. messageSends: []
  34547. }),
  34548. $globals.MethodNode);
  34549. $core.addClass("ReturnNode", $globals.ASTNode, ["scope"], "Compiler-AST");
  34550. $globals.ReturnNode.comment="I represent an return node. At the AST level, there is not difference between a local return or non-local return.";
  34551. $core.addMethod(
  34552. $core.method({
  34553. selector: "acceptDagVisitor:",
  34554. protocol: "visiting",
  34555. fn: function (aVisitor){
  34556. var self=this,$self=this;
  34557. return $core.withContext(function($ctx1) {
  34558. return $recv(aVisitor)._visitReturnNode_(self);
  34559. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ReturnNode)});
  34560. },
  34561. args: ["aVisitor"],
  34562. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitReturnNode: self",
  34563. referencedClasses: [],
  34564. messageSends: ["visitReturnNode:"]
  34565. }),
  34566. $globals.ReturnNode);
  34567. $core.addMethod(
  34568. $core.method({
  34569. selector: "isReturnNode",
  34570. protocol: "testing",
  34571. fn: function (){
  34572. var self=this,$self=this;
  34573. return true;
  34574. },
  34575. args: [],
  34576. source: "isReturnNode\x0a\x09^ true",
  34577. referencedClasses: [],
  34578. messageSends: []
  34579. }),
  34580. $globals.ReturnNode);
  34581. $core.addMethod(
  34582. $core.method({
  34583. selector: "nonLocalReturn",
  34584. protocol: "testing",
  34585. fn: function (){
  34586. var self=this,$self=this;
  34587. return $core.withContext(function($ctx1) {
  34588. return $recv($recv($self._scope())._isMethodScope())._not();
  34589. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturn",{},$globals.ReturnNode)});
  34590. },
  34591. args: [],
  34592. source: "nonLocalReturn\x0a\x09^ self scope isMethodScope not",
  34593. referencedClasses: [],
  34594. messageSends: ["not", "isMethodScope", "scope"]
  34595. }),
  34596. $globals.ReturnNode);
  34597. $core.addMethod(
  34598. $core.method({
  34599. selector: "scope",
  34600. protocol: "accessing",
  34601. fn: function (){
  34602. var self=this,$self=this;
  34603. return $self["@scope"];
  34604. },
  34605. args: [],
  34606. source: "scope\x0a\x09^ scope",
  34607. referencedClasses: [],
  34608. messageSends: []
  34609. }),
  34610. $globals.ReturnNode);
  34611. $core.addMethod(
  34612. $core.method({
  34613. selector: "scope:",
  34614. protocol: "accessing",
  34615. fn: function (aLexicalScope){
  34616. var self=this,$self=this;
  34617. $self["@scope"]=aLexicalScope;
  34618. return self;
  34619. },
  34620. args: ["aLexicalScope"],
  34621. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  34622. referencedClasses: [],
  34623. messageSends: []
  34624. }),
  34625. $globals.ReturnNode);
  34626. $core.addClass("SendNode", $globals.ASTNode, ["selector", "arguments", "receiver", "index", "shouldBeInlined"], "Compiler-AST");
  34627. $globals.SendNode.comment="I represent an message send node.";
  34628. $core.addMethod(
  34629. $core.method({
  34630. selector: "acceptDagVisitor:",
  34631. protocol: "visiting",
  34632. fn: function (aVisitor){
  34633. var self=this,$self=this;
  34634. return $core.withContext(function($ctx1) {
  34635. return $recv(aVisitor)._visitSendNode_(self);
  34636. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SendNode)});
  34637. },
  34638. args: ["aVisitor"],
  34639. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSendNode: self",
  34640. referencedClasses: [],
  34641. messageSends: ["visitSendNode:"]
  34642. }),
  34643. $globals.SendNode);
  34644. $core.addMethod(
  34645. $core.method({
  34646. selector: "arguments",
  34647. protocol: "accessing",
  34648. fn: function (){
  34649. var self=this,$self=this;
  34650. return $core.withContext(function($ctx1) {
  34651. var $1,$receiver;
  34652. $1=$self["@arguments"];
  34653. if(($receiver = $1) == null || $receiver.a$nil){
  34654. $self["@arguments"]=[];
  34655. return $self["@arguments"];
  34656. } else {
  34657. return $1;
  34658. }
  34659. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.SendNode)});
  34660. },
  34661. args: [],
  34662. source: "arguments\x0a\x09^ arguments ifNil: [ arguments := #() ]",
  34663. referencedClasses: [],
  34664. messageSends: ["ifNil:"]
  34665. }),
  34666. $globals.SendNode);
  34667. $core.addMethod(
  34668. $core.method({
  34669. selector: "arguments:",
  34670. protocol: "accessing",
  34671. fn: function (aCollection){
  34672. var self=this,$self=this;
  34673. $self["@arguments"]=aCollection;
  34674. return self;
  34675. },
  34676. args: ["aCollection"],
  34677. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  34678. referencedClasses: [],
  34679. messageSends: []
  34680. }),
  34681. $globals.SendNode);
  34682. $core.addMethod(
  34683. $core.method({
  34684. selector: "dagChildren",
  34685. protocol: "accessing",
  34686. fn: function (){
  34687. var self=this,$self=this;
  34688. return $core.withContext(function($ctx1) {
  34689. var $1,$2,$3,$receiver;
  34690. $1=$self._receiver();
  34691. $ctx1.sendIdx["receiver"]=1;
  34692. if(($receiver = $1) == null || $receiver.a$nil){
  34693. $2=$self._arguments();
  34694. $ctx1.sendIdx["arguments"]=1;
  34695. return $recv($2)._copy();
  34696. } else {
  34697. $1;
  34698. }
  34699. $3=$recv($globals.Array)._with_($self._receiver());
  34700. $recv($3)._addAll_($self._arguments());
  34701. return $recv($3)._yourself();
  34702. }, function($ctx1) {$ctx1.fill(self,"dagChildren",{},$globals.SendNode)});
  34703. },
  34704. args: [],
  34705. 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",
  34706. referencedClasses: ["Array"],
  34707. messageSends: ["ifNil:", "receiver", "copy", "arguments", "addAll:", "with:", "yourself"]
  34708. }),
  34709. $globals.SendNode);
  34710. $core.addMethod(
  34711. $core.method({
  34712. selector: "index",
  34713. protocol: "accessing",
  34714. fn: function (){
  34715. var self=this,$self=this;
  34716. return $self["@index"];
  34717. },
  34718. args: [],
  34719. source: "index\x0a\x09^ index",
  34720. referencedClasses: [],
  34721. messageSends: []
  34722. }),
  34723. $globals.SendNode);
  34724. $core.addMethod(
  34725. $core.method({
  34726. selector: "index:",
  34727. protocol: "accessing",
  34728. fn: function (anInteger){
  34729. var self=this,$self=this;
  34730. $self["@index"]=anInteger;
  34731. return self;
  34732. },
  34733. args: ["anInteger"],
  34734. source: "index: anInteger\x0a\x09index := anInteger",
  34735. referencedClasses: [],
  34736. messageSends: []
  34737. }),
  34738. $globals.SendNode);
  34739. $core.addMethod(
  34740. $core.method({
  34741. selector: "isNavigationNode",
  34742. protocol: "testing",
  34743. fn: function (){
  34744. var self=this,$self=this;
  34745. return true;
  34746. },
  34747. args: [],
  34748. source: "isNavigationNode\x0a\x09^ true",
  34749. referencedClasses: [],
  34750. messageSends: []
  34751. }),
  34752. $globals.SendNode);
  34753. $core.addMethod(
  34754. $core.method({
  34755. selector: "isSendNode",
  34756. protocol: "testing",
  34757. fn: function (){
  34758. var self=this,$self=this;
  34759. return true;
  34760. },
  34761. args: [],
  34762. source: "isSendNode\x0a\x09^ true",
  34763. referencedClasses: [],
  34764. messageSends: []
  34765. }),
  34766. $globals.SendNode);
  34767. $core.addMethod(
  34768. $core.method({
  34769. selector: "navigationLink",
  34770. protocol: "accessing",
  34771. fn: function (){
  34772. var self=this,$self=this;
  34773. return $core.withContext(function($ctx1) {
  34774. return $self._selector();
  34775. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.SendNode)});
  34776. },
  34777. args: [],
  34778. source: "navigationLink\x0a\x09^ self selector",
  34779. referencedClasses: [],
  34780. messageSends: ["selector"]
  34781. }),
  34782. $globals.SendNode);
  34783. $core.addMethod(
  34784. $core.method({
  34785. selector: "receiver",
  34786. protocol: "accessing",
  34787. fn: function (){
  34788. var self=this,$self=this;
  34789. return $self["@receiver"];
  34790. },
  34791. args: [],
  34792. source: "receiver\x0a\x09^ receiver",
  34793. referencedClasses: [],
  34794. messageSends: []
  34795. }),
  34796. $globals.SendNode);
  34797. $core.addMethod(
  34798. $core.method({
  34799. selector: "receiver:",
  34800. protocol: "accessing",
  34801. fn: function (aNode){
  34802. var self=this,$self=this;
  34803. $self["@receiver"]=aNode;
  34804. return self;
  34805. },
  34806. args: ["aNode"],
  34807. source: "receiver: aNode\x0a\x09receiver := aNode",
  34808. referencedClasses: [],
  34809. messageSends: []
  34810. }),
  34811. $globals.SendNode);
  34812. $core.addMethod(
  34813. $core.method({
  34814. selector: "requiresSmalltalkContext",
  34815. protocol: "testing",
  34816. fn: function (){
  34817. var self=this,$self=this;
  34818. return true;
  34819. },
  34820. args: [],
  34821. source: "requiresSmalltalkContext\x0a\x09^ true",
  34822. referencedClasses: [],
  34823. messageSends: []
  34824. }),
  34825. $globals.SendNode);
  34826. $core.addMethod(
  34827. $core.method({
  34828. selector: "selector",
  34829. protocol: "accessing",
  34830. fn: function (){
  34831. var self=this,$self=this;
  34832. return $self["@selector"];
  34833. },
  34834. args: [],
  34835. source: "selector\x0a\x09^ selector",
  34836. referencedClasses: [],
  34837. messageSends: []
  34838. }),
  34839. $globals.SendNode);
  34840. $core.addMethod(
  34841. $core.method({
  34842. selector: "selector:",
  34843. protocol: "accessing",
  34844. fn: function (aString){
  34845. var self=this,$self=this;
  34846. $self["@selector"]=aString;
  34847. return self;
  34848. },
  34849. args: ["aString"],
  34850. source: "selector: aString\x0a\x09selector := aString",
  34851. referencedClasses: [],
  34852. messageSends: []
  34853. }),
  34854. $globals.SendNode);
  34855. $core.addMethod(
  34856. $core.method({
  34857. selector: "shouldBeInlined",
  34858. protocol: "accessing",
  34859. fn: function (){
  34860. var self=this,$self=this;
  34861. return $core.withContext(function($ctx1) {
  34862. var $1,$receiver;
  34863. $1=$self["@shouldBeInlined"];
  34864. if(($receiver = $1) == null || $receiver.a$nil){
  34865. return false;
  34866. } else {
  34867. return $1;
  34868. }
  34869. }, function($ctx1) {$ctx1.fill(self,"shouldBeInlined",{},$globals.SendNode)});
  34870. },
  34871. args: [],
  34872. source: "shouldBeInlined\x0a\x09^ shouldBeInlined ifNil: [ false ]",
  34873. referencedClasses: [],
  34874. messageSends: ["ifNil:"]
  34875. }),
  34876. $globals.SendNode);
  34877. $core.addMethod(
  34878. $core.method({
  34879. selector: "shouldBeInlined:",
  34880. protocol: "accessing",
  34881. fn: function (aBoolean){
  34882. var self=this,$self=this;
  34883. $self["@shouldBeInlined"]=aBoolean;
  34884. return self;
  34885. },
  34886. args: ["aBoolean"],
  34887. source: "shouldBeInlined: aBoolean\x0a\x09shouldBeInlined := aBoolean",
  34888. referencedClasses: [],
  34889. messageSends: []
  34890. }),
  34891. $globals.SendNode);
  34892. $core.addMethod(
  34893. $core.method({
  34894. selector: "superSend",
  34895. protocol: "accessing",
  34896. fn: function (){
  34897. var self=this,$self=this;
  34898. return $core.withContext(function($ctx1) {
  34899. var $2,$1;
  34900. $2=$self._receiver();
  34901. $ctx1.sendIdx["receiver"]=1;
  34902. $1=$recv($2)._notNil();
  34903. return $recv($1)._and_((function(){
  34904. return $core.withContext(function($ctx2) {
  34905. return $recv($self._receiver())._isSuperKeyword();
  34906. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  34907. }));
  34908. }, function($ctx1) {$ctx1.fill(self,"superSend",{},$globals.SendNode)});
  34909. },
  34910. args: [],
  34911. source: "superSend\x0a\x09^ self receiver notNil and: [ self receiver isSuperKeyword ]",
  34912. referencedClasses: [],
  34913. messageSends: ["and:", "notNil", "receiver", "isSuperKeyword"]
  34914. }),
  34915. $globals.SendNode);
  34916. $core.addClass("SequenceNode", $globals.ASTNode, ["temps", "pragmas", "scope"], "Compiler-AST");
  34917. $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).";
  34918. $core.addMethod(
  34919. $core.method({
  34920. selector: "acceptDagVisitor:",
  34921. protocol: "visiting",
  34922. fn: function (aVisitor){
  34923. var self=this,$self=this;
  34924. return $core.withContext(function($ctx1) {
  34925. return $recv(aVisitor)._visitSequenceNode_(self);
  34926. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.SequenceNode)});
  34927. },
  34928. args: ["aVisitor"],
  34929. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitSequenceNode: self",
  34930. referencedClasses: [],
  34931. messageSends: ["visitSequenceNode:"]
  34932. }),
  34933. $globals.SequenceNode);
  34934. $core.addMethod(
  34935. $core.method({
  34936. selector: "asBlockSequenceNode",
  34937. protocol: "building",
  34938. fn: function (){
  34939. var self=this,$self=this;
  34940. return $core.withContext(function($ctx1) {
  34941. var $1;
  34942. $1=$recv($globals.BlockSequenceNode)._new();
  34943. $recv($1)._position_($self._position());
  34944. $recv($1)._source_($self._source());
  34945. $recv($1)._dagChildren_($self._dagChildren());
  34946. $recv($1)._temps_($self._temps());
  34947. $recv($1)._pragmas_($self._pragmas());
  34948. return $recv($1)._yourself();
  34949. }, function($ctx1) {$ctx1.fill(self,"asBlockSequenceNode",{},$globals.SequenceNode)});
  34950. },
  34951. args: [],
  34952. 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",
  34953. referencedClasses: ["BlockSequenceNode"],
  34954. messageSends: ["position:", "new", "position", "source:", "source", "dagChildren:", "dagChildren", "temps:", "temps", "pragmas:", "pragmas", "yourself"]
  34955. }),
  34956. $globals.SequenceNode);
  34957. $core.addMethod(
  34958. $core.method({
  34959. selector: "isSequenceNode",
  34960. protocol: "testing",
  34961. fn: function (){
  34962. var self=this,$self=this;
  34963. return true;
  34964. },
  34965. args: [],
  34966. source: "isSequenceNode\x0a\x09^ true",
  34967. referencedClasses: [],
  34968. messageSends: []
  34969. }),
  34970. $globals.SequenceNode);
  34971. $core.addMethod(
  34972. $core.method({
  34973. selector: "pragmas",
  34974. protocol: "accessing",
  34975. fn: function (){
  34976. var self=this,$self=this;
  34977. return $core.withContext(function($ctx1) {
  34978. var $1,$receiver;
  34979. $1=$self["@pragmas"];
  34980. if(($receiver = $1) == null || $receiver.a$nil){
  34981. return [];
  34982. } else {
  34983. return $1;
  34984. }
  34985. }, function($ctx1) {$ctx1.fill(self,"pragmas",{},$globals.SequenceNode)});
  34986. },
  34987. args: [],
  34988. source: "pragmas\x0a\x09^ pragmas ifNil: [ #() ]",
  34989. referencedClasses: [],
  34990. messageSends: ["ifNil:"]
  34991. }),
  34992. $globals.SequenceNode);
  34993. $core.addMethod(
  34994. $core.method({
  34995. selector: "pragmas:",
  34996. protocol: "accessing",
  34997. fn: function (aCollection){
  34998. var self=this,$self=this;
  34999. $self["@pragmas"]=aCollection;
  35000. return self;
  35001. },
  35002. args: ["aCollection"],
  35003. source: "pragmas: aCollection\x0a\x09pragmas := aCollection",
  35004. referencedClasses: [],
  35005. messageSends: []
  35006. }),
  35007. $globals.SequenceNode);
  35008. $core.addMethod(
  35009. $core.method({
  35010. selector: "scope",
  35011. protocol: "accessing",
  35012. fn: function (){
  35013. var self=this,$self=this;
  35014. return $self["@scope"];
  35015. },
  35016. args: [],
  35017. source: "scope\x0a\x09^ scope",
  35018. referencedClasses: [],
  35019. messageSends: []
  35020. }),
  35021. $globals.SequenceNode);
  35022. $core.addMethod(
  35023. $core.method({
  35024. selector: "scope:",
  35025. protocol: "accessing",
  35026. fn: function (aLexicalScope){
  35027. var self=this,$self=this;
  35028. $self["@scope"]=aLexicalScope;
  35029. return self;
  35030. },
  35031. args: ["aLexicalScope"],
  35032. source: "scope: aLexicalScope\x0a\x09scope := aLexicalScope",
  35033. referencedClasses: [],
  35034. messageSends: []
  35035. }),
  35036. $globals.SequenceNode);
  35037. $core.addMethod(
  35038. $core.method({
  35039. selector: "temps",
  35040. protocol: "accessing",
  35041. fn: function (){
  35042. var self=this,$self=this;
  35043. return $core.withContext(function($ctx1) {
  35044. var $1,$receiver;
  35045. $1=$self["@temps"];
  35046. if(($receiver = $1) == null || $receiver.a$nil){
  35047. return [];
  35048. } else {
  35049. return $1;
  35050. }
  35051. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.SequenceNode)});
  35052. },
  35053. args: [],
  35054. source: "temps\x0a\x09^ temps ifNil: [ #() ]",
  35055. referencedClasses: [],
  35056. messageSends: ["ifNil:"]
  35057. }),
  35058. $globals.SequenceNode);
  35059. $core.addMethod(
  35060. $core.method({
  35061. selector: "temps:",
  35062. protocol: "accessing",
  35063. fn: function (aCollection){
  35064. var self=this,$self=this;
  35065. $self["@temps"]=aCollection;
  35066. return self;
  35067. },
  35068. args: ["aCollection"],
  35069. source: "temps: aCollection\x0a\x09temps := aCollection",
  35070. referencedClasses: [],
  35071. messageSends: []
  35072. }),
  35073. $globals.SequenceNode);
  35074. $core.addClass("BlockSequenceNode", $globals.SequenceNode, [], "Compiler-AST");
  35075. $globals.BlockSequenceNode.comment="I represent an special sequence node for block scopes.";
  35076. $core.addMethod(
  35077. $core.method({
  35078. selector: "acceptDagVisitor:",
  35079. protocol: "visiting",
  35080. fn: function (aVisitor){
  35081. var self=this,$self=this;
  35082. return $core.withContext(function($ctx1) {
  35083. return $recv(aVisitor)._visitBlockSequenceNode_(self);
  35084. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.BlockSequenceNode)});
  35085. },
  35086. args: ["aVisitor"],
  35087. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitBlockSequenceNode: self",
  35088. referencedClasses: [],
  35089. messageSends: ["visitBlockSequenceNode:"]
  35090. }),
  35091. $globals.BlockSequenceNode);
  35092. $core.addMethod(
  35093. $core.method({
  35094. selector: "isBlockSequenceNode",
  35095. protocol: "testing",
  35096. fn: function (){
  35097. var self=this,$self=this;
  35098. return true;
  35099. },
  35100. args: [],
  35101. source: "isBlockSequenceNode\x0a\x09^ true",
  35102. referencedClasses: [],
  35103. messageSends: []
  35104. }),
  35105. $globals.BlockSequenceNode);
  35106. $core.addMethod(
  35107. $core.method({
  35108. selector: "pragmas:",
  35109. protocol: "visiting",
  35110. fn: function (aCollection){
  35111. var self=this,$self=this;
  35112. return $core.withContext(function($ctx1) {
  35113. var $1;
  35114. $recv(aCollection)._ifNotEmpty_((function(){
  35115. return $core.withContext(function($ctx2) {
  35116. return $recv($globals.CompilerError)._signal_("Block must have no pragmas.");
  35117. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35118. }));
  35119. $1=(
  35120. $ctx1.supercall = true,
  35121. ($globals.BlockSequenceNode.superclass||$boot.nilAsClass).fn.prototype._pragmas_.apply($self, [aCollection]));
  35122. $ctx1.supercall = false;
  35123. return $1;
  35124. }, function($ctx1) {$ctx1.fill(self,"pragmas:",{aCollection:aCollection},$globals.BlockSequenceNode)});
  35125. },
  35126. args: ["aCollection"],
  35127. source: "pragmas: aCollection\x0a\x09aCollection ifNotEmpty: [\x0a\x09\x09CompilerError signal: 'Block must have no pragmas.' ].\x0a\x09^ super pragmas: aCollection",
  35128. referencedClasses: ["CompilerError"],
  35129. messageSends: ["ifNotEmpty:", "signal:", "pragmas:"]
  35130. }),
  35131. $globals.BlockSequenceNode);
  35132. $core.addClass("ValueNode", $globals.ASTNode, ["value"], "Compiler-AST");
  35133. $globals.ValueNode.comment="I represent a value node.";
  35134. $core.addMethod(
  35135. $core.method({
  35136. selector: "acceptDagVisitor:",
  35137. protocol: "visiting",
  35138. fn: function (aVisitor){
  35139. var self=this,$self=this;
  35140. return $core.withContext(function($ctx1) {
  35141. return $recv(aVisitor)._visitValueNode_(self);
  35142. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.ValueNode)});
  35143. },
  35144. args: ["aVisitor"],
  35145. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitValueNode: self",
  35146. referencedClasses: [],
  35147. messageSends: ["visitValueNode:"]
  35148. }),
  35149. $globals.ValueNode);
  35150. $core.addMethod(
  35151. $core.method({
  35152. selector: "isImmutable",
  35153. protocol: "testing",
  35154. fn: function (){
  35155. var self=this,$self=this;
  35156. return $core.withContext(function($ctx1) {
  35157. return $recv($self._value())._isImmutable();
  35158. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.ValueNode)});
  35159. },
  35160. args: [],
  35161. source: "isImmutable\x0a\x09^ self value isImmutable",
  35162. referencedClasses: [],
  35163. messageSends: ["isImmutable", "value"]
  35164. }),
  35165. $globals.ValueNode);
  35166. $core.addMethod(
  35167. $core.method({
  35168. selector: "isValueNode",
  35169. protocol: "testing",
  35170. fn: function (){
  35171. var self=this,$self=this;
  35172. return true;
  35173. },
  35174. args: [],
  35175. source: "isValueNode\x0a\x09^ true",
  35176. referencedClasses: [],
  35177. messageSends: []
  35178. }),
  35179. $globals.ValueNode);
  35180. $core.addMethod(
  35181. $core.method({
  35182. selector: "value",
  35183. protocol: "accessing",
  35184. fn: function (){
  35185. var self=this,$self=this;
  35186. return $self["@value"];
  35187. },
  35188. args: [],
  35189. source: "value\x0a\x09^ value",
  35190. referencedClasses: [],
  35191. messageSends: []
  35192. }),
  35193. $globals.ValueNode);
  35194. $core.addMethod(
  35195. $core.method({
  35196. selector: "value:",
  35197. protocol: "accessing",
  35198. fn: function (anObject){
  35199. var self=this,$self=this;
  35200. $self["@value"]=anObject;
  35201. return self;
  35202. },
  35203. args: ["anObject"],
  35204. source: "value: anObject\x0a\x09value := anObject",
  35205. referencedClasses: [],
  35206. messageSends: []
  35207. }),
  35208. $globals.ValueNode);
  35209. $core.addClass("VariableNode", $globals.ValueNode, ["assigned", "binding"], "Compiler-AST");
  35210. $globals.VariableNode.comment="I represent an variable node.";
  35211. $core.addMethod(
  35212. $core.method({
  35213. selector: "acceptDagVisitor:",
  35214. protocol: "visiting",
  35215. fn: function (aVisitor){
  35216. var self=this,$self=this;
  35217. return $core.withContext(function($ctx1) {
  35218. return $recv(aVisitor)._visitVariableNode_(self);
  35219. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.VariableNode)});
  35220. },
  35221. args: ["aVisitor"],
  35222. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitVariableNode: self",
  35223. referencedClasses: [],
  35224. messageSends: ["visitVariableNode:"]
  35225. }),
  35226. $globals.VariableNode);
  35227. $core.addMethod(
  35228. $core.method({
  35229. selector: "alias",
  35230. protocol: "accessing",
  35231. fn: function (){
  35232. var self=this,$self=this;
  35233. return $core.withContext(function($ctx1) {
  35234. return $recv($self._binding())._alias();
  35235. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.VariableNode)});
  35236. },
  35237. args: [],
  35238. source: "alias\x0a\x09^ self binding alias",
  35239. referencedClasses: [],
  35240. messageSends: ["alias", "binding"]
  35241. }),
  35242. $globals.VariableNode);
  35243. $core.addMethod(
  35244. $core.method({
  35245. selector: "assigned",
  35246. protocol: "accessing",
  35247. fn: function (){
  35248. var self=this,$self=this;
  35249. return $core.withContext(function($ctx1) {
  35250. var $1,$receiver;
  35251. $1=$self["@assigned"];
  35252. if(($receiver = $1) == null || $receiver.a$nil){
  35253. return false;
  35254. } else {
  35255. return $1;
  35256. }
  35257. }, function($ctx1) {$ctx1.fill(self,"assigned",{},$globals.VariableNode)});
  35258. },
  35259. args: [],
  35260. source: "assigned\x0a\x09^ assigned ifNil: [ false ]",
  35261. referencedClasses: [],
  35262. messageSends: ["ifNil:"]
  35263. }),
  35264. $globals.VariableNode);
  35265. $core.addMethod(
  35266. $core.method({
  35267. selector: "assigned:",
  35268. protocol: "accessing",
  35269. fn: function (aBoolean){
  35270. var self=this,$self=this;
  35271. $self["@assigned"]=aBoolean;
  35272. return self;
  35273. },
  35274. args: ["aBoolean"],
  35275. source: "assigned: aBoolean\x0a\x09assigned := aBoolean",
  35276. referencedClasses: [],
  35277. messageSends: []
  35278. }),
  35279. $globals.VariableNode);
  35280. $core.addMethod(
  35281. $core.method({
  35282. selector: "beAssigned",
  35283. protocol: "accessing",
  35284. fn: function (){
  35285. var self=this,$self=this;
  35286. return $core.withContext(function($ctx1) {
  35287. $recv($self._binding())._validateAssignment();
  35288. $self["@assigned"]=true;
  35289. return self;
  35290. }, function($ctx1) {$ctx1.fill(self,"beAssigned",{},$globals.VariableNode)});
  35291. },
  35292. args: [],
  35293. source: "beAssigned\x0a\x09self binding validateAssignment.\x0a\x09assigned := true",
  35294. referencedClasses: [],
  35295. messageSends: ["validateAssignment", "binding"]
  35296. }),
  35297. $globals.VariableNode);
  35298. $core.addMethod(
  35299. $core.method({
  35300. selector: "binding",
  35301. protocol: "accessing",
  35302. fn: function (){
  35303. var self=this,$self=this;
  35304. return $self["@binding"];
  35305. },
  35306. args: [],
  35307. source: "binding\x0a\x09^ binding",
  35308. referencedClasses: [],
  35309. messageSends: []
  35310. }),
  35311. $globals.VariableNode);
  35312. $core.addMethod(
  35313. $core.method({
  35314. selector: "binding:",
  35315. protocol: "accessing",
  35316. fn: function (aScopeVar){
  35317. var self=this,$self=this;
  35318. $self["@binding"]=aScopeVar;
  35319. return self;
  35320. },
  35321. args: ["aScopeVar"],
  35322. source: "binding: aScopeVar\x0a\x09binding := aScopeVar",
  35323. referencedClasses: [],
  35324. messageSends: []
  35325. }),
  35326. $globals.VariableNode);
  35327. $core.addMethod(
  35328. $core.method({
  35329. selector: "isArgument",
  35330. protocol: "testing",
  35331. fn: function (){
  35332. var self=this,$self=this;
  35333. return $core.withContext(function($ctx1) {
  35334. return $recv($self._binding())._isArgVar();
  35335. }, function($ctx1) {$ctx1.fill(self,"isArgument",{},$globals.VariableNode)});
  35336. },
  35337. args: [],
  35338. source: "isArgument\x0a\x09^ self binding isArgVar",
  35339. referencedClasses: [],
  35340. messageSends: ["isArgVar", "binding"]
  35341. }),
  35342. $globals.VariableNode);
  35343. $core.addMethod(
  35344. $core.method({
  35345. selector: "isImmutable",
  35346. protocol: "testing",
  35347. fn: function (){
  35348. var self=this,$self=this;
  35349. return $core.withContext(function($ctx1) {
  35350. return $recv($self._binding())._isImmutable();
  35351. }, function($ctx1) {$ctx1.fill(self,"isImmutable",{},$globals.VariableNode)});
  35352. },
  35353. args: [],
  35354. source: "isImmutable\x0a\x09^ self binding isImmutable",
  35355. referencedClasses: [],
  35356. messageSends: ["isImmutable", "binding"]
  35357. }),
  35358. $globals.VariableNode);
  35359. $core.addMethod(
  35360. $core.method({
  35361. selector: "isNavigationNode",
  35362. protocol: "testing",
  35363. fn: function (){
  35364. var self=this,$self=this;
  35365. return true;
  35366. },
  35367. args: [],
  35368. source: "isNavigationNode\x0a\x09^ true",
  35369. referencedClasses: [],
  35370. messageSends: []
  35371. }),
  35372. $globals.VariableNode);
  35373. $core.addMethod(
  35374. $core.method({
  35375. selector: "isSuperKeyword",
  35376. protocol: "testing",
  35377. fn: function (){
  35378. var self=this,$self=this;
  35379. return $core.withContext(function($ctx1) {
  35380. return $recv($self._value()).__eq("super");
  35381. }, function($ctx1) {$ctx1.fill(self,"isSuperKeyword",{},$globals.VariableNode)});
  35382. },
  35383. args: [],
  35384. source: "isSuperKeyword\x0a\x09^ self value = 'super'",
  35385. referencedClasses: [],
  35386. messageSends: ["=", "value"]
  35387. }),
  35388. $globals.VariableNode);
  35389. $core.addMethod(
  35390. $core.method({
  35391. selector: "isVariableNode",
  35392. protocol: "testing",
  35393. fn: function (){
  35394. var self=this,$self=this;
  35395. return true;
  35396. },
  35397. args: [],
  35398. source: "isVariableNode\x0a\x09^ true",
  35399. referencedClasses: [],
  35400. messageSends: []
  35401. }),
  35402. $globals.VariableNode);
  35403. $core.addMethod(
  35404. $core.method({
  35405. selector: "navigationLink",
  35406. protocol: "accessing",
  35407. fn: function (){
  35408. var self=this,$self=this;
  35409. return $core.withContext(function($ctx1) {
  35410. return $self._value();
  35411. }, function($ctx1) {$ctx1.fill(self,"navigationLink",{},$globals.VariableNode)});
  35412. },
  35413. args: [],
  35414. source: "navigationLink\x0a\x09^ self value",
  35415. referencedClasses: [],
  35416. messageSends: ["value"]
  35417. }),
  35418. $globals.VariableNode);
  35419. $core.addClass("CompilerError", $globals.Error, [], "Compiler-AST");
  35420. $globals.CompilerError.comment="I am the common superclass of all compiling errors.";
  35421. $core.addClass("ParentFakingPathDagVisitor", $globals.PathDagVisitor, ["setParentSelector"], "Compiler-AST");
  35422. $globals.ParentFakingPathDagVisitor.comment="I am base class of `DagNode` visitor.\x0a\x0aI hold the path of ancestors up to actual node\x0ain `self path`.";
  35423. $core.addMethod(
  35424. $core.method({
  35425. selector: "visit:",
  35426. protocol: "visiting",
  35427. fn: function (aNode){
  35428. var self=this,$self=this;
  35429. return $core.withContext(function($ctx1) {
  35430. var $1;
  35431. $recv($self._path())._ifNotEmpty_((function(p){
  35432. return $core.withContext(function($ctx2) {
  35433. return $recv(aNode)._parent_($recv(p)._last());
  35434. }, function($ctx2) {$ctx2.fillBlock({p:p},$ctx1,1)});
  35435. }));
  35436. $1=(
  35437. $ctx1.supercall = true,
  35438. ($globals.ParentFakingPathDagVisitor.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  35439. $ctx1.supercall = false;
  35440. return $1;
  35441. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ParentFakingPathDagVisitor)});
  35442. },
  35443. args: ["aNode"],
  35444. source: "visit: aNode\x0a\x09self path ifNotEmpty: [ :p | aNode parent: p last ].\x0a\x09^ super visit: aNode",
  35445. referencedClasses: [],
  35446. messageSends: ["ifNotEmpty:", "path", "parent:", "last", "visit:"]
  35447. }),
  35448. $globals.ParentFakingPathDagVisitor);
  35449. $core.addClass("NodeVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-AST");
  35450. $globals.NodeVisitor.comment="I am the abstract super class of all AST node visitors.";
  35451. $core.addMethod(
  35452. $core.method({
  35453. selector: "visitAssignmentNode:",
  35454. protocol: "visiting",
  35455. fn: function (aNode){
  35456. var self=this,$self=this;
  35457. return $core.withContext(function($ctx1) {
  35458. return $self._visitDagNode_(aNode);
  35459. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.NodeVisitor)});
  35460. },
  35461. args: ["aNode"],
  35462. source: "visitAssignmentNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35463. referencedClasses: [],
  35464. messageSends: ["visitDagNode:"]
  35465. }),
  35466. $globals.NodeVisitor);
  35467. $core.addMethod(
  35468. $core.method({
  35469. selector: "visitBlockNode:",
  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,"visitBlockNode:",{aNode:aNode},$globals.NodeVisitor)});
  35476. },
  35477. args: ["aNode"],
  35478. source: "visitBlockNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35479. referencedClasses: [],
  35480. messageSends: ["visitDagNode:"]
  35481. }),
  35482. $globals.NodeVisitor);
  35483. $core.addMethod(
  35484. $core.method({
  35485. selector: "visitBlockSequenceNode:",
  35486. protocol: "visiting",
  35487. fn: function (aNode){
  35488. var self=this,$self=this;
  35489. return $core.withContext(function($ctx1) {
  35490. return $self._visitSequenceNode_(aNode);
  35491. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35492. },
  35493. args: ["aNode"],
  35494. source: "visitBlockSequenceNode: aNode\x0a\x09^ self visitSequenceNode: aNode",
  35495. referencedClasses: [],
  35496. messageSends: ["visitSequenceNode:"]
  35497. }),
  35498. $globals.NodeVisitor);
  35499. $core.addMethod(
  35500. $core.method({
  35501. selector: "visitCascadeNode:",
  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,"visitCascadeNode:",{aNode:aNode},$globals.NodeVisitor)});
  35508. },
  35509. args: ["aNode"],
  35510. source: "visitCascadeNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35511. referencedClasses: [],
  35512. messageSends: ["visitDagNode:"]
  35513. }),
  35514. $globals.NodeVisitor);
  35515. $core.addMethod(
  35516. $core.method({
  35517. selector: "visitDagNode:",
  35518. protocol: "visiting",
  35519. fn: function (aNode){
  35520. var self=this,$self=this;
  35521. return $core.withContext(function($ctx1) {
  35522. return $self._visitDagNodeVariantSimple_(aNode);
  35523. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.NodeVisitor)});
  35524. },
  35525. args: ["aNode"],
  35526. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  35527. referencedClasses: [],
  35528. messageSends: ["visitDagNodeVariantSimple:"]
  35529. }),
  35530. $globals.NodeVisitor);
  35531. $core.addMethod(
  35532. $core.method({
  35533. selector: "visitDynamicArrayNode:",
  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,"visitDynamicArrayNode:",{aNode:aNode},$globals.NodeVisitor)});
  35540. },
  35541. args: ["aNode"],
  35542. source: "visitDynamicArrayNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35543. referencedClasses: [],
  35544. messageSends: ["visitDagNode:"]
  35545. }),
  35546. $globals.NodeVisitor);
  35547. $core.addMethod(
  35548. $core.method({
  35549. selector: "visitDynamicDictionaryNode:",
  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,"visitDynamicDictionaryNode:",{aNode:aNode},$globals.NodeVisitor)});
  35556. },
  35557. args: ["aNode"],
  35558. source: "visitDynamicDictionaryNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35559. referencedClasses: [],
  35560. messageSends: ["visitDagNode:"]
  35561. }),
  35562. $globals.NodeVisitor);
  35563. $core.addMethod(
  35564. $core.method({
  35565. selector: "visitJSStatementNode:",
  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,"visitJSStatementNode:",{aNode:aNode},$globals.NodeVisitor)});
  35572. },
  35573. args: ["aNode"],
  35574. source: "visitJSStatementNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35575. referencedClasses: [],
  35576. messageSends: ["visitDagNode:"]
  35577. }),
  35578. $globals.NodeVisitor);
  35579. $core.addMethod(
  35580. $core.method({
  35581. selector: "visitMethodNode:",
  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,"visitMethodNode:",{aNode:aNode},$globals.NodeVisitor)});
  35588. },
  35589. args: ["aNode"],
  35590. source: "visitMethodNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35591. referencedClasses: [],
  35592. messageSends: ["visitDagNode:"]
  35593. }),
  35594. $globals.NodeVisitor);
  35595. $core.addMethod(
  35596. $core.method({
  35597. selector: "visitReturnNode:",
  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,"visitReturnNode:",{aNode:aNode},$globals.NodeVisitor)});
  35604. },
  35605. args: ["aNode"],
  35606. source: "visitReturnNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35607. referencedClasses: [],
  35608. messageSends: ["visitDagNode:"]
  35609. }),
  35610. $globals.NodeVisitor);
  35611. $core.addMethod(
  35612. $core.method({
  35613. selector: "visitSendNode:",
  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,"visitSendNode:",{aNode:aNode},$globals.NodeVisitor)});
  35620. },
  35621. args: ["aNode"],
  35622. source: "visitSendNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35623. referencedClasses: [],
  35624. messageSends: ["visitDagNode:"]
  35625. }),
  35626. $globals.NodeVisitor);
  35627. $core.addMethod(
  35628. $core.method({
  35629. selector: "visitSequenceNode:",
  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,"visitSequenceNode:",{aNode:aNode},$globals.NodeVisitor)});
  35636. },
  35637. args: ["aNode"],
  35638. source: "visitSequenceNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35639. referencedClasses: [],
  35640. messageSends: ["visitDagNode:"]
  35641. }),
  35642. $globals.NodeVisitor);
  35643. $core.addMethod(
  35644. $core.method({
  35645. selector: "visitValueNode:",
  35646. protocol: "visiting",
  35647. fn: function (aNode){
  35648. var self=this,$self=this;
  35649. return $core.withContext(function($ctx1) {
  35650. return $self._visitDagNode_(aNode);
  35651. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.NodeVisitor)});
  35652. },
  35653. args: ["aNode"],
  35654. source: "visitValueNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35655. referencedClasses: [],
  35656. messageSends: ["visitDagNode:"]
  35657. }),
  35658. $globals.NodeVisitor);
  35659. $core.addMethod(
  35660. $core.method({
  35661. selector: "visitVariableNode:",
  35662. protocol: "visiting",
  35663. fn: function (aNode){
  35664. var self=this,$self=this;
  35665. return $core.withContext(function($ctx1) {
  35666. return $self._visitDagNode_(aNode);
  35667. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.NodeVisitor)});
  35668. },
  35669. args: ["aNode"],
  35670. source: "visitVariableNode: aNode\x0a\x09^ self visitDagNode: aNode",
  35671. referencedClasses: [],
  35672. messageSends: ["visitDagNode:"]
  35673. }),
  35674. $globals.NodeVisitor);
  35675. $core.addMethod(
  35676. $core.method({
  35677. selector: "ast",
  35678. protocol: "*Compiler-AST",
  35679. fn: function (){
  35680. var self=this,$self=this;
  35681. return $core.withContext(function($ctx1) {
  35682. var $1;
  35683. $1=$self._source();
  35684. $ctx1.sendIdx["source"]=1;
  35685. $recv($1)._ifEmpty_((function(){
  35686. return $core.withContext(function($ctx2) {
  35687. return $recv($globals.CompilerError)._signal_("Method source is empty");
  35688. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  35689. }));
  35690. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_($self._source(),$self._methodClass(),$self._protocol());
  35691. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.CompiledMethod)});
  35692. },
  35693. args: [],
  35694. 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",
  35695. referencedClasses: ["CompilerError", "Compiler"],
  35696. messageSends: ["ifEmpty:", "source", "signal:", "ast:forClass:protocol:", "new", "methodClass", "protocol"]
  35697. }),
  35698. $globals.CompiledMethod);
  35699. });
  35700. define('amber_core/Compiler-Core',["amber/boot", "amber_core/Compiler-AST", "amber_core/Kernel-Collections", "amber_core/Kernel-Objects"], function($boot){"use strict";
  35701. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  35702. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  35703. $core.addPackage("Compiler-Core");
  35704. ($core.packageDescriptors||$core.packages)["Compiler-Core"].innerEval = function (expr) { return eval(expr); };
  35705. ($core.packageDescriptors||$core.packages)["Compiler-Core"].transport = {"type":"amd","amdNamespace":"amber_core"};
  35706. $core.addClass("AbstractCodeGenerator", $globals.Object, ["currentClass", "currentPackage", "source"], "Compiler-Core");
  35707. $globals.AbstractCodeGenerator.comment="I am the abstract super class of all code generators and provide their common API.";
  35708. $core.addMethod(
  35709. $core.method({
  35710. selector: "compileNode:",
  35711. protocol: "compiling",
  35712. fn: function (aNode){
  35713. var self=this,$self=this;
  35714. return $core.withContext(function($ctx1) {
  35715. return $recv($self._transformers())._inject_into_(aNode,(function(input,transformer){
  35716. return $core.withContext(function($ctx2) {
  35717. return $recv(transformer)._value_(input);
  35718. }, function($ctx2) {$ctx2.fillBlock({input:input,transformer:transformer},$ctx1,1)});
  35719. }));
  35720. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode},$globals.AbstractCodeGenerator)});
  35721. },
  35722. args: ["aNode"],
  35723. source: "compileNode: aNode\x0a\x09^ self transformers\x0a\x09\x09inject: aNode\x0a\x09\x09into: [ :input :transformer | transformer value: input ]",
  35724. referencedClasses: [],
  35725. messageSends: ["inject:into:", "transformers", "value:"]
  35726. }),
  35727. $globals.AbstractCodeGenerator);
  35728. $core.addMethod(
  35729. $core.method({
  35730. selector: "currentClass",
  35731. protocol: "accessing",
  35732. fn: function (){
  35733. var self=this,$self=this;
  35734. return $self["@currentClass"];
  35735. },
  35736. args: [],
  35737. source: "currentClass\x0a\x09^ currentClass",
  35738. referencedClasses: [],
  35739. messageSends: []
  35740. }),
  35741. $globals.AbstractCodeGenerator);
  35742. $core.addMethod(
  35743. $core.method({
  35744. selector: "currentClass:",
  35745. protocol: "accessing",
  35746. fn: function (aClass){
  35747. var self=this,$self=this;
  35748. $self["@currentClass"]=aClass;
  35749. return self;
  35750. },
  35751. args: ["aClass"],
  35752. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  35753. referencedClasses: [],
  35754. messageSends: []
  35755. }),
  35756. $globals.AbstractCodeGenerator);
  35757. $core.addMethod(
  35758. $core.method({
  35759. selector: "currentPackage",
  35760. protocol: "accessing",
  35761. fn: function (){
  35762. var self=this,$self=this;
  35763. return $self["@currentPackage"];
  35764. },
  35765. args: [],
  35766. source: "currentPackage\x0a\x09^ currentPackage",
  35767. referencedClasses: [],
  35768. messageSends: []
  35769. }),
  35770. $globals.AbstractCodeGenerator);
  35771. $core.addMethod(
  35772. $core.method({
  35773. selector: "currentPackage:",
  35774. protocol: "accessing",
  35775. fn: function (anObject){
  35776. var self=this,$self=this;
  35777. $self["@currentPackage"]=anObject;
  35778. return self;
  35779. },
  35780. args: ["anObject"],
  35781. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  35782. referencedClasses: [],
  35783. messageSends: []
  35784. }),
  35785. $globals.AbstractCodeGenerator);
  35786. $core.addMethod(
  35787. $core.method({
  35788. selector: "pseudoVariables",
  35789. protocol: "accessing",
  35790. fn: function (){
  35791. var self=this,$self=this;
  35792. return $core.withContext(function($ctx1) {
  35793. return $recv($globals.Smalltalk)._pseudoVariableNames();
  35794. }, function($ctx1) {$ctx1.fill(self,"pseudoVariables",{},$globals.AbstractCodeGenerator)});
  35795. },
  35796. args: [],
  35797. source: "pseudoVariables\x0a\x09^ Smalltalk pseudoVariableNames",
  35798. referencedClasses: ["Smalltalk"],
  35799. messageSends: ["pseudoVariableNames"]
  35800. }),
  35801. $globals.AbstractCodeGenerator);
  35802. $core.addMethod(
  35803. $core.method({
  35804. selector: "source",
  35805. protocol: "accessing",
  35806. fn: function (){
  35807. var self=this,$self=this;
  35808. return $core.withContext(function($ctx1) {
  35809. var $1,$receiver;
  35810. $1=$self["@source"];
  35811. if(($receiver = $1) == null || $receiver.a$nil){
  35812. return "";
  35813. } else {
  35814. return $1;
  35815. }
  35816. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.AbstractCodeGenerator)});
  35817. },
  35818. args: [],
  35819. source: "source\x0a\x09^ source ifNil: [ '' ]",
  35820. referencedClasses: [],
  35821. messageSends: ["ifNil:"]
  35822. }),
  35823. $globals.AbstractCodeGenerator);
  35824. $core.addMethod(
  35825. $core.method({
  35826. selector: "source:",
  35827. protocol: "accessing",
  35828. fn: function (aString){
  35829. var self=this,$self=this;
  35830. $self["@source"]=aString;
  35831. return self;
  35832. },
  35833. args: ["aString"],
  35834. source: "source: aString\x0a\x09source := aString",
  35835. referencedClasses: [],
  35836. messageSends: []
  35837. }),
  35838. $globals.AbstractCodeGenerator);
  35839. $core.addMethod(
  35840. $core.method({
  35841. selector: "transformers",
  35842. protocol: "compiling",
  35843. fn: function (){
  35844. var self=this,$self=this;
  35845. var dict;
  35846. return $core.withContext(function($ctx1) {
  35847. dict=$self._transformersDictionary();
  35848. return $recv($recv($recv($recv(dict)._keys())._asArray())._sort())._collect_((function(each){
  35849. return $core.withContext(function($ctx2) {
  35850. return $recv(dict)._at_(each);
  35851. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  35852. }));
  35853. }, function($ctx1) {$ctx1.fill(self,"transformers",{dict:dict},$globals.AbstractCodeGenerator)});
  35854. },
  35855. args: [],
  35856. source: "transformers\x0a\x09| dict |\x0a\x09dict := self transformersDictionary.\x0a\x09^ dict keys asArray sort collect: [ :each | dict at: each ]",
  35857. referencedClasses: [],
  35858. messageSends: ["transformersDictionary", "collect:", "sort", "asArray", "keys", "at:"]
  35859. }),
  35860. $globals.AbstractCodeGenerator);
  35861. $core.addMethod(
  35862. $core.method({
  35863. selector: "transformersDictionary",
  35864. protocol: "compiling",
  35865. fn: function (){
  35866. var self=this,$self=this;
  35867. return $core.withContext(function($ctx1) {
  35868. $self._subclassResponsibility();
  35869. return self;
  35870. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.AbstractCodeGenerator)});
  35871. },
  35872. args: [],
  35873. source: "transformersDictionary\x0a\x09self subclassResponsibility",
  35874. referencedClasses: [],
  35875. messageSends: ["subclassResponsibility"]
  35876. }),
  35877. $globals.AbstractCodeGenerator);
  35878. $core.addClass("CodeGenerator", $globals.AbstractCodeGenerator, ["transformersDictionary"], "Compiler-Core");
  35879. $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.";
  35880. $core.addMethod(
  35881. $core.method({
  35882. selector: "irTranslator",
  35883. protocol: "compiling",
  35884. fn: function (){
  35885. var self=this,$self=this;
  35886. return $core.withContext(function($ctx1) {
  35887. var $1;
  35888. $1=$recv($self._irTranslatorClass())._new();
  35889. $recv($1)._currentClass_($self._currentClass());
  35890. return $recv($1)._yourself();
  35891. }, function($ctx1) {$ctx1.fill(self,"irTranslator",{},$globals.CodeGenerator)});
  35892. },
  35893. args: [],
  35894. source: "irTranslator\x0a\x09^ self irTranslatorClass new\x0a\x09\x09currentClass: self currentClass;\x0a\x09\x09yourself",
  35895. referencedClasses: [],
  35896. messageSends: ["currentClass:", "new", "irTranslatorClass", "currentClass", "yourself"]
  35897. }),
  35898. $globals.CodeGenerator);
  35899. $core.addMethod(
  35900. $core.method({
  35901. selector: "irTranslatorClass",
  35902. protocol: "compiling",
  35903. fn: function (){
  35904. var self=this,$self=this;
  35905. return $globals.IRJSTranslator;
  35906. },
  35907. args: [],
  35908. source: "irTranslatorClass\x0a\x09^ IRJSTranslator",
  35909. referencedClasses: ["IRJSTranslator"],
  35910. messageSends: []
  35911. }),
  35912. $globals.CodeGenerator);
  35913. $core.addMethod(
  35914. $core.method({
  35915. selector: "semanticAnalyzer",
  35916. protocol: "compiling",
  35917. fn: function (){
  35918. var self=this,$self=this;
  35919. return $core.withContext(function($ctx1) {
  35920. var $1;
  35921. $1=$recv($globals.SemanticAnalyzer)._on_($self._currentClass());
  35922. $recv($1)._thePackage_($self._currentPackage());
  35923. return $recv($1)._yourself();
  35924. }, function($ctx1) {$ctx1.fill(self,"semanticAnalyzer",{},$globals.CodeGenerator)});
  35925. },
  35926. args: [],
  35927. source: "semanticAnalyzer\x0a\x09^ (SemanticAnalyzer on: self currentClass)\x0a\x09\x09thePackage: self currentPackage;\x0a\x09\x09yourself",
  35928. referencedClasses: ["SemanticAnalyzer"],
  35929. messageSends: ["thePackage:", "on:", "currentClass", "currentPackage", "yourself"]
  35930. }),
  35931. $globals.CodeGenerator);
  35932. $core.addMethod(
  35933. $core.method({
  35934. selector: "transformersDictionary",
  35935. protocol: "compiling",
  35936. fn: function (){
  35937. var self=this,$self=this;
  35938. return $core.withContext(function($ctx1) {
  35939. var $1,$2,$receiver;
  35940. $1=$self["@transformersDictionary"];
  35941. if(($receiver = $1) == null || $receiver.a$nil){
  35942. $2=$recv($globals.Dictionary)._new();
  35943. $ctx1.sendIdx["new"]=1;
  35944. $recv($2)._at_put_("1000-earlyPragmas",$recv($globals.EarlyPragmator)._new());
  35945. $ctx1.sendIdx["at:put:"]=1;
  35946. $recv($2)._at_put_("2000-semantic",$self._semanticAnalyzer());
  35947. $ctx1.sendIdx["at:put:"]=2;
  35948. $recv($2)._at_put_("5000-astToIr",$self._translator());
  35949. $ctx1.sendIdx["at:put:"]=3;
  35950. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  35951. $self["@transformersDictionary"]=$recv($2)._yourself();
  35952. return $self["@transformersDictionary"];
  35953. } else {
  35954. return $1;
  35955. }
  35956. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.CodeGenerator)});
  35957. },
  35958. args: [],
  35959. 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 ]",
  35960. referencedClasses: ["Dictionary", "EarlyPragmator"],
  35961. messageSends: ["ifNil:", "at:put:", "new", "semanticAnalyzer", "translator", "irTranslator", "yourself"]
  35962. }),
  35963. $globals.CodeGenerator);
  35964. $core.addMethod(
  35965. $core.method({
  35966. selector: "translator",
  35967. protocol: "compiling",
  35968. fn: function (){
  35969. var self=this,$self=this;
  35970. return $core.withContext(function($ctx1) {
  35971. var $1;
  35972. $1=$recv($globals.IRASTTranslator)._new();
  35973. $recv($1)._source_($self._source());
  35974. $recv($1)._theClass_($self._currentClass());
  35975. return $recv($1)._yourself();
  35976. }, function($ctx1) {$ctx1.fill(self,"translator",{},$globals.CodeGenerator)});
  35977. },
  35978. args: [],
  35979. source: "translator\x0a\x09^ IRASTTranslator new\x0a\x09\x09source: self source;\x0a\x09\x09theClass: self currentClass;\x0a\x09\x09yourself",
  35980. referencedClasses: ["IRASTTranslator"],
  35981. messageSends: ["source:", "new", "source", "theClass:", "currentClass", "yourself"]
  35982. }),
  35983. $globals.CodeGenerator);
  35984. $core.addClass("Compiler", $globals.Object, ["currentClass", "currentPackage", "source", "codeGeneratorClass", "codeGenerator"], "Compiler-Core");
  35985. $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`";
  35986. $core.addMethod(
  35987. $core.method({
  35988. selector: "ast:forClass:protocol:",
  35989. protocol: "compiling",
  35990. fn: function (aString,aClass,anotherString){
  35991. var self=this,$self=this;
  35992. return $core.withContext(function($ctx1) {
  35993. var $early={};
  35994. try {
  35995. $self._source_(aString);
  35996. $self._forClass_protocol_(aClass,anotherString);
  35997. $recv($recv($self._codeGenerator())._transformersDictionary())._at_put_("2500-astCheckpoint",(function(x){
  35998. throw $early=[x];
  35999. }));
  36000. $self._compileNode_($self._parse_(aString));
  36001. $recv($globals.CompilerError)._signal_("AST transformation failed.");
  36002. return self;
  36003. }
  36004. catch(e) {if(e===$early)return e[0]; throw e}
  36005. }, function($ctx1) {$ctx1.fill(self,"ast:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36006. },
  36007. args: ["aString", "aClass", "anotherString"],
  36008. 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.'",
  36009. referencedClasses: ["CompilerError"],
  36010. messageSends: ["source:", "forClass:protocol:", "at:put:", "transformersDictionary", "codeGenerator", "compileNode:", "parse:", "signal:"]
  36011. }),
  36012. $globals.Compiler);
  36013. $core.addMethod(
  36014. $core.method({
  36015. selector: "cleanCodeGenerator",
  36016. protocol: "accessing",
  36017. fn: function (){
  36018. var self=this,$self=this;
  36019. $self["@codeGenerator"]=nil;
  36020. return self;
  36021. },
  36022. args: [],
  36023. source: "cleanCodeGenerator\x0a\x09codeGenerator := nil",
  36024. referencedClasses: [],
  36025. messageSends: []
  36026. }),
  36027. $globals.Compiler);
  36028. $core.addMethod(
  36029. $core.method({
  36030. selector: "codeGenerator",
  36031. protocol: "accessing",
  36032. fn: function (){
  36033. var self=this,$self=this;
  36034. return $core.withContext(function($ctx1) {
  36035. var $1,$2,$receiver;
  36036. $1=$self["@codeGenerator"];
  36037. if(($receiver = $1) == null || $receiver.a$nil){
  36038. $2=$recv($self._codeGeneratorClass())._new();
  36039. $recv($2)._source_($self._source());
  36040. $recv($2)._currentClass_($self._currentClass());
  36041. $recv($2)._currentPackage_($self._currentPackage());
  36042. $self["@codeGenerator"]=$recv($2)._yourself();
  36043. return $self["@codeGenerator"];
  36044. } else {
  36045. return $1;
  36046. }
  36047. }, function($ctx1) {$ctx1.fill(self,"codeGenerator",{},$globals.Compiler)});
  36048. },
  36049. args: [],
  36050. 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 ]",
  36051. referencedClasses: [],
  36052. messageSends: ["ifNil:", "source:", "new", "codeGeneratorClass", "source", "currentClass:", "currentClass", "currentPackage:", "currentPackage", "yourself"]
  36053. }),
  36054. $globals.Compiler);
  36055. $core.addMethod(
  36056. $core.method({
  36057. selector: "codeGeneratorClass",
  36058. protocol: "accessing",
  36059. fn: function (){
  36060. var self=this,$self=this;
  36061. return $core.withContext(function($ctx1) {
  36062. var $1,$receiver;
  36063. $1=$self["@codeGeneratorClass"];
  36064. if(($receiver = $1) == null || $receiver.a$nil){
  36065. return $globals.InliningCodeGenerator;
  36066. } else {
  36067. return $1;
  36068. }
  36069. }, function($ctx1) {$ctx1.fill(self,"codeGeneratorClass",{},$globals.Compiler)});
  36070. },
  36071. args: [],
  36072. source: "codeGeneratorClass\x0a\x09^ codeGeneratorClass ifNil: [ InliningCodeGenerator ]",
  36073. referencedClasses: ["InliningCodeGenerator"],
  36074. messageSends: ["ifNil:"]
  36075. }),
  36076. $globals.Compiler);
  36077. $core.addMethod(
  36078. $core.method({
  36079. selector: "codeGeneratorClass:",
  36080. protocol: "accessing",
  36081. fn: function (aClass){
  36082. var self=this,$self=this;
  36083. $self["@codeGeneratorClass"]=aClass;
  36084. return self;
  36085. },
  36086. args: ["aClass"],
  36087. source: "codeGeneratorClass: aClass\x0a\x09codeGeneratorClass := aClass",
  36088. referencedClasses: [],
  36089. messageSends: []
  36090. }),
  36091. $globals.Compiler);
  36092. $core.addMethod(
  36093. $core.method({
  36094. selector: "compile:forClass:protocol:",
  36095. protocol: "compiling",
  36096. fn: function (aString,aClass,anotherString){
  36097. var self=this,$self=this;
  36098. return $core.withContext(function($ctx1) {
  36099. $self._source_(aString);
  36100. $self._forClass_protocol_(aClass,anotherString);
  36101. return $self._compileNode_($self._parse_(aString));
  36102. }, function($ctx1) {$ctx1.fill(self,"compile:forClass:protocol:",{aString:aString,aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36103. },
  36104. args: ["aString", "aClass", "anotherString"],
  36105. 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)",
  36106. referencedClasses: [],
  36107. messageSends: ["source:", "forClass:protocol:", "compileNode:", "parse:"]
  36108. }),
  36109. $globals.Compiler);
  36110. $core.addMethod(
  36111. $core.method({
  36112. selector: "compileExpression:on:",
  36113. protocol: "compiling",
  36114. fn: function (aString,anObject){
  36115. var self=this,$self=this;
  36116. return $core.withContext(function($ctx1) {
  36117. var $1;
  36118. $1=$recv("xxxDoIt ^ [ ".__comma(aString)).__comma(" ] value");
  36119. $ctx1.sendIdx[","]=1;
  36120. return $self._compile_forClass_protocol_($1,$recv(anObject)._class(),"**xxxDoIt");
  36121. }, function($ctx1) {$ctx1.fill(self,"compileExpression:on:",{aString:aString,anObject:anObject},$globals.Compiler)});
  36122. },
  36123. args: ["aString", "anObject"],
  36124. source: "compileExpression: aString on: anObject\x0a\x09^ self\x0a\x09\x09compile: 'xxxDoIt ^ [ ', aString, ' ] value'\x0a\x09\x09forClass: anObject class\x0a\x09\x09protocol: '**xxxDoIt'",
  36125. referencedClasses: [],
  36126. messageSends: ["compile:forClass:protocol:", ",", "class"]
  36127. }),
  36128. $globals.Compiler);
  36129. $core.addMethod(
  36130. $core.method({
  36131. selector: "compileNode:",
  36132. protocol: "compiling",
  36133. fn: function (aNode){
  36134. var self=this,$self=this;
  36135. var result;
  36136. return $core.withContext(function($ctx1) {
  36137. result=$recv($self._codeGenerator())._compileNode_(aNode);
  36138. $self._cleanCodeGenerator();
  36139. return result;
  36140. }, function($ctx1) {$ctx1.fill(self,"compileNode:",{aNode:aNode,result:result},$globals.Compiler)});
  36141. },
  36142. args: ["aNode"],
  36143. source: "compileNode: aNode\x0a | result |\x0a\x09result := self codeGenerator compileNode: aNode.\x0a\x09self cleanCodeGenerator.\x0a\x09^ result",
  36144. referencedClasses: [],
  36145. messageSends: ["compileNode:", "codeGenerator", "cleanCodeGenerator"]
  36146. }),
  36147. $globals.Compiler);
  36148. $core.addMethod(
  36149. $core.method({
  36150. selector: "currentClass",
  36151. protocol: "accessing",
  36152. fn: function (){
  36153. var self=this,$self=this;
  36154. return $self["@currentClass"];
  36155. },
  36156. args: [],
  36157. source: "currentClass\x0a\x09^ currentClass",
  36158. referencedClasses: [],
  36159. messageSends: []
  36160. }),
  36161. $globals.Compiler);
  36162. $core.addMethod(
  36163. $core.method({
  36164. selector: "currentClass:",
  36165. protocol: "accessing",
  36166. fn: function (aClass){
  36167. var self=this,$self=this;
  36168. $self["@currentClass"]=aClass;
  36169. return self;
  36170. },
  36171. args: ["aClass"],
  36172. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  36173. referencedClasses: [],
  36174. messageSends: []
  36175. }),
  36176. $globals.Compiler);
  36177. $core.addMethod(
  36178. $core.method({
  36179. selector: "currentPackage",
  36180. protocol: "accessing",
  36181. fn: function (){
  36182. var self=this,$self=this;
  36183. return $self["@currentPackage"];
  36184. },
  36185. args: [],
  36186. source: "currentPackage\x0a\x09^ currentPackage",
  36187. referencedClasses: [],
  36188. messageSends: []
  36189. }),
  36190. $globals.Compiler);
  36191. $core.addMethod(
  36192. $core.method({
  36193. selector: "currentPackage:",
  36194. protocol: "accessing",
  36195. fn: function (anObject){
  36196. var self=this,$self=this;
  36197. $self["@currentPackage"]=anObject;
  36198. return self;
  36199. },
  36200. args: ["anObject"],
  36201. source: "currentPackage: anObject\x0a\x09currentPackage := anObject",
  36202. referencedClasses: [],
  36203. messageSends: []
  36204. }),
  36205. $globals.Compiler);
  36206. $core.addMethod(
  36207. $core.method({
  36208. selector: "eval:",
  36209. protocol: "compiling",
  36210. fn: function (aString){
  36211. var self=this,$self=this;
  36212. return $core.withContext(function($ctx1) {
  36213. return eval(aString);
  36214. return self;
  36215. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler)});
  36216. },
  36217. args: ["aString"],
  36218. source: "eval: aString\x0a\x09<inlineJS: 'return eval(aString)'>",
  36219. referencedClasses: [],
  36220. messageSends: []
  36221. }),
  36222. $globals.Compiler);
  36223. $core.addMethod(
  36224. $core.method({
  36225. selector: "eval:forPackage:",
  36226. protocol: "compiling",
  36227. fn: function (aString,aPackage){
  36228. var self=this,$self=this;
  36229. return $core.withContext(function($ctx1) {
  36230. var $receiver;
  36231. if(($receiver = aPackage) == null || $receiver.a$nil){
  36232. return $self._eval_(aString);
  36233. $ctx1.sendIdx["eval:"]=1;
  36234. } else {
  36235. return $recv(aPackage)._eval_(aString);
  36236. }
  36237. }, function($ctx1) {$ctx1.fill(self,"eval:forPackage:",{aString:aString,aPackage:aPackage},$globals.Compiler)});
  36238. },
  36239. args: ["aString", "aPackage"],
  36240. source: "eval: aString forPackage: aPackage\x0a\x09^ aPackage\x0a\x09\x09ifNil: [ self eval: aString ]\x0a\x09\x09ifNotNil: [ aPackage eval: aString ]",
  36241. referencedClasses: [],
  36242. messageSends: ["ifNil:ifNotNil:", "eval:"]
  36243. }),
  36244. $globals.Compiler);
  36245. $core.addMethod(
  36246. $core.method({
  36247. selector: "evaluateExpression:",
  36248. protocol: "compiling",
  36249. fn: function (aString){
  36250. var self=this,$self=this;
  36251. return $core.withContext(function($ctx1) {
  36252. return $self._evaluateExpression_on_(aString,$recv($globals.DoIt)._new());
  36253. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:",{aString:aString},$globals.Compiler)});
  36254. },
  36255. args: ["aString"],
  36256. 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",
  36257. referencedClasses: ["DoIt"],
  36258. messageSends: ["evaluateExpression:on:", "new"]
  36259. }),
  36260. $globals.Compiler);
  36261. $core.addMethod(
  36262. $core.method({
  36263. selector: "evaluateExpression:on:",
  36264. protocol: "compiling",
  36265. fn: function (aString,anObject){
  36266. var self=this,$self=this;
  36267. var result,method;
  36268. return $core.withContext(function($ctx1) {
  36269. var $1;
  36270. method=$self._eval_($self._compileExpression_on_(aString,anObject));
  36271. $recv(method)._protocol_("**xxxDoIt");
  36272. $1=$recv(anObject)._class();
  36273. $ctx1.sendIdx["class"]=1;
  36274. $recv($1)._addCompiledMethod_(method);
  36275. result=$recv(anObject)._xxxDoIt();
  36276. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  36277. return result;
  36278. }, function($ctx1) {$ctx1.fill(self,"evaluateExpression:on:",{aString:aString,anObject:anObject,result:result,method:method},$globals.Compiler)});
  36279. },
  36280. args: ["aString", "anObject"],
  36281. 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",
  36282. referencedClasses: [],
  36283. messageSends: ["eval:", "compileExpression:on:", "protocol:", "addCompiledMethod:", "class", "xxxDoIt", "removeCompiledMethod:"]
  36284. }),
  36285. $globals.Compiler);
  36286. $core.addMethod(
  36287. $core.method({
  36288. selector: "forClass:protocol:",
  36289. protocol: "compiling",
  36290. fn: function (aClass,anotherString){
  36291. var self=this,$self=this;
  36292. return $core.withContext(function($ctx1) {
  36293. $self._currentPackage_($recv(aClass)._packageOfProtocol_(anotherString));
  36294. $self._currentClass_(aClass);
  36295. return self;
  36296. }, function($ctx1) {$ctx1.fill(self,"forClass:protocol:",{aClass:aClass,anotherString:anotherString},$globals.Compiler)});
  36297. },
  36298. args: ["aClass", "anotherString"],
  36299. source: "forClass: aClass protocol: anotherString\x0a\x09self\x0a\x09\x09currentPackage: (aClass packageOfProtocol: anotherString);\x0a\x09\x09currentClass: aClass",
  36300. referencedClasses: [],
  36301. messageSends: ["currentPackage:", "packageOfProtocol:", "currentClass:"]
  36302. }),
  36303. $globals.Compiler);
  36304. $core.addMethod(
  36305. $core.method({
  36306. selector: "install:forClass:protocol:",
  36307. protocol: "compiling",
  36308. fn: function (aString,aBehavior,anotherString){
  36309. var self=this,$self=this;
  36310. var compiledMethod;
  36311. return $core.withContext(function($ctx1) {
  36312. compiledMethod=$self._eval_forPackage_($self._compile_forClass_protocol_(aString,aBehavior,anotherString),$recv(aBehavior)._packageOfProtocol_(anotherString));
  36313. return $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(compiledMethod,aBehavior,anotherString);
  36314. }, function($ctx1) {$ctx1.fill(self,"install:forClass:protocol:",{aString:aString,aBehavior:aBehavior,anotherString:anotherString,compiledMethod:compiledMethod},$globals.Compiler)});
  36315. },
  36316. args: ["aString", "aBehavior", "anotherString"],
  36317. 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",
  36318. referencedClasses: ["ClassBuilder"],
  36319. messageSends: ["eval:forPackage:", "compile:forClass:protocol:", "packageOfProtocol:", "installMethod:forClass:protocol:", "new"]
  36320. }),
  36321. $globals.Compiler);
  36322. $core.addMethod(
  36323. $core.method({
  36324. selector: "parse:",
  36325. protocol: "compiling",
  36326. fn: function (aString){
  36327. var self=this,$self=this;
  36328. return $core.withContext(function($ctx1) {
  36329. return $recv($globals.Smalltalk)._parse_(aString);
  36330. }, function($ctx1) {$ctx1.fill(self,"parse:",{aString:aString},$globals.Compiler)});
  36331. },
  36332. args: ["aString"],
  36333. source: "parse: aString\x0a\x09^ Smalltalk parse: aString",
  36334. referencedClasses: ["Smalltalk"],
  36335. messageSends: ["parse:"]
  36336. }),
  36337. $globals.Compiler);
  36338. $core.addMethod(
  36339. $core.method({
  36340. selector: "parseExpression:",
  36341. protocol: "compiling",
  36342. fn: function (aString){
  36343. var self=this,$self=this;
  36344. return $core.withContext(function($ctx1) {
  36345. var $1;
  36346. $1=$recv("doIt ^ [ ".__comma(aString)).__comma(" ] value");
  36347. $ctx1.sendIdx[","]=1;
  36348. return $self._parse_($1);
  36349. }, function($ctx1) {$ctx1.fill(self,"parseExpression:",{aString:aString},$globals.Compiler)});
  36350. },
  36351. args: ["aString"],
  36352. source: "parseExpression: aString\x0a\x09^ self parse: 'doIt ^ [ ', aString, ' ] value'",
  36353. referencedClasses: [],
  36354. messageSends: ["parse:", ","]
  36355. }),
  36356. $globals.Compiler);
  36357. $core.addMethod(
  36358. $core.method({
  36359. selector: "recompile:",
  36360. protocol: "compiling",
  36361. fn: function (aClass){
  36362. var self=this,$self=this;
  36363. return $core.withContext(function($ctx1) {
  36364. var $1,$2,$3,$receiver;
  36365. $recv($recv($recv(aClass)._methodDictionary())._values())._do_displayingProgress_((function(each){
  36366. return $core.withContext(function($ctx2) {
  36367. $1=$recv($recv(each)._methodClass()).__eq(aClass);
  36368. $ctx2.sendIdx["="]=1;
  36369. if($core.assert($1)){
  36370. return $self._install_forClass_protocol_($recv(each)._source(),aClass,$recv(each)._protocol());
  36371. }
  36372. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36373. }),"Recompiling ".__comma($recv(aClass)._name()));
  36374. $2=$recv(aClass)._theMetaClass();
  36375. if(($receiver = $2) == null || $receiver.a$nil){
  36376. $2;
  36377. } else {
  36378. var meta;
  36379. meta=$receiver;
  36380. $3=$recv(meta).__eq(aClass);
  36381. if(!$core.assert($3)){
  36382. $self._recompile_(meta);
  36383. }
  36384. }
  36385. return self;
  36386. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler)});
  36387. },
  36388. args: ["aClass"],
  36389. 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 ] ]",
  36390. referencedClasses: [],
  36391. messageSends: ["do:displayingProgress:", "values", "methodDictionary", "ifTrue:", "=", "methodClass", "install:forClass:protocol:", "source", "protocol", ",", "name", "ifNotNil:", "theMetaClass", "ifFalse:", "recompile:"]
  36392. }),
  36393. $globals.Compiler);
  36394. $core.addMethod(
  36395. $core.method({
  36396. selector: "recompileAll",
  36397. protocol: "compiling",
  36398. fn: function (){
  36399. var self=this,$self=this;
  36400. return $core.withContext(function($ctx1) {
  36401. $recv($recv($globals.Smalltalk)._classes())._do_displayingProgress_((function(each){
  36402. return $core.withContext(function($ctx2) {
  36403. return $self._recompile_(each);
  36404. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36405. }),"Compiling all classes...");
  36406. return self;
  36407. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler)});
  36408. },
  36409. args: [],
  36410. source: "recompileAll\x0a\x09Smalltalk classes \x0a\x09\x09do: [ :each | self recompile: each ]\x0a\x09\x09displayingProgress: 'Compiling all classes...'",
  36411. referencedClasses: ["Smalltalk"],
  36412. messageSends: ["do:displayingProgress:", "classes", "recompile:"]
  36413. }),
  36414. $globals.Compiler);
  36415. $core.addMethod(
  36416. $core.method({
  36417. selector: "source",
  36418. protocol: "accessing",
  36419. fn: function (){
  36420. var self=this,$self=this;
  36421. return $core.withContext(function($ctx1) {
  36422. var $1,$receiver;
  36423. $1=$self["@source"];
  36424. if(($receiver = $1) == null || $receiver.a$nil){
  36425. return "";
  36426. } else {
  36427. return $1;
  36428. }
  36429. }, function($ctx1) {$ctx1.fill(self,"source",{},$globals.Compiler)});
  36430. },
  36431. args: [],
  36432. source: "source\x0a\x09^ source ifNil: [ '' ]",
  36433. referencedClasses: [],
  36434. messageSends: ["ifNil:"]
  36435. }),
  36436. $globals.Compiler);
  36437. $core.addMethod(
  36438. $core.method({
  36439. selector: "source:",
  36440. protocol: "accessing",
  36441. fn: function (aString){
  36442. var self=this,$self=this;
  36443. $self["@source"]=aString;
  36444. return self;
  36445. },
  36446. args: ["aString"],
  36447. source: "source: aString\x0a\x09source := aString",
  36448. referencedClasses: [],
  36449. messageSends: []
  36450. }),
  36451. $globals.Compiler);
  36452. $core.addMethod(
  36453. $core.method({
  36454. selector: "eval:",
  36455. protocol: "evaluating",
  36456. fn: function (aString){
  36457. var self=this,$self=this;
  36458. return $core.withContext(function($ctx1) {
  36459. return $recv($self._new())._eval_(aString);
  36460. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString},$globals.Compiler.a$cls)});
  36461. },
  36462. args: ["aString"],
  36463. source: "eval: aString\x0a\x09^ self new eval: aString",
  36464. referencedClasses: [],
  36465. messageSends: ["eval:", "new"]
  36466. }),
  36467. $globals.Compiler.a$cls);
  36468. $core.addMethod(
  36469. $core.method({
  36470. selector: "recompile:",
  36471. protocol: "compiling",
  36472. fn: function (aClass){
  36473. var self=this,$self=this;
  36474. return $core.withContext(function($ctx1) {
  36475. $recv($self._new())._recompile_(aClass);
  36476. return self;
  36477. }, function($ctx1) {$ctx1.fill(self,"recompile:",{aClass:aClass},$globals.Compiler.a$cls)});
  36478. },
  36479. args: ["aClass"],
  36480. source: "recompile: aClass\x0a\x09self new recompile: aClass",
  36481. referencedClasses: [],
  36482. messageSends: ["recompile:", "new"]
  36483. }),
  36484. $globals.Compiler.a$cls);
  36485. $core.addMethod(
  36486. $core.method({
  36487. selector: "recompileAll",
  36488. protocol: "compiling",
  36489. fn: function (){
  36490. var self=this,$self=this;
  36491. return $core.withContext(function($ctx1) {
  36492. $recv($recv($globals.Smalltalk)._classes())._do_((function(each){
  36493. return $core.withContext(function($ctx2) {
  36494. return $self._recompile_(each);
  36495. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36496. }));
  36497. return self;
  36498. }, function($ctx1) {$ctx1.fill(self,"recompileAll",{},$globals.Compiler.a$cls)});
  36499. },
  36500. args: [],
  36501. source: "recompileAll\x0a\x09Smalltalk classes do: [ :each |\x0a\x09\x09self recompile: each ]",
  36502. referencedClasses: ["Smalltalk"],
  36503. messageSends: ["do:", "classes", "recompile:"]
  36504. }),
  36505. $globals.Compiler.a$cls);
  36506. $core.addClass("DoIt", $globals.Object, [], "Compiler-Core");
  36507. $globals.DoIt.comment="`DoIt` is the class used to compile and evaluate expressions. See `Compiler >> evaluateExpression:`.";
  36508. $core.addClass("Evaluator", $globals.Object, [], "Compiler-Core");
  36509. $globals.Evaluator.comment="I evaluate code against a receiver, dispatching #evaluate:on: to the receiver.";
  36510. $core.addMethod(
  36511. $core.method({
  36512. selector: "evaluate:context:",
  36513. protocol: "evaluating",
  36514. fn: function (aString,aContext){
  36515. var self=this,$self=this;
  36516. var compiler,ast;
  36517. return $core.withContext(function($ctx1) {
  36518. var $1;
  36519. var $early={};
  36520. try {
  36521. compiler=$recv($globals.Compiler)._new();
  36522. $recv((function(){
  36523. return $core.withContext(function($ctx2) {
  36524. ast=$recv(compiler)._parseExpression_(aString);
  36525. return ast;
  36526. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36527. }))._on_do_($globals.Error,(function(ex){
  36528. return $core.withContext(function($ctx2) {
  36529. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36530. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36531. }));
  36532. $1=$recv($globals.AISemanticAnalyzer)._on_($recv($recv(aContext)._receiver())._class());
  36533. $recv($1)._context_(aContext);
  36534. $recv($1)._visit_(ast);
  36535. return $recv(aContext)._evaluateNode_(ast);
  36536. }
  36537. catch(e) {if(e===$early)return e[0]; throw e}
  36538. }, function($ctx1) {$ctx1.fill(self,"evaluate:context:",{aString:aString,aContext:aContext,compiler:compiler,ast:ast},$globals.Evaluator)});
  36539. },
  36540. args: ["aString", "aContext"],
  36541. 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",
  36542. referencedClasses: ["Compiler", "Error", "Terminal", "AISemanticAnalyzer"],
  36543. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "context:", "on:", "class", "receiver", "visit:", "evaluateNode:"]
  36544. }),
  36545. $globals.Evaluator);
  36546. $core.addMethod(
  36547. $core.method({
  36548. selector: "evaluate:for:",
  36549. protocol: "evaluating",
  36550. fn: function (aString,anObject){
  36551. var self=this,$self=this;
  36552. return $core.withContext(function($ctx1) {
  36553. return $recv(anObject)._evaluate_on_(aString,self);
  36554. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator)});
  36555. },
  36556. args: ["aString", "anObject"],
  36557. source: "evaluate: aString for: anObject\x0a\x09^ anObject evaluate: aString on: self",
  36558. referencedClasses: [],
  36559. messageSends: ["evaluate:on:"]
  36560. }),
  36561. $globals.Evaluator);
  36562. $core.addMethod(
  36563. $core.method({
  36564. selector: "evaluate:receiver:",
  36565. protocol: "evaluating",
  36566. fn: function (aString,anObject){
  36567. var self=this,$self=this;
  36568. var compiler;
  36569. return $core.withContext(function($ctx1) {
  36570. var $early={};
  36571. try {
  36572. compiler=$recv($globals.Compiler)._new();
  36573. $recv((function(){
  36574. return $core.withContext(function($ctx2) {
  36575. return $recv(compiler)._parseExpression_(aString);
  36576. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36577. }))._on_do_($globals.Error,(function(ex){
  36578. return $core.withContext(function($ctx2) {
  36579. throw $early=[$recv($globals.Terminal)._alert_($recv(ex)._messageText())];
  36580. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,2)});
  36581. }));
  36582. return $recv(compiler)._evaluateExpression_on_(aString,anObject);
  36583. }
  36584. catch(e) {if(e===$early)return e[0]; throw e}
  36585. }, function($ctx1) {$ctx1.fill(self,"evaluate:receiver:",{aString:aString,anObject:anObject,compiler:compiler},$globals.Evaluator)});
  36586. },
  36587. args: ["aString", "anObject"],
  36588. 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",
  36589. referencedClasses: ["Compiler", "Error", "Terminal"],
  36590. messageSends: ["new", "on:do:", "parseExpression:", "alert:", "messageText", "evaluateExpression:on:"]
  36591. }),
  36592. $globals.Evaluator);
  36593. $core.addMethod(
  36594. $core.method({
  36595. selector: "evaluate:for:",
  36596. protocol: "instance creation",
  36597. fn: function (aString,anObject){
  36598. var self=this,$self=this;
  36599. return $core.withContext(function($ctx1) {
  36600. return $recv($self._new())._evaluate_for_(aString,anObject);
  36601. }, function($ctx1) {$ctx1.fill(self,"evaluate:for:",{aString:aString,anObject:anObject},$globals.Evaluator.a$cls)});
  36602. },
  36603. args: ["aString", "anObject"],
  36604. source: "evaluate: aString for: anObject\x0a\x09^ self new evaluate: aString for: anObject",
  36605. referencedClasses: [],
  36606. messageSends: ["evaluate:for:", "new"]
  36607. }),
  36608. $globals.Evaluator.a$cls);
  36609. $core.addClass("Pragmator", $globals.NodeVisitor, ["methodNode", "sequenceNode"], "Compiler-Core");
  36610. $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.";
  36611. $core.addMethod(
  36612. $core.method({
  36613. selector: "canProcessPragma:",
  36614. protocol: "pragma processing",
  36615. fn: function (aMessage){
  36616. var self=this,$self=this;
  36617. var selector;
  36618. return $core.withContext(function($ctx1) {
  36619. selector=$recv(aMessage)._selector();
  36620. return $recv($self._respondsTo_(selector))._and_((function(){
  36621. return $core.withContext(function($ctx2) {
  36622. return $recv($recv($recv($self._class())._superclass())._canUnderstand_(selector))._not();
  36623. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36624. }));
  36625. }, function($ctx1) {$ctx1.fill(self,"canProcessPragma:",{aMessage:aMessage,selector:selector},$globals.Pragmator)});
  36626. },
  36627. args: ["aMessage"],
  36628. 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]",
  36629. referencedClasses: [],
  36630. messageSends: ["selector", "and:", "respondsTo:", "not", "canUnderstand:", "superclass", "class"]
  36631. }),
  36632. $globals.Pragmator);
  36633. $core.addMethod(
  36634. $core.method({
  36635. selector: "methodNode",
  36636. protocol: "accessing",
  36637. fn: function (){
  36638. var self=this,$self=this;
  36639. return $self["@methodNode"];
  36640. },
  36641. args: [],
  36642. source: "methodNode\x0a\x09^ methodNode",
  36643. referencedClasses: [],
  36644. messageSends: []
  36645. }),
  36646. $globals.Pragmator);
  36647. $core.addMethod(
  36648. $core.method({
  36649. selector: "methodNode:",
  36650. protocol: "accessing",
  36651. fn: function (anObject){
  36652. var self=this,$self=this;
  36653. $self["@methodNode"]=anObject;
  36654. return self;
  36655. },
  36656. args: ["anObject"],
  36657. source: "methodNode: anObject\x0a\x09methodNode := anObject",
  36658. referencedClasses: [],
  36659. messageSends: []
  36660. }),
  36661. $globals.Pragmator);
  36662. $core.addMethod(
  36663. $core.method({
  36664. selector: "processPragma:",
  36665. protocol: "pragma processing",
  36666. fn: function (aMessage){
  36667. var self=this,$self=this;
  36668. return $core.withContext(function($ctx1) {
  36669. var $1;
  36670. $1=$self._canProcessPragma_(aMessage);
  36671. if($core.assert($1)){
  36672. return $recv(aMessage)._sendTo_(self);
  36673. }
  36674. return self;
  36675. }, function($ctx1) {$ctx1.fill(self,"processPragma:",{aMessage:aMessage},$globals.Pragmator)});
  36676. },
  36677. args: ["aMessage"],
  36678. source: "processPragma: aMessage\x0a\x09(self canProcessPragma: aMessage) ifTrue: [\x0a\x09\x09^ aMessage sendTo: self ]",
  36679. referencedClasses: [],
  36680. messageSends: ["ifTrue:", "canProcessPragma:", "sendTo:"]
  36681. }),
  36682. $globals.Pragmator);
  36683. $core.addMethod(
  36684. $core.method({
  36685. selector: "sequenceNode",
  36686. protocol: "accessing",
  36687. fn: function (){
  36688. var self=this,$self=this;
  36689. return $self["@sequenceNode"];
  36690. },
  36691. args: [],
  36692. source: "sequenceNode\x0a\x09^ sequenceNode",
  36693. referencedClasses: [],
  36694. messageSends: []
  36695. }),
  36696. $globals.Pragmator);
  36697. $core.addMethod(
  36698. $core.method({
  36699. selector: "sequenceNode:",
  36700. protocol: "accessing",
  36701. fn: function (anObject){
  36702. var self=this,$self=this;
  36703. $self["@sequenceNode"]=anObject;
  36704. return self;
  36705. },
  36706. args: ["anObject"],
  36707. source: "sequenceNode: anObject\x0a\x09sequenceNode := anObject",
  36708. referencedClasses: [],
  36709. messageSends: []
  36710. }),
  36711. $globals.Pragmator);
  36712. $core.addMethod(
  36713. $core.method({
  36714. selector: "visitMethodNode:",
  36715. protocol: "pragma processing",
  36716. fn: function (aNode){
  36717. var self=this,$self=this;
  36718. return $core.withContext(function($ctx1) {
  36719. var $1;
  36720. $self._methodNode_(aNode);
  36721. $1=(
  36722. $ctx1.supercall = true,
  36723. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  36724. $ctx1.supercall = false;
  36725. return $1;
  36726. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.Pragmator)});
  36727. },
  36728. args: ["aNode"],
  36729. source: "visitMethodNode: aNode\x0a\x09self methodNode: aNode.\x0a\x09^ super visitMethodNode: aNode",
  36730. referencedClasses: [],
  36731. messageSends: ["methodNode:", "visitMethodNode:"]
  36732. }),
  36733. $globals.Pragmator);
  36734. $core.addMethod(
  36735. $core.method({
  36736. selector: "visitSequenceNode:",
  36737. protocol: "pragma processing",
  36738. fn: function (aNode){
  36739. var self=this,$self=this;
  36740. return $core.withContext(function($ctx1) {
  36741. var $1;
  36742. $self._sequenceNode_(aNode);
  36743. $recv($recv(aNode)._pragmas())._do_((function(each){
  36744. return $core.withContext(function($ctx2) {
  36745. return $self._processPragma_(each);
  36746. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  36747. }));
  36748. $1=(
  36749. $ctx1.supercall = true,
  36750. ($globals.Pragmator.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  36751. $ctx1.supercall = false;
  36752. return $1;
  36753. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.Pragmator)});
  36754. },
  36755. args: ["aNode"],
  36756. source: "visitSequenceNode: aNode\x0a\x09self sequenceNode: aNode.\x0a\x09aNode pragmas do: [ :each | self processPragma: each ].\x0a\x09^ super visitSequenceNode: aNode",
  36757. referencedClasses: [],
  36758. messageSends: ["sequenceNode:", "do:", "pragmas", "processPragma:", "visitSequenceNode:"]
  36759. }),
  36760. $globals.Pragmator);
  36761. $core.addClass("EarlyPragmator", $globals.Pragmator, [], "Compiler-Core");
  36762. $core.addMethod(
  36763. $core.method({
  36764. selector: "asVariableName",
  36765. protocol: "*Compiler-Core",
  36766. fn: function (){
  36767. var self=this,$self=this;
  36768. return $core.withContext(function($ctx1) {
  36769. var $1;
  36770. $1=$recv($recv($globals.Smalltalk)._reservedWords())._includes_(self);
  36771. if($core.assert($1)){
  36772. return $self.__comma("_");
  36773. } else {
  36774. return self;
  36775. }
  36776. }, function($ctx1) {$ctx1.fill(self,"asVariableName",{},$globals.String)});
  36777. },
  36778. args: [],
  36779. source: "asVariableName\x0a\x09^ (Smalltalk reservedWords includes: self)\x0a\x09\x09ifTrue: [ self, '_' ]\x0a\x09\x09ifFalse: [ self ]",
  36780. referencedClasses: ["Smalltalk"],
  36781. messageSends: ["ifTrue:ifFalse:", "includes:", "reservedWords", ","]
  36782. }),
  36783. $globals.String);
  36784. });
  36785. define('amber_core/Compiler-Semantic',["amber/boot", "amber_core/Compiler-AST", "amber_core/Compiler-Core", "amber_core/Kernel-Objects"], function($boot){"use strict";
  36786. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  36787. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  36788. $core.addPackage("Compiler-Semantic");
  36789. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].innerEval = function (expr) { return eval(expr); };
  36790. ($core.packageDescriptors||$core.packages)["Compiler-Semantic"].transport = {"type":"amd","amdNamespace":"amber_core"};
  36791. $core.addClass("LexicalScope", $globals.Object, ["node", "instruction", "temps", "args", "outerScope", "blockIndex"], "Compiler-Semantic");
  36792. $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.";
  36793. $core.addMethod(
  36794. $core.method({
  36795. selector: "addArg:",
  36796. protocol: "adding",
  36797. fn: function (aString){
  36798. var self=this,$self=this;
  36799. return $core.withContext(function($ctx1) {
  36800. var $1;
  36801. $1=$self._args();
  36802. $ctx1.sendIdx["args"]=1;
  36803. $recv($1)._at_put_(aString,$recv($globals.ArgVar)._on_(aString));
  36804. $recv($recv($self._args())._at_(aString))._scope_(self);
  36805. return self;
  36806. }, function($ctx1) {$ctx1.fill(self,"addArg:",{aString:aString},$globals.LexicalScope)});
  36807. },
  36808. args: ["aString"],
  36809. source: "addArg: aString\x0a\x09self args at: aString put: (ArgVar on: aString).\x0a\x09(self args at: aString) scope: self",
  36810. referencedClasses: ["ArgVar"],
  36811. messageSends: ["at:put:", "args", "on:", "scope:", "at:"]
  36812. }),
  36813. $globals.LexicalScope);
  36814. $core.addMethod(
  36815. $core.method({
  36816. selector: "addTemp:",
  36817. protocol: "adding",
  36818. fn: function (aString){
  36819. var self=this,$self=this;
  36820. return $core.withContext(function($ctx1) {
  36821. var $1;
  36822. $1=$self._temps();
  36823. $ctx1.sendIdx["temps"]=1;
  36824. $recv($1)._at_put_(aString,$recv($globals.TempVar)._on_(aString));
  36825. $recv($recv($self._temps())._at_(aString))._scope_(self);
  36826. return self;
  36827. }, function($ctx1) {$ctx1.fill(self,"addTemp:",{aString:aString},$globals.LexicalScope)});
  36828. },
  36829. args: ["aString"],
  36830. source: "addTemp: aString\x0a\x09self temps at: aString put: (TempVar on: aString).\x0a\x09(self temps at: aString) scope: self",
  36831. referencedClasses: ["TempVar"],
  36832. messageSends: ["at:put:", "temps", "on:", "scope:", "at:"]
  36833. }),
  36834. $globals.LexicalScope);
  36835. $core.addMethod(
  36836. $core.method({
  36837. selector: "alias",
  36838. protocol: "accessing",
  36839. fn: function (){
  36840. var self=this,$self=this;
  36841. return $core.withContext(function($ctx1) {
  36842. return "$ctx".__comma($recv($self._scopeLevel())._asString());
  36843. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.LexicalScope)});
  36844. },
  36845. args: [],
  36846. source: "alias\x0a\x09^ '$ctx', self scopeLevel asString",
  36847. referencedClasses: [],
  36848. messageSends: [",", "asString", "scopeLevel"]
  36849. }),
  36850. $globals.LexicalScope);
  36851. $core.addMethod(
  36852. $core.method({
  36853. selector: "allVariableNames",
  36854. protocol: "accessing",
  36855. fn: function (){
  36856. var self=this,$self=this;
  36857. return $core.withContext(function($ctx1) {
  36858. var $1;
  36859. $1=$recv($self._args())._keys();
  36860. $ctx1.sendIdx["keys"]=1;
  36861. return $recv($1).__comma($recv($self._temps())._keys());
  36862. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.LexicalScope)});
  36863. },
  36864. args: [],
  36865. source: "allVariableNames\x0a\x09^ self args keys, self temps keys",
  36866. referencedClasses: [],
  36867. messageSends: [",", "keys", "args", "temps"]
  36868. }),
  36869. $globals.LexicalScope);
  36870. $core.addMethod(
  36871. $core.method({
  36872. selector: "args",
  36873. protocol: "accessing",
  36874. fn: function (){
  36875. var self=this,$self=this;
  36876. return $core.withContext(function($ctx1) {
  36877. var $1,$receiver;
  36878. $1=$self["@args"];
  36879. if(($receiver = $1) == null || $receiver.a$nil){
  36880. $self["@args"]=$recv($globals.Dictionary)._new();
  36881. return $self["@args"];
  36882. } else {
  36883. return $1;
  36884. }
  36885. }, function($ctx1) {$ctx1.fill(self,"args",{},$globals.LexicalScope)});
  36886. },
  36887. args: [],
  36888. source: "args\x0a\x09^ args ifNil: [ args := Dictionary new ]",
  36889. referencedClasses: ["Dictionary"],
  36890. messageSends: ["ifNil:", "new"]
  36891. }),
  36892. $globals.LexicalScope);
  36893. $core.addMethod(
  36894. $core.method({
  36895. selector: "bindingFor:",
  36896. protocol: "accessing",
  36897. fn: function (aStringOrNode){
  36898. var self=this,$self=this;
  36899. return $core.withContext(function($ctx1) {
  36900. var $2,$3,$4,$5,$1;
  36901. $2=$self._pseudoVars();
  36902. $3=$recv(aStringOrNode)._value();
  36903. $ctx1.sendIdx["value"]=1;
  36904. $1=$recv($2)._at_ifAbsent_($3,(function(){
  36905. return $core.withContext(function($ctx2) {
  36906. $4=$self._args();
  36907. $5=$recv(aStringOrNode)._value();
  36908. $ctx2.sendIdx["value"]=2;
  36909. return $recv($4)._at_ifAbsent_($5,(function(){
  36910. return $core.withContext(function($ctx3) {
  36911. return $recv($self._temps())._at_ifAbsent_($recv(aStringOrNode)._value(),(function(){
  36912. return nil;
  36913. }));
  36914. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  36915. }));
  36916. $ctx2.sendIdx["at:ifAbsent:"]=2;
  36917. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36918. }));
  36919. $ctx1.sendIdx["at:ifAbsent:"]=1;
  36920. return $1;
  36921. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aStringOrNode:aStringOrNode},$globals.LexicalScope)});
  36922. },
  36923. args: ["aStringOrNode"],
  36924. 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 ]]]",
  36925. referencedClasses: [],
  36926. messageSends: ["at:ifAbsent:", "pseudoVars", "value", "args", "temps"]
  36927. }),
  36928. $globals.LexicalScope);
  36929. $core.addMethod(
  36930. $core.method({
  36931. selector: "blockIndex",
  36932. protocol: "accessing",
  36933. fn: function (){
  36934. var self=this,$self=this;
  36935. return $core.withContext(function($ctx1) {
  36936. var $1,$receiver;
  36937. $1=$self["@blockIndex"];
  36938. if(($receiver = $1) == null || $receiver.a$nil){
  36939. return (0);
  36940. } else {
  36941. return $1;
  36942. }
  36943. }, function($ctx1) {$ctx1.fill(self,"blockIndex",{},$globals.LexicalScope)});
  36944. },
  36945. args: [],
  36946. source: "blockIndex\x0a\x09^ blockIndex ifNil: [ 0 ]",
  36947. referencedClasses: [],
  36948. messageSends: ["ifNil:"]
  36949. }),
  36950. $globals.LexicalScope);
  36951. $core.addMethod(
  36952. $core.method({
  36953. selector: "blockIndex:",
  36954. protocol: "accessing",
  36955. fn: function (anInteger){
  36956. var self=this,$self=this;
  36957. $self["@blockIndex"]=anInteger;
  36958. return self;
  36959. },
  36960. args: ["anInteger"],
  36961. source: "blockIndex: anInteger \x0a\x09blockIndex := anInteger",
  36962. referencedClasses: [],
  36963. messageSends: []
  36964. }),
  36965. $globals.LexicalScope);
  36966. $core.addMethod(
  36967. $core.method({
  36968. selector: "canInlineNonLocalReturns",
  36969. protocol: "testing",
  36970. fn: function (){
  36971. var self=this,$self=this;
  36972. return $core.withContext(function($ctx1) {
  36973. return $recv($self._isInlined())._and_((function(){
  36974. return $core.withContext(function($ctx2) {
  36975. return $recv($self._outerScope())._canInlineNonLocalReturns();
  36976. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  36977. }));
  36978. }, function($ctx1) {$ctx1.fill(self,"canInlineNonLocalReturns",{},$globals.LexicalScope)});
  36979. },
  36980. args: [],
  36981. source: "canInlineNonLocalReturns\x0a\x09^ self isInlined and: [ self outerScope canInlineNonLocalReturns ]",
  36982. referencedClasses: [],
  36983. messageSends: ["and:", "isInlined", "canInlineNonLocalReturns", "outerScope"]
  36984. }),
  36985. $globals.LexicalScope);
  36986. $core.addMethod(
  36987. $core.method({
  36988. selector: "instruction",
  36989. protocol: "accessing",
  36990. fn: function (){
  36991. var self=this,$self=this;
  36992. return $self["@instruction"];
  36993. },
  36994. args: [],
  36995. source: "instruction\x0a\x09^ instruction",
  36996. referencedClasses: [],
  36997. messageSends: []
  36998. }),
  36999. $globals.LexicalScope);
  37000. $core.addMethod(
  37001. $core.method({
  37002. selector: "instruction:",
  37003. protocol: "accessing",
  37004. fn: function (anIRInstruction){
  37005. var self=this,$self=this;
  37006. $self["@instruction"]=anIRInstruction;
  37007. return self;
  37008. },
  37009. args: ["anIRInstruction"],
  37010. source: "instruction: anIRInstruction\x0a\x09instruction := anIRInstruction",
  37011. referencedClasses: [],
  37012. messageSends: []
  37013. }),
  37014. $globals.LexicalScope);
  37015. $core.addMethod(
  37016. $core.method({
  37017. selector: "isBlockScope",
  37018. protocol: "testing",
  37019. fn: function (){
  37020. var self=this,$self=this;
  37021. return $core.withContext(function($ctx1) {
  37022. return $recv($self._isMethodScope())._not();
  37023. }, function($ctx1) {$ctx1.fill(self,"isBlockScope",{},$globals.LexicalScope)});
  37024. },
  37025. args: [],
  37026. source: "isBlockScope\x0a\x09^ self isMethodScope not",
  37027. referencedClasses: [],
  37028. messageSends: ["not", "isMethodScope"]
  37029. }),
  37030. $globals.LexicalScope);
  37031. $core.addMethod(
  37032. $core.method({
  37033. selector: "isInlined",
  37034. protocol: "testing",
  37035. fn: function (){
  37036. var self=this,$self=this;
  37037. return $core.withContext(function($ctx1) {
  37038. var $2,$1;
  37039. $2=$self._instruction();
  37040. $ctx1.sendIdx["instruction"]=1;
  37041. $1=$recv($2)._notNil();
  37042. return $recv($1)._and_((function(){
  37043. return $core.withContext(function($ctx2) {
  37044. return $recv($self._instruction())._isInlined();
  37045. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37046. }));
  37047. }, function($ctx1) {$ctx1.fill(self,"isInlined",{},$globals.LexicalScope)});
  37048. },
  37049. args: [],
  37050. source: "isInlined\x0a\x09^ self instruction notNil and: [\x0a\x09\x09self instruction isInlined ]",
  37051. referencedClasses: [],
  37052. messageSends: ["and:", "notNil", "instruction", "isInlined"]
  37053. }),
  37054. $globals.LexicalScope);
  37055. $core.addMethod(
  37056. $core.method({
  37057. selector: "isMethodScope",
  37058. protocol: "testing",
  37059. fn: function (){
  37060. var self=this,$self=this;
  37061. return false;
  37062. },
  37063. args: [],
  37064. source: "isMethodScope\x0a\x09^ false",
  37065. referencedClasses: [],
  37066. messageSends: []
  37067. }),
  37068. $globals.LexicalScope);
  37069. $core.addMethod(
  37070. $core.method({
  37071. selector: "lookupVariable:",
  37072. protocol: "accessing",
  37073. fn: function (aNode){
  37074. var self=this,$self=this;
  37075. var lookup;
  37076. return $core.withContext(function($ctx1) {
  37077. var $1,$2,$receiver;
  37078. lookup=$self._bindingFor_(aNode);
  37079. $1=lookup;
  37080. if(($receiver = $1) == null || $receiver.a$nil){
  37081. $2=$self._outerScope();
  37082. $ctx1.sendIdx["outerScope"]=1;
  37083. if(($receiver = $2) == null || $receiver.a$nil){
  37084. lookup=$2;
  37085. } else {
  37086. lookup=$recv($self._outerScope())._lookupVariable_(aNode);
  37087. }
  37088. lookup;
  37089. } else {
  37090. $1;
  37091. }
  37092. return lookup;
  37093. }, function($ctx1) {$ctx1.fill(self,"lookupVariable:",{aNode:aNode,lookup:lookup},$globals.LexicalScope)});
  37094. },
  37095. args: ["aNode"],
  37096. 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",
  37097. referencedClasses: [],
  37098. messageSends: ["bindingFor:", "ifNil:", "ifNotNil:", "outerScope", "lookupVariable:"]
  37099. }),
  37100. $globals.LexicalScope);
  37101. $core.addMethod(
  37102. $core.method({
  37103. selector: "methodScope",
  37104. protocol: "accessing",
  37105. fn: function (){
  37106. var self=this,$self=this;
  37107. return $core.withContext(function($ctx1) {
  37108. var $1,$receiver;
  37109. $1=$self._outerScope();
  37110. $ctx1.sendIdx["outerScope"]=1;
  37111. if(($receiver = $1) == null || $receiver.a$nil){
  37112. return $1;
  37113. } else {
  37114. return $recv($self._outerScope())._methodScope();
  37115. }
  37116. }, function($ctx1) {$ctx1.fill(self,"methodScope",{},$globals.LexicalScope)});
  37117. },
  37118. args: [],
  37119. source: "methodScope\x0a\x09^ self outerScope ifNotNil: [\x0a\x09\x09self outerScope methodScope ]",
  37120. referencedClasses: [],
  37121. messageSends: ["ifNotNil:", "outerScope", "methodScope"]
  37122. }),
  37123. $globals.LexicalScope);
  37124. $core.addMethod(
  37125. $core.method({
  37126. selector: "node",
  37127. protocol: "accessing",
  37128. fn: function (){
  37129. var self=this,$self=this;
  37130. return $self["@node"];
  37131. },
  37132. args: [],
  37133. source: "node\x0a\x09\x22Answer the node in which I am defined\x22\x0a\x09\x0a\x09^ node",
  37134. referencedClasses: [],
  37135. messageSends: []
  37136. }),
  37137. $globals.LexicalScope);
  37138. $core.addMethod(
  37139. $core.method({
  37140. selector: "node:",
  37141. protocol: "accessing",
  37142. fn: function (aNode){
  37143. var self=this,$self=this;
  37144. $self["@node"]=aNode;
  37145. return self;
  37146. },
  37147. args: ["aNode"],
  37148. source: "node: aNode\x0a\x09node := aNode",
  37149. referencedClasses: [],
  37150. messageSends: []
  37151. }),
  37152. $globals.LexicalScope);
  37153. $core.addMethod(
  37154. $core.method({
  37155. selector: "outerScope",
  37156. protocol: "accessing",
  37157. fn: function (){
  37158. var self=this,$self=this;
  37159. return $self["@outerScope"];
  37160. },
  37161. args: [],
  37162. source: "outerScope\x0a\x09^ outerScope",
  37163. referencedClasses: [],
  37164. messageSends: []
  37165. }),
  37166. $globals.LexicalScope);
  37167. $core.addMethod(
  37168. $core.method({
  37169. selector: "outerScope:",
  37170. protocol: "accessing",
  37171. fn: function (aLexicalScope){
  37172. var self=this,$self=this;
  37173. $self["@outerScope"]=aLexicalScope;
  37174. return self;
  37175. },
  37176. args: ["aLexicalScope"],
  37177. source: "outerScope: aLexicalScope\x0a\x09outerScope := aLexicalScope",
  37178. referencedClasses: [],
  37179. messageSends: []
  37180. }),
  37181. $globals.LexicalScope);
  37182. $core.addMethod(
  37183. $core.method({
  37184. selector: "pseudoVars",
  37185. protocol: "accessing",
  37186. fn: function (){
  37187. var self=this,$self=this;
  37188. return $core.withContext(function($ctx1) {
  37189. return $recv($self._methodScope())._pseudoVars();
  37190. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.LexicalScope)});
  37191. },
  37192. args: [],
  37193. source: "pseudoVars\x0a\x09^ self methodScope pseudoVars",
  37194. referencedClasses: [],
  37195. messageSends: ["pseudoVars", "methodScope"]
  37196. }),
  37197. $globals.LexicalScope);
  37198. $core.addMethod(
  37199. $core.method({
  37200. selector: "scopeLevel",
  37201. protocol: "accessing",
  37202. fn: function (){
  37203. var self=this,$self=this;
  37204. return $core.withContext(function($ctx1) {
  37205. var $1,$2,$4,$3,$receiver;
  37206. $1=$self._outerScope();
  37207. $ctx1.sendIdx["outerScope"]=1;
  37208. if(($receiver = $1) == null || $receiver.a$nil){
  37209. return (1);
  37210. } else {
  37211. $1;
  37212. }
  37213. $2=$self._isInlined();
  37214. if($core.assert($2)){
  37215. $4=$self._outerScope();
  37216. $ctx1.sendIdx["outerScope"]=2;
  37217. $3=$recv($4)._scopeLevel();
  37218. $ctx1.sendIdx["scopeLevel"]=1;
  37219. return $3;
  37220. }
  37221. return $recv($recv($self._outerScope())._scopeLevel()).__plus((1));
  37222. }, function($ctx1) {$ctx1.fill(self,"scopeLevel",{},$globals.LexicalScope)});
  37223. },
  37224. args: [],
  37225. source: "scopeLevel\x0a\x09self outerScope ifNil: [ ^ 1 ].\x0a\x09self isInlined ifTrue: [ ^ self outerScope scopeLevel ].\x0a\x09\x0a\x09^ self outerScope scopeLevel + 1",
  37226. referencedClasses: [],
  37227. messageSends: ["ifNil:", "outerScope", "ifTrue:", "isInlined", "scopeLevel", "+"]
  37228. }),
  37229. $globals.LexicalScope);
  37230. $core.addMethod(
  37231. $core.method({
  37232. selector: "temps",
  37233. protocol: "accessing",
  37234. fn: function (){
  37235. var self=this,$self=this;
  37236. return $core.withContext(function($ctx1) {
  37237. var $1,$receiver;
  37238. $1=$self["@temps"];
  37239. if(($receiver = $1) == null || $receiver.a$nil){
  37240. $self["@temps"]=$recv($globals.Dictionary)._new();
  37241. return $self["@temps"];
  37242. } else {
  37243. return $1;
  37244. }
  37245. }, function($ctx1) {$ctx1.fill(self,"temps",{},$globals.LexicalScope)});
  37246. },
  37247. args: [],
  37248. source: "temps\x0a\x09^ temps ifNil: [ temps := Dictionary new ]",
  37249. referencedClasses: ["Dictionary"],
  37250. messageSends: ["ifNil:", "new"]
  37251. }),
  37252. $globals.LexicalScope);
  37253. $core.addClass("MethodLexicalScope", $globals.LexicalScope, ["iVars", "pseudoVars", "unknownVariables", "localReturn", "nonLocalReturns"], "Compiler-Semantic");
  37254. $globals.MethodLexicalScope.comment="I represent a method scope.";
  37255. $core.addMethod(
  37256. $core.method({
  37257. selector: "addIVar:",
  37258. protocol: "adding",
  37259. fn: function (aString){
  37260. var self=this,$self=this;
  37261. return $core.withContext(function($ctx1) {
  37262. var $1;
  37263. $1=$self._iVars();
  37264. $ctx1.sendIdx["iVars"]=1;
  37265. $recv($1)._at_put_(aString,$recv($globals.InstanceVar)._on_(aString));
  37266. $recv($recv($self._iVars())._at_(aString))._scope_(self);
  37267. return self;
  37268. }, function($ctx1) {$ctx1.fill(self,"addIVar:",{aString:aString},$globals.MethodLexicalScope)});
  37269. },
  37270. args: ["aString"],
  37271. source: "addIVar: aString\x0a\x09self iVars at: aString put: (InstanceVar on: aString).\x0a\x09(self iVars at: aString) scope: self",
  37272. referencedClasses: ["InstanceVar"],
  37273. messageSends: ["at:put:", "iVars", "on:", "scope:", "at:"]
  37274. }),
  37275. $globals.MethodLexicalScope);
  37276. $core.addMethod(
  37277. $core.method({
  37278. selector: "addNonLocalReturn:",
  37279. protocol: "adding",
  37280. fn: function (aScope){
  37281. var self=this,$self=this;
  37282. return $core.withContext(function($ctx1) {
  37283. $recv($self._nonLocalReturns())._add_(aScope);
  37284. return self;
  37285. }, function($ctx1) {$ctx1.fill(self,"addNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37286. },
  37287. args: ["aScope"],
  37288. source: "addNonLocalReturn: aScope\x0a\x09self nonLocalReturns add: aScope",
  37289. referencedClasses: [],
  37290. messageSends: ["add:", "nonLocalReturns"]
  37291. }),
  37292. $globals.MethodLexicalScope);
  37293. $core.addMethod(
  37294. $core.method({
  37295. selector: "allVariableNames",
  37296. protocol: "accessing",
  37297. fn: function (){
  37298. var self=this,$self=this;
  37299. return $core.withContext(function($ctx1) {
  37300. var $1;
  37301. $1=(
  37302. $ctx1.supercall = true,
  37303. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._allVariableNames.apply($self, []));
  37304. $ctx1.supercall = false;
  37305. return $recv($1).__comma($recv($self._iVars())._keys());
  37306. }, function($ctx1) {$ctx1.fill(self,"allVariableNames",{},$globals.MethodLexicalScope)});
  37307. },
  37308. args: [],
  37309. source: "allVariableNames\x0a\x09^ super allVariableNames, self iVars keys",
  37310. referencedClasses: [],
  37311. messageSends: [",", "allVariableNames", "keys", "iVars"]
  37312. }),
  37313. $globals.MethodLexicalScope);
  37314. $core.addMethod(
  37315. $core.method({
  37316. selector: "bindingFor:",
  37317. protocol: "accessing",
  37318. fn: function (aNode){
  37319. var self=this,$self=this;
  37320. return $core.withContext(function($ctx1) {
  37321. var $1,$receiver;
  37322. $1=(
  37323. $ctx1.supercall = true,
  37324. ($globals.MethodLexicalScope.superclass||$boot.nilAsClass).fn.prototype._bindingFor_.apply($self, [aNode]));
  37325. $ctx1.supercall = false;
  37326. if(($receiver = $1) == null || $receiver.a$nil){
  37327. return $recv($self._iVars())._at_ifAbsent_($recv(aNode)._value(),(function(){
  37328. return nil;
  37329. }));
  37330. } else {
  37331. return $1;
  37332. }
  37333. }, function($ctx1) {$ctx1.fill(self,"bindingFor:",{aNode:aNode},$globals.MethodLexicalScope)});
  37334. },
  37335. args: ["aNode"],
  37336. source: "bindingFor: aNode\x0a\x09^ (super bindingFor: aNode) ifNil: [\x0a\x09\x09self iVars at: aNode value ifAbsent: [ nil ]]",
  37337. referencedClasses: [],
  37338. messageSends: ["ifNil:", "bindingFor:", "at:ifAbsent:", "iVars", "value"]
  37339. }),
  37340. $globals.MethodLexicalScope);
  37341. $core.addMethod(
  37342. $core.method({
  37343. selector: "canInlineNonLocalReturns",
  37344. protocol: "testing",
  37345. fn: function (){
  37346. var self=this,$self=this;
  37347. return true;
  37348. },
  37349. args: [],
  37350. source: "canInlineNonLocalReturns\x0a\x09^ true",
  37351. referencedClasses: [],
  37352. messageSends: []
  37353. }),
  37354. $globals.MethodLexicalScope);
  37355. $core.addMethod(
  37356. $core.method({
  37357. selector: "hasLocalReturn",
  37358. protocol: "testing",
  37359. fn: function (){
  37360. var self=this,$self=this;
  37361. return $core.withContext(function($ctx1) {
  37362. return $self._localReturn();
  37363. }, function($ctx1) {$ctx1.fill(self,"hasLocalReturn",{},$globals.MethodLexicalScope)});
  37364. },
  37365. args: [],
  37366. source: "hasLocalReturn\x0a\x09^ self localReturn",
  37367. referencedClasses: [],
  37368. messageSends: ["localReturn"]
  37369. }),
  37370. $globals.MethodLexicalScope);
  37371. $core.addMethod(
  37372. $core.method({
  37373. selector: "hasNonLocalReturn",
  37374. protocol: "testing",
  37375. fn: function (){
  37376. var self=this,$self=this;
  37377. return $core.withContext(function($ctx1) {
  37378. return $recv($self._nonLocalReturns())._notEmpty();
  37379. }, function($ctx1) {$ctx1.fill(self,"hasNonLocalReturn",{},$globals.MethodLexicalScope)});
  37380. },
  37381. args: [],
  37382. source: "hasNonLocalReturn\x0a\x09^ self nonLocalReturns notEmpty",
  37383. referencedClasses: [],
  37384. messageSends: ["notEmpty", "nonLocalReturns"]
  37385. }),
  37386. $globals.MethodLexicalScope);
  37387. $core.addMethod(
  37388. $core.method({
  37389. selector: "iVars",
  37390. protocol: "accessing",
  37391. fn: function (){
  37392. var self=this,$self=this;
  37393. return $core.withContext(function($ctx1) {
  37394. var $1,$receiver;
  37395. $1=$self["@iVars"];
  37396. if(($receiver = $1) == null || $receiver.a$nil){
  37397. $self["@iVars"]=$recv($globals.Dictionary)._new();
  37398. return $self["@iVars"];
  37399. } else {
  37400. return $1;
  37401. }
  37402. }, function($ctx1) {$ctx1.fill(self,"iVars",{},$globals.MethodLexicalScope)});
  37403. },
  37404. args: [],
  37405. source: "iVars\x0a\x09^ iVars ifNil: [ iVars := Dictionary new ]",
  37406. referencedClasses: ["Dictionary"],
  37407. messageSends: ["ifNil:", "new"]
  37408. }),
  37409. $globals.MethodLexicalScope);
  37410. $core.addMethod(
  37411. $core.method({
  37412. selector: "isMethodScope",
  37413. protocol: "testing",
  37414. fn: function (){
  37415. var self=this,$self=this;
  37416. return true;
  37417. },
  37418. args: [],
  37419. source: "isMethodScope\x0a\x09^ true",
  37420. referencedClasses: [],
  37421. messageSends: []
  37422. }),
  37423. $globals.MethodLexicalScope);
  37424. $core.addMethod(
  37425. $core.method({
  37426. selector: "localReturn",
  37427. protocol: "accessing",
  37428. fn: function (){
  37429. var self=this,$self=this;
  37430. return $core.withContext(function($ctx1) {
  37431. var $1,$receiver;
  37432. $1=$self["@localReturn"];
  37433. if(($receiver = $1) == null || $receiver.a$nil){
  37434. return false;
  37435. } else {
  37436. return $1;
  37437. }
  37438. }, function($ctx1) {$ctx1.fill(self,"localReturn",{},$globals.MethodLexicalScope)});
  37439. },
  37440. args: [],
  37441. source: "localReturn\x0a\x09^ localReturn ifNil: [ false ]",
  37442. referencedClasses: [],
  37443. messageSends: ["ifNil:"]
  37444. }),
  37445. $globals.MethodLexicalScope);
  37446. $core.addMethod(
  37447. $core.method({
  37448. selector: "localReturn:",
  37449. protocol: "accessing",
  37450. fn: function (aBoolean){
  37451. var self=this,$self=this;
  37452. $self["@localReturn"]=aBoolean;
  37453. return self;
  37454. },
  37455. args: ["aBoolean"],
  37456. source: "localReturn: aBoolean\x0a\x09localReturn := aBoolean",
  37457. referencedClasses: [],
  37458. messageSends: []
  37459. }),
  37460. $globals.MethodLexicalScope);
  37461. $core.addMethod(
  37462. $core.method({
  37463. selector: "methodScope",
  37464. protocol: "accessing",
  37465. fn: function (){
  37466. var self=this,$self=this;
  37467. return self;
  37468. },
  37469. args: [],
  37470. source: "methodScope\x0a\x09^ self",
  37471. referencedClasses: [],
  37472. messageSends: []
  37473. }),
  37474. $globals.MethodLexicalScope);
  37475. $core.addMethod(
  37476. $core.method({
  37477. selector: "nonLocalReturns",
  37478. protocol: "accessing",
  37479. fn: function (){
  37480. var self=this,$self=this;
  37481. return $core.withContext(function($ctx1) {
  37482. var $1,$receiver;
  37483. $1=$self["@nonLocalReturns"];
  37484. if(($receiver = $1) == null || $receiver.a$nil){
  37485. $self["@nonLocalReturns"]=$recv($globals.OrderedCollection)._new();
  37486. return $self["@nonLocalReturns"];
  37487. } else {
  37488. return $1;
  37489. }
  37490. }, function($ctx1) {$ctx1.fill(self,"nonLocalReturns",{},$globals.MethodLexicalScope)});
  37491. },
  37492. args: [],
  37493. source: "nonLocalReturns\x0a\x09^ nonLocalReturns ifNil: [ nonLocalReturns := OrderedCollection new ]",
  37494. referencedClasses: ["OrderedCollection"],
  37495. messageSends: ["ifNil:", "new"]
  37496. }),
  37497. $globals.MethodLexicalScope);
  37498. $core.addMethod(
  37499. $core.method({
  37500. selector: "pseudoVars",
  37501. protocol: "accessing",
  37502. fn: function (){
  37503. var self=this,$self=this;
  37504. return $core.withContext(function($ctx1) {
  37505. var $1,$2,$4,$3,$receiver;
  37506. $1=$self["@pseudoVars"];
  37507. if(($receiver = $1) == null || $receiver.a$nil){
  37508. $self["@pseudoVars"]=$recv($globals.Dictionary)._new();
  37509. $recv($recv($globals.Smalltalk)._pseudoVariableNames())._do_((function(each){
  37510. return $core.withContext(function($ctx2) {
  37511. $2=$self["@pseudoVars"];
  37512. $4=$recv($globals.PseudoVar)._on_(each);
  37513. $recv($4)._scope_($self._methodScope());
  37514. $3=$recv($4)._yourself();
  37515. return $recv($2)._at_put_(each,$3);
  37516. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  37517. }));
  37518. } else {
  37519. $1;
  37520. }
  37521. return $self["@pseudoVars"];
  37522. }, function($ctx1) {$ctx1.fill(self,"pseudoVars",{},$globals.MethodLexicalScope)});
  37523. },
  37524. args: [],
  37525. 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",
  37526. referencedClasses: ["Dictionary", "Smalltalk", "PseudoVar"],
  37527. messageSends: ["ifNil:", "new", "do:", "pseudoVariableNames", "at:put:", "scope:", "on:", "methodScope", "yourself"]
  37528. }),
  37529. $globals.MethodLexicalScope);
  37530. $core.addMethod(
  37531. $core.method({
  37532. selector: "removeNonLocalReturn:",
  37533. protocol: "adding",
  37534. fn: function (aScope){
  37535. var self=this,$self=this;
  37536. return $core.withContext(function($ctx1) {
  37537. $recv($self._nonLocalReturns())._remove_ifAbsent_(aScope,(function(){
  37538. }));
  37539. return self;
  37540. }, function($ctx1) {$ctx1.fill(self,"removeNonLocalReturn:",{aScope:aScope},$globals.MethodLexicalScope)});
  37541. },
  37542. args: ["aScope"],
  37543. source: "removeNonLocalReturn: aScope\x0a\x09self nonLocalReturns remove: aScope ifAbsent: []",
  37544. referencedClasses: [],
  37545. messageSends: ["remove:ifAbsent:", "nonLocalReturns"]
  37546. }),
  37547. $globals.MethodLexicalScope);
  37548. $core.addMethod(
  37549. $core.method({
  37550. selector: "unknownVariables",
  37551. protocol: "accessing",
  37552. fn: function (){
  37553. var self=this,$self=this;
  37554. return $core.withContext(function($ctx1) {
  37555. var $1,$receiver;
  37556. $1=$self["@unknownVariables"];
  37557. if(($receiver = $1) == null || $receiver.a$nil){
  37558. $self["@unknownVariables"]=$recv($globals.OrderedCollection)._new();
  37559. return $self["@unknownVariables"];
  37560. } else {
  37561. return $1;
  37562. }
  37563. }, function($ctx1) {$ctx1.fill(self,"unknownVariables",{},$globals.MethodLexicalScope)});
  37564. },
  37565. args: [],
  37566. source: "unknownVariables\x0a\x09^ unknownVariables ifNil: [ unknownVariables := OrderedCollection new ]",
  37567. referencedClasses: ["OrderedCollection"],
  37568. messageSends: ["ifNil:", "new"]
  37569. }),
  37570. $globals.MethodLexicalScope);
  37571. $core.addClass("ScopeVar", $globals.Object, ["scope", "name"], "Compiler-Semantic");
  37572. $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.";
  37573. $core.addMethod(
  37574. $core.method({
  37575. selector: "alias",
  37576. protocol: "accessing",
  37577. fn: function (){
  37578. var self=this,$self=this;
  37579. return $core.withContext(function($ctx1) {
  37580. return $recv($self._name())._asVariableName();
  37581. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ScopeVar)});
  37582. },
  37583. args: [],
  37584. source: "alias\x0a\x09^ self name asVariableName",
  37585. referencedClasses: [],
  37586. messageSends: ["asVariableName", "name"]
  37587. }),
  37588. $globals.ScopeVar);
  37589. $core.addMethod(
  37590. $core.method({
  37591. selector: "isArgVar",
  37592. protocol: "testing",
  37593. fn: function (){
  37594. var self=this,$self=this;
  37595. return false;
  37596. },
  37597. args: [],
  37598. source: "isArgVar\x0a\x09^ false",
  37599. referencedClasses: [],
  37600. messageSends: []
  37601. }),
  37602. $globals.ScopeVar);
  37603. $core.addMethod(
  37604. $core.method({
  37605. selector: "isClassRefVar",
  37606. protocol: "testing",
  37607. fn: function (){
  37608. var self=this,$self=this;
  37609. return false;
  37610. },
  37611. args: [],
  37612. source: "isClassRefVar\x0a\x09^ false",
  37613. referencedClasses: [],
  37614. messageSends: []
  37615. }),
  37616. $globals.ScopeVar);
  37617. $core.addMethod(
  37618. $core.method({
  37619. selector: "isImmutable",
  37620. protocol: "testing",
  37621. fn: function (){
  37622. var self=this,$self=this;
  37623. return false;
  37624. },
  37625. args: [],
  37626. source: "isImmutable\x0a\x09^ false",
  37627. referencedClasses: [],
  37628. messageSends: []
  37629. }),
  37630. $globals.ScopeVar);
  37631. $core.addMethod(
  37632. $core.method({
  37633. selector: "isInstanceVar",
  37634. protocol: "testing",
  37635. fn: function (){
  37636. var self=this,$self=this;
  37637. return false;
  37638. },
  37639. args: [],
  37640. source: "isInstanceVar\x0a\x09^ false",
  37641. referencedClasses: [],
  37642. messageSends: []
  37643. }),
  37644. $globals.ScopeVar);
  37645. $core.addMethod(
  37646. $core.method({
  37647. selector: "isPseudoVar",
  37648. protocol: "testing",
  37649. fn: function (){
  37650. var self=this,$self=this;
  37651. return false;
  37652. },
  37653. args: [],
  37654. source: "isPseudoVar\x0a\x09^ false",
  37655. referencedClasses: [],
  37656. messageSends: []
  37657. }),
  37658. $globals.ScopeVar);
  37659. $core.addMethod(
  37660. $core.method({
  37661. selector: "isSelf",
  37662. protocol: "testing",
  37663. fn: function (){
  37664. var self=this,$self=this;
  37665. return false;
  37666. },
  37667. args: [],
  37668. source: "isSelf\x0a\x09^ false",
  37669. referencedClasses: [],
  37670. messageSends: []
  37671. }),
  37672. $globals.ScopeVar);
  37673. $core.addMethod(
  37674. $core.method({
  37675. selector: "isSuper",
  37676. protocol: "testing",
  37677. fn: function (){
  37678. var self=this,$self=this;
  37679. return false;
  37680. },
  37681. args: [],
  37682. source: "isSuper\x0a\x09^ false",
  37683. referencedClasses: [],
  37684. messageSends: []
  37685. }),
  37686. $globals.ScopeVar);
  37687. $core.addMethod(
  37688. $core.method({
  37689. selector: "isTempVar",
  37690. protocol: "testing",
  37691. fn: function (){
  37692. var self=this,$self=this;
  37693. return false;
  37694. },
  37695. args: [],
  37696. source: "isTempVar\x0a\x09^ false",
  37697. referencedClasses: [],
  37698. messageSends: []
  37699. }),
  37700. $globals.ScopeVar);
  37701. $core.addMethod(
  37702. $core.method({
  37703. selector: "isUnknownVar",
  37704. protocol: "testing",
  37705. fn: function (){
  37706. var self=this,$self=this;
  37707. return false;
  37708. },
  37709. args: [],
  37710. source: "isUnknownVar\x0a\x09^ false",
  37711. referencedClasses: [],
  37712. messageSends: []
  37713. }),
  37714. $globals.ScopeVar);
  37715. $core.addMethod(
  37716. $core.method({
  37717. selector: "name",
  37718. protocol: "accessing",
  37719. fn: function (){
  37720. var self=this,$self=this;
  37721. return $self["@name"];
  37722. },
  37723. args: [],
  37724. source: "name\x0a\x09^ name",
  37725. referencedClasses: [],
  37726. messageSends: []
  37727. }),
  37728. $globals.ScopeVar);
  37729. $core.addMethod(
  37730. $core.method({
  37731. selector: "name:",
  37732. protocol: "accessing",
  37733. fn: function (aString){
  37734. var self=this,$self=this;
  37735. $self["@name"]=aString;
  37736. return self;
  37737. },
  37738. args: ["aString"],
  37739. source: "name: aString\x0a\x09name := aString",
  37740. referencedClasses: [],
  37741. messageSends: []
  37742. }),
  37743. $globals.ScopeVar);
  37744. $core.addMethod(
  37745. $core.method({
  37746. selector: "scope",
  37747. protocol: "accessing",
  37748. fn: function (){
  37749. var self=this,$self=this;
  37750. return $self["@scope"];
  37751. },
  37752. args: [],
  37753. source: "scope\x0a\x09^ scope",
  37754. referencedClasses: [],
  37755. messageSends: []
  37756. }),
  37757. $globals.ScopeVar);
  37758. $core.addMethod(
  37759. $core.method({
  37760. selector: "scope:",
  37761. protocol: "accessing",
  37762. fn: function (aScope){
  37763. var self=this,$self=this;
  37764. $self["@scope"]=aScope;
  37765. return self;
  37766. },
  37767. args: ["aScope"],
  37768. source: "scope: aScope\x0a\x09scope := aScope",
  37769. referencedClasses: [],
  37770. messageSends: []
  37771. }),
  37772. $globals.ScopeVar);
  37773. $core.addMethod(
  37774. $core.method({
  37775. selector: "validateAssignment",
  37776. protocol: "testing",
  37777. fn: function (){
  37778. var self=this,$self=this;
  37779. return $core.withContext(function($ctx1) {
  37780. var $1,$2;
  37781. $1=$recv($self._isArgVar())._or_((function(){
  37782. return $core.withContext(function($ctx2) {
  37783. return $self._isPseudoVar();
  37784. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  37785. }));
  37786. if($core.assert($1)){
  37787. $2=$recv($globals.InvalidAssignmentError)._new();
  37788. $recv($2)._variableName_($self._name());
  37789. $recv($2)._signal();
  37790. }
  37791. return self;
  37792. }, function($ctx1) {$ctx1.fill(self,"validateAssignment",{},$globals.ScopeVar)});
  37793. },
  37794. args: [],
  37795. source: "validateAssignment\x0a\x09(self isArgVar or: [ self isPseudoVar ]) ifTrue: [\x0a\x09\x09InvalidAssignmentError new\x0a\x09\x09\x09variableName: self name;\x0a\x09\x09\x09signal]",
  37796. referencedClasses: ["InvalidAssignmentError"],
  37797. messageSends: ["ifTrue:", "or:", "isArgVar", "isPseudoVar", "variableName:", "new", "name", "signal"]
  37798. }),
  37799. $globals.ScopeVar);
  37800. $core.addMethod(
  37801. $core.method({
  37802. selector: "on:",
  37803. protocol: "instance creation",
  37804. fn: function (aString){
  37805. var self=this,$self=this;
  37806. return $core.withContext(function($ctx1) {
  37807. var $1;
  37808. $1=$self._new();
  37809. $recv($1)._name_(aString);
  37810. return $recv($1)._yourself();
  37811. }, function($ctx1) {$ctx1.fill(self,"on:",{aString:aString},$globals.ScopeVar.a$cls)});
  37812. },
  37813. args: ["aString"],
  37814. source: "on: aString\x0a\x09^ self new\x0a\x09\x09name: aString;\x0a\x09\x09yourself",
  37815. referencedClasses: [],
  37816. messageSends: ["name:", "new", "yourself"]
  37817. }),
  37818. $globals.ScopeVar.a$cls);
  37819. $core.addClass("AliasVar", $globals.ScopeVar, ["node"], "Compiler-Semantic");
  37820. $globals.AliasVar.comment="I am an internally defined variable by the compiler";
  37821. $core.addMethod(
  37822. $core.method({
  37823. selector: "isImmutable",
  37824. protocol: "testing",
  37825. fn: function (){
  37826. var self=this,$self=this;
  37827. return true;
  37828. },
  37829. args: [],
  37830. source: "isImmutable\x0a\x09^ true",
  37831. referencedClasses: [],
  37832. messageSends: []
  37833. }),
  37834. $globals.AliasVar);
  37835. $core.addMethod(
  37836. $core.method({
  37837. selector: "node",
  37838. protocol: "accessing",
  37839. fn: function (){
  37840. var self=this,$self=this;
  37841. return $self["@node"];
  37842. },
  37843. args: [],
  37844. source: "node\x0a\x09^ node",
  37845. referencedClasses: [],
  37846. messageSends: []
  37847. }),
  37848. $globals.AliasVar);
  37849. $core.addMethod(
  37850. $core.method({
  37851. selector: "node:",
  37852. protocol: "accessing",
  37853. fn: function (aNode){
  37854. var self=this,$self=this;
  37855. $self["@node"]=aNode;
  37856. return self;
  37857. },
  37858. args: ["aNode"],
  37859. source: "node: aNode\x0a\x09node := aNode",
  37860. referencedClasses: [],
  37861. messageSends: []
  37862. }),
  37863. $globals.AliasVar);
  37864. $core.addClass("ArgVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37865. $globals.ArgVar.comment="I am an argument of a method or block.";
  37866. $core.addMethod(
  37867. $core.method({
  37868. selector: "isArgVar",
  37869. protocol: "testing",
  37870. fn: function (){
  37871. var self=this,$self=this;
  37872. return true;
  37873. },
  37874. args: [],
  37875. source: "isArgVar\x0a\x09^ true",
  37876. referencedClasses: [],
  37877. messageSends: []
  37878. }),
  37879. $globals.ArgVar);
  37880. $core.addMethod(
  37881. $core.method({
  37882. selector: "isImmutable",
  37883. protocol: "testing",
  37884. fn: function (){
  37885. var self=this,$self=this;
  37886. return true;
  37887. },
  37888. args: [],
  37889. source: "isImmutable\x0a\x09^ true",
  37890. referencedClasses: [],
  37891. messageSends: []
  37892. }),
  37893. $globals.ArgVar);
  37894. $core.addClass("ClassRefVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37895. $globals.ClassRefVar.comment="I am an class reference variable";
  37896. $core.addMethod(
  37897. $core.method({
  37898. selector: "alias",
  37899. protocol: "accessing",
  37900. fn: function (){
  37901. var self=this,$self=this;
  37902. return $core.withContext(function($ctx1) {
  37903. return "$globals.".__comma($self._name());
  37904. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.ClassRefVar)});
  37905. },
  37906. args: [],
  37907. 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",
  37908. referencedClasses: [],
  37909. messageSends: [",", "name"]
  37910. }),
  37911. $globals.ClassRefVar);
  37912. $core.addMethod(
  37913. $core.method({
  37914. selector: "isClassRefVar",
  37915. protocol: "testing",
  37916. fn: function (){
  37917. var self=this,$self=this;
  37918. return true;
  37919. },
  37920. args: [],
  37921. source: "isClassRefVar\x0a\x09^ true",
  37922. referencedClasses: [],
  37923. messageSends: []
  37924. }),
  37925. $globals.ClassRefVar);
  37926. $core.addMethod(
  37927. $core.method({
  37928. selector: "isImmutable",
  37929. protocol: "testing",
  37930. fn: function (){
  37931. var self=this,$self=this;
  37932. return true;
  37933. },
  37934. args: [],
  37935. source: "isImmutable\x0a\x09^ true",
  37936. referencedClasses: [],
  37937. messageSends: []
  37938. }),
  37939. $globals.ClassRefVar);
  37940. $core.addClass("InstanceVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37941. $globals.InstanceVar.comment="I am an instance variable of a method or block.";
  37942. $core.addMethod(
  37943. $core.method({
  37944. selector: "alias",
  37945. protocol: "testing",
  37946. fn: function (){
  37947. var self=this,$self=this;
  37948. return $core.withContext(function($ctx1) {
  37949. var $1;
  37950. $1=$recv("$self[\x22@".__comma($self._name())).__comma("\x22]");
  37951. $ctx1.sendIdx[","]=1;
  37952. return $1;
  37953. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.InstanceVar)});
  37954. },
  37955. args: [],
  37956. source: "alias\x0a\x09^ '$self[\x22@', self name, '\x22]'",
  37957. referencedClasses: [],
  37958. messageSends: [",", "name"]
  37959. }),
  37960. $globals.InstanceVar);
  37961. $core.addMethod(
  37962. $core.method({
  37963. selector: "isInstanceVar",
  37964. protocol: "testing",
  37965. fn: function (){
  37966. var self=this,$self=this;
  37967. return true;
  37968. },
  37969. args: [],
  37970. source: "isInstanceVar\x0a\x09^ true",
  37971. referencedClasses: [],
  37972. messageSends: []
  37973. }),
  37974. $globals.InstanceVar);
  37975. $core.addClass("PseudoVar", $globals.ScopeVar, [], "Compiler-Semantic");
  37976. $globals.PseudoVar.comment="I am an pseudo variable.\x0a\x0aThe five Smalltalk pseudo variables are: 'self', 'super', 'nil', 'true' and 'false'";
  37977. $core.addMethod(
  37978. $core.method({
  37979. selector: "alias",
  37980. protocol: "accessing",
  37981. fn: function (){
  37982. var self=this,$self=this;
  37983. return $core.withContext(function($ctx1) {
  37984. return $self._name();
  37985. }, function($ctx1) {$ctx1.fill(self,"alias",{},$globals.PseudoVar)});
  37986. },
  37987. args: [],
  37988. source: "alias\x0a\x09^ self name",
  37989. referencedClasses: [],
  37990. messageSends: ["name"]
  37991. }),
  37992. $globals.PseudoVar);
  37993. $core.addMethod(
  37994. $core.method({
  37995. selector: "isImmutable",
  37996. protocol: "testing",
  37997. fn: function (){
  37998. var self=this,$self=this;
  37999. return true;
  38000. },
  38001. args: [],
  38002. source: "isImmutable\x0a\x09^ true",
  38003. referencedClasses: [],
  38004. messageSends: []
  38005. }),
  38006. $globals.PseudoVar);
  38007. $core.addMethod(
  38008. $core.method({
  38009. selector: "isPseudoVar",
  38010. protocol: "testing",
  38011. fn: function (){
  38012. var self=this,$self=this;
  38013. return true;
  38014. },
  38015. args: [],
  38016. source: "isPseudoVar\x0a\x09^ true",
  38017. referencedClasses: [],
  38018. messageSends: []
  38019. }),
  38020. $globals.PseudoVar);
  38021. $core.addMethod(
  38022. $core.method({
  38023. selector: "isSelf",
  38024. protocol: "testing",
  38025. fn: function (){
  38026. var self=this,$self=this;
  38027. return $core.withContext(function($ctx1) {
  38028. return $recv($self["@name"]).__eq("self");
  38029. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.PseudoVar)});
  38030. },
  38031. args: [],
  38032. source: "isSelf\x0a\x09^ name = 'self'",
  38033. referencedClasses: [],
  38034. messageSends: ["="]
  38035. }),
  38036. $globals.PseudoVar);
  38037. $core.addMethod(
  38038. $core.method({
  38039. selector: "isSuper",
  38040. protocol: "testing",
  38041. fn: function (){
  38042. var self=this,$self=this;
  38043. return $core.withContext(function($ctx1) {
  38044. return $recv($self["@name"]).__eq("super");
  38045. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.PseudoVar)});
  38046. },
  38047. args: [],
  38048. source: "isSuper\x0a\x09^ name = 'super'",
  38049. referencedClasses: [],
  38050. messageSends: ["="]
  38051. }),
  38052. $globals.PseudoVar);
  38053. $core.addClass("TempVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38054. $globals.TempVar.comment="I am an temporary variable of a method or block.";
  38055. $core.addMethod(
  38056. $core.method({
  38057. selector: "isTempVar",
  38058. protocol: "testing",
  38059. fn: function (){
  38060. var self=this,$self=this;
  38061. return true;
  38062. },
  38063. args: [],
  38064. source: "isTempVar\x0a\x09^ true",
  38065. referencedClasses: [],
  38066. messageSends: []
  38067. }),
  38068. $globals.TempVar);
  38069. $core.addClass("UnknownVar", $globals.ScopeVar, [], "Compiler-Semantic");
  38070. $globals.UnknownVar.comment="I am an unknown variable. Amber uses unknown variables as JavaScript globals";
  38071. $core.addMethod(
  38072. $core.method({
  38073. selector: "isUnknownVar",
  38074. protocol: "testing",
  38075. fn: function (){
  38076. var self=this,$self=this;
  38077. return true;
  38078. },
  38079. args: [],
  38080. source: "isUnknownVar\x0a\x09^ true",
  38081. referencedClasses: [],
  38082. messageSends: []
  38083. }),
  38084. $globals.UnknownVar);
  38085. $core.addClass("SemanticAnalyzer", $globals.NodeVisitor, ["currentScope", "blockIndex", "thePackage", "theClass", "classReferences", "messageSends"], "Compiler-Semantic");
  38086. $globals.SemanticAnalyzer.comment="I semantically analyze the abstract syntax tree and annotate it with informations such as non local returns and variable scopes.";
  38087. $core.addMethod(
  38088. $core.method({
  38089. selector: "classReferences",
  38090. protocol: "accessing",
  38091. fn: function (){
  38092. var self=this,$self=this;
  38093. return $core.withContext(function($ctx1) {
  38094. var $1,$receiver;
  38095. $1=$self["@classReferences"];
  38096. if(($receiver = $1) == null || $receiver.a$nil){
  38097. $self["@classReferences"]=$recv($globals.Set)._new();
  38098. return $self["@classReferences"];
  38099. } else {
  38100. return $1;
  38101. }
  38102. }, function($ctx1) {$ctx1.fill(self,"classReferences",{},$globals.SemanticAnalyzer)});
  38103. },
  38104. args: [],
  38105. source: "classReferences\x0a\x09^ classReferences ifNil: [ classReferences := Set new ]",
  38106. referencedClasses: ["Set"],
  38107. messageSends: ["ifNil:", "new"]
  38108. }),
  38109. $globals.SemanticAnalyzer);
  38110. $core.addMethod(
  38111. $core.method({
  38112. selector: "errorShadowingVariable:",
  38113. protocol: "error handling",
  38114. fn: function (aString){
  38115. var self=this,$self=this;
  38116. return $core.withContext(function($ctx1) {
  38117. var $1;
  38118. $1=$recv($globals.ShadowingVariableError)._new();
  38119. $recv($1)._variableName_(aString);
  38120. $recv($1)._signal();
  38121. return self;
  38122. }, function($ctx1) {$ctx1.fill(self,"errorShadowingVariable:",{aString:aString},$globals.SemanticAnalyzer)});
  38123. },
  38124. args: ["aString"],
  38125. source: "errorShadowingVariable: aString\x0a\x09ShadowingVariableError new\x0a\x09\x09variableName: aString;\x0a\x09\x09signal",
  38126. referencedClasses: ["ShadowingVariableError"],
  38127. messageSends: ["variableName:", "new", "signal"]
  38128. }),
  38129. $globals.SemanticAnalyzer);
  38130. $core.addMethod(
  38131. $core.method({
  38132. selector: "errorUnknownVariable:",
  38133. protocol: "error handling",
  38134. fn: function (aNode){
  38135. var self=this,$self=this;
  38136. var identifier;
  38137. return $core.withContext(function($ctx1) {
  38138. var $1,$2,$3;
  38139. identifier=$recv(aNode)._value();
  38140. $ctx1.sendIdx["value"]=1;
  38141. $1=$recv($recv($recv($recv($globals.Smalltalk)._globalJsVariables())._includes_(identifier))._not())._and_((function(){
  38142. return $core.withContext(function($ctx2) {
  38143. return $self._isVariableUndefined_inPackage_(identifier,$self._thePackage());
  38144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38145. }));
  38146. if($core.assert($1)){
  38147. $2=$recv($globals.UnknownVariableError)._new();
  38148. $3=$recv(aNode)._value();
  38149. $ctx1.sendIdx["value"]=2;
  38150. $recv($2)._variableName_($3);
  38151. $recv($2)._signal();
  38152. } else {
  38153. $recv($recv($recv($self["@currentScope"])._methodScope())._unknownVariables())._add_($recv(aNode)._value());
  38154. }
  38155. return self;
  38156. }, function($ctx1) {$ctx1.fill(self,"errorUnknownVariable:",{aNode:aNode,identifier:identifier},$globals.SemanticAnalyzer)});
  38157. },
  38158. args: ["aNode"],
  38159. 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 ]",
  38160. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  38161. messageSends: ["value", "ifTrue:ifFalse:", "and:", "not", "includes:", "globalJsVariables", "isVariableUndefined:inPackage:", "thePackage", "variableName:", "new", "signal", "add:", "unknownVariables", "methodScope"]
  38162. }),
  38163. $globals.SemanticAnalyzer);
  38164. $core.addMethod(
  38165. $core.method({
  38166. selector: "isVariableUndefined:inPackage:",
  38167. protocol: "testing",
  38168. fn: function (aString,aPackage){
  38169. var self=this,$self=this;
  38170. return $core.withContext(function($ctx1) {
  38171. var $1,$2,$receiver;
  38172. if(($receiver = aPackage) == null || $receiver.a$nil){
  38173. aPackage;
  38174. } else {
  38175. var packageKnownVars;
  38176. packageKnownVars=$recv($recv($recv(aPackage)._imports())._reject_("isString"))._collect_("key");
  38177. $1=$recv(packageKnownVars)._includes_(aString);
  38178. if($core.assert($1)){
  38179. return false;
  38180. }
  38181. }
  38182. $2=$recv("typeof ".__comma(aString)).__comma(" === \x22undefined\x22");
  38183. $ctx1.sendIdx[","]=1;
  38184. return $recv($globals.Compiler)._eval_($2);
  38185. }, function($ctx1) {$ctx1.fill(self,"isVariableUndefined:inPackage:",{aString:aString,aPackage:aPackage},$globals.SemanticAnalyzer)});
  38186. },
  38187. args: ["aString", "aPackage"],
  38188. 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'",
  38189. referencedClasses: ["Compiler"],
  38190. messageSends: ["ifNotNil:", "collect:", "reject:", "imports", "ifTrue:", "includes:", "eval:", ","]
  38191. }),
  38192. $globals.SemanticAnalyzer);
  38193. $core.addMethod(
  38194. $core.method({
  38195. selector: "messageSends",
  38196. protocol: "accessing",
  38197. fn: function (){
  38198. var self=this,$self=this;
  38199. return $core.withContext(function($ctx1) {
  38200. var $1,$receiver;
  38201. $1=$self["@messageSends"];
  38202. if(($receiver = $1) == null || $receiver.a$nil){
  38203. $self["@messageSends"]=$recv($globals.Dictionary)._new();
  38204. return $self["@messageSends"];
  38205. } else {
  38206. return $1;
  38207. }
  38208. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.SemanticAnalyzer)});
  38209. },
  38210. args: [],
  38211. source: "messageSends\x0a\x09^ messageSends ifNil: [ messageSends := Dictionary new ]",
  38212. referencedClasses: ["Dictionary"],
  38213. messageSends: ["ifNil:", "new"]
  38214. }),
  38215. $globals.SemanticAnalyzer);
  38216. $core.addMethod(
  38217. $core.method({
  38218. selector: "newBlockScope",
  38219. protocol: "factory",
  38220. fn: function (){
  38221. var self=this,$self=this;
  38222. return $core.withContext(function($ctx1) {
  38223. return $self._newScopeOfClass_($globals.LexicalScope);
  38224. }, function($ctx1) {$ctx1.fill(self,"newBlockScope",{},$globals.SemanticAnalyzer)});
  38225. },
  38226. args: [],
  38227. source: "newBlockScope\x0a\x09^ self newScopeOfClass: LexicalScope",
  38228. referencedClasses: ["LexicalScope"],
  38229. messageSends: ["newScopeOfClass:"]
  38230. }),
  38231. $globals.SemanticAnalyzer);
  38232. $core.addMethod(
  38233. $core.method({
  38234. selector: "newMethodScope",
  38235. protocol: "factory",
  38236. fn: function (){
  38237. var self=this,$self=this;
  38238. return $core.withContext(function($ctx1) {
  38239. return $self._newScopeOfClass_($globals.MethodLexicalScope);
  38240. }, function($ctx1) {$ctx1.fill(self,"newMethodScope",{},$globals.SemanticAnalyzer)});
  38241. },
  38242. args: [],
  38243. source: "newMethodScope\x0a\x09^ self newScopeOfClass: MethodLexicalScope",
  38244. referencedClasses: ["MethodLexicalScope"],
  38245. messageSends: ["newScopeOfClass:"]
  38246. }),
  38247. $globals.SemanticAnalyzer);
  38248. $core.addMethod(
  38249. $core.method({
  38250. selector: "newScopeOfClass:",
  38251. protocol: "factory",
  38252. fn: function (aLexicalScopeClass){
  38253. var self=this,$self=this;
  38254. return $core.withContext(function($ctx1) {
  38255. var $1;
  38256. $1=$recv(aLexicalScopeClass)._new();
  38257. $recv($1)._outerScope_($self["@currentScope"]);
  38258. return $recv($1)._yourself();
  38259. }, function($ctx1) {$ctx1.fill(self,"newScopeOfClass:",{aLexicalScopeClass:aLexicalScopeClass},$globals.SemanticAnalyzer)});
  38260. },
  38261. args: ["aLexicalScopeClass"],
  38262. source: "newScopeOfClass: aLexicalScopeClass\x0a\x09^ aLexicalScopeClass new\x0a\x09\x09outerScope: currentScope;\x0a\x09\x09yourself",
  38263. referencedClasses: [],
  38264. messageSends: ["outerScope:", "new", "yourself"]
  38265. }),
  38266. $globals.SemanticAnalyzer);
  38267. $core.addMethod(
  38268. $core.method({
  38269. selector: "nextBlockIndex",
  38270. protocol: "private",
  38271. fn: function (){
  38272. var self=this,$self=this;
  38273. return $core.withContext(function($ctx1) {
  38274. var $1,$receiver;
  38275. $1=$self["@blockIndex"];
  38276. if(($receiver = $1) == null || $receiver.a$nil){
  38277. $self["@blockIndex"]=(0);
  38278. $self["@blockIndex"];
  38279. } else {
  38280. $1;
  38281. }
  38282. $self["@blockIndex"]=$recv($self["@blockIndex"]).__plus((1));
  38283. return $self["@blockIndex"];
  38284. }, function($ctx1) {$ctx1.fill(self,"nextBlockIndex",{},$globals.SemanticAnalyzer)});
  38285. },
  38286. args: [],
  38287. source: "nextBlockIndex\x0a\x09blockIndex ifNil: [ blockIndex := 0 ].\x0a\x09\x0a\x09blockIndex := blockIndex + 1.\x0a\x09^ blockIndex",
  38288. referencedClasses: [],
  38289. messageSends: ["ifNil:", "+"]
  38290. }),
  38291. $globals.SemanticAnalyzer);
  38292. $core.addMethod(
  38293. $core.method({
  38294. selector: "popScope",
  38295. protocol: "scope",
  38296. fn: function (){
  38297. var self=this,$self=this;
  38298. return $core.withContext(function($ctx1) {
  38299. var $1,$receiver;
  38300. $1=$self["@currentScope"];
  38301. if(($receiver = $1) == null || $receiver.a$nil){
  38302. $1;
  38303. } else {
  38304. $self["@currentScope"]=$recv($self["@currentScope"])._outerScope();
  38305. $self["@currentScope"];
  38306. }
  38307. return self;
  38308. }, function($ctx1) {$ctx1.fill(self,"popScope",{},$globals.SemanticAnalyzer)});
  38309. },
  38310. args: [],
  38311. source: "popScope\x0a\x09currentScope ifNotNil: [\x0a\x09\x09currentScope := currentScope outerScope ]",
  38312. referencedClasses: [],
  38313. messageSends: ["ifNotNil:", "outerScope"]
  38314. }),
  38315. $globals.SemanticAnalyzer);
  38316. $core.addMethod(
  38317. $core.method({
  38318. selector: "pushScope:",
  38319. protocol: "scope",
  38320. fn: function (aScope){
  38321. var self=this,$self=this;
  38322. return $core.withContext(function($ctx1) {
  38323. $recv(aScope)._outerScope_($self["@currentScope"]);
  38324. $self["@currentScope"]=aScope;
  38325. return self;
  38326. }, function($ctx1) {$ctx1.fill(self,"pushScope:",{aScope:aScope},$globals.SemanticAnalyzer)});
  38327. },
  38328. args: ["aScope"],
  38329. source: "pushScope: aScope\x0a\x09aScope outerScope: currentScope.\x0a\x09currentScope := aScope",
  38330. referencedClasses: [],
  38331. messageSends: ["outerScope:"]
  38332. }),
  38333. $globals.SemanticAnalyzer);
  38334. $core.addMethod(
  38335. $core.method({
  38336. selector: "theClass",
  38337. protocol: "accessing",
  38338. fn: function (){
  38339. var self=this,$self=this;
  38340. return $self["@theClass"];
  38341. },
  38342. args: [],
  38343. source: "theClass\x0a\x09^ theClass",
  38344. referencedClasses: [],
  38345. messageSends: []
  38346. }),
  38347. $globals.SemanticAnalyzer);
  38348. $core.addMethod(
  38349. $core.method({
  38350. selector: "theClass:",
  38351. protocol: "accessing",
  38352. fn: function (aClass){
  38353. var self=this,$self=this;
  38354. $self["@theClass"]=aClass;
  38355. return self;
  38356. },
  38357. args: ["aClass"],
  38358. source: "theClass: aClass\x0a\x09theClass := aClass",
  38359. referencedClasses: [],
  38360. messageSends: []
  38361. }),
  38362. $globals.SemanticAnalyzer);
  38363. $core.addMethod(
  38364. $core.method({
  38365. selector: "thePackage",
  38366. protocol: "accessing",
  38367. fn: function (){
  38368. var self=this,$self=this;
  38369. return $self["@thePackage"];
  38370. },
  38371. args: [],
  38372. source: "thePackage\x0a\x09^ thePackage",
  38373. referencedClasses: [],
  38374. messageSends: []
  38375. }),
  38376. $globals.SemanticAnalyzer);
  38377. $core.addMethod(
  38378. $core.method({
  38379. selector: "thePackage:",
  38380. protocol: "accessing",
  38381. fn: function (aPackage){
  38382. var self=this,$self=this;
  38383. $self["@thePackage"]=aPackage;
  38384. return self;
  38385. },
  38386. args: ["aPackage"],
  38387. source: "thePackage: aPackage\x0a\x09thePackage := aPackage",
  38388. referencedClasses: [],
  38389. messageSends: []
  38390. }),
  38391. $globals.SemanticAnalyzer);
  38392. $core.addMethod(
  38393. $core.method({
  38394. selector: "validateVariableScope:",
  38395. protocol: "scope",
  38396. fn: function (aString){
  38397. var self=this,$self=this;
  38398. return $core.withContext(function($ctx1) {
  38399. var $1,$receiver;
  38400. $1=$recv($self["@currentScope"])._lookupVariable_(aString);
  38401. if(($receiver = $1) == null || $receiver.a$nil){
  38402. $1;
  38403. } else {
  38404. $self._errorShadowingVariable_(aString);
  38405. }
  38406. return self;
  38407. }, function($ctx1) {$ctx1.fill(self,"validateVariableScope:",{aString:aString},$globals.SemanticAnalyzer)});
  38408. },
  38409. args: ["aString"],
  38410. 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 ]",
  38411. referencedClasses: [],
  38412. messageSends: ["ifNotNil:", "lookupVariable:", "errorShadowingVariable:"]
  38413. }),
  38414. $globals.SemanticAnalyzer);
  38415. $core.addMethod(
  38416. $core.method({
  38417. selector: "visitAssignmentNode:",
  38418. protocol: "visiting",
  38419. fn: function (aNode){
  38420. var self=this,$self=this;
  38421. return $core.withContext(function($ctx1) {
  38422. (
  38423. $ctx1.supercall = true,
  38424. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitAssignmentNode_.apply($self, [aNode]));
  38425. $ctx1.supercall = false;
  38426. $recv($recv(aNode)._left())._beAssigned();
  38427. return self;
  38428. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38429. },
  38430. args: ["aNode"],
  38431. source: "visitAssignmentNode: aNode\x0a\x09super visitAssignmentNode: aNode.\x0a\x09aNode left beAssigned",
  38432. referencedClasses: [],
  38433. messageSends: ["visitAssignmentNode:", "beAssigned", "left"]
  38434. }),
  38435. $globals.SemanticAnalyzer);
  38436. $core.addMethod(
  38437. $core.method({
  38438. selector: "visitBlockNode:",
  38439. protocol: "visiting",
  38440. fn: function (aNode){
  38441. var self=this,$self=this;
  38442. return $core.withContext(function($ctx1) {
  38443. $self._pushScope_($self._newBlockScope());
  38444. $recv(aNode)._scope_($self["@currentScope"]);
  38445. $recv($self["@currentScope"])._node_(aNode);
  38446. $recv($self["@currentScope"])._blockIndex_($self._nextBlockIndex());
  38447. $recv($recv(aNode)._parameters())._do_((function(each){
  38448. return $core.withContext(function($ctx2) {
  38449. $self._validateVariableScope_(each);
  38450. return $recv($self["@currentScope"])._addArg_(each);
  38451. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38452. }));
  38453. (
  38454. $ctx1.supercall = true,
  38455. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitBlockNode_.apply($self, [aNode]));
  38456. $ctx1.supercall = false;
  38457. $self._popScope();
  38458. return self;
  38459. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38460. },
  38461. args: ["aNode"],
  38462. 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",
  38463. referencedClasses: [],
  38464. messageSends: ["pushScope:", "newBlockScope", "scope:", "node:", "blockIndex:", "nextBlockIndex", "do:", "parameters", "validateVariableScope:", "addArg:", "visitBlockNode:", "popScope"]
  38465. }),
  38466. $globals.SemanticAnalyzer);
  38467. $core.addMethod(
  38468. $core.method({
  38469. selector: "visitCascadeNode:",
  38470. protocol: "visiting",
  38471. fn: function (aNode){
  38472. var self=this,$self=this;
  38473. return $core.withContext(function($ctx1) {
  38474. $recv(aNode)._receiver_($recv($recv($recv(aNode)._dagChildren())._first())._receiver());
  38475. (
  38476. $ctx1.supercall = true,
  38477. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitCascadeNode_.apply($self, [aNode]));
  38478. $ctx1.supercall = false;
  38479. return self;
  38480. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38481. },
  38482. args: ["aNode"],
  38483. source: "visitCascadeNode: aNode\x0a\x09aNode receiver: aNode dagChildren first receiver.\x0a\x09super visitCascadeNode: aNode",
  38484. referencedClasses: [],
  38485. messageSends: ["receiver:", "receiver", "first", "dagChildren", "visitCascadeNode:"]
  38486. }),
  38487. $globals.SemanticAnalyzer);
  38488. $core.addMethod(
  38489. $core.method({
  38490. selector: "visitMethodNode:",
  38491. protocol: "visiting",
  38492. fn: function (aNode){
  38493. var self=this,$self=this;
  38494. return $core.withContext(function($ctx1) {
  38495. $self._pushScope_($self._newMethodScope());
  38496. $recv(aNode)._scope_($self["@currentScope"]);
  38497. $recv($self["@currentScope"])._node_(aNode);
  38498. $recv($recv($self._theClass())._allInstanceVariableNames())._do_((function(each){
  38499. return $core.withContext(function($ctx2) {
  38500. return $recv($self["@currentScope"])._addIVar_(each);
  38501. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38502. }));
  38503. $ctx1.sendIdx["do:"]=1;
  38504. $recv($recv(aNode)._arguments())._do_((function(each){
  38505. return $core.withContext(function($ctx2) {
  38506. $self._validateVariableScope_(each);
  38507. return $recv($self["@currentScope"])._addArg_(each);
  38508. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  38509. }));
  38510. (
  38511. $ctx1.supercall = true,
  38512. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitMethodNode_.apply($self, [aNode]));
  38513. $ctx1.supercall = false;
  38514. $recv(aNode)._classReferences_($self._classReferences());
  38515. $recv(aNode)._sendIndexes_($self._messageSends());
  38516. $self._popScope();
  38517. return aNode;
  38518. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38519. },
  38520. args: ["aNode"],
  38521. 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",
  38522. referencedClasses: [],
  38523. messageSends: ["pushScope:", "newMethodScope", "scope:", "node:", "do:", "allInstanceVariableNames", "theClass", "addIVar:", "arguments", "validateVariableScope:", "addArg:", "visitMethodNode:", "classReferences:", "classReferences", "sendIndexes:", "messageSends", "popScope"]
  38524. }),
  38525. $globals.SemanticAnalyzer);
  38526. $core.addMethod(
  38527. $core.method({
  38528. selector: "visitReturnNode:",
  38529. protocol: "visiting",
  38530. fn: function (aNode){
  38531. var self=this,$self=this;
  38532. return $core.withContext(function($ctx1) {
  38533. var $1;
  38534. $recv(aNode)._scope_($self["@currentScope"]);
  38535. $1=$recv($self["@currentScope"])._isMethodScope();
  38536. if($core.assert($1)){
  38537. $recv($self["@currentScope"])._localReturn_(true);
  38538. } else {
  38539. $recv($recv($self["@currentScope"])._methodScope())._addNonLocalReturn_($self["@currentScope"]);
  38540. }
  38541. (
  38542. $ctx1.supercall = true,
  38543. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitReturnNode_.apply($self, [aNode]));
  38544. $ctx1.supercall = false;
  38545. return self;
  38546. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38547. },
  38548. args: ["aNode"],
  38549. 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",
  38550. referencedClasses: [],
  38551. messageSends: ["scope:", "ifTrue:ifFalse:", "isMethodScope", "localReturn:", "addNonLocalReturn:", "methodScope", "visitReturnNode:"]
  38552. }),
  38553. $globals.SemanticAnalyzer);
  38554. $core.addMethod(
  38555. $core.method({
  38556. selector: "visitSendNode:",
  38557. protocol: "visiting",
  38558. fn: function (aNode){
  38559. var self=this,$self=this;
  38560. var sends;
  38561. return $core.withContext(function($ctx1) {
  38562. sends=$recv($self._messageSends())._at_ifAbsentPut_($recv(aNode)._selector(),(function(){
  38563. return $core.withContext(function($ctx2) {
  38564. return $recv($globals.OrderedCollection)._new();
  38565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38566. }));
  38567. $recv(sends)._add_(aNode);
  38568. $recv(aNode)._index_($recv(sends)._size());
  38569. (
  38570. $ctx1.supercall = true,
  38571. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  38572. $ctx1.supercall = false;
  38573. return self;
  38574. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,sends:sends},$globals.SemanticAnalyzer)});
  38575. },
  38576. args: ["aNode"],
  38577. 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",
  38578. referencedClasses: ["OrderedCollection"],
  38579. messageSends: ["at:ifAbsentPut:", "messageSends", "selector", "new", "add:", "index:", "size", "visitSendNode:"]
  38580. }),
  38581. $globals.SemanticAnalyzer);
  38582. $core.addMethod(
  38583. $core.method({
  38584. selector: "visitSequenceNode:",
  38585. protocol: "visiting",
  38586. fn: function (aNode){
  38587. var self=this,$self=this;
  38588. return $core.withContext(function($ctx1) {
  38589. $recv($recv(aNode)._temps())._do_((function(each){
  38590. return $core.withContext(function($ctx2) {
  38591. $self._validateVariableScope_(each);
  38592. return $recv($self["@currentScope"])._addTemp_(each);
  38593. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  38594. }));
  38595. (
  38596. $ctx1.supercall = true,
  38597. ($globals.SemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  38598. $ctx1.supercall = false;
  38599. return self;
  38600. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.SemanticAnalyzer)});
  38601. },
  38602. args: ["aNode"],
  38603. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self validateVariableScope: each.\x0a\x09\x09currentScope addTemp: each ].\x0a\x0a\x09super visitSequenceNode: aNode",
  38604. referencedClasses: [],
  38605. messageSends: ["do:", "temps", "validateVariableScope:", "addTemp:", "visitSequenceNode:"]
  38606. }),
  38607. $globals.SemanticAnalyzer);
  38608. $core.addMethod(
  38609. $core.method({
  38610. selector: "visitVariableNode:",
  38611. protocol: "visiting",
  38612. fn: function (aNode){
  38613. var self=this,$self=this;
  38614. var binding;
  38615. return $core.withContext(function($ctx1) {
  38616. var $1,$3,$2,$4,$5,$6,$7,$8,$9,$receiver;
  38617. binding=$recv($self["@currentScope"])._lookupVariable_(aNode);
  38618. $1=binding;
  38619. if(($receiver = $1) == null || $receiver.a$nil){
  38620. $3=$recv(aNode)._value();
  38621. $ctx1.sendIdx["value"]=1;
  38622. $2=$recv($3)._isCapitalized();
  38623. if($core.assert($2)){
  38624. $4=$recv($globals.ClassRefVar)._new();
  38625. $ctx1.sendIdx["new"]=1;
  38626. $5=$recv(aNode)._value();
  38627. $ctx1.sendIdx["value"]=2;
  38628. $recv($4)._name_($5);
  38629. $ctx1.sendIdx["name:"]=1;
  38630. $6=$recv($4)._yourself();
  38631. $ctx1.sendIdx["yourself"]=1;
  38632. binding=$6;
  38633. $7=$self._classReferences();
  38634. $8=$recv(aNode)._value();
  38635. $ctx1.sendIdx["value"]=3;
  38636. $recv($7)._add_($8);
  38637. } else {
  38638. $self._errorUnknownVariable_(aNode);
  38639. $9=$recv($globals.UnknownVar)._new();
  38640. $recv($9)._name_($recv(aNode)._value());
  38641. binding=$recv($9)._yourself();
  38642. binding;
  38643. }
  38644. } else {
  38645. $1;
  38646. }
  38647. $recv(aNode)._binding_(binding);
  38648. return self;
  38649. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode,binding:binding},$globals.SemanticAnalyzer)});
  38650. },
  38651. args: ["aNode"],
  38652. 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.",
  38653. referencedClasses: ["ClassRefVar", "UnknownVar"],
  38654. messageSends: ["lookupVariable:", "ifNil:", "ifTrue:ifFalse:", "isCapitalized", "value", "name:", "new", "yourself", "add:", "classReferences", "errorUnknownVariable:", "binding:"]
  38655. }),
  38656. $globals.SemanticAnalyzer);
  38657. $core.addMethod(
  38658. $core.method({
  38659. selector: "on:",
  38660. protocol: "instance creation",
  38661. fn: function (aClass){
  38662. var self=this,$self=this;
  38663. return $core.withContext(function($ctx1) {
  38664. var $1;
  38665. $1=$self._new();
  38666. $recv($1)._theClass_(aClass);
  38667. return $recv($1)._yourself();
  38668. }, function($ctx1) {$ctx1.fill(self,"on:",{aClass:aClass},$globals.SemanticAnalyzer.a$cls)});
  38669. },
  38670. args: ["aClass"],
  38671. source: "on: aClass\x0a\x09^ self new\x0a\x09\x09theClass: aClass;\x0a\x09\x09yourself",
  38672. referencedClasses: [],
  38673. messageSends: ["theClass:", "new", "yourself"]
  38674. }),
  38675. $globals.SemanticAnalyzer.a$cls);
  38676. $core.addClass("SemanticError", $globals.CompilerError, [], "Compiler-Semantic");
  38677. $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";
  38678. $core.addClass("InvalidAssignmentError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38679. $globals.InvalidAssignmentError.comment="I get signaled when a pseudo variable gets assigned.";
  38680. $core.addMethod(
  38681. $core.method({
  38682. selector: "messageText",
  38683. protocol: "accessing",
  38684. fn: function (){
  38685. var self=this,$self=this;
  38686. return $core.withContext(function($ctx1) {
  38687. return " Invalid assignment to variable: ".__comma($self._variableName());
  38688. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.InvalidAssignmentError)});
  38689. },
  38690. args: [],
  38691. source: "messageText\x0a\x09^ ' Invalid assignment to variable: ', self variableName",
  38692. referencedClasses: [],
  38693. messageSends: [",", "variableName"]
  38694. }),
  38695. $globals.InvalidAssignmentError);
  38696. $core.addMethod(
  38697. $core.method({
  38698. selector: "variableName",
  38699. protocol: "accessing",
  38700. fn: function (){
  38701. var self=this,$self=this;
  38702. return $self["@variableName"];
  38703. },
  38704. args: [],
  38705. source: "variableName\x0a\x09^ variableName",
  38706. referencedClasses: [],
  38707. messageSends: []
  38708. }),
  38709. $globals.InvalidAssignmentError);
  38710. $core.addMethod(
  38711. $core.method({
  38712. selector: "variableName:",
  38713. protocol: "accessing",
  38714. fn: function (aString){
  38715. var self=this,$self=this;
  38716. $self["@variableName"]=aString;
  38717. return self;
  38718. },
  38719. args: ["aString"],
  38720. source: "variableName: aString\x0a\x09variableName := aString",
  38721. referencedClasses: [],
  38722. messageSends: []
  38723. }),
  38724. $globals.InvalidAssignmentError);
  38725. $core.addClass("ShadowingVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38726. $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.";
  38727. $core.addMethod(
  38728. $core.method({
  38729. selector: "messageText",
  38730. protocol: "accessing",
  38731. fn: function (){
  38732. var self=this,$self=this;
  38733. return $core.withContext(function($ctx1) {
  38734. var $1;
  38735. $1=$recv("Variable shadowing error: ".__comma($self._variableName())).__comma(" is already defined");
  38736. $ctx1.sendIdx[","]=1;
  38737. return $1;
  38738. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.ShadowingVariableError)});
  38739. },
  38740. args: [],
  38741. source: "messageText\x0a\x09^ 'Variable shadowing error: ', self variableName, ' is already defined'",
  38742. referencedClasses: [],
  38743. messageSends: [",", "variableName"]
  38744. }),
  38745. $globals.ShadowingVariableError);
  38746. $core.addMethod(
  38747. $core.method({
  38748. selector: "variableName",
  38749. protocol: "accessing",
  38750. fn: function (){
  38751. var self=this,$self=this;
  38752. return $self["@variableName"];
  38753. },
  38754. args: [],
  38755. source: "variableName\x0a\x09^ variableName",
  38756. referencedClasses: [],
  38757. messageSends: []
  38758. }),
  38759. $globals.ShadowingVariableError);
  38760. $core.addMethod(
  38761. $core.method({
  38762. selector: "variableName:",
  38763. protocol: "accessing",
  38764. fn: function (aString){
  38765. var self=this,$self=this;
  38766. $self["@variableName"]=aString;
  38767. return self;
  38768. },
  38769. args: ["aString"],
  38770. source: "variableName: aString\x0a\x09variableName := aString",
  38771. referencedClasses: [],
  38772. messageSends: []
  38773. }),
  38774. $globals.ShadowingVariableError);
  38775. $core.addClass("UnknownVariableError", $globals.SemanticError, ["variableName"], "Compiler-Semantic");
  38776. $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.";
  38777. $core.addMethod(
  38778. $core.method({
  38779. selector: "messageText",
  38780. protocol: "accessing",
  38781. fn: function (){
  38782. var self=this,$self=this;
  38783. return $core.withContext(function($ctx1) {
  38784. var $1;
  38785. $1=$recv("Unknown Variable error: ".__comma($self._variableName())).__comma(" is not defined");
  38786. $ctx1.sendIdx[","]=1;
  38787. return $1;
  38788. }, function($ctx1) {$ctx1.fill(self,"messageText",{},$globals.UnknownVariableError)});
  38789. },
  38790. args: [],
  38791. source: "messageText\x0a\x09^ 'Unknown Variable error: ', self variableName, ' is not defined'",
  38792. referencedClasses: [],
  38793. messageSends: [",", "variableName"]
  38794. }),
  38795. $globals.UnknownVariableError);
  38796. $core.addMethod(
  38797. $core.method({
  38798. selector: "variableName",
  38799. protocol: "accessing",
  38800. fn: function (){
  38801. var self=this,$self=this;
  38802. return $self["@variableName"];
  38803. },
  38804. args: [],
  38805. source: "variableName\x0a\x09^ variableName",
  38806. referencedClasses: [],
  38807. messageSends: []
  38808. }),
  38809. $globals.UnknownVariableError);
  38810. $core.addMethod(
  38811. $core.method({
  38812. selector: "variableName:",
  38813. protocol: "accessing",
  38814. fn: function (aString){
  38815. var self=this,$self=this;
  38816. $self["@variableName"]=aString;
  38817. return self;
  38818. },
  38819. args: ["aString"],
  38820. source: "variableName: aString\x0a\x09variableName := aString",
  38821. referencedClasses: [],
  38822. messageSends: []
  38823. }),
  38824. $globals.UnknownVariableError);
  38825. $core.addMethod(
  38826. $core.method({
  38827. selector: "inlineJS:",
  38828. protocol: "*Compiler-Semantic",
  38829. fn: function (aString){
  38830. var self=this,$self=this;
  38831. return $core.withContext(function($ctx1) {
  38832. var $2,$1,$3,$5,$4;
  38833. $2=$self._sequenceNode();
  38834. $ctx1.sendIdx["sequenceNode"]=1;
  38835. $1=$recv($2)._dagChildren();
  38836. $recv($1)._ifNotEmpty_((function(){
  38837. return $core.withContext(function($ctx2) {
  38838. return $recv($globals.CompilerError)._signal_("inlineJS: does not allow smalltalk statements");
  38839. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  38840. }));
  38841. $3=$self._sequenceNode();
  38842. $5=$recv($globals.JSStatementNode)._new();
  38843. $recv($5)._source_(aString);
  38844. $4=$recv($5)._yourself();
  38845. $recv($3)._addDagChild_($4);
  38846. return self;
  38847. }, function($ctx1) {$ctx1.fill(self,"inlineJS:",{aString:aString},$globals.EarlyPragmator)});
  38848. },
  38849. args: ["aString"],
  38850. 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)",
  38851. referencedClasses: ["CompilerError", "JSStatementNode"],
  38852. messageSends: ["ifNotEmpty:", "dagChildren", "sequenceNode", "signal:", "addDagChild:", "source:", "new", "yourself"]
  38853. }),
  38854. $globals.EarlyPragmator);
  38855. });
  38856. 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";
  38857. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  38858. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  38859. $core.addPackage("Compiler-IR");
  38860. ($core.packageDescriptors||$core.packages)["Compiler-IR"].innerEval = function (expr) { return eval(expr); };
  38861. ($core.packageDescriptors||$core.packages)["Compiler-IR"].transport = {"type":"amd","amdNamespace":"amber_core"};
  38862. $core.addClass("IRASTTranslator", $globals.NodeVisitor, ["source", "theClass", "method", "sequence", "nextAlias"], "Compiler-IR");
  38863. $globals.IRASTTranslator.comment="I am the AST (abstract syntax tree) visitor responsible for building the intermediate representation graph.";
  38864. $core.addMethod(
  38865. $core.method({
  38866. selector: "addToSequence:",
  38867. protocol: "visiting",
  38868. fn: function (anInstruction){
  38869. var self=this,$self=this;
  38870. return $core.withContext(function($ctx1) {
  38871. var $1,$receiver;
  38872. if(($receiver = anInstruction) == null || $receiver.a$nil){
  38873. anInstruction;
  38874. } else {
  38875. $1=$recv(anInstruction)._isVariable();
  38876. if(!$core.assert($1)){
  38877. $recv($self._sequence())._add_(anInstruction);
  38878. }
  38879. }
  38880. return anInstruction;
  38881. }, function($ctx1) {$ctx1.fill(self,"addToSequence:",{anInstruction:anInstruction},$globals.IRASTTranslator)});
  38882. },
  38883. args: ["anInstruction"],
  38884. source: "addToSequence: anInstruction\x0a\x09anInstruction ifNotNil: [\x0a\x09\x09anInstruction isVariable ifFalse: [\x0a\x09\x09\x09self sequence add: anInstruction ] ].\x0a\x09^ anInstruction",
  38885. referencedClasses: [],
  38886. messageSends: ["ifNotNil:", "ifFalse:", "isVariable", "add:", "sequence"]
  38887. }),
  38888. $globals.IRASTTranslator);
  38889. $core.addMethod(
  38890. $core.method({
  38891. selector: "alias:",
  38892. protocol: "visiting",
  38893. fn: function (aNode){
  38894. var self=this,$self=this;
  38895. var variable;
  38896. return $core.withContext(function($ctx1) {
  38897. var $1,$2,$3,$5,$4,$6,$8,$7;
  38898. $1=$recv(aNode)._isImmutable();
  38899. if($core.assert($1)){
  38900. $2=$self._visit_(aNode);
  38901. $ctx1.sendIdx["visit:"]=1;
  38902. return $2;
  38903. }
  38904. $3=$recv($globals.IRVariable)._new();
  38905. $ctx1.sendIdx["new"]=1;
  38906. $5=$recv($globals.AliasVar)._new();
  38907. $ctx1.sendIdx["new"]=2;
  38908. $4=$recv($5)._name_("$".__comma($self._nextAlias()));
  38909. $recv($3)._variable_($4);
  38910. $6=$recv($3)._yourself();
  38911. $ctx1.sendIdx["yourself"]=1;
  38912. variable=$6;
  38913. $8=$recv($globals.IRAssignment)._new();
  38914. $recv($8)._add_(variable);
  38915. $ctx1.sendIdx["add:"]=1;
  38916. $recv($8)._add_($self._visit_(aNode));
  38917. $ctx1.sendIdx["add:"]=2;
  38918. $7=$recv($8)._yourself();
  38919. $self._addToSequence_($7);
  38920. $recv($recv($self._method())._internalVariables())._add_(variable);
  38921. return variable;
  38922. }, function($ctx1) {$ctx1.fill(self,"alias:",{aNode:aNode,variable:variable},$globals.IRASTTranslator)});
  38923. },
  38924. args: ["aNode"],
  38925. 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",
  38926. referencedClasses: ["IRVariable", "AliasVar", "IRAssignment"],
  38927. messageSends: ["ifTrue:", "isImmutable", "visit:", "variable:", "new", "name:", ",", "nextAlias", "yourself", "addToSequence:", "add:", "internalVariables", "method"]
  38928. }),
  38929. $globals.IRASTTranslator);
  38930. $core.addMethod(
  38931. $core.method({
  38932. selector: "aliasTemporally:",
  38933. protocol: "visiting",
  38934. fn: function (aCollection){
  38935. var self=this,$self=this;
  38936. var threshold,result;
  38937. return $core.withContext(function($ctx1) {
  38938. var $1,$2,$4,$3;
  38939. threshold=(0);
  38940. $recv(aCollection)._withIndexDo_((function(each,i){
  38941. return $core.withContext(function($ctx2) {
  38942. $1=$recv(each)._subtreeNeedsAliasing();
  38943. if($core.assert($1)){
  38944. threshold=i;
  38945. return threshold;
  38946. }
  38947. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,1)});
  38948. }));
  38949. $ctx1.sendIdx["withIndexDo:"]=1;
  38950. result=$recv($globals.OrderedCollection)._new();
  38951. $recv(aCollection)._withIndexDo_((function(each,i){
  38952. return $core.withContext(function($ctx2) {
  38953. $2=result;
  38954. $4=$recv(i).__lt_eq(threshold);
  38955. if($core.assert($4)){
  38956. $3=$self._alias_(each);
  38957. } else {
  38958. $3=$self._visit_(each);
  38959. }
  38960. return $recv($2)._add_($3);
  38961. }, function($ctx2) {$ctx2.fillBlock({each:each,i:i},$ctx1,3)});
  38962. }));
  38963. return result;
  38964. }, function($ctx1) {$ctx1.fill(self,"aliasTemporally:",{aCollection:aCollection,threshold:threshold,result:result},$globals.IRASTTranslator)});
  38965. },
  38966. args: ["aCollection"],
  38967. 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",
  38968. referencedClasses: ["OrderedCollection"],
  38969. messageSends: ["withIndexDo:", "ifTrue:", "subtreeNeedsAliasing", "new", "add:", "ifTrue:ifFalse:", "<=", "alias:", "visit:"]
  38970. }),
  38971. $globals.IRASTTranslator);
  38972. $core.addMethod(
  38973. $core.method({
  38974. selector: "method",
  38975. protocol: "accessing",
  38976. fn: function (){
  38977. var self=this,$self=this;
  38978. return $self["@method"];
  38979. },
  38980. args: [],
  38981. source: "method\x0a\x09^ method",
  38982. referencedClasses: [],
  38983. messageSends: []
  38984. }),
  38985. $globals.IRASTTranslator);
  38986. $core.addMethod(
  38987. $core.method({
  38988. selector: "method:",
  38989. protocol: "accessing",
  38990. fn: function (anIRMethod){
  38991. var self=this,$self=this;
  38992. $self["@method"]=anIRMethod;
  38993. return self;
  38994. },
  38995. args: ["anIRMethod"],
  38996. source: "method: anIRMethod\x0a\x09method := anIRMethod",
  38997. referencedClasses: [],
  38998. messageSends: []
  38999. }),
  39000. $globals.IRASTTranslator);
  39001. $core.addMethod(
  39002. $core.method({
  39003. selector: "nextAlias",
  39004. protocol: "accessing",
  39005. fn: function (){
  39006. var self=this,$self=this;
  39007. return $core.withContext(function($ctx1) {
  39008. var $1,$receiver;
  39009. $1=$self["@nextAlias"];
  39010. if(($receiver = $1) == null || $receiver.a$nil){
  39011. $self["@nextAlias"]=(0);
  39012. $self["@nextAlias"];
  39013. } else {
  39014. $1;
  39015. }
  39016. $self["@nextAlias"]=$recv($self["@nextAlias"]).__plus((1));
  39017. return $recv($self["@nextAlias"])._asString();
  39018. }, function($ctx1) {$ctx1.fill(self,"nextAlias",{},$globals.IRASTTranslator)});
  39019. },
  39020. args: [],
  39021. source: "nextAlias\x0a\x09nextAlias ifNil: [ nextAlias := 0 ].\x0a\x09nextAlias := nextAlias + 1.\x0a\x09^ nextAlias asString",
  39022. referencedClasses: [],
  39023. messageSends: ["ifNil:", "+", "asString"]
  39024. }),
  39025. $globals.IRASTTranslator);
  39026. $core.addMethod(
  39027. $core.method({
  39028. selector: "sequence",
  39029. protocol: "accessing",
  39030. fn: function (){
  39031. var self=this,$self=this;
  39032. return $self["@sequence"];
  39033. },
  39034. args: [],
  39035. source: "sequence\x0a\x09^ sequence",
  39036. referencedClasses: [],
  39037. messageSends: []
  39038. }),
  39039. $globals.IRASTTranslator);
  39040. $core.addMethod(
  39041. $core.method({
  39042. selector: "sequence:",
  39043. protocol: "accessing",
  39044. fn: function (anIRSequence){
  39045. var self=this,$self=this;
  39046. $self["@sequence"]=anIRSequence;
  39047. return self;
  39048. },
  39049. args: ["anIRSequence"],
  39050. source: "sequence: anIRSequence\x0a\x09sequence := anIRSequence",
  39051. referencedClasses: [],
  39052. messageSends: []
  39053. }),
  39054. $globals.IRASTTranslator);
  39055. $core.addMethod(
  39056. $core.method({
  39057. selector: "source",
  39058. protocol: "accessing",
  39059. fn: function (){
  39060. var self=this,$self=this;
  39061. return $self["@source"];
  39062. },
  39063. args: [],
  39064. source: "source\x0a\x09^ source",
  39065. referencedClasses: [],
  39066. messageSends: []
  39067. }),
  39068. $globals.IRASTTranslator);
  39069. $core.addMethod(
  39070. $core.method({
  39071. selector: "source:",
  39072. protocol: "accessing",
  39073. fn: function (aString){
  39074. var self=this,$self=this;
  39075. $self["@source"]=aString;
  39076. return self;
  39077. },
  39078. args: ["aString"],
  39079. source: "source: aString\x0a\x09source := aString",
  39080. referencedClasses: [],
  39081. messageSends: []
  39082. }),
  39083. $globals.IRASTTranslator);
  39084. $core.addMethod(
  39085. $core.method({
  39086. selector: "theClass",
  39087. protocol: "accessing",
  39088. fn: function (){
  39089. var self=this,$self=this;
  39090. return $self["@theClass"];
  39091. },
  39092. args: [],
  39093. source: "theClass\x0a\x09^ theClass",
  39094. referencedClasses: [],
  39095. messageSends: []
  39096. }),
  39097. $globals.IRASTTranslator);
  39098. $core.addMethod(
  39099. $core.method({
  39100. selector: "theClass:",
  39101. protocol: "accessing",
  39102. fn: function (aClass){
  39103. var self=this,$self=this;
  39104. $self["@theClass"]=aClass;
  39105. return self;
  39106. },
  39107. args: ["aClass"],
  39108. source: "theClass: aClass\x0a\x09theClass := aClass",
  39109. referencedClasses: [],
  39110. messageSends: []
  39111. }),
  39112. $globals.IRASTTranslator);
  39113. $core.addMethod(
  39114. $core.method({
  39115. selector: "visitAssignmentNode:",
  39116. protocol: "visiting",
  39117. fn: function (aNode){
  39118. var self=this,$self=this;
  39119. var left,right,assignment;
  39120. return $core.withContext(function($ctx1) {
  39121. var $2,$1;
  39122. right=$self._visit_($recv(aNode)._right());
  39123. $ctx1.sendIdx["visit:"]=1;
  39124. left=$self._visit_($recv(aNode)._left());
  39125. $2=$recv($globals.IRAssignment)._new();
  39126. $recv($2)._add_(left);
  39127. $ctx1.sendIdx["add:"]=1;
  39128. $recv($2)._add_(right);
  39129. $1=$recv($2)._yourself();
  39130. $self._addToSequence_($1);
  39131. return left;
  39132. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,left:left,right:right,assignment:assignment},$globals.IRASTTranslator)});
  39133. },
  39134. args: ["aNode"],
  39135. 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",
  39136. referencedClasses: ["IRAssignment"],
  39137. messageSends: ["visit:", "right", "left", "addToSequence:", "add:", "new", "yourself"]
  39138. }),
  39139. $globals.IRASTTranslator);
  39140. $core.addMethod(
  39141. $core.method({
  39142. selector: "visitBlockNode:",
  39143. protocol: "visiting",
  39144. fn: function (aNode){
  39145. var self=this,$self=this;
  39146. var closure;
  39147. return $core.withContext(function($ctx1) {
  39148. var $1,$2,$3,$5,$4,$6,$8,$7;
  39149. $1=$recv($globals.IRClosure)._new();
  39150. $ctx1.sendIdx["new"]=1;
  39151. $recv($1)._arguments_($recv(aNode)._parameters());
  39152. $recv($1)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39153. $2=$recv(aNode)._scope();
  39154. $ctx1.sendIdx["scope"]=1;
  39155. $recv($1)._scope_($2);
  39156. $ctx1.sendIdx["scope:"]=1;
  39157. $3=$recv($1)._yourself();
  39158. $ctx1.sendIdx["yourself"]=1;
  39159. closure=$3;
  39160. $5=$recv(aNode)._scope();
  39161. $ctx1.sendIdx["scope"]=2;
  39162. $4=$recv($5)._temps();
  39163. $recv($4)._do_((function(each){
  39164. return $core.withContext(function($ctx2) {
  39165. $6=closure;
  39166. $8=$recv($globals.IRTempDeclaration)._new();
  39167. $recv($8)._name_($recv(each)._name());
  39168. $recv($8)._scope_($recv(aNode)._scope());
  39169. $7=$recv($8)._yourself();
  39170. return $recv($6)._add_($7);
  39171. $ctx2.sendIdx["add:"]=1;
  39172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39173. }));
  39174. $ctx1.sendIdx["do:"]=1;
  39175. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39176. return $core.withContext(function($ctx2) {
  39177. return $recv(closure)._add_($self._visit_(each));
  39178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39179. }));
  39180. return closure;
  39181. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,closure:closure},$globals.IRASTTranslator)});
  39182. },
  39183. args: ["aNode"],
  39184. 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",
  39185. referencedClasses: ["IRClosure", "IRTempDeclaration"],
  39186. messageSends: ["arguments:", "new", "parameters", "requiresSmalltalkContext:", "requiresSmalltalkContext", "scope:", "scope", "yourself", "do:", "temps", "add:", "name:", "name", "dagChildren", "visit:"]
  39187. }),
  39188. $globals.IRASTTranslator);
  39189. $core.addMethod(
  39190. $core.method({
  39191. selector: "visitBlockSequenceNode:",
  39192. protocol: "visiting",
  39193. fn: function (aNode){
  39194. var self=this,$self=this;
  39195. return $core.withContext(function($ctx1) {
  39196. var $1,$2,$4,$3,$5,$8,$7,$6,$10,$13,$12,$11,$9;
  39197. $1=$recv($globals.IRBlockSequence)._new();
  39198. $ctx1.sendIdx["new"]=1;
  39199. return $self._withSequence_do_($1,(function(){
  39200. return $core.withContext(function($ctx2) {
  39201. $2=$recv(aNode)._dagChildren();
  39202. $ctx2.sendIdx["dagChildren"]=1;
  39203. return $recv($2)._ifNotEmpty_((function(){
  39204. return $core.withContext(function($ctx3) {
  39205. $4=$recv(aNode)._dagChildren();
  39206. $ctx3.sendIdx["dagChildren"]=2;
  39207. $3=$recv($4)._allButLast();
  39208. $recv($3)._do_((function(each){
  39209. return $core.withContext(function($ctx4) {
  39210. $5=$self._visitOrAlias_(each);
  39211. $ctx4.sendIdx["visitOrAlias:"]=1;
  39212. return $self._addToSequence_($5);
  39213. $ctx4.sendIdx["addToSequence:"]=1;
  39214. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  39215. }));
  39216. $8=$recv(aNode)._dagChildren();
  39217. $ctx3.sendIdx["dagChildren"]=3;
  39218. $7=$recv($8)._last();
  39219. $ctx3.sendIdx["last"]=1;
  39220. $6=$recv($7)._isReturnNode();
  39221. if($core.assert($6)){
  39222. return $self._addToSequence_($self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last()));
  39223. } else {
  39224. $10=$recv($globals.IRBlockReturn)._new();
  39225. $13=$recv(aNode)._dagChildren();
  39226. $ctx3.sendIdx["dagChildren"]=4;
  39227. $12=$recv($13)._last();
  39228. $ctx3.sendIdx["last"]=2;
  39229. $11=$self._visitOrAlias_($12);
  39230. $ctx3.sendIdx["visitOrAlias:"]=2;
  39231. $recv($10)._add_($11);
  39232. $9=$recv($10)._yourself();
  39233. return $self._addToSequence_($9);
  39234. $ctx3.sendIdx["addToSequence:"]=2;
  39235. }
  39236. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  39237. }));
  39238. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39239. }));
  39240. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39241. },
  39242. args: ["aNode"],
  39243. 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) ] ]]",
  39244. referencedClasses: ["IRBlockSequence", "IRBlockReturn"],
  39245. messageSends: ["withSequence:do:", "new", "ifNotEmpty:", "dagChildren", "do:", "allButLast", "addToSequence:", "visitOrAlias:", "ifFalse:ifTrue:", "isReturnNode", "last", "add:", "yourself"]
  39246. }),
  39247. $globals.IRASTTranslator);
  39248. $core.addMethod(
  39249. $core.method({
  39250. selector: "visitCascadeNode:",
  39251. protocol: "visiting",
  39252. fn: function (aNode){
  39253. var self=this,$self=this;
  39254. var receiver;
  39255. return $core.withContext(function($ctx1) {
  39256. var $1,$2,$4,$3;
  39257. receiver=$recv(aNode)._receiver();
  39258. $1=$recv(receiver)._isImmutable();
  39259. if(!$core.assert($1)){
  39260. var alias;
  39261. alias=$self._alias_(receiver);
  39262. receiver=$recv($recv($globals.VariableNode)._new())._binding_($recv(alias)._variable());
  39263. receiver;
  39264. }
  39265. $2=$recv(aNode)._dagChildren();
  39266. $ctx1.sendIdx["dagChildren"]=1;
  39267. $recv($2)._do_((function(each){
  39268. return $core.withContext(function($ctx2) {
  39269. return $recv(each)._receiver_(receiver);
  39270. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39271. }));
  39272. $ctx1.sendIdx["do:"]=1;
  39273. $4=$recv(aNode)._dagChildren();
  39274. $ctx1.sendIdx["dagChildren"]=2;
  39275. $3=$recv($4)._allButLast();
  39276. $recv($3)._do_((function(each){
  39277. return $core.withContext(function($ctx2) {
  39278. return $self._addToSequence_($self._visit_(each));
  39279. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39280. }));
  39281. return $self._visitOrAlias_($recv($recv(aNode)._dagChildren())._last());
  39282. }, function($ctx1) {$ctx1.fill(self,"visitCascadeNode:",{aNode:aNode,receiver:receiver},$globals.IRASTTranslator)});
  39283. },
  39284. args: ["aNode"],
  39285. 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",
  39286. referencedClasses: ["VariableNode"],
  39287. messageSends: ["receiver", "ifFalse:", "isImmutable", "alias:", "binding:", "new", "variable", "do:", "dagChildren", "receiver:", "allButLast", "addToSequence:", "visit:", "visitOrAlias:", "last"]
  39288. }),
  39289. $globals.IRASTTranslator);
  39290. $core.addMethod(
  39291. $core.method({
  39292. selector: "visitDynamicArrayNode:",
  39293. protocol: "visiting",
  39294. fn: function (aNode){
  39295. var self=this,$self=this;
  39296. var array;
  39297. return $core.withContext(function($ctx1) {
  39298. array=$recv($globals.IRDynamicArray)._new();
  39299. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39300. return $core.withContext(function($ctx2) {
  39301. return $recv(array)._add_(each);
  39302. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39303. }));
  39304. return array;
  39305. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.IRASTTranslator)});
  39306. },
  39307. args: ["aNode"],
  39308. source: "visitDynamicArrayNode: aNode\x0a\x09| array |\x0a\x09array := IRDynamicArray new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | array add: each ].\x0a\x09^ array",
  39309. referencedClasses: ["IRDynamicArray"],
  39310. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39311. }),
  39312. $globals.IRASTTranslator);
  39313. $core.addMethod(
  39314. $core.method({
  39315. selector: "visitDynamicDictionaryNode:",
  39316. protocol: "visiting",
  39317. fn: function (aNode){
  39318. var self=this,$self=this;
  39319. var dictionary;
  39320. return $core.withContext(function($ctx1) {
  39321. dictionary=$recv($globals.IRDynamicDictionary)._new();
  39322. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39323. return $core.withContext(function($ctx2) {
  39324. return $recv(dictionary)._add_(each);
  39325. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39326. }));
  39327. return dictionary;
  39328. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,dictionary:dictionary},$globals.IRASTTranslator)});
  39329. },
  39330. args: ["aNode"],
  39331. source: "visitDynamicDictionaryNode: aNode\x0a\x09| dictionary |\x0a\x09dictionary := IRDynamicDictionary new.\x0a\x09(self aliasTemporally: aNode dagChildren) do: [ :each | dictionary add: each ].\x0a\x09^ dictionary",
  39332. referencedClasses: ["IRDynamicDictionary"],
  39333. messageSends: ["new", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39334. }),
  39335. $globals.IRASTTranslator);
  39336. $core.addMethod(
  39337. $core.method({
  39338. selector: "visitJSStatementNode:",
  39339. protocol: "visiting",
  39340. fn: function (aNode){
  39341. var self=this,$self=this;
  39342. return $core.withContext(function($ctx1) {
  39343. var $1;
  39344. $1=$recv($globals.IRVerbatim)._new();
  39345. $recv($1)._source_($recv($recv(aNode)._source())._crlfSanitized());
  39346. return $recv($1)._yourself();
  39347. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39348. },
  39349. args: ["aNode"],
  39350. source: "visitJSStatementNode: aNode\x0a\x09^ IRVerbatim new\x0a\x09\x09source: aNode source crlfSanitized;\x0a\x09\x09yourself",
  39351. referencedClasses: ["IRVerbatim"],
  39352. messageSends: ["source:", "new", "crlfSanitized", "source", "yourself"]
  39353. }),
  39354. $globals.IRASTTranslator);
  39355. $core.addMethod(
  39356. $core.method({
  39357. selector: "visitMethodNode:",
  39358. protocol: "visiting",
  39359. fn: function (aNode){
  39360. var self=this,$self=this;
  39361. return $core.withContext(function($ctx1) {
  39362. var $2,$3,$4,$1,$6,$5,$7,$9,$10,$11,$8,$12,$14,$13,$15,$17,$19,$20,$18,$21,$16,$23,$22;
  39363. $2=$recv($globals.IRMethod)._new();
  39364. $ctx1.sendIdx["new"]=1;
  39365. $recv($2)._source_($recv($self._source())._crlfSanitized());
  39366. $ctx1.sendIdx["source:"]=1;
  39367. $recv($2)._theClass_($self._theClass());
  39368. $recv($2)._arguments_($recv(aNode)._arguments());
  39369. $recv($2)._selector_($recv(aNode)._selector());
  39370. $recv($2)._sendIndexes_($recv(aNode)._sendIndexes());
  39371. $recv($2)._requiresSmalltalkContext_($recv(aNode)._requiresSmalltalkContext());
  39372. $recv($2)._classReferences_($recv(aNode)._classReferences());
  39373. $3=$recv(aNode)._scope();
  39374. $ctx1.sendIdx["scope"]=1;
  39375. $recv($2)._scope_($3);
  39376. $ctx1.sendIdx["scope:"]=1;
  39377. $4=$recv($2)._yourself();
  39378. $ctx1.sendIdx["yourself"]=1;
  39379. $1=$4;
  39380. $self._method_($1);
  39381. $6=$recv(aNode)._scope();
  39382. $ctx1.sendIdx["scope"]=2;
  39383. $5=$recv($6)._temps();
  39384. $recv($5)._do_((function(each){
  39385. return $core.withContext(function($ctx2) {
  39386. $7=$self._method();
  39387. $ctx2.sendIdx["method"]=1;
  39388. $9=$recv($globals.IRTempDeclaration)._new();
  39389. $ctx2.sendIdx["new"]=2;
  39390. $recv($9)._name_($recv(each)._name());
  39391. $10=$recv(aNode)._scope();
  39392. $ctx2.sendIdx["scope"]=3;
  39393. $recv($9)._scope_($10);
  39394. $11=$recv($9)._yourself();
  39395. $ctx2.sendIdx["yourself"]=2;
  39396. $8=$11;
  39397. return $recv($7)._add_($8);
  39398. $ctx2.sendIdx["add:"]=1;
  39399. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39400. }));
  39401. $ctx1.sendIdx["do:"]=1;
  39402. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39403. return $core.withContext(function($ctx2) {
  39404. $12=$self._method();
  39405. $ctx2.sendIdx["method"]=2;
  39406. return $recv($12)._add_($self._visit_(each));
  39407. $ctx2.sendIdx["add:"]=2;
  39408. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  39409. }));
  39410. $14=$recv(aNode)._scope();
  39411. $ctx1.sendIdx["scope"]=4;
  39412. $13=$recv($14)._hasLocalReturn();
  39413. if(!$core.assert($13)){
  39414. $15=$self._method();
  39415. $ctx1.sendIdx["method"]=3;
  39416. $17=$recv($globals.IRReturn)._new();
  39417. $ctx1.sendIdx["new"]=3;
  39418. $19=$recv($globals.IRVariable)._new();
  39419. $ctx1.sendIdx["new"]=4;
  39420. $recv($19)._variable_($recv($recv($recv(aNode)._scope())._pseudoVars())._at_("self"));
  39421. $20=$recv($19)._yourself();
  39422. $ctx1.sendIdx["yourself"]=3;
  39423. $18=$20;
  39424. $recv($17)._add_($18);
  39425. $ctx1.sendIdx["add:"]=4;
  39426. $21=$recv($17)._yourself();
  39427. $ctx1.sendIdx["yourself"]=4;
  39428. $16=$21;
  39429. $recv($15)._add_($16);
  39430. $ctx1.sendIdx["add:"]=3;
  39431. $23=$recv($globals.IRVerbatim)._new();
  39432. $recv($23)._source_(";".__comma($recv($globals.String)._lf()));
  39433. $22=$recv($23)._yourself();
  39434. $recv($15)._add_($22);
  39435. }
  39436. return $self._method();
  39437. }, function($ctx1) {$ctx1.fill(self,"visitMethodNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39438. },
  39439. args: ["aNode"],
  39440. 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",
  39441. referencedClasses: ["IRMethod", "IRTempDeclaration", "IRReturn", "IRVariable", "IRVerbatim", "String"],
  39442. 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"]
  39443. }),
  39444. $globals.IRASTTranslator);
  39445. $core.addMethod(
  39446. $core.method({
  39447. selector: "visitOrAlias:",
  39448. protocol: "visiting",
  39449. fn: function (aNode){
  39450. var self=this,$self=this;
  39451. return $core.withContext(function($ctx1) {
  39452. var $1;
  39453. $1=$recv(aNode)._shouldBeAliased();
  39454. if($core.assert($1)){
  39455. return $self._alias_(aNode);
  39456. } else {
  39457. return $self._visit_(aNode);
  39458. }
  39459. }, function($ctx1) {$ctx1.fill(self,"visitOrAlias:",{aNode:aNode},$globals.IRASTTranslator)});
  39460. },
  39461. args: ["aNode"],
  39462. source: "visitOrAlias: aNode\x0a\x09^ aNode shouldBeAliased\x0a\x09\x09ifTrue: [ self alias: aNode ]\x0a\x09\x09ifFalse: [ self visit: aNode ]",
  39463. referencedClasses: [],
  39464. messageSends: ["ifTrue:ifFalse:", "shouldBeAliased", "alias:", "visit:"]
  39465. }),
  39466. $globals.IRASTTranslator);
  39467. $core.addMethod(
  39468. $core.method({
  39469. selector: "visitReturnNode:",
  39470. protocol: "visiting",
  39471. fn: function (aNode){
  39472. var self=this,$self=this;
  39473. var return_;
  39474. return $core.withContext(function($ctx1) {
  39475. var $1;
  39476. $1=$recv(aNode)._nonLocalReturn();
  39477. if($core.assert($1)){
  39478. return_=$recv($globals.IRNonLocalReturn)._new();
  39479. $ctx1.sendIdx["new"]=1;
  39480. } else {
  39481. return_=$recv($globals.IRReturn)._new();
  39482. }
  39483. $recv(return_)._scope_($recv(aNode)._scope());
  39484. $recv($recv(aNode)._dagChildren())._do_((function(each){
  39485. return $core.withContext(function($ctx2) {
  39486. return $recv(return_)._add_($self._visitOrAlias_(each));
  39487. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  39488. }));
  39489. return return_;
  39490. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode,return_:return_},$globals.IRASTTranslator)});
  39491. },
  39492. args: ["aNode"],
  39493. 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",
  39494. referencedClasses: ["IRNonLocalReturn", "IRReturn"],
  39495. messageSends: ["ifTrue:ifFalse:", "nonLocalReturn", "new", "scope:", "scope", "do:", "dagChildren", "add:", "visitOrAlias:"]
  39496. }),
  39497. $globals.IRASTTranslator);
  39498. $core.addMethod(
  39499. $core.method({
  39500. selector: "visitSendNode:",
  39501. protocol: "visiting",
  39502. fn: function (aNode){
  39503. var self=this,$self=this;
  39504. var send;
  39505. return $core.withContext(function($ctx1) {
  39506. var $1;
  39507. send=$recv($globals.IRSend)._new();
  39508. $1=send;
  39509. $recv($1)._selector_($recv(aNode)._selector());
  39510. $recv($1)._index_($recv(aNode)._index());
  39511. $recv($self._aliasTemporally_($recv(aNode)._dagChildren()))._do_((function(each){
  39512. return $core.withContext(function($ctx2) {
  39513. return $recv(send)._add_(each);
  39514. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  39515. }));
  39516. return send;
  39517. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,send:send},$globals.IRASTTranslator)});
  39518. },
  39519. args: ["aNode"],
  39520. 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",
  39521. referencedClasses: ["IRSend"],
  39522. messageSends: ["new", "selector:", "selector", "index:", "index", "do:", "aliasTemporally:", "dagChildren", "add:"]
  39523. }),
  39524. $globals.IRASTTranslator);
  39525. $core.addMethod(
  39526. $core.method({
  39527. selector: "visitSequenceNode:",
  39528. protocol: "visiting",
  39529. fn: function (aNode){
  39530. var self=this,$self=this;
  39531. return $core.withContext(function($ctx1) {
  39532. return $self._withSequence_do_($recv($globals.IRSequence)._new(),(function(){
  39533. return $core.withContext(function($ctx2) {
  39534. return $recv($recv(aNode)._dagChildren())._do_((function(each){
  39535. return $core.withContext(function($ctx3) {
  39536. return $self._addToSequence_($self._visitOrAlias_(each));
  39537. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  39538. }));
  39539. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  39540. }));
  39541. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39542. },
  39543. args: ["aNode"],
  39544. 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) ] ]",
  39545. referencedClasses: ["IRSequence"],
  39546. messageSends: ["withSequence:do:", "new", "do:", "dagChildren", "addToSequence:", "visitOrAlias:"]
  39547. }),
  39548. $globals.IRASTTranslator);
  39549. $core.addMethod(
  39550. $core.method({
  39551. selector: "visitValueNode:",
  39552. protocol: "visiting",
  39553. fn: function (aNode){
  39554. var self=this,$self=this;
  39555. return $core.withContext(function($ctx1) {
  39556. var $1;
  39557. $1=$recv($globals.IRValue)._new();
  39558. $recv($1)._value_($recv(aNode)._value());
  39559. return $recv($1)._yourself();
  39560. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39561. },
  39562. args: ["aNode"],
  39563. source: "visitValueNode: aNode\x0a\x09^ IRValue new\x0a\x09\x09value: aNode value;\x0a\x09\x09yourself",
  39564. referencedClasses: ["IRValue"],
  39565. messageSends: ["value:", "new", "value", "yourself"]
  39566. }),
  39567. $globals.IRASTTranslator);
  39568. $core.addMethod(
  39569. $core.method({
  39570. selector: "visitVariableNode:",
  39571. protocol: "visiting",
  39572. fn: function (aNode){
  39573. var self=this,$self=this;
  39574. return $core.withContext(function($ctx1) {
  39575. var $1;
  39576. $1=$recv($globals.IRVariable)._new();
  39577. $recv($1)._variable_($recv(aNode)._binding());
  39578. return $recv($1)._yourself();
  39579. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.IRASTTranslator)});
  39580. },
  39581. args: ["aNode"],
  39582. source: "visitVariableNode: aNode\x0a\x09^ IRVariable new\x0a\x09\x09variable: aNode binding;\x0a\x09\x09yourself",
  39583. referencedClasses: ["IRVariable"],
  39584. messageSends: ["variable:", "new", "binding", "yourself"]
  39585. }),
  39586. $globals.IRASTTranslator);
  39587. $core.addMethod(
  39588. $core.method({
  39589. selector: "withSequence:do:",
  39590. protocol: "accessing",
  39591. fn: function (aSequence,aBlock){
  39592. var self=this,$self=this;
  39593. var outerSequence;
  39594. return $core.withContext(function($ctx1) {
  39595. outerSequence=$self._sequence();
  39596. $self._sequence_(aSequence);
  39597. $ctx1.sendIdx["sequence:"]=1;
  39598. $recv(aBlock)._value();
  39599. $self._sequence_(outerSequence);
  39600. return aSequence;
  39601. }, function($ctx1) {$ctx1.fill(self,"withSequence:do:",{aSequence:aSequence,aBlock:aBlock,outerSequence:outerSequence},$globals.IRASTTranslator)});
  39602. },
  39603. args: ["aSequence", "aBlock"],
  39604. 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",
  39605. referencedClasses: [],
  39606. messageSends: ["sequence", "sequence:", "value"]
  39607. }),
  39608. $globals.IRASTTranslator);
  39609. $core.addClass("IRInstruction", $globals.DagParentNode, ["parent"], "Compiler-IR");
  39610. $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.";
  39611. $core.addMethod(
  39612. $core.method({
  39613. selector: "add:",
  39614. protocol: "building",
  39615. fn: function (anObject){
  39616. var self=this,$self=this;
  39617. return $core.withContext(function($ctx1) {
  39618. $recv(anObject)._parent_(self);
  39619. return $recv($self._dagChildren())._add_(anObject);
  39620. }, function($ctx1) {$ctx1.fill(self,"add:",{anObject:anObject},$globals.IRInstruction)});
  39621. },
  39622. args: ["anObject"],
  39623. source: "add: anObject\x0a\x09anObject parent: self.\x0a\x09^ self dagChildren add: anObject",
  39624. referencedClasses: [],
  39625. messageSends: ["parent:", "add:", "dagChildren"]
  39626. }),
  39627. $globals.IRInstruction);
  39628. $core.addMethod(
  39629. $core.method({
  39630. selector: "isClosure",
  39631. protocol: "testing",
  39632. fn: function (){
  39633. var self=this,$self=this;
  39634. return false;
  39635. },
  39636. args: [],
  39637. source: "isClosure\x0a\x09^ false",
  39638. referencedClasses: [],
  39639. messageSends: []
  39640. }),
  39641. $globals.IRInstruction);
  39642. $core.addMethod(
  39643. $core.method({
  39644. selector: "isInlined",
  39645. protocol: "testing",
  39646. fn: function (){
  39647. var self=this,$self=this;
  39648. return false;
  39649. },
  39650. args: [],
  39651. source: "isInlined\x0a\x09^ false",
  39652. referencedClasses: [],
  39653. messageSends: []
  39654. }),
  39655. $globals.IRInstruction);
  39656. $core.addMethod(
  39657. $core.method({
  39658. selector: "isMethod",
  39659. protocol: "testing",
  39660. fn: function (){
  39661. var self=this,$self=this;
  39662. return false;
  39663. },
  39664. args: [],
  39665. source: "isMethod\x0a\x09^ false",
  39666. referencedClasses: [],
  39667. messageSends: []
  39668. }),
  39669. $globals.IRInstruction);
  39670. $core.addMethod(
  39671. $core.method({
  39672. selector: "isSelf",
  39673. protocol: "testing",
  39674. fn: function (){
  39675. var self=this,$self=this;
  39676. return false;
  39677. },
  39678. args: [],
  39679. source: "isSelf\x0a\x09^ false",
  39680. referencedClasses: [],
  39681. messageSends: []
  39682. }),
  39683. $globals.IRInstruction);
  39684. $core.addMethod(
  39685. $core.method({
  39686. selector: "isSend",
  39687. protocol: "testing",
  39688. fn: function (){
  39689. var self=this,$self=this;
  39690. return false;
  39691. },
  39692. args: [],
  39693. source: "isSend\x0a\x09^ false",
  39694. referencedClasses: [],
  39695. messageSends: []
  39696. }),
  39697. $globals.IRInstruction);
  39698. $core.addMethod(
  39699. $core.method({
  39700. selector: "isSequence",
  39701. protocol: "testing",
  39702. fn: function (){
  39703. var self=this,$self=this;
  39704. return false;
  39705. },
  39706. args: [],
  39707. source: "isSequence\x0a\x09^ false",
  39708. referencedClasses: [],
  39709. messageSends: []
  39710. }),
  39711. $globals.IRInstruction);
  39712. $core.addMethod(
  39713. $core.method({
  39714. selector: "isSuper",
  39715. protocol: "testing",
  39716. fn: function (){
  39717. var self=this,$self=this;
  39718. return false;
  39719. },
  39720. args: [],
  39721. source: "isSuper\x0a\x09^ false",
  39722. referencedClasses: [],
  39723. messageSends: []
  39724. }),
  39725. $globals.IRInstruction);
  39726. $core.addMethod(
  39727. $core.method({
  39728. selector: "isTempDeclaration",
  39729. protocol: "testing",
  39730. fn: function (){
  39731. var self=this,$self=this;
  39732. return false;
  39733. },
  39734. args: [],
  39735. source: "isTempDeclaration\x0a\x09^ false",
  39736. referencedClasses: [],
  39737. messageSends: []
  39738. }),
  39739. $globals.IRInstruction);
  39740. $core.addMethod(
  39741. $core.method({
  39742. selector: "isVariable",
  39743. protocol: "testing",
  39744. fn: function (){
  39745. var self=this,$self=this;
  39746. return false;
  39747. },
  39748. args: [],
  39749. source: "isVariable\x0a\x09^ false",
  39750. referencedClasses: [],
  39751. messageSends: []
  39752. }),
  39753. $globals.IRInstruction);
  39754. $core.addMethod(
  39755. $core.method({
  39756. selector: "method",
  39757. protocol: "accessing",
  39758. fn: function (){
  39759. var self=this,$self=this;
  39760. return $core.withContext(function($ctx1) {
  39761. return $recv($self._parent())._method();
  39762. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.IRInstruction)});
  39763. },
  39764. args: [],
  39765. source: "method\x0a\x09^ self parent method",
  39766. referencedClasses: [],
  39767. messageSends: ["method", "parent"]
  39768. }),
  39769. $globals.IRInstruction);
  39770. $core.addMethod(
  39771. $core.method({
  39772. selector: "needsBoxingAsReceiver",
  39773. protocol: "testing",
  39774. fn: function (){
  39775. var self=this,$self=this;
  39776. return true;
  39777. },
  39778. args: [],
  39779. source: "needsBoxingAsReceiver\x0a\x09^ true",
  39780. referencedClasses: [],
  39781. messageSends: []
  39782. }),
  39783. $globals.IRInstruction);
  39784. $core.addMethod(
  39785. $core.method({
  39786. selector: "parent",
  39787. protocol: "accessing",
  39788. fn: function (){
  39789. var self=this,$self=this;
  39790. return $self["@parent"];
  39791. },
  39792. args: [],
  39793. source: "parent\x0a\x09^ parent",
  39794. referencedClasses: [],
  39795. messageSends: []
  39796. }),
  39797. $globals.IRInstruction);
  39798. $core.addMethod(
  39799. $core.method({
  39800. selector: "parent:",
  39801. protocol: "accessing",
  39802. fn: function (anIRInstruction){
  39803. var self=this,$self=this;
  39804. $self["@parent"]=anIRInstruction;
  39805. return self;
  39806. },
  39807. args: ["anIRInstruction"],
  39808. source: "parent: anIRInstruction\x0a\x09parent := anIRInstruction",
  39809. referencedClasses: [],
  39810. messageSends: []
  39811. }),
  39812. $globals.IRInstruction);
  39813. $core.addMethod(
  39814. $core.method({
  39815. selector: "remove:",
  39816. protocol: "building",
  39817. fn: function (anIRInstruction){
  39818. var self=this,$self=this;
  39819. return $core.withContext(function($ctx1) {
  39820. $recv($self._dagChildren())._remove_(anIRInstruction);
  39821. return self;
  39822. }, function($ctx1) {$ctx1.fill(self,"remove:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39823. },
  39824. args: ["anIRInstruction"],
  39825. source: "remove: anIRInstruction\x0a\x09self dagChildren remove: anIRInstruction",
  39826. referencedClasses: [],
  39827. messageSends: ["remove:", "dagChildren"]
  39828. }),
  39829. $globals.IRInstruction);
  39830. $core.addMethod(
  39831. $core.method({
  39832. selector: "replace:with:",
  39833. protocol: "building",
  39834. fn: function (anIRInstruction,anotherIRInstruction){
  39835. var self=this,$self=this;
  39836. return $core.withContext(function($ctx1) {
  39837. var $1;
  39838. $recv(anotherIRInstruction)._parent_(self);
  39839. $1=$self._dagChildren();
  39840. $ctx1.sendIdx["dagChildren"]=1;
  39841. $recv($1)._at_put_($recv($self._dagChildren())._indexOf_(anIRInstruction),anotherIRInstruction);
  39842. return self;
  39843. }, function($ctx1) {$ctx1.fill(self,"replace:with:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRInstruction)});
  39844. },
  39845. args: ["anIRInstruction", "anotherIRInstruction"],
  39846. source: "replace: anIRInstruction with: anotherIRInstruction\x0a\x09anotherIRInstruction parent: self.\x0a\x09self dagChildren\x0a\x09\x09at: (self dagChildren indexOf: anIRInstruction)\x0a\x09\x09put: anotherIRInstruction",
  39847. referencedClasses: [],
  39848. messageSends: ["parent:", "at:put:", "dagChildren", "indexOf:"]
  39849. }),
  39850. $globals.IRInstruction);
  39851. $core.addMethod(
  39852. $core.method({
  39853. selector: "replaceWith:",
  39854. protocol: "building",
  39855. fn: function (anIRInstruction){
  39856. var self=this,$self=this;
  39857. return $core.withContext(function($ctx1) {
  39858. $recv($self._parent())._replace_with_(self,anIRInstruction);
  39859. return self;
  39860. }, function($ctx1) {$ctx1.fill(self,"replaceWith:",{anIRInstruction:anIRInstruction},$globals.IRInstruction)});
  39861. },
  39862. args: ["anIRInstruction"],
  39863. source: "replaceWith: anIRInstruction\x0a\x09self parent replace: self with: anIRInstruction",
  39864. referencedClasses: [],
  39865. messageSends: ["replace:with:", "parent"]
  39866. }),
  39867. $globals.IRInstruction);
  39868. $core.addMethod(
  39869. $core.method({
  39870. selector: "scope",
  39871. protocol: "accessing",
  39872. fn: function (){
  39873. var self=this,$self=this;
  39874. return $core.withContext(function($ctx1) {
  39875. var $1,$receiver;
  39876. $1=$self._parent();
  39877. if(($receiver = $1) == null || $receiver.a$nil){
  39878. return $1;
  39879. } else {
  39880. var node;
  39881. node=$receiver;
  39882. return $recv(node)._scope();
  39883. }
  39884. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRInstruction)});
  39885. },
  39886. args: [],
  39887. source: "scope\x0a\x09^ self parent ifNotNil: [ :node | \x0a\x09\x09node scope ]",
  39888. referencedClasses: [],
  39889. messageSends: ["ifNotNil:", "parent", "scope"]
  39890. }),
  39891. $globals.IRInstruction);
  39892. $core.addMethod(
  39893. $core.method({
  39894. selector: "yieldsValue",
  39895. protocol: "testing",
  39896. fn: function (){
  39897. var self=this,$self=this;
  39898. return true;
  39899. },
  39900. args: [],
  39901. source: "yieldsValue\x0a\x09^ true",
  39902. referencedClasses: [],
  39903. messageSends: []
  39904. }),
  39905. $globals.IRInstruction);
  39906. $core.addMethod(
  39907. $core.method({
  39908. selector: "on:",
  39909. protocol: "instance creation",
  39910. fn: function (aBuilder){
  39911. var self=this,$self=this;
  39912. return $core.withContext(function($ctx1) {
  39913. var $1;
  39914. $1=$self._new();
  39915. $recv($1)._builder_(aBuilder);
  39916. return $recv($1)._yourself();
  39917. }, function($ctx1) {$ctx1.fill(self,"on:",{aBuilder:aBuilder},$globals.IRInstruction.a$cls)});
  39918. },
  39919. args: ["aBuilder"],
  39920. source: "on: aBuilder\x0a\x09^ self new\x0a\x09\x09builder: aBuilder;\x0a\x09\x09yourself",
  39921. referencedClasses: [],
  39922. messageSends: ["builder:", "new", "yourself"]
  39923. }),
  39924. $globals.IRInstruction.a$cls);
  39925. $core.addClass("IRAssignment", $globals.IRInstruction, [], "Compiler-IR");
  39926. $core.addMethod(
  39927. $core.method({
  39928. selector: "acceptDagVisitor:",
  39929. protocol: "visiting",
  39930. fn: function (aVisitor){
  39931. var self=this,$self=this;
  39932. return $core.withContext(function($ctx1) {
  39933. return $recv(aVisitor)._visitIRAssignment_(self);
  39934. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRAssignment)});
  39935. },
  39936. args: ["aVisitor"],
  39937. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRAssignment: self",
  39938. referencedClasses: [],
  39939. messageSends: ["visitIRAssignment:"]
  39940. }),
  39941. $globals.IRAssignment);
  39942. $core.addMethod(
  39943. $core.method({
  39944. selector: "left",
  39945. protocol: "accessing",
  39946. fn: function (){
  39947. var self=this,$self=this;
  39948. return $core.withContext(function($ctx1) {
  39949. return $recv($self._dagChildren())._first();
  39950. }, function($ctx1) {$ctx1.fill(self,"left",{},$globals.IRAssignment)});
  39951. },
  39952. args: [],
  39953. source: "left\x0a\x09^ self dagChildren first",
  39954. referencedClasses: [],
  39955. messageSends: ["first", "dagChildren"]
  39956. }),
  39957. $globals.IRAssignment);
  39958. $core.addMethod(
  39959. $core.method({
  39960. selector: "right",
  39961. protocol: "accessing",
  39962. fn: function (){
  39963. var self=this,$self=this;
  39964. return $core.withContext(function($ctx1) {
  39965. return $recv($self._dagChildren())._last();
  39966. }, function($ctx1) {$ctx1.fill(self,"right",{},$globals.IRAssignment)});
  39967. },
  39968. args: [],
  39969. source: "right\x0a\x09^ self dagChildren last",
  39970. referencedClasses: [],
  39971. messageSends: ["last", "dagChildren"]
  39972. }),
  39973. $globals.IRAssignment);
  39974. $core.addClass("IRDynamicArray", $globals.IRInstruction, [], "Compiler-IR");
  39975. $core.addMethod(
  39976. $core.method({
  39977. selector: "acceptDagVisitor:",
  39978. protocol: "visiting",
  39979. fn: function (aVisitor){
  39980. var self=this,$self=this;
  39981. return $core.withContext(function($ctx1) {
  39982. return $recv(aVisitor)._visitIRDynamicArray_(self);
  39983. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicArray)});
  39984. },
  39985. args: ["aVisitor"],
  39986. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicArray: self",
  39987. referencedClasses: [],
  39988. messageSends: ["visitIRDynamicArray:"]
  39989. }),
  39990. $globals.IRDynamicArray);
  39991. $core.addClass("IRDynamicDictionary", $globals.IRInstruction, [], "Compiler-IR");
  39992. $core.addMethod(
  39993. $core.method({
  39994. selector: "acceptDagVisitor:",
  39995. protocol: "visiting",
  39996. fn: function (aVisitor){
  39997. var self=this,$self=this;
  39998. return $core.withContext(function($ctx1) {
  39999. return $recv(aVisitor)._visitIRDynamicDictionary_(self);
  40000. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRDynamicDictionary)});
  40001. },
  40002. args: ["aVisitor"],
  40003. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRDynamicDictionary: self",
  40004. referencedClasses: [],
  40005. messageSends: ["visitIRDynamicDictionary:"]
  40006. }),
  40007. $globals.IRDynamicDictionary);
  40008. $core.addClass("IRScopedInstruction", $globals.IRInstruction, ["scope"], "Compiler-IR");
  40009. $core.addMethod(
  40010. $core.method({
  40011. selector: "scope",
  40012. protocol: "accessing",
  40013. fn: function (){
  40014. var self=this,$self=this;
  40015. return $self["@scope"];
  40016. },
  40017. args: [],
  40018. source: "scope\x0a\x09^ scope",
  40019. referencedClasses: [],
  40020. messageSends: []
  40021. }),
  40022. $globals.IRScopedInstruction);
  40023. $core.addMethod(
  40024. $core.method({
  40025. selector: "scope:",
  40026. protocol: "accessing",
  40027. fn: function (aScope){
  40028. var self=this,$self=this;
  40029. $self["@scope"]=aScope;
  40030. return self;
  40031. },
  40032. args: ["aScope"],
  40033. source: "scope: aScope\x0a\x09scope := aScope",
  40034. referencedClasses: [],
  40035. messageSends: []
  40036. }),
  40037. $globals.IRScopedInstruction);
  40038. $core.addClass("IRClosureInstruction", $globals.IRScopedInstruction, ["arguments", "requiresSmalltalkContext"], "Compiler-IR");
  40039. $core.addMethod(
  40040. $core.method({
  40041. selector: "arguments",
  40042. protocol: "accessing",
  40043. fn: function (){
  40044. var self=this,$self=this;
  40045. return $core.withContext(function($ctx1) {
  40046. var $1,$receiver;
  40047. $1=$self["@arguments"];
  40048. if(($receiver = $1) == null || $receiver.a$nil){
  40049. return [];
  40050. } else {
  40051. return $1;
  40052. }
  40053. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRClosureInstruction)});
  40054. },
  40055. args: [],
  40056. source: "arguments\x0a\x09^ arguments ifNil: [ #() ]",
  40057. referencedClasses: [],
  40058. messageSends: ["ifNil:"]
  40059. }),
  40060. $globals.IRClosureInstruction);
  40061. $core.addMethod(
  40062. $core.method({
  40063. selector: "arguments:",
  40064. protocol: "accessing",
  40065. fn: function (aCollection){
  40066. var self=this,$self=this;
  40067. $self["@arguments"]=aCollection;
  40068. return self;
  40069. },
  40070. args: ["aCollection"],
  40071. source: "arguments: aCollection\x0a\x09arguments := aCollection",
  40072. referencedClasses: [],
  40073. messageSends: []
  40074. }),
  40075. $globals.IRClosureInstruction);
  40076. $core.addMethod(
  40077. $core.method({
  40078. selector: "locals",
  40079. protocol: "accessing",
  40080. fn: function (){
  40081. var self=this,$self=this;
  40082. return $core.withContext(function($ctx1) {
  40083. var $1;
  40084. $1=$recv($self._arguments())._copy();
  40085. $recv($1)._addAll_($recv($self._tempDeclarations())._collect_((function(each){
  40086. return $core.withContext(function($ctx2) {
  40087. return $recv(each)._name();
  40088. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40089. })));
  40090. return $recv($1)._yourself();
  40091. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.IRClosureInstruction)});
  40092. },
  40093. args: [],
  40094. source: "locals\x0a\x09^ self arguments copy\x0a\x09\x09addAll: (self tempDeclarations collect: [ :each | each name ]);\x0a\x09\x09yourself",
  40095. referencedClasses: [],
  40096. messageSends: ["addAll:", "copy", "arguments", "collect:", "tempDeclarations", "name", "yourself"]
  40097. }),
  40098. $globals.IRClosureInstruction);
  40099. $core.addMethod(
  40100. $core.method({
  40101. selector: "requiresSmalltalkContext",
  40102. protocol: "accessing",
  40103. fn: function (){
  40104. var self=this,$self=this;
  40105. return $core.withContext(function($ctx1) {
  40106. var $1,$receiver;
  40107. $1=$self["@requiresSmalltalkContext"];
  40108. if(($receiver = $1) == null || $receiver.a$nil){
  40109. return false;
  40110. } else {
  40111. return $1;
  40112. }
  40113. }, function($ctx1) {$ctx1.fill(self,"requiresSmalltalkContext",{},$globals.IRClosureInstruction)});
  40114. },
  40115. args: [],
  40116. source: "requiresSmalltalkContext\x0a\x09^ requiresSmalltalkContext ifNil: [ false ]",
  40117. referencedClasses: [],
  40118. messageSends: ["ifNil:"]
  40119. }),
  40120. $globals.IRClosureInstruction);
  40121. $core.addMethod(
  40122. $core.method({
  40123. selector: "requiresSmalltalkContext:",
  40124. protocol: "accessing",
  40125. fn: function (anObject){
  40126. var self=this,$self=this;
  40127. $self["@requiresSmalltalkContext"]=anObject;
  40128. return self;
  40129. },
  40130. args: ["anObject"],
  40131. source: "requiresSmalltalkContext: anObject\x0a\x09requiresSmalltalkContext := anObject",
  40132. referencedClasses: [],
  40133. messageSends: []
  40134. }),
  40135. $globals.IRClosureInstruction);
  40136. $core.addMethod(
  40137. $core.method({
  40138. selector: "scope:",
  40139. protocol: "accessing",
  40140. fn: function (aScope){
  40141. var self=this,$self=this;
  40142. return $core.withContext(function($ctx1) {
  40143. (
  40144. $ctx1.supercall = true,
  40145. ($globals.IRClosureInstruction.superclass||$boot.nilAsClass).fn.prototype._scope_.apply($self, [aScope]));
  40146. $ctx1.supercall = false;
  40147. $recv(aScope)._instruction_(self);
  40148. return self;
  40149. }, function($ctx1) {$ctx1.fill(self,"scope:",{aScope:aScope},$globals.IRClosureInstruction)});
  40150. },
  40151. args: ["aScope"],
  40152. source: "scope: aScope\x0a\x09super scope: aScope.\x0a\x09aScope instruction: self",
  40153. referencedClasses: [],
  40154. messageSends: ["scope:", "instruction:"]
  40155. }),
  40156. $globals.IRClosureInstruction);
  40157. $core.addMethod(
  40158. $core.method({
  40159. selector: "tempDeclarations",
  40160. protocol: "accessing",
  40161. fn: function (){
  40162. var self=this,$self=this;
  40163. return $core.withContext(function($ctx1) {
  40164. return $recv($self._dagChildren())._select_((function(each){
  40165. return $core.withContext(function($ctx2) {
  40166. return $recv(each)._isTempDeclaration();
  40167. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  40168. }));
  40169. }, function($ctx1) {$ctx1.fill(self,"tempDeclarations",{},$globals.IRClosureInstruction)});
  40170. },
  40171. args: [],
  40172. source: "tempDeclarations\x0a\x09^ self dagChildren select: [ :each |\x0a\x09\x09each isTempDeclaration ]",
  40173. referencedClasses: [],
  40174. messageSends: ["select:", "dagChildren", "isTempDeclaration"]
  40175. }),
  40176. $globals.IRClosureInstruction);
  40177. $core.addClass("IRClosure", $globals.IRClosureInstruction, [], "Compiler-IR");
  40178. $core.addMethod(
  40179. $core.method({
  40180. selector: "acceptDagVisitor:",
  40181. protocol: "visiting",
  40182. fn: function (aVisitor){
  40183. var self=this,$self=this;
  40184. return $core.withContext(function($ctx1) {
  40185. return $recv(aVisitor)._visitIRClosure_(self);
  40186. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRClosure)});
  40187. },
  40188. args: ["aVisitor"],
  40189. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRClosure: self",
  40190. referencedClasses: [],
  40191. messageSends: ["visitIRClosure:"]
  40192. }),
  40193. $globals.IRClosure);
  40194. $core.addMethod(
  40195. $core.method({
  40196. selector: "isClosure",
  40197. protocol: "testing",
  40198. fn: function (){
  40199. var self=this,$self=this;
  40200. return true;
  40201. },
  40202. args: [],
  40203. source: "isClosure\x0a\x09^ true",
  40204. referencedClasses: [],
  40205. messageSends: []
  40206. }),
  40207. $globals.IRClosure);
  40208. $core.addMethod(
  40209. $core.method({
  40210. selector: "sequence",
  40211. protocol: "accessing",
  40212. fn: function (){
  40213. var self=this,$self=this;
  40214. return $core.withContext(function($ctx1) {
  40215. return $recv($self._dagChildren())._last();
  40216. }, function($ctx1) {$ctx1.fill(self,"sequence",{},$globals.IRClosure)});
  40217. },
  40218. args: [],
  40219. source: "sequence\x0a\x09^ self dagChildren last",
  40220. referencedClasses: [],
  40221. messageSends: ["last", "dagChildren"]
  40222. }),
  40223. $globals.IRClosure);
  40224. $core.addClass("IRMethod", $globals.IRClosureInstruction, ["theClass", "source", "selector", "classReferences", "sendIndexes", "requiresSmalltalkContext", "internalVariables"], "Compiler-IR");
  40225. $globals.IRMethod.comment="I am a method instruction";
  40226. $core.addMethod(
  40227. $core.method({
  40228. selector: "acceptDagVisitor:",
  40229. protocol: "visiting",
  40230. fn: function (aVisitor){
  40231. var self=this,$self=this;
  40232. return $core.withContext(function($ctx1) {
  40233. return $recv(aVisitor)._visitIRMethod_(self);
  40234. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRMethod)});
  40235. },
  40236. args: ["aVisitor"],
  40237. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRMethod: self",
  40238. referencedClasses: [],
  40239. messageSends: ["visitIRMethod:"]
  40240. }),
  40241. $globals.IRMethod);
  40242. $core.addMethod(
  40243. $core.method({
  40244. selector: "classReferences",
  40245. protocol: "accessing",
  40246. fn: function (){
  40247. var self=this,$self=this;
  40248. return $self["@classReferences"];
  40249. },
  40250. args: [],
  40251. source: "classReferences\x0a\x09^ classReferences",
  40252. referencedClasses: [],
  40253. messageSends: []
  40254. }),
  40255. $globals.IRMethod);
  40256. $core.addMethod(
  40257. $core.method({
  40258. selector: "classReferences:",
  40259. protocol: "accessing",
  40260. fn: function (aCollection){
  40261. var self=this,$self=this;
  40262. $self["@classReferences"]=aCollection;
  40263. return self;
  40264. },
  40265. args: ["aCollection"],
  40266. source: "classReferences: aCollection\x0a\x09classReferences := aCollection",
  40267. referencedClasses: [],
  40268. messageSends: []
  40269. }),
  40270. $globals.IRMethod);
  40271. $core.addMethod(
  40272. $core.method({
  40273. selector: "internalVariables",
  40274. protocol: "accessing",
  40275. fn: function (){
  40276. var self=this,$self=this;
  40277. return $core.withContext(function($ctx1) {
  40278. var $1,$receiver;
  40279. $1=$self["@internalVariables"];
  40280. if(($receiver = $1) == null || $receiver.a$nil){
  40281. $self["@internalVariables"]=$recv($globals.Set)._new();
  40282. return $self["@internalVariables"];
  40283. } else {
  40284. return $1;
  40285. }
  40286. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRMethod)});
  40287. },
  40288. args: [],
  40289. source: "internalVariables\x0a\x09^ internalVariables ifNil: [ internalVariables := Set new ]",
  40290. referencedClasses: ["Set"],
  40291. messageSends: ["ifNil:", "new"]
  40292. }),
  40293. $globals.IRMethod);
  40294. $core.addMethod(
  40295. $core.method({
  40296. selector: "isMethod",
  40297. protocol: "testing",
  40298. fn: function (){
  40299. var self=this,$self=this;
  40300. return true;
  40301. },
  40302. args: [],
  40303. source: "isMethod\x0a\x09^ true",
  40304. referencedClasses: [],
  40305. messageSends: []
  40306. }),
  40307. $globals.IRMethod);
  40308. $core.addMethod(
  40309. $core.method({
  40310. selector: "messageSends",
  40311. protocol: "accessing",
  40312. fn: function (){
  40313. var self=this,$self=this;
  40314. return $core.withContext(function($ctx1) {
  40315. return $recv($self._sendIndexes())._keys();
  40316. }, function($ctx1) {$ctx1.fill(self,"messageSends",{},$globals.IRMethod)});
  40317. },
  40318. args: [],
  40319. source: "messageSends\x0a\x09^ self sendIndexes keys",
  40320. referencedClasses: [],
  40321. messageSends: ["keys", "sendIndexes"]
  40322. }),
  40323. $globals.IRMethod);
  40324. $core.addMethod(
  40325. $core.method({
  40326. selector: "method",
  40327. protocol: "accessing",
  40328. fn: function (){
  40329. var self=this,$self=this;
  40330. return self;
  40331. },
  40332. args: [],
  40333. source: "method\x0a\x09^ self",
  40334. referencedClasses: [],
  40335. messageSends: []
  40336. }),
  40337. $globals.IRMethod);
  40338. $core.addMethod(
  40339. $core.method({
  40340. selector: "selector",
  40341. protocol: "accessing",
  40342. fn: function (){
  40343. var self=this,$self=this;
  40344. return $self["@selector"];
  40345. },
  40346. args: [],
  40347. source: "selector\x0a\x09^ selector",
  40348. referencedClasses: [],
  40349. messageSends: []
  40350. }),
  40351. $globals.IRMethod);
  40352. $core.addMethod(
  40353. $core.method({
  40354. selector: "selector:",
  40355. protocol: "accessing",
  40356. fn: function (aString){
  40357. var self=this,$self=this;
  40358. $self["@selector"]=aString;
  40359. return self;
  40360. },
  40361. args: ["aString"],
  40362. source: "selector: aString\x0a\x09selector := aString",
  40363. referencedClasses: [],
  40364. messageSends: []
  40365. }),
  40366. $globals.IRMethod);
  40367. $core.addMethod(
  40368. $core.method({
  40369. selector: "sendIndexes",
  40370. protocol: "accessing",
  40371. fn: function (){
  40372. var self=this,$self=this;
  40373. return $self["@sendIndexes"];
  40374. },
  40375. args: [],
  40376. source: "sendIndexes\x0a\x09^ sendIndexes",
  40377. referencedClasses: [],
  40378. messageSends: []
  40379. }),
  40380. $globals.IRMethod);
  40381. $core.addMethod(
  40382. $core.method({
  40383. selector: "sendIndexes:",
  40384. protocol: "accessing",
  40385. fn: function (aDictionary){
  40386. var self=this,$self=this;
  40387. $self["@sendIndexes"]=aDictionary;
  40388. return self;
  40389. },
  40390. args: ["aDictionary"],
  40391. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  40392. referencedClasses: [],
  40393. messageSends: []
  40394. }),
  40395. $globals.IRMethod);
  40396. $core.addMethod(
  40397. $core.method({
  40398. selector: "source",
  40399. protocol: "accessing",
  40400. fn: function (){
  40401. var self=this,$self=this;
  40402. return $self["@source"];
  40403. },
  40404. args: [],
  40405. source: "source\x0a\x09^ source",
  40406. referencedClasses: [],
  40407. messageSends: []
  40408. }),
  40409. $globals.IRMethod);
  40410. $core.addMethod(
  40411. $core.method({
  40412. selector: "source:",
  40413. protocol: "accessing",
  40414. fn: function (aString){
  40415. var self=this,$self=this;
  40416. $self["@source"]=aString;
  40417. return self;
  40418. },
  40419. args: ["aString"],
  40420. source: "source: aString\x0a\x09source := aString",
  40421. referencedClasses: [],
  40422. messageSends: []
  40423. }),
  40424. $globals.IRMethod);
  40425. $core.addMethod(
  40426. $core.method({
  40427. selector: "theClass",
  40428. protocol: "accessing",
  40429. fn: function (){
  40430. var self=this,$self=this;
  40431. return $self["@theClass"];
  40432. },
  40433. args: [],
  40434. source: "theClass\x0a\x09^ theClass",
  40435. referencedClasses: [],
  40436. messageSends: []
  40437. }),
  40438. $globals.IRMethod);
  40439. $core.addMethod(
  40440. $core.method({
  40441. selector: "theClass:",
  40442. protocol: "accessing",
  40443. fn: function (aClass){
  40444. var self=this,$self=this;
  40445. $self["@theClass"]=aClass;
  40446. return self;
  40447. },
  40448. args: ["aClass"],
  40449. source: "theClass: aClass\x0a\x09theClass := aClass",
  40450. referencedClasses: [],
  40451. messageSends: []
  40452. }),
  40453. $globals.IRMethod);
  40454. $core.addClass("IRReturn", $globals.IRScopedInstruction, [], "Compiler-IR");
  40455. $globals.IRReturn.comment="I am a local return instruction.";
  40456. $core.addMethod(
  40457. $core.method({
  40458. selector: "acceptDagVisitor:",
  40459. protocol: "visiting",
  40460. fn: function (aVisitor){
  40461. var self=this,$self=this;
  40462. return $core.withContext(function($ctx1) {
  40463. return $recv(aVisitor)._visitIRReturn_(self);
  40464. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRReturn)});
  40465. },
  40466. args: ["aVisitor"],
  40467. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRReturn: self",
  40468. referencedClasses: [],
  40469. messageSends: ["visitIRReturn:"]
  40470. }),
  40471. $globals.IRReturn);
  40472. $core.addMethod(
  40473. $core.method({
  40474. selector: "expression",
  40475. protocol: "accessing",
  40476. fn: function (){
  40477. var self=this,$self=this;
  40478. return $core.withContext(function($ctx1) {
  40479. return $recv($self._dagChildren())._single();
  40480. }, function($ctx1) {$ctx1.fill(self,"expression",{},$globals.IRReturn)});
  40481. },
  40482. args: [],
  40483. source: "expression\x0a\x09^ self dagChildren single",
  40484. referencedClasses: [],
  40485. messageSends: ["single", "dagChildren"]
  40486. }),
  40487. $globals.IRReturn);
  40488. $core.addMethod(
  40489. $core.method({
  40490. selector: "scope",
  40491. protocol: "accessing",
  40492. fn: function (){
  40493. var self=this,$self=this;
  40494. return $core.withContext(function($ctx1) {
  40495. var $1,$receiver;
  40496. $1=$self["@scope"];
  40497. if(($receiver = $1) == null || $receiver.a$nil){
  40498. return $recv($self._parent())._scope();
  40499. } else {
  40500. return $1;
  40501. }
  40502. }, function($ctx1) {$ctx1.fill(self,"scope",{},$globals.IRReturn)});
  40503. },
  40504. args: [],
  40505. source: "scope\x0a\x09^ scope ifNil: [ self parent scope ]",
  40506. referencedClasses: [],
  40507. messageSends: ["ifNil:", "scope", "parent"]
  40508. }),
  40509. $globals.IRReturn);
  40510. $core.addMethod(
  40511. $core.method({
  40512. selector: "yieldsValue",
  40513. protocol: "testing",
  40514. fn: function (){
  40515. var self=this,$self=this;
  40516. return false;
  40517. },
  40518. args: [],
  40519. source: "yieldsValue\x0a\x09^ false",
  40520. referencedClasses: [],
  40521. messageSends: []
  40522. }),
  40523. $globals.IRReturn);
  40524. $core.addClass("IRBlockReturn", $globals.IRReturn, [], "Compiler-IR");
  40525. $globals.IRBlockReturn.comment="Smalltalk blocks return their last statement. I am a implicit block return instruction.";
  40526. $core.addMethod(
  40527. $core.method({
  40528. selector: "acceptDagVisitor:",
  40529. protocol: "visiting",
  40530. fn: function (aVisitor){
  40531. var self=this,$self=this;
  40532. return $core.withContext(function($ctx1) {
  40533. return $recv(aVisitor)._visitIRBlockReturn_(self);
  40534. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockReturn)});
  40535. },
  40536. args: ["aVisitor"],
  40537. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockReturn: self",
  40538. referencedClasses: [],
  40539. messageSends: ["visitIRBlockReturn:"]
  40540. }),
  40541. $globals.IRBlockReturn);
  40542. $core.addClass("IRNonLocalReturn", $globals.IRReturn, [], "Compiler-IR");
  40543. $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.";
  40544. $core.addMethod(
  40545. $core.method({
  40546. selector: "acceptDagVisitor:",
  40547. protocol: "visiting",
  40548. fn: function (aVisitor){
  40549. var self=this,$self=this;
  40550. return $core.withContext(function($ctx1) {
  40551. return $recv(aVisitor)._visitIRNonLocalReturn_(self);
  40552. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRNonLocalReturn)});
  40553. },
  40554. args: ["aVisitor"],
  40555. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRNonLocalReturn: self",
  40556. referencedClasses: [],
  40557. messageSends: ["visitIRNonLocalReturn:"]
  40558. }),
  40559. $globals.IRNonLocalReturn);
  40560. $core.addClass("IRTempDeclaration", $globals.IRScopedInstruction, ["name"], "Compiler-IR");
  40561. $core.addMethod(
  40562. $core.method({
  40563. selector: "acceptDagVisitor:",
  40564. protocol: "visiting",
  40565. fn: function (aVisitor){
  40566. var self=this,$self=this;
  40567. return $core.withContext(function($ctx1) {
  40568. return $recv(aVisitor)._visitIRTempDeclaration_(self);
  40569. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRTempDeclaration)});
  40570. },
  40571. args: ["aVisitor"],
  40572. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRTempDeclaration: self",
  40573. referencedClasses: [],
  40574. messageSends: ["visitIRTempDeclaration:"]
  40575. }),
  40576. $globals.IRTempDeclaration);
  40577. $core.addMethod(
  40578. $core.method({
  40579. selector: "isTempDeclaration",
  40580. protocol: "testing",
  40581. fn: function (){
  40582. var self=this,$self=this;
  40583. return true;
  40584. },
  40585. args: [],
  40586. source: "isTempDeclaration\x0a\x09^ true",
  40587. referencedClasses: [],
  40588. messageSends: []
  40589. }),
  40590. $globals.IRTempDeclaration);
  40591. $core.addMethod(
  40592. $core.method({
  40593. selector: "name",
  40594. protocol: "accessing",
  40595. fn: function (){
  40596. var self=this,$self=this;
  40597. return $self["@name"];
  40598. },
  40599. args: [],
  40600. source: "name\x0a\x09^ name",
  40601. referencedClasses: [],
  40602. messageSends: []
  40603. }),
  40604. $globals.IRTempDeclaration);
  40605. $core.addMethod(
  40606. $core.method({
  40607. selector: "name:",
  40608. protocol: "accessing",
  40609. fn: function (aString){
  40610. var self=this,$self=this;
  40611. $self["@name"]=aString;
  40612. return self;
  40613. },
  40614. args: ["aString"],
  40615. source: "name: aString\x0a\x09name := aString",
  40616. referencedClasses: [],
  40617. messageSends: []
  40618. }),
  40619. $globals.IRTempDeclaration);
  40620. $core.addClass("IRSend", $globals.IRInstruction, ["selector", "index"], "Compiler-IR");
  40621. $globals.IRSend.comment="I am a message send instruction.";
  40622. $core.addMethod(
  40623. $core.method({
  40624. selector: "acceptDagVisitor:",
  40625. protocol: "visiting",
  40626. fn: function (aVisitor){
  40627. var self=this,$self=this;
  40628. return $core.withContext(function($ctx1) {
  40629. return $recv(aVisitor)._visitIRSend_(self);
  40630. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSend)});
  40631. },
  40632. args: ["aVisitor"],
  40633. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSend: self",
  40634. referencedClasses: [],
  40635. messageSends: ["visitIRSend:"]
  40636. }),
  40637. $globals.IRSend);
  40638. $core.addMethod(
  40639. $core.method({
  40640. selector: "arguments",
  40641. protocol: "accessing",
  40642. fn: function (){
  40643. var self=this,$self=this;
  40644. return $core.withContext(function($ctx1) {
  40645. return $recv($self._dagChildren())._allButFirst();
  40646. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.IRSend)});
  40647. },
  40648. args: [],
  40649. source: "arguments\x0a\x09^ self dagChildren allButFirst",
  40650. referencedClasses: [],
  40651. messageSends: ["allButFirst", "dagChildren"]
  40652. }),
  40653. $globals.IRSend);
  40654. $core.addMethod(
  40655. $core.method({
  40656. selector: "index",
  40657. protocol: "accessing",
  40658. fn: function (){
  40659. var self=this,$self=this;
  40660. return $self["@index"];
  40661. },
  40662. args: [],
  40663. source: "index\x0a\x09^ index",
  40664. referencedClasses: [],
  40665. messageSends: []
  40666. }),
  40667. $globals.IRSend);
  40668. $core.addMethod(
  40669. $core.method({
  40670. selector: "index:",
  40671. protocol: "accessing",
  40672. fn: function (anInteger){
  40673. var self=this,$self=this;
  40674. $self["@index"]=anInteger;
  40675. return self;
  40676. },
  40677. args: ["anInteger"],
  40678. source: "index: anInteger\x0a\x09index := anInteger",
  40679. referencedClasses: [],
  40680. messageSends: []
  40681. }),
  40682. $globals.IRSend);
  40683. $core.addMethod(
  40684. $core.method({
  40685. selector: "isSend",
  40686. protocol: "testing",
  40687. fn: function (){
  40688. var self=this,$self=this;
  40689. return true;
  40690. },
  40691. args: [],
  40692. source: "isSend\x0a\x09^ true",
  40693. referencedClasses: [],
  40694. messageSends: []
  40695. }),
  40696. $globals.IRSend);
  40697. $core.addMethod(
  40698. $core.method({
  40699. selector: "receiver",
  40700. protocol: "accessing",
  40701. fn: function (){
  40702. var self=this,$self=this;
  40703. return $core.withContext(function($ctx1) {
  40704. return $recv($self._dagChildren())._first();
  40705. }, function($ctx1) {$ctx1.fill(self,"receiver",{},$globals.IRSend)});
  40706. },
  40707. args: [],
  40708. source: "receiver\x0a\x09^ self dagChildren first",
  40709. referencedClasses: [],
  40710. messageSends: ["first", "dagChildren"]
  40711. }),
  40712. $globals.IRSend);
  40713. $core.addMethod(
  40714. $core.method({
  40715. selector: "selector",
  40716. protocol: "accessing",
  40717. fn: function (){
  40718. var self=this,$self=this;
  40719. return $self["@selector"];
  40720. },
  40721. args: [],
  40722. source: "selector\x0a\x09^ selector",
  40723. referencedClasses: [],
  40724. messageSends: []
  40725. }),
  40726. $globals.IRSend);
  40727. $core.addMethod(
  40728. $core.method({
  40729. selector: "selector:",
  40730. protocol: "accessing",
  40731. fn: function (aString){
  40732. var self=this,$self=this;
  40733. $self["@selector"]=aString;
  40734. return self;
  40735. },
  40736. args: ["aString"],
  40737. source: "selector: aString\x0a\x09selector := aString",
  40738. referencedClasses: [],
  40739. messageSends: []
  40740. }),
  40741. $globals.IRSend);
  40742. $core.addClass("IRSequence", $globals.IRInstruction, [], "Compiler-IR");
  40743. $core.addMethod(
  40744. $core.method({
  40745. selector: "acceptDagVisitor:",
  40746. protocol: "visiting",
  40747. fn: function (aVisitor){
  40748. var self=this,$self=this;
  40749. return $core.withContext(function($ctx1) {
  40750. return $recv(aVisitor)._visitIRSequence_(self);
  40751. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRSequence)});
  40752. },
  40753. args: ["aVisitor"],
  40754. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRSequence: self",
  40755. referencedClasses: [],
  40756. messageSends: ["visitIRSequence:"]
  40757. }),
  40758. $globals.IRSequence);
  40759. $core.addMethod(
  40760. $core.method({
  40761. selector: "isSequence",
  40762. protocol: "testing",
  40763. fn: function (){
  40764. var self=this,$self=this;
  40765. return true;
  40766. },
  40767. args: [],
  40768. source: "isSequence\x0a\x09^ true",
  40769. referencedClasses: [],
  40770. messageSends: []
  40771. }),
  40772. $globals.IRSequence);
  40773. $core.addClass("IRBlockSequence", $globals.IRSequence, [], "Compiler-IR");
  40774. $core.addMethod(
  40775. $core.method({
  40776. selector: "acceptDagVisitor:",
  40777. protocol: "visiting",
  40778. fn: function (aVisitor){
  40779. var self=this,$self=this;
  40780. return $core.withContext(function($ctx1) {
  40781. return $recv(aVisitor)._visitIRBlockSequence_(self);
  40782. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRBlockSequence)});
  40783. },
  40784. args: ["aVisitor"],
  40785. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRBlockSequence: self",
  40786. referencedClasses: [],
  40787. messageSends: ["visitIRBlockSequence:"]
  40788. }),
  40789. $globals.IRBlockSequence);
  40790. $core.addClass("IRValue", $globals.IRInstruction, ["value"], "Compiler-IR");
  40791. $globals.IRValue.comment="I am the simplest possible instruction. I represent a value.";
  40792. $core.addMethod(
  40793. $core.method({
  40794. selector: "acceptDagVisitor:",
  40795. protocol: "visiting",
  40796. fn: function (aVisitor){
  40797. var self=this,$self=this;
  40798. return $core.withContext(function($ctx1) {
  40799. return $recv(aVisitor)._visitIRValue_(self);
  40800. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRValue)});
  40801. },
  40802. args: ["aVisitor"],
  40803. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRValue: self",
  40804. referencedClasses: [],
  40805. messageSends: ["visitIRValue:"]
  40806. }),
  40807. $globals.IRValue);
  40808. $core.addMethod(
  40809. $core.method({
  40810. selector: "needsBoxingAsReceiver",
  40811. protocol: "testing",
  40812. fn: function (){
  40813. var self=this,$self=this;
  40814. return false;
  40815. },
  40816. args: [],
  40817. source: "needsBoxingAsReceiver\x0a\x09^ false",
  40818. referencedClasses: [],
  40819. messageSends: []
  40820. }),
  40821. $globals.IRValue);
  40822. $core.addMethod(
  40823. $core.method({
  40824. selector: "value",
  40825. protocol: "accessing",
  40826. fn: function (){
  40827. var self=this,$self=this;
  40828. return $self["@value"];
  40829. },
  40830. args: [],
  40831. source: "value\x0a\x09^ value",
  40832. referencedClasses: [],
  40833. messageSends: []
  40834. }),
  40835. $globals.IRValue);
  40836. $core.addMethod(
  40837. $core.method({
  40838. selector: "value:",
  40839. protocol: "accessing",
  40840. fn: function (aString){
  40841. var self=this,$self=this;
  40842. $self["@value"]=aString;
  40843. return self;
  40844. },
  40845. args: ["aString"],
  40846. source: "value: aString\x0a\x09value := aString",
  40847. referencedClasses: [],
  40848. messageSends: []
  40849. }),
  40850. $globals.IRValue);
  40851. $core.addClass("IRVariable", $globals.IRInstruction, ["variable"], "Compiler-IR");
  40852. $globals.IRVariable.comment="I am a variable instruction.";
  40853. $core.addMethod(
  40854. $core.method({
  40855. selector: "acceptDagVisitor:",
  40856. protocol: "visiting",
  40857. fn: function (aVisitor){
  40858. var self=this,$self=this;
  40859. return $core.withContext(function($ctx1) {
  40860. return $recv(aVisitor)._visitIRVariable_(self);
  40861. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVariable)});
  40862. },
  40863. args: ["aVisitor"],
  40864. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVariable: self",
  40865. referencedClasses: [],
  40866. messageSends: ["visitIRVariable:"]
  40867. }),
  40868. $globals.IRVariable);
  40869. $core.addMethod(
  40870. $core.method({
  40871. selector: "isSelf",
  40872. protocol: "testing",
  40873. fn: function (){
  40874. var self=this,$self=this;
  40875. return $core.withContext(function($ctx1) {
  40876. return $recv($self._variable())._isSelf();
  40877. }, function($ctx1) {$ctx1.fill(self,"isSelf",{},$globals.IRVariable)});
  40878. },
  40879. args: [],
  40880. source: "isSelf\x0a\x09^ self variable isSelf",
  40881. referencedClasses: [],
  40882. messageSends: ["isSelf", "variable"]
  40883. }),
  40884. $globals.IRVariable);
  40885. $core.addMethod(
  40886. $core.method({
  40887. selector: "isSuper",
  40888. protocol: "testing",
  40889. fn: function (){
  40890. var self=this,$self=this;
  40891. return $core.withContext(function($ctx1) {
  40892. return $recv($self._variable())._isSuper();
  40893. }, function($ctx1) {$ctx1.fill(self,"isSuper",{},$globals.IRVariable)});
  40894. },
  40895. args: [],
  40896. source: "isSuper\x0a\x09^ self variable isSuper",
  40897. referencedClasses: [],
  40898. messageSends: ["isSuper", "variable"]
  40899. }),
  40900. $globals.IRVariable);
  40901. $core.addMethod(
  40902. $core.method({
  40903. selector: "isVariable",
  40904. protocol: "testing",
  40905. fn: function (){
  40906. var self=this,$self=this;
  40907. return true;
  40908. },
  40909. args: [],
  40910. source: "isVariable\x0a\x09^ true",
  40911. referencedClasses: [],
  40912. messageSends: []
  40913. }),
  40914. $globals.IRVariable);
  40915. $core.addMethod(
  40916. $core.method({
  40917. selector: "needsBoxingAsReceiver",
  40918. protocol: "testing",
  40919. fn: function (){
  40920. var self=this,$self=this;
  40921. return $core.withContext(function($ctx1) {
  40922. return $recv($recv($self._variable())._isPseudoVar())._not();
  40923. }, function($ctx1) {$ctx1.fill(self,"needsBoxingAsReceiver",{},$globals.IRVariable)});
  40924. },
  40925. args: [],
  40926. source: "needsBoxingAsReceiver\x0a\x09^ self variable isPseudoVar not",
  40927. referencedClasses: [],
  40928. messageSends: ["not", "isPseudoVar", "variable"]
  40929. }),
  40930. $globals.IRVariable);
  40931. $core.addMethod(
  40932. $core.method({
  40933. selector: "variable",
  40934. protocol: "accessing",
  40935. fn: function (){
  40936. var self=this,$self=this;
  40937. return $self["@variable"];
  40938. },
  40939. args: [],
  40940. source: "variable\x0a\x09^ variable",
  40941. referencedClasses: [],
  40942. messageSends: []
  40943. }),
  40944. $globals.IRVariable);
  40945. $core.addMethod(
  40946. $core.method({
  40947. selector: "variable:",
  40948. protocol: "accessing",
  40949. fn: function (aScopeVariable){
  40950. var self=this,$self=this;
  40951. $self["@variable"]=aScopeVariable;
  40952. return self;
  40953. },
  40954. args: ["aScopeVariable"],
  40955. source: "variable: aScopeVariable\x0a\x09variable := aScopeVariable",
  40956. referencedClasses: [],
  40957. messageSends: []
  40958. }),
  40959. $globals.IRVariable);
  40960. $core.addClass("IRVerbatim", $globals.IRInstruction, ["source"], "Compiler-IR");
  40961. $core.addMethod(
  40962. $core.method({
  40963. selector: "acceptDagVisitor:",
  40964. protocol: "visiting",
  40965. fn: function (aVisitor){
  40966. var self=this,$self=this;
  40967. return $core.withContext(function($ctx1) {
  40968. return $recv(aVisitor)._visitIRVerbatim_(self);
  40969. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRVerbatim)});
  40970. },
  40971. args: ["aVisitor"],
  40972. source: "acceptDagVisitor: aVisitor\x0a\x09^ aVisitor visitIRVerbatim: self",
  40973. referencedClasses: [],
  40974. messageSends: ["visitIRVerbatim:"]
  40975. }),
  40976. $globals.IRVerbatim);
  40977. $core.addMethod(
  40978. $core.method({
  40979. selector: "source",
  40980. protocol: "accessing",
  40981. fn: function (){
  40982. var self=this,$self=this;
  40983. return $self["@source"];
  40984. },
  40985. args: [],
  40986. source: "source\x0a\x09^ source",
  40987. referencedClasses: [],
  40988. messageSends: []
  40989. }),
  40990. $globals.IRVerbatim);
  40991. $core.addMethod(
  40992. $core.method({
  40993. selector: "source:",
  40994. protocol: "accessing",
  40995. fn: function (aString){
  40996. var self=this,$self=this;
  40997. $self["@source"]=aString;
  40998. return self;
  40999. },
  41000. args: ["aString"],
  41001. source: "source: aString\x0a\x09source := aString",
  41002. referencedClasses: [],
  41003. messageSends: []
  41004. }),
  41005. $globals.IRVerbatim);
  41006. $core.addClass("IRVisitor", $globals.ParentFakingPathDagVisitor, [], "Compiler-IR");
  41007. $core.addMethod(
  41008. $core.method({
  41009. selector: "visitDagNode:",
  41010. protocol: "visiting",
  41011. fn: function (aNode){
  41012. var self=this,$self=this;
  41013. return $core.withContext(function($ctx1) {
  41014. return $self._visitDagNodeVariantSimple_(aNode);
  41015. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.IRVisitor)});
  41016. },
  41017. args: ["aNode"],
  41018. source: "visitDagNode: aNode\x0a\x09^ self visitDagNodeVariantSimple: aNode",
  41019. referencedClasses: [],
  41020. messageSends: ["visitDagNodeVariantSimple:"]
  41021. }),
  41022. $globals.IRVisitor);
  41023. $core.addMethod(
  41024. $core.method({
  41025. selector: "visitIRAssignment:",
  41026. protocol: "visiting",
  41027. fn: function (anIRAssignment){
  41028. var self=this,$self=this;
  41029. return $core.withContext(function($ctx1) {
  41030. return $self._visitDagNode_(anIRAssignment);
  41031. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRVisitor)});
  41032. },
  41033. args: ["anIRAssignment"],
  41034. source: "visitIRAssignment: anIRAssignment\x0a\x09^ self visitDagNode: anIRAssignment",
  41035. referencedClasses: [],
  41036. messageSends: ["visitDagNode:"]
  41037. }),
  41038. $globals.IRVisitor);
  41039. $core.addMethod(
  41040. $core.method({
  41041. selector: "visitIRBlockReturn:",
  41042. protocol: "visiting",
  41043. fn: function (anIRBlockReturn){
  41044. var self=this,$self=this;
  41045. return $core.withContext(function($ctx1) {
  41046. return $self._visitIRReturn_(anIRBlockReturn);
  41047. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockReturn:",{anIRBlockReturn:anIRBlockReturn},$globals.IRVisitor)});
  41048. },
  41049. args: ["anIRBlockReturn"],
  41050. source: "visitIRBlockReturn: anIRBlockReturn\x0a\x09^ self visitIRReturn: anIRBlockReturn",
  41051. referencedClasses: [],
  41052. messageSends: ["visitIRReturn:"]
  41053. }),
  41054. $globals.IRVisitor);
  41055. $core.addMethod(
  41056. $core.method({
  41057. selector: "visitIRBlockSequence:",
  41058. protocol: "visiting",
  41059. fn: function (anIRBlockSequence){
  41060. var self=this,$self=this;
  41061. return $core.withContext(function($ctx1) {
  41062. return $self._visitIRSequence_(anIRBlockSequence);
  41063. }, function($ctx1) {$ctx1.fill(self,"visitIRBlockSequence:",{anIRBlockSequence:anIRBlockSequence},$globals.IRVisitor)});
  41064. },
  41065. args: ["anIRBlockSequence"],
  41066. source: "visitIRBlockSequence: anIRBlockSequence\x0a\x09^ self visitIRSequence: anIRBlockSequence",
  41067. referencedClasses: [],
  41068. messageSends: ["visitIRSequence:"]
  41069. }),
  41070. $globals.IRVisitor);
  41071. $core.addMethod(
  41072. $core.method({
  41073. selector: "visitIRClosure:",
  41074. protocol: "visiting",
  41075. fn: function (anIRClosure){
  41076. var self=this,$self=this;
  41077. return $core.withContext(function($ctx1) {
  41078. return $self._visitDagNode_(anIRClosure);
  41079. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRVisitor)});
  41080. },
  41081. args: ["anIRClosure"],
  41082. source: "visitIRClosure: anIRClosure\x0a\x09^ self visitDagNode: anIRClosure",
  41083. referencedClasses: [],
  41084. messageSends: ["visitDagNode:"]
  41085. }),
  41086. $globals.IRVisitor);
  41087. $core.addMethod(
  41088. $core.method({
  41089. selector: "visitIRDynamicArray:",
  41090. protocol: "visiting",
  41091. fn: function (anIRDynamicArray){
  41092. var self=this,$self=this;
  41093. return $core.withContext(function($ctx1) {
  41094. return $self._visitDagNode_(anIRDynamicArray);
  41095. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRVisitor)});
  41096. },
  41097. args: ["anIRDynamicArray"],
  41098. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09^ self visitDagNode: anIRDynamicArray",
  41099. referencedClasses: [],
  41100. messageSends: ["visitDagNode:"]
  41101. }),
  41102. $globals.IRVisitor);
  41103. $core.addMethod(
  41104. $core.method({
  41105. selector: "visitIRDynamicDictionary:",
  41106. protocol: "visiting",
  41107. fn: function (anIRDynamicDictionary){
  41108. var self=this,$self=this;
  41109. return $core.withContext(function($ctx1) {
  41110. return $self._visitDagNode_(anIRDynamicDictionary);
  41111. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRVisitor)});
  41112. },
  41113. args: ["anIRDynamicDictionary"],
  41114. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09^ self visitDagNode: anIRDynamicDictionary",
  41115. referencedClasses: [],
  41116. messageSends: ["visitDagNode:"]
  41117. }),
  41118. $globals.IRVisitor);
  41119. $core.addMethod(
  41120. $core.method({
  41121. selector: "visitIRInlinedClosure:",
  41122. protocol: "visiting",
  41123. fn: function (anIRInlinedClosure){
  41124. var self=this,$self=this;
  41125. return $core.withContext(function($ctx1) {
  41126. return $self._visitIRClosure_(anIRInlinedClosure);
  41127. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRVisitor)});
  41128. },
  41129. args: ["anIRInlinedClosure"],
  41130. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09^ self visitIRClosure: anIRInlinedClosure",
  41131. referencedClasses: [],
  41132. messageSends: ["visitIRClosure:"]
  41133. }),
  41134. $globals.IRVisitor);
  41135. $core.addMethod(
  41136. $core.method({
  41137. selector: "visitIRInlinedSequence:",
  41138. protocol: "visiting",
  41139. fn: function (anIRInlinedSequence){
  41140. var self=this,$self=this;
  41141. return $core.withContext(function($ctx1) {
  41142. return $self._visitIRSequence_(anIRInlinedSequence);
  41143. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedSequence:",{anIRInlinedSequence:anIRInlinedSequence},$globals.IRVisitor)});
  41144. },
  41145. args: ["anIRInlinedSequence"],
  41146. source: "visitIRInlinedSequence: anIRInlinedSequence\x0a\x09^ self visitIRSequence: anIRInlinedSequence",
  41147. referencedClasses: [],
  41148. messageSends: ["visitIRSequence:"]
  41149. }),
  41150. $globals.IRVisitor);
  41151. $core.addMethod(
  41152. $core.method({
  41153. selector: "visitIRMethod:",
  41154. protocol: "visiting",
  41155. fn: function (anIRMethod){
  41156. var self=this,$self=this;
  41157. return $core.withContext(function($ctx1) {
  41158. return $self._visitDagNode_(anIRMethod);
  41159. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRVisitor)});
  41160. },
  41161. args: ["anIRMethod"],
  41162. source: "visitIRMethod: anIRMethod\x0a\x09^ self visitDagNode: anIRMethod",
  41163. referencedClasses: [],
  41164. messageSends: ["visitDagNode:"]
  41165. }),
  41166. $globals.IRVisitor);
  41167. $core.addMethod(
  41168. $core.method({
  41169. selector: "visitIRNonLocalReturn:",
  41170. protocol: "visiting",
  41171. fn: function (anIRNonLocalReturn){
  41172. var self=this,$self=this;
  41173. return $core.withContext(function($ctx1) {
  41174. return $self._visitDagNode_(anIRNonLocalReturn);
  41175. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRVisitor)});
  41176. },
  41177. args: ["anIRNonLocalReturn"],
  41178. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09^ self visitDagNode: anIRNonLocalReturn",
  41179. referencedClasses: [],
  41180. messageSends: ["visitDagNode:"]
  41181. }),
  41182. $globals.IRVisitor);
  41183. $core.addMethod(
  41184. $core.method({
  41185. selector: "visitIRNonLocalReturnHandling:",
  41186. protocol: "visiting",
  41187. fn: function (anIRNonLocalReturnHandling){
  41188. var self=this,$self=this;
  41189. return $core.withContext(function($ctx1) {
  41190. return $self._visitDagNode_(anIRNonLocalReturnHandling);
  41191. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturnHandling:",{anIRNonLocalReturnHandling:anIRNonLocalReturnHandling},$globals.IRVisitor)});
  41192. },
  41193. args: ["anIRNonLocalReturnHandling"],
  41194. source: "visitIRNonLocalReturnHandling: anIRNonLocalReturnHandling\x0a\x09^ self visitDagNode: anIRNonLocalReturnHandling",
  41195. referencedClasses: [],
  41196. messageSends: ["visitDagNode:"]
  41197. }),
  41198. $globals.IRVisitor);
  41199. $core.addMethod(
  41200. $core.method({
  41201. selector: "visitIRReturn:",
  41202. protocol: "visiting",
  41203. fn: function (anIRReturn){
  41204. var self=this,$self=this;
  41205. return $core.withContext(function($ctx1) {
  41206. return $self._visitDagNode_(anIRReturn);
  41207. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRVisitor)});
  41208. },
  41209. args: ["anIRReturn"],
  41210. source: "visitIRReturn: anIRReturn\x0a\x09^ self visitDagNode: anIRReturn",
  41211. referencedClasses: [],
  41212. messageSends: ["visitDagNode:"]
  41213. }),
  41214. $globals.IRVisitor);
  41215. $core.addMethod(
  41216. $core.method({
  41217. selector: "visitIRSend:",
  41218. protocol: "visiting",
  41219. fn: function (anIRSend){
  41220. var self=this,$self=this;
  41221. return $core.withContext(function($ctx1) {
  41222. return $self._visitDagNode_(anIRSend);
  41223. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRVisitor)});
  41224. },
  41225. args: ["anIRSend"],
  41226. source: "visitIRSend: anIRSend\x0a\x09^ self visitDagNode: anIRSend",
  41227. referencedClasses: [],
  41228. messageSends: ["visitDagNode:"]
  41229. }),
  41230. $globals.IRVisitor);
  41231. $core.addMethod(
  41232. $core.method({
  41233. selector: "visitIRSequence:",
  41234. protocol: "visiting",
  41235. fn: function (anIRSequence){
  41236. var self=this,$self=this;
  41237. return $core.withContext(function($ctx1) {
  41238. return $self._visitDagNode_(anIRSequence);
  41239. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRVisitor)});
  41240. },
  41241. args: ["anIRSequence"],
  41242. source: "visitIRSequence: anIRSequence\x0a\x09^ self visitDagNode: anIRSequence",
  41243. referencedClasses: [],
  41244. messageSends: ["visitDagNode:"]
  41245. }),
  41246. $globals.IRVisitor);
  41247. $core.addMethod(
  41248. $core.method({
  41249. selector: "visitIRTempDeclaration:",
  41250. protocol: "visiting",
  41251. fn: function (anIRTempDeclaration){
  41252. var self=this,$self=this;
  41253. return $core.withContext(function($ctx1) {
  41254. return $self._visitDagNode_(anIRTempDeclaration);
  41255. }, function($ctx1) {$ctx1.fill(self,"visitIRTempDeclaration:",{anIRTempDeclaration:anIRTempDeclaration},$globals.IRVisitor)});
  41256. },
  41257. args: ["anIRTempDeclaration"],
  41258. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09^ self visitDagNode: anIRTempDeclaration",
  41259. referencedClasses: [],
  41260. messageSends: ["visitDagNode:"]
  41261. }),
  41262. $globals.IRVisitor);
  41263. $core.addMethod(
  41264. $core.method({
  41265. selector: "visitIRValue:",
  41266. protocol: "visiting",
  41267. fn: function (anIRValue){
  41268. var self=this,$self=this;
  41269. return $core.withContext(function($ctx1) {
  41270. return $self._visitDagNode_(anIRValue);
  41271. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRVisitor)});
  41272. },
  41273. args: ["anIRValue"],
  41274. source: "visitIRValue: anIRValue\x0a\x09^ self visitDagNode: anIRValue",
  41275. referencedClasses: [],
  41276. messageSends: ["visitDagNode:"]
  41277. }),
  41278. $globals.IRVisitor);
  41279. $core.addMethod(
  41280. $core.method({
  41281. selector: "visitIRVariable:",
  41282. protocol: "visiting",
  41283. fn: function (anIRVariable){
  41284. var self=this,$self=this;
  41285. return $core.withContext(function($ctx1) {
  41286. return $self._visitDagNode_(anIRVariable);
  41287. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRVisitor)});
  41288. },
  41289. args: ["anIRVariable"],
  41290. source: "visitIRVariable: anIRVariable\x0a\x09^ self visitDagNode: anIRVariable",
  41291. referencedClasses: [],
  41292. messageSends: ["visitDagNode:"]
  41293. }),
  41294. $globals.IRVisitor);
  41295. $core.addMethod(
  41296. $core.method({
  41297. selector: "visitIRVerbatim:",
  41298. protocol: "visiting",
  41299. fn: function (anIRVerbatim){
  41300. var self=this,$self=this;
  41301. return $core.withContext(function($ctx1) {
  41302. return $self._visitDagNode_(anIRVerbatim);
  41303. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRVisitor)});
  41304. },
  41305. args: ["anIRVerbatim"],
  41306. source: "visitIRVerbatim: anIRVerbatim\x0a\x09^ self visitDagNode: anIRVerbatim",
  41307. referencedClasses: [],
  41308. messageSends: ["visitDagNode:"]
  41309. }),
  41310. $globals.IRVisitor);
  41311. $core.addClass("IRJSTranslator", $globals.IRVisitor, ["stream", "currentClass"], "Compiler-IR");
  41312. $core.addMethod(
  41313. $core.method({
  41314. selector: "contents",
  41315. protocol: "accessing",
  41316. fn: function (){
  41317. var self=this,$self=this;
  41318. return $core.withContext(function($ctx1) {
  41319. return $recv($self._stream())._contents();
  41320. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.IRJSTranslator)});
  41321. },
  41322. args: [],
  41323. source: "contents\x0a\x09^ self stream contents",
  41324. referencedClasses: [],
  41325. messageSends: ["contents", "stream"]
  41326. }),
  41327. $globals.IRJSTranslator);
  41328. $core.addMethod(
  41329. $core.method({
  41330. selector: "currentClass",
  41331. protocol: "accessing",
  41332. fn: function (){
  41333. var self=this,$self=this;
  41334. return $self["@currentClass"];
  41335. },
  41336. args: [],
  41337. source: "currentClass\x0a\x09^ currentClass",
  41338. referencedClasses: [],
  41339. messageSends: []
  41340. }),
  41341. $globals.IRJSTranslator);
  41342. $core.addMethod(
  41343. $core.method({
  41344. selector: "currentClass:",
  41345. protocol: "accessing",
  41346. fn: function (aClass){
  41347. var self=this,$self=this;
  41348. $self["@currentClass"]=aClass;
  41349. return self;
  41350. },
  41351. args: ["aClass"],
  41352. source: "currentClass: aClass\x0a\x09currentClass := aClass",
  41353. referencedClasses: [],
  41354. messageSends: []
  41355. }),
  41356. $globals.IRJSTranslator);
  41357. $core.addMethod(
  41358. $core.method({
  41359. selector: "initialize",
  41360. protocol: "initialization",
  41361. fn: function (){
  41362. var self=this,$self=this;
  41363. return $core.withContext(function($ctx1) {
  41364. (
  41365. $ctx1.supercall = true,
  41366. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41367. $ctx1.supercall = false;
  41368. $self["@stream"]=$recv($globals.JSStream)._new();
  41369. return self;
  41370. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.IRJSTranslator)});
  41371. },
  41372. args: [],
  41373. source: "initialize\x0a\x09super initialize.\x0a\x09stream := JSStream new.",
  41374. referencedClasses: ["JSStream"],
  41375. messageSends: ["initialize", "new"]
  41376. }),
  41377. $globals.IRJSTranslator);
  41378. $core.addMethod(
  41379. $core.method({
  41380. selector: "stream",
  41381. protocol: "accessing",
  41382. fn: function (){
  41383. var self=this,$self=this;
  41384. return $self["@stream"];
  41385. },
  41386. args: [],
  41387. source: "stream\x0a\x09^ stream",
  41388. referencedClasses: [],
  41389. messageSends: []
  41390. }),
  41391. $globals.IRJSTranslator);
  41392. $core.addMethod(
  41393. $core.method({
  41394. selector: "stream:",
  41395. protocol: "accessing",
  41396. fn: function (aStream){
  41397. var self=this,$self=this;
  41398. $self["@stream"]=aStream;
  41399. return self;
  41400. },
  41401. args: ["aStream"],
  41402. source: "stream: aStream\x0a\x09stream := aStream",
  41403. referencedClasses: [],
  41404. messageSends: []
  41405. }),
  41406. $globals.IRJSTranslator);
  41407. $core.addMethod(
  41408. $core.method({
  41409. selector: "visitIRAssignment:",
  41410. protocol: "visiting",
  41411. fn: function (anIRAssignment){
  41412. var self=this,$self=this;
  41413. return $core.withContext(function($ctx1) {
  41414. $recv($self._stream())._nextPutAssignLhs_rhs_((function(){
  41415. return $core.withContext(function($ctx2) {
  41416. return $self._visit_($recv(anIRAssignment)._left());
  41417. $ctx2.sendIdx["visit:"]=1;
  41418. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41419. }),(function(){
  41420. return $core.withContext(function($ctx2) {
  41421. return $self._visit_($recv(anIRAssignment)._right());
  41422. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41423. }));
  41424. return self;
  41425. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRJSTranslator)});
  41426. },
  41427. args: ["anIRAssignment"],
  41428. source: "visitIRAssignment: anIRAssignment\x0a\x09self stream\x0a\x09\x09nextPutAssignLhs: [self visit: anIRAssignment left]\x0a\x09\x09rhs: [self visit: anIRAssignment right].",
  41429. referencedClasses: [],
  41430. messageSends: ["nextPutAssignLhs:rhs:", "stream", "visit:", "left", "right"]
  41431. }),
  41432. $globals.IRJSTranslator);
  41433. $core.addMethod(
  41434. $core.method({
  41435. selector: "visitIRClosure:",
  41436. protocol: "visiting",
  41437. fn: function (anIRClosure){
  41438. var self=this,$self=this;
  41439. return $core.withContext(function($ctx1) {
  41440. var $1,$2;
  41441. $1=$self._stream();
  41442. $ctx1.sendIdx["stream"]=1;
  41443. $recv($1)._nextPutClosureWith_arguments_((function(){
  41444. return $core.withContext(function($ctx2) {
  41445. $2=$self._stream();
  41446. $ctx2.sendIdx["stream"]=2;
  41447. $recv($2)._nextPutVars_($recv($recv(anIRClosure)._tempDeclarations())._collect_((function(each){
  41448. return $core.withContext(function($ctx3) {
  41449. return $recv($recv(each)._name())._asVariableName();
  41450. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  41451. })));
  41452. return $recv($self._stream())._nextPutBlockContextFor_during_(anIRClosure,(function(){
  41453. return $core.withContext(function($ctx3) {
  41454. return (
  41455. $ctx3.supercall = true,
  41456. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRClosure_.apply($self, [anIRClosure]));
  41457. $ctx3.supercall = false;
  41458. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  41459. }));
  41460. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41461. }),$recv(anIRClosure)._arguments());
  41462. return self;
  41463. }, function($ctx1) {$ctx1.fill(self,"visitIRClosure:",{anIRClosure:anIRClosure},$globals.IRJSTranslator)});
  41464. },
  41465. args: ["anIRClosure"],
  41466. 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",
  41467. referencedClasses: [],
  41468. messageSends: ["nextPutClosureWith:arguments:", "stream", "nextPutVars:", "collect:", "tempDeclarations", "asVariableName", "name", "nextPutBlockContextFor:during:", "visitIRClosure:", "arguments"]
  41469. }),
  41470. $globals.IRJSTranslator);
  41471. $core.addMethod(
  41472. $core.method({
  41473. selector: "visitIRDynamicArray:",
  41474. protocol: "visiting",
  41475. fn: function (anIRDynamicArray){
  41476. var self=this,$self=this;
  41477. return $core.withContext(function($ctx1) {
  41478. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicArray)._dagChildren(),"[","]");
  41479. return self;
  41480. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicArray:",{anIRDynamicArray:anIRDynamicArray},$globals.IRJSTranslator)});
  41481. },
  41482. args: ["anIRDynamicArray"],
  41483. source: "visitIRDynamicArray: anIRDynamicArray\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicArray dagChildren\x0a\x09\x09enclosedBetween: '[' and: ']'",
  41484. referencedClasses: [],
  41485. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41486. }),
  41487. $globals.IRJSTranslator);
  41488. $core.addMethod(
  41489. $core.method({
  41490. selector: "visitIRDynamicDictionary:",
  41491. protocol: "visiting",
  41492. fn: function (anIRDynamicDictionary){
  41493. var self=this,$self=this;
  41494. return $core.withContext(function($ctx1) {
  41495. $self._visitInstructionList_enclosedBetween_and_($recv(anIRDynamicDictionary)._dagChildren(),"$globals.HashedCollection._newFromPairs_([","])");
  41496. return self;
  41497. }, function($ctx1) {$ctx1.fill(self,"visitIRDynamicDictionary:",{anIRDynamicDictionary:anIRDynamicDictionary},$globals.IRJSTranslator)});
  41498. },
  41499. args: ["anIRDynamicDictionary"],
  41500. source: "visitIRDynamicDictionary: anIRDynamicDictionary\x0a\x09self\x0a\x09\x09visitInstructionList: anIRDynamicDictionary dagChildren\x0a\x09\x09enclosedBetween: '$globals.HashedCollection._newFromPairs_([' and: '])'",
  41501. referencedClasses: [],
  41502. messageSends: ["visitInstructionList:enclosedBetween:and:", "dagChildren"]
  41503. }),
  41504. $globals.IRJSTranslator);
  41505. $core.addMethod(
  41506. $core.method({
  41507. selector: "visitIRMethod:",
  41508. protocol: "visiting",
  41509. fn: function (anIRMethod){
  41510. var self=this,$self=this;
  41511. return $core.withContext(function($ctx1) {
  41512. var $1,$2,$3,$4,$5,$6,$7;
  41513. $1=$self._stream();
  41514. $ctx1.sendIdx["stream"]=1;
  41515. $recv($1)._nextPutMethodDeclaration_with_(anIRMethod,(function(){
  41516. return $core.withContext(function($ctx2) {
  41517. $2=$self._stream();
  41518. $ctx2.sendIdx["stream"]=2;
  41519. return $recv($2)._nextPutFunctionWith_arguments_((function(){
  41520. return $core.withContext(function($ctx3) {
  41521. $3=$self._stream();
  41522. $ctx3.sendIdx["stream"]=3;
  41523. $4=$recv($recv(anIRMethod)._tempDeclarations())._collect_((function(each){
  41524. return $core.withContext(function($ctx4) {
  41525. return $recv($recv(each)._name())._asVariableName();
  41526. }, function($ctx4) {$ctx4.fillBlock({each:each},$ctx3,3)});
  41527. }));
  41528. $ctx3.sendIdx["collect:"]=1;
  41529. $recv($3)._nextPutVars_($4);
  41530. $ctx3.sendIdx["nextPutVars:"]=1;
  41531. $5=$self._stream();
  41532. $ctx3.sendIdx["stream"]=4;
  41533. return $recv($5)._nextPutContextFor_during_(anIRMethod,(function(){
  41534. return $core.withContext(function($ctx4) {
  41535. $recv($recv(anIRMethod)._internalVariables())._ifNotEmpty_((function(internalVars){
  41536. return $core.withContext(function($ctx5) {
  41537. $6=$self._stream();
  41538. $ctx5.sendIdx["stream"]=5;
  41539. return $recv($6)._nextPutVars_($recv($recv(internalVars)._asSet())._collect_((function(each){
  41540. return $core.withContext(function($ctx6) {
  41541. return $recv($recv(each)._variable())._alias();
  41542. }, function($ctx6) {$ctx6.fillBlock({each:each},$ctx5,6)});
  41543. })));
  41544. }, function($ctx5) {$ctx5.fillBlock({internalVars:internalVars},$ctx4,5)});
  41545. }));
  41546. $7=$recv($recv(anIRMethod)._scope())._hasNonLocalReturn();
  41547. if($core.assert($7)){
  41548. return $recv($self._stream())._nextPutNonLocalReturnHandlingWith_((function(){
  41549. return $core.withContext(function($ctx5) {
  41550. return (
  41551. $ctx5.supercall = true,
  41552. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41553. $ctx5.supercall = false;
  41554. $ctx5.sendIdx["visitIRMethod:"]=1;
  41555. }, function($ctx5) {$ctx5.fillBlock({},$ctx4,8)});
  41556. }));
  41557. } else {
  41558. return (
  41559. $ctx4.supercall = true,
  41560. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRMethod_.apply($self, [anIRMethod]));
  41561. $ctx4.supercall = false;
  41562. }
  41563. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,4)});
  41564. }));
  41565. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41566. }),$recv(anIRMethod)._arguments());
  41567. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41568. }));
  41569. return $self._contents();
  41570. }, function($ctx1) {$ctx1.fill(self,"visitIRMethod:",{anIRMethod:anIRMethod},$globals.IRJSTranslator)});
  41571. },
  41572. args: ["anIRMethod"],
  41573. 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",
  41574. referencedClasses: [],
  41575. 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"]
  41576. }),
  41577. $globals.IRJSTranslator);
  41578. $core.addMethod(
  41579. $core.method({
  41580. selector: "visitIRNonLocalReturn:",
  41581. protocol: "visiting",
  41582. fn: function (anIRNonLocalReturn){
  41583. var self=this,$self=this;
  41584. return $core.withContext(function($ctx1) {
  41585. $recv($self._stream())._nextPutNonLocalReturnWith_((function(){
  41586. return $core.withContext(function($ctx2) {
  41587. return (
  41588. $ctx2.supercall = true,
  41589. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  41590. $ctx2.supercall = false;
  41591. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41592. }));
  41593. return self;
  41594. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn},$globals.IRJSTranslator)});
  41595. },
  41596. args: ["anIRNonLocalReturn"],
  41597. source: "visitIRNonLocalReturn: anIRNonLocalReturn\x0a\x09self stream nextPutNonLocalReturnWith: [\x0a\x09\x09super visitIRNonLocalReturn: anIRNonLocalReturn ]",
  41598. referencedClasses: [],
  41599. messageSends: ["nextPutNonLocalReturnWith:", "stream", "visitIRNonLocalReturn:"]
  41600. }),
  41601. $globals.IRJSTranslator);
  41602. $core.addMethod(
  41603. $core.method({
  41604. selector: "visitIRReturn:",
  41605. protocol: "visiting",
  41606. fn: function (anIRReturn){
  41607. var self=this,$self=this;
  41608. return $core.withContext(function($ctx1) {
  41609. $recv($self._stream())._nextPutReturnWith_((function(){
  41610. return $core.withContext(function($ctx2) {
  41611. return (
  41612. $ctx2.supercall = true,
  41613. ($globals.IRJSTranslator.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  41614. $ctx2.supercall = false;
  41615. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  41616. }));
  41617. return self;
  41618. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRJSTranslator)});
  41619. },
  41620. args: ["anIRReturn"],
  41621. source: "visitIRReturn: anIRReturn\x0a\x09self stream nextPutReturnWith: [\x0a\x09\x09super visitIRReturn: anIRReturn ]",
  41622. referencedClasses: [],
  41623. messageSends: ["nextPutReturnWith:", "stream", "visitIRReturn:"]
  41624. }),
  41625. $globals.IRJSTranslator);
  41626. $core.addMethod(
  41627. $core.method({
  41628. selector: "visitIRSend:",
  41629. protocol: "visiting",
  41630. fn: function (anIRSend){
  41631. var self=this,$self=this;
  41632. var sends,superclass;
  41633. return $core.withContext(function($ctx1) {
  41634. var $1,$2;
  41635. sends=$recv($recv($recv($recv(anIRSend)._method())._sendIndexes())._at_($recv(anIRSend)._selector()))._size();
  41636. $1=$recv($recv(anIRSend)._receiver())._isSuper();
  41637. if($core.assert($1)){
  41638. $self._visitSuperSend_(anIRSend);
  41639. } else {
  41640. $self._visitSend_(anIRSend);
  41641. }
  41642. $2=$recv($recv(anIRSend)._index()).__lt(sends);
  41643. if($core.assert($2)){
  41644. $recv($self._stream())._nextPutSendIndexFor_(anIRSend);
  41645. }
  41646. return self;
  41647. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend,sends:sends,superclass:superclass},$globals.IRJSTranslator)});
  41648. },
  41649. args: ["anIRSend"],
  41650. 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 ]",
  41651. referencedClasses: [],
  41652. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "ifTrue:ifFalse:", "isSuper", "receiver", "visitSuperSend:", "visitSend:", "ifTrue:", "<", "index", "nextPutSendIndexFor:", "stream"]
  41653. }),
  41654. $globals.IRJSTranslator);
  41655. $core.addMethod(
  41656. $core.method({
  41657. selector: "visitIRSequence:",
  41658. protocol: "visiting",
  41659. fn: function (anIRSequence){
  41660. var self=this,$self=this;
  41661. return $core.withContext(function($ctx1) {
  41662. $recv($recv(anIRSequence)._dagChildren())._do_((function(each){
  41663. return $core.withContext(function($ctx2) {
  41664. return $recv($self._stream())._nextPutStatementWith_((function(){
  41665. return $core.withContext(function($ctx3) {
  41666. return $self._visit_(each);
  41667. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  41668. }));
  41669. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41670. }));
  41671. return self;
  41672. }, function($ctx1) {$ctx1.fill(self,"visitIRSequence:",{anIRSequence:anIRSequence},$globals.IRJSTranslator)});
  41673. },
  41674. args: ["anIRSequence"],
  41675. source: "visitIRSequence: anIRSequence\x0a\x09anIRSequence dagChildren do: [ :each |\x0a\x09\x09self stream nextPutStatementWith: [ self visit: each ] ]",
  41676. referencedClasses: [],
  41677. messageSends: ["do:", "dagChildren", "nextPutStatementWith:", "stream", "visit:"]
  41678. }),
  41679. $globals.IRJSTranslator);
  41680. $core.addMethod(
  41681. $core.method({
  41682. selector: "visitIRTempDeclaration:",
  41683. protocol: "visiting",
  41684. fn: function (anIRTempDeclaration){
  41685. var self=this,$self=this;
  41686. return self;
  41687. },
  41688. args: ["anIRTempDeclaration"],
  41689. source: "visitIRTempDeclaration: anIRTempDeclaration\x0a\x09\x22self stream\x0a\x09\x09nextPutAll: 'var ', anIRTempDeclaration name asVariableName, ';';\x0a\x09\x09lf\x22",
  41690. referencedClasses: [],
  41691. messageSends: []
  41692. }),
  41693. $globals.IRJSTranslator);
  41694. $core.addMethod(
  41695. $core.method({
  41696. selector: "visitIRValue:",
  41697. protocol: "visiting",
  41698. fn: function (anIRValue){
  41699. var self=this,$self=this;
  41700. return $core.withContext(function($ctx1) {
  41701. $recv($self._stream())._nextPutAll_($recv($recv(anIRValue)._value())._asJavaScriptSource());
  41702. return self;
  41703. }, function($ctx1) {$ctx1.fill(self,"visitIRValue:",{anIRValue:anIRValue},$globals.IRJSTranslator)});
  41704. },
  41705. args: ["anIRValue"],
  41706. source: "visitIRValue: anIRValue\x0a\x09self stream nextPutAll: anIRValue value asJavaScriptSource",
  41707. referencedClasses: [],
  41708. messageSends: ["nextPutAll:", "stream", "asJavaScriptSource", "value"]
  41709. }),
  41710. $globals.IRJSTranslator);
  41711. $core.addMethod(
  41712. $core.method({
  41713. selector: "visitIRVariable:",
  41714. protocol: "visiting",
  41715. fn: function (anIRVariable){
  41716. var self=this,$self=this;
  41717. return $core.withContext(function($ctx1) {
  41718. var $3,$2,$1,$4;
  41719. $3=$recv(anIRVariable)._variable();
  41720. $ctx1.sendIdx["variable"]=1;
  41721. $2=$recv($3)._name();
  41722. $1=$recv($2).__eq("thisContext");
  41723. if($core.assert($1)){
  41724. $4=$self._stream();
  41725. $ctx1.sendIdx["stream"]=1;
  41726. $recv($4)._nextPutAll_("$core.getThisContext()");
  41727. $ctx1.sendIdx["nextPutAll:"]=1;
  41728. } else {
  41729. $recv($self._stream())._nextPutAll_($recv($recv(anIRVariable)._variable())._alias());
  41730. }
  41731. return self;
  41732. }, function($ctx1) {$ctx1.fill(self,"visitIRVariable:",{anIRVariable:anIRVariable},$globals.IRJSTranslator)});
  41733. },
  41734. args: ["anIRVariable"],
  41735. 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 ]",
  41736. referencedClasses: [],
  41737. messageSends: ["ifTrue:ifFalse:", "=", "name", "variable", "nextPutAll:", "stream", "alias"]
  41738. }),
  41739. $globals.IRJSTranslator);
  41740. $core.addMethod(
  41741. $core.method({
  41742. selector: "visitIRVerbatim:",
  41743. protocol: "visiting",
  41744. fn: function (anIRVerbatim){
  41745. var self=this,$self=this;
  41746. return $core.withContext(function($ctx1) {
  41747. $recv($self._stream())._nextPutAll_($recv(anIRVerbatim)._source());
  41748. return self;
  41749. }, function($ctx1) {$ctx1.fill(self,"visitIRVerbatim:",{anIRVerbatim:anIRVerbatim},$globals.IRJSTranslator)});
  41750. },
  41751. args: ["anIRVerbatim"],
  41752. source: "visitIRVerbatim: anIRVerbatim\x0a\x09self stream nextPutAll: anIRVerbatim source",
  41753. referencedClasses: [],
  41754. messageSends: ["nextPutAll:", "stream", "source"]
  41755. }),
  41756. $globals.IRJSTranslator);
  41757. $core.addMethod(
  41758. $core.method({
  41759. selector: "visitInstructionList:enclosedBetween:and:",
  41760. protocol: "visiting",
  41761. fn: function (anArray,aString,anotherString){
  41762. var self=this,$self=this;
  41763. return $core.withContext(function($ctx1) {
  41764. var $1;
  41765. $1=$self._stream();
  41766. $ctx1.sendIdx["stream"]=1;
  41767. $recv($1)._nextPutAll_(aString);
  41768. $ctx1.sendIdx["nextPutAll:"]=1;
  41769. $recv(anArray)._do_separatedBy_((function(each){
  41770. return $core.withContext(function($ctx2) {
  41771. return $self._visit_(each);
  41772. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  41773. }),(function(){
  41774. return $core.withContext(function($ctx2) {
  41775. return $recv($self._stream())._nextPutAll_(",");
  41776. $ctx2.sendIdx["nextPutAll:"]=2;
  41777. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  41778. }));
  41779. $recv($self["@stream"])._nextPutAll_(anotherString);
  41780. return self;
  41781. }, function($ctx1) {$ctx1.fill(self,"visitInstructionList:enclosedBetween:and:",{anArray:anArray,aString:aString,anotherString:anotherString},$globals.IRJSTranslator)});
  41782. },
  41783. args: ["anArray", "aString", "anotherString"],
  41784. 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",
  41785. referencedClasses: [],
  41786. messageSends: ["nextPutAll:", "stream", "do:separatedBy:", "visit:"]
  41787. }),
  41788. $globals.IRJSTranslator);
  41789. $core.addMethod(
  41790. $core.method({
  41791. selector: "visitReceiver:",
  41792. protocol: "visiting",
  41793. fn: function (anIRInstruction){
  41794. var self=this,$self=this;
  41795. var instr;
  41796. return $core.withContext(function($ctx1) {
  41797. var $1,$2,$4,$5,$3,$6,$7,$8;
  41798. $1=$recv(anIRInstruction)._isSelf();
  41799. if($core.assert($1)){
  41800. $2=$recv(anIRInstruction)._copy();
  41801. $ctx1.sendIdx["copy"]=1;
  41802. $4=$recv($recv(anIRInstruction)._variable())._copy();
  41803. $recv($4)._name_("$self");
  41804. $5=$recv($4)._yourself();
  41805. $ctx1.sendIdx["yourself"]=1;
  41806. $3=$5;
  41807. $recv($2)._variable_($3);
  41808. instr=$recv($2)._yourself();
  41809. instr;
  41810. } else {
  41811. instr=anIRInstruction;
  41812. instr;
  41813. }
  41814. $6=$recv(instr)._needsBoxingAsReceiver();
  41815. if(!$core.assert($6)){
  41816. $7=$self._visit_(instr);
  41817. $ctx1.sendIdx["visit:"]=1;
  41818. return $7;
  41819. }
  41820. $8=$self._stream();
  41821. $ctx1.sendIdx["stream"]=1;
  41822. $recv($8)._nextPutAll_("$recv(");
  41823. $ctx1.sendIdx["nextPutAll:"]=1;
  41824. $self._visit_(instr);
  41825. $recv($self._stream())._nextPutAll_(")");
  41826. return self;
  41827. }, function($ctx1) {$ctx1.fill(self,"visitReceiver:",{anIRInstruction:anIRInstruction,instr:instr},$globals.IRJSTranslator)});
  41828. },
  41829. args: ["anIRInstruction"],
  41830. 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: ')'",
  41831. referencedClasses: [],
  41832. messageSends: ["ifTrue:ifFalse:", "isSelf", "variable:", "copy", "name:", "variable", "yourself", "ifFalse:", "needsBoxingAsReceiver", "visit:", "nextPutAll:", "stream"]
  41833. }),
  41834. $globals.IRJSTranslator);
  41835. $core.addMethod(
  41836. $core.method({
  41837. selector: "visitSend:",
  41838. protocol: "visiting",
  41839. fn: function (anIRSend){
  41840. var self=this,$self=this;
  41841. return $core.withContext(function($ctx1) {
  41842. $self._visitReceiver_($recv(anIRSend)._receiver());
  41843. $recv($self._stream())._nextPutAll_(".".__comma($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()));
  41844. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"(",")");
  41845. return self;
  41846. }, function($ctx1) {$ctx1.fill(self,"visitSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41847. },
  41848. args: ["anIRSend"],
  41849. 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: ')'",
  41850. referencedClasses: [],
  41851. messageSends: ["visitReceiver:", "receiver", "nextPutAll:", "stream", ",", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41852. }),
  41853. $globals.IRJSTranslator);
  41854. $core.addMethod(
  41855. $core.method({
  41856. selector: "visitSuperSend:",
  41857. protocol: "visiting",
  41858. fn: function (anIRSend){
  41859. var self=this,$self=this;
  41860. return $core.withContext(function($ctx1) {
  41861. var $1,$4,$3,$2,$5,$6,$7,$8;
  41862. $1=$self._stream();
  41863. $ctx1.sendIdx["stream"]=1;
  41864. $recv($1)._nextPutAll_("(");
  41865. $ctx1.sendIdx["nextPutAll:"]=1;
  41866. $recv($1)._lf();
  41867. $ctx1.sendIdx["lf"]=1;
  41868. $recv($1)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41869. $ctx1.sendIdx["nextPutAll:"]=2;
  41870. $recv($1)._lf();
  41871. $ctx1.sendIdx["lf"]=2;
  41872. $4=$recv(anIRSend)._scope();
  41873. $ctx1.sendIdx["scope"]=1;
  41874. $3=$recv($4)._alias();
  41875. $ctx1.sendIdx["alias"]=1;
  41876. $2=$recv($3).__comma(".supercall = true,");
  41877. $ctx1.sendIdx[","]=1;
  41878. $recv($1)._nextPutAll_($2);
  41879. $ctx1.sendIdx["nextPutAll:"]=3;
  41880. $recv($1)._lf();
  41881. $ctx1.sendIdx["lf"]=3;
  41882. $recv($1)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41883. $ctx1.sendIdx["nextPutAll:"]=4;
  41884. $recv($1)._lf();
  41885. $ctx1.sendIdx["lf"]=4;
  41886. $5="(".__comma($recv($self._currentClass())._asJavaScriptSource());
  41887. $ctx1.sendIdx[","]=2;
  41888. $recv($1)._nextPutAll_($5);
  41889. $ctx1.sendIdx["nextPutAll:"]=5;
  41890. $recv($1)._nextPutAll_(".superclass||$boot.nilAsClass).fn.prototype.");
  41891. $ctx1.sendIdx["nextPutAll:"]=6;
  41892. $6=$recv($recv($recv(anIRSend)._selector())._asJavaScriptMethodName()).__comma(".apply(");
  41893. $ctx1.sendIdx[","]=3;
  41894. $recv($1)._nextPutAll_($6);
  41895. $ctx1.sendIdx["nextPutAll:"]=7;
  41896. $7=$recv($1)._nextPutAll_("$self, ");
  41897. $ctx1.sendIdx["nextPutAll:"]=8;
  41898. $self._visitInstructionList_enclosedBetween_and_($recv(anIRSend)._arguments(),"[","]");
  41899. $8=$self._stream();
  41900. $recv($8)._nextPutAll_("));");
  41901. $ctx1.sendIdx["nextPutAll:"]=9;
  41902. $recv($8)._lf();
  41903. $ctx1.sendIdx["lf"]=5;
  41904. $recv($8)._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  41905. $ctx1.sendIdx["nextPutAll:"]=10;
  41906. $recv($8)._lf();
  41907. $ctx1.sendIdx["lf"]=6;
  41908. $recv($8)._nextPutAll_($recv($recv($recv(anIRSend)._scope())._alias()).__comma(".supercall = false;"));
  41909. $ctx1.sendIdx["nextPutAll:"]=11;
  41910. $recv($8)._lf();
  41911. $recv($8)._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  41912. return self;
  41913. }, function($ctx1) {$ctx1.fill(self,"visitSuperSend:",{anIRSend:anIRSend},$globals.IRJSTranslator)});
  41914. },
  41915. args: ["anIRSend"],
  41916. 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);'",
  41917. referencedClasses: [],
  41918. messageSends: ["nextPutAll:", "stream", "lf", ",", "alias", "scope", "asJavaScriptSource", "currentClass", "asJavaScriptMethodName", "selector", "visitInstructionList:enclosedBetween:and:", "arguments"]
  41919. }),
  41920. $globals.IRJSTranslator);
  41921. $core.addClass("JSStream", $globals.Object, ["stream", "omitSemicolon"], "Compiler-IR");
  41922. $core.addMethod(
  41923. $core.method({
  41924. selector: "contents",
  41925. protocol: "accessing",
  41926. fn: function (){
  41927. var self=this,$self=this;
  41928. return $core.withContext(function($ctx1) {
  41929. return $recv($self["@stream"])._contents();
  41930. }, function($ctx1) {$ctx1.fill(self,"contents",{},$globals.JSStream)});
  41931. },
  41932. args: [],
  41933. source: "contents\x0a\x09^ stream contents",
  41934. referencedClasses: [],
  41935. messageSends: ["contents"]
  41936. }),
  41937. $globals.JSStream);
  41938. $core.addMethod(
  41939. $core.method({
  41940. selector: "initialize",
  41941. protocol: "initialization",
  41942. fn: function (){
  41943. var self=this,$self=this;
  41944. return $core.withContext(function($ctx1) {
  41945. (
  41946. $ctx1.supercall = true,
  41947. ($globals.JSStream.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  41948. $ctx1.supercall = false;
  41949. $self["@stream"]=""._writeStream();
  41950. return self;
  41951. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.JSStream)});
  41952. },
  41953. args: [],
  41954. source: "initialize\x0a\x09super initialize.\x0a\x09stream := '' writeStream.",
  41955. referencedClasses: [],
  41956. messageSends: ["initialize", "writeStream"]
  41957. }),
  41958. $globals.JSStream);
  41959. $core.addMethod(
  41960. $core.method({
  41961. selector: "lf",
  41962. protocol: "streaming",
  41963. fn: function (){
  41964. var self=this,$self=this;
  41965. return $core.withContext(function($ctx1) {
  41966. $recv($self["@stream"])._lf();
  41967. return self;
  41968. }, function($ctx1) {$ctx1.fill(self,"lf",{},$globals.JSStream)});
  41969. },
  41970. args: [],
  41971. source: "lf\x0a\x09stream lf",
  41972. referencedClasses: [],
  41973. messageSends: ["lf"]
  41974. }),
  41975. $globals.JSStream);
  41976. $core.addMethod(
  41977. $core.method({
  41978. selector: "nextPut:",
  41979. protocol: "streaming",
  41980. fn: function (aString){
  41981. var self=this,$self=this;
  41982. return $core.withContext(function($ctx1) {
  41983. $recv($self["@stream"])._nextPut_(aString);
  41984. return self;
  41985. }, function($ctx1) {$ctx1.fill(self,"nextPut:",{aString:aString},$globals.JSStream)});
  41986. },
  41987. args: ["aString"],
  41988. source: "nextPut: aString\x0a\x09stream nextPut: aString",
  41989. referencedClasses: [],
  41990. messageSends: ["nextPut:"]
  41991. }),
  41992. $globals.JSStream);
  41993. $core.addMethod(
  41994. $core.method({
  41995. selector: "nextPutAll:",
  41996. protocol: "streaming",
  41997. fn: function (aString){
  41998. var self=this,$self=this;
  41999. return $core.withContext(function($ctx1) {
  42000. $recv($self["@stream"])._nextPutAll_(aString);
  42001. return self;
  42002. }, function($ctx1) {$ctx1.fill(self,"nextPutAll:",{aString:aString},$globals.JSStream)});
  42003. },
  42004. args: ["aString"],
  42005. source: "nextPutAll: aString\x0a\x09stream nextPutAll: aString",
  42006. referencedClasses: [],
  42007. messageSends: ["nextPutAll:"]
  42008. }),
  42009. $globals.JSStream);
  42010. $core.addMethod(
  42011. $core.method({
  42012. selector: "nextPutAssignLhs:rhs:",
  42013. protocol: "streaming",
  42014. fn: function (aBlock,anotherBlock){
  42015. var self=this,$self=this;
  42016. return $core.withContext(function($ctx1) {
  42017. $recv(aBlock)._value();
  42018. $ctx1.sendIdx["value"]=1;
  42019. $recv($self["@stream"])._nextPutAll_("=");
  42020. $recv(anotherBlock)._value();
  42021. return self;
  42022. }, function($ctx1) {$ctx1.fill(self,"nextPutAssignLhs:rhs:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42023. },
  42024. args: ["aBlock", "anotherBlock"],
  42025. source: "nextPutAssignLhs: aBlock rhs: anotherBlock\x0a\x09aBlock value.\x0a\x09stream nextPutAll: '='.\x0a\x09anotherBlock value",
  42026. referencedClasses: [],
  42027. messageSends: ["value", "nextPutAll:"]
  42028. }),
  42029. $globals.JSStream);
  42030. $core.addMethod(
  42031. $core.method({
  42032. selector: "nextPutBlockContextFor:during:",
  42033. protocol: "streaming",
  42034. fn: function (anIRClosure,aBlock){
  42035. var self=this,$self=this;
  42036. return $core.withContext(function($ctx1) {
  42037. var $1,$2,$6,$5,$4,$3,$7,$11,$10,$9,$8,$15,$14,$13,$12,$16,$17,$23,$22,$21,$20,$19,$18;
  42038. $1=$recv(anIRClosure)._requiresSmalltalkContext();
  42039. if(!$core.assert($1)){
  42040. $2=$recv(aBlock)._value();
  42041. $ctx1.sendIdx["value"]=1;
  42042. return $2;
  42043. }
  42044. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42045. $ctx1.sendIdx["nextPutAll:"]=1;
  42046. $self._lf();
  42047. $ctx1.sendIdx["lf"]=1;
  42048. $6=$recv(anIRClosure)._scope();
  42049. $ctx1.sendIdx["scope"]=1;
  42050. $5=$recv($6)._alias();
  42051. $ctx1.sendIdx["alias"]=1;
  42052. $4="return $core.withContext(function(".__comma($5);
  42053. $ctx1.sendIdx[","]=2;
  42054. $3=$recv($4).__comma(") {");
  42055. $ctx1.sendIdx[","]=1;
  42056. $self._nextPutAll_($3);
  42057. $ctx1.sendIdx["nextPutAll:"]=2;
  42058. $self._lf();
  42059. $ctx1.sendIdx["lf"]=2;
  42060. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42061. $ctx1.sendIdx["nextPutAll:"]=3;
  42062. $7=$self._lf();
  42063. $ctx1.sendIdx["lf"]=3;
  42064. $recv(aBlock)._value();
  42065. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42066. $ctx1.sendIdx["nextPutAll:"]=4;
  42067. $self._lf();
  42068. $ctx1.sendIdx["lf"]=4;
  42069. $11=$recv(anIRClosure)._scope();
  42070. $ctx1.sendIdx["scope"]=2;
  42071. $10=$recv($11)._alias();
  42072. $ctx1.sendIdx["alias"]=2;
  42073. $9="}, function(".__comma($10);
  42074. $ctx1.sendIdx[","]=4;
  42075. $8=$recv($9).__comma(") {");
  42076. $ctx1.sendIdx[","]=3;
  42077. $self._nextPutAll_($8);
  42078. $ctx1.sendIdx["nextPutAll:"]=5;
  42079. $15=$recv(anIRClosure)._scope();
  42080. $ctx1.sendIdx["scope"]=3;
  42081. $14=$recv($15)._alias();
  42082. $ctx1.sendIdx["alias"]=3;
  42083. $13=$recv($14).__comma(".fillBlock({");
  42084. $ctx1.sendIdx[","]=5;
  42085. $12=$self._nextPutAll_($13);
  42086. $ctx1.sendIdx["nextPutAll:"]=6;
  42087. $recv($recv(anIRClosure)._locals())._do_separatedBy_((function(each){
  42088. return $core.withContext(function($ctx2) {
  42089. $16=$recv(each)._asVariableName();
  42090. $ctx2.sendIdx["asVariableName"]=1;
  42091. $self._nextPutAll_($16);
  42092. $ctx2.sendIdx["nextPutAll:"]=7;
  42093. $self._nextPutAll_(":");
  42094. $ctx2.sendIdx["nextPutAll:"]=8;
  42095. $17=$self._nextPutAll_($recv(each)._asVariableName());
  42096. $ctx2.sendIdx["nextPutAll:"]=9;
  42097. return $17;
  42098. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42099. }),(function(){
  42100. return $core.withContext(function($ctx2) {
  42101. return $self._nextPutAll_(",");
  42102. $ctx2.sendIdx["nextPutAll:"]=10;
  42103. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42104. }));
  42105. $self._nextPutAll_("},");
  42106. $ctx1.sendIdx["nextPutAll:"]=11;
  42107. $23=$recv(anIRClosure)._scope();
  42108. $ctx1.sendIdx["scope"]=4;
  42109. $22=$recv($23)._outerScope();
  42110. $21=$recv($22)._alias();
  42111. $20=$recv($21).__comma(",");
  42112. $19=$recv($20).__comma($recv($recv($recv(anIRClosure)._scope())._blockIndex())._asString());
  42113. $ctx1.sendIdx[","]=7;
  42114. $18=$recv($19).__comma(")});");
  42115. $ctx1.sendIdx[","]=6;
  42116. $self._nextPutAll_($18);
  42117. $ctx1.sendIdx["nextPutAll:"]=12;
  42118. $self._lf();
  42119. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42120. return self;
  42121. }, function($ctx1) {$ctx1.fill(self,"nextPutBlockContextFor:during:",{anIRClosure:anIRClosure,aBlock:aBlock},$globals.JSStream)});
  42122. },
  42123. args: ["anIRClosure", "aBlock"],
  42124. 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);'",
  42125. referencedClasses: [],
  42126. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "do:separatedBy:", "locals", "asVariableName", "outerScope", "asString", "blockIndex"]
  42127. }),
  42128. $globals.JSStream);
  42129. $core.addMethod(
  42130. $core.method({
  42131. selector: "nextPutClosureWith:arguments:",
  42132. protocol: "streaming",
  42133. fn: function (aBlock,anArray){
  42134. var self=this,$self=this;
  42135. return $core.withContext(function($ctx1) {
  42136. var $1,$2,$3;
  42137. $recv($self["@stream"])._nextPutAll_("(function(");
  42138. $ctx1.sendIdx["nextPutAll:"]=1;
  42139. $recv(anArray)._do_separatedBy_((function(each){
  42140. return $core.withContext(function($ctx2) {
  42141. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42142. $ctx2.sendIdx["nextPutAll:"]=2;
  42143. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42144. }),(function(){
  42145. return $core.withContext(function($ctx2) {
  42146. return $recv($self["@stream"])._nextPut_(",");
  42147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42148. }));
  42149. $1=$self["@stream"];
  42150. $recv($1)._nextPutAll_("){");
  42151. $ctx1.sendIdx["nextPutAll:"]=3;
  42152. $2=$recv($1)._lf();
  42153. $ctx1.sendIdx["lf"]=1;
  42154. $recv(aBlock)._value();
  42155. $3=$self["@stream"];
  42156. $recv($3)._lf();
  42157. $recv($3)._nextPutAll_("})");
  42158. return self;
  42159. }, function($ctx1) {$ctx1.fill(self,"nextPutClosureWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42160. },
  42161. args: ["aBlock", "anArray"],
  42162. 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: '})'",
  42163. referencedClasses: [],
  42164. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42165. }),
  42166. $globals.JSStream);
  42167. $core.addMethod(
  42168. $core.method({
  42169. selector: "nextPutContextFor:during:",
  42170. protocol: "streaming",
  42171. fn: function (aMethod,aBlock){
  42172. var self=this,$self=this;
  42173. return $core.withContext(function($ctx1) {
  42174. var $1,$2,$6,$5,$4,$3,$7,$12,$11,$10,$9,$8,$16,$15,$14,$13,$17,$18;
  42175. $1=$recv(aMethod)._requiresSmalltalkContext();
  42176. if(!$core.assert($1)){
  42177. $2=$recv(aBlock)._value();
  42178. $ctx1.sendIdx["value"]=1;
  42179. return $2;
  42180. }
  42181. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42182. $ctx1.sendIdx["nextPutAll:"]=1;
  42183. $self._lf();
  42184. $ctx1.sendIdx["lf"]=1;
  42185. $6=$recv(aMethod)._scope();
  42186. $ctx1.sendIdx["scope"]=1;
  42187. $5=$recv($6)._alias();
  42188. $ctx1.sendIdx["alias"]=1;
  42189. $4="return $core.withContext(function(".__comma($5);
  42190. $ctx1.sendIdx[","]=2;
  42191. $3=$recv($4).__comma(") {");
  42192. $ctx1.sendIdx[","]=1;
  42193. $self._nextPutAll_($3);
  42194. $ctx1.sendIdx["nextPutAll:"]=2;
  42195. $self._lf();
  42196. $ctx1.sendIdx["lf"]=2;
  42197. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42198. $ctx1.sendIdx["nextPutAll:"]=3;
  42199. $7=$self._lf();
  42200. $ctx1.sendIdx["lf"]=3;
  42201. $recv(aBlock)._value();
  42202. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42203. $ctx1.sendIdx["nextPutAll:"]=4;
  42204. $self._lf();
  42205. $ctx1.sendIdx["lf"]=4;
  42206. $12=$recv(aMethod)._scope();
  42207. $ctx1.sendIdx["scope"]=2;
  42208. $11=$recv($12)._alias();
  42209. $ctx1.sendIdx["alias"]=2;
  42210. $10="}, function(".__comma($11);
  42211. $ctx1.sendIdx[","]=5;
  42212. $9=$recv($10).__comma(") {");
  42213. $ctx1.sendIdx[","]=4;
  42214. $8=$recv($9).__comma($recv($recv(aMethod)._scope())._alias());
  42215. $ctx1.sendIdx[","]=3;
  42216. $self._nextPutAll_($8);
  42217. $ctx1.sendIdx["nextPutAll:"]=5;
  42218. $16=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42219. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42220. $15=".fill(self,".__comma($16);
  42221. $14=$recv($15).__comma(",{");
  42222. $ctx1.sendIdx[","]=6;
  42223. $13=$self._nextPutAll_($14);
  42224. $ctx1.sendIdx["nextPutAll:"]=6;
  42225. $recv($recv(aMethod)._locals())._do_separatedBy_((function(each){
  42226. return $core.withContext(function($ctx2) {
  42227. $17=$recv(each)._asVariableName();
  42228. $ctx2.sendIdx["asVariableName"]=1;
  42229. $self._nextPutAll_($17);
  42230. $ctx2.sendIdx["nextPutAll:"]=7;
  42231. $self._nextPutAll_(":");
  42232. $ctx2.sendIdx["nextPutAll:"]=8;
  42233. $18=$self._nextPutAll_($recv(each)._asVariableName());
  42234. $ctx2.sendIdx["nextPutAll:"]=9;
  42235. return $18;
  42236. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42237. }),(function(){
  42238. return $core.withContext(function($ctx2) {
  42239. return $self._nextPutAll_(",");
  42240. $ctx2.sendIdx["nextPutAll:"]=10;
  42241. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42242. }));
  42243. $self._nextPutAll_("},");
  42244. $ctx1.sendIdx["nextPutAll:"]=11;
  42245. $self._nextPutAll_($recv($recv(aMethod)._theClass())._asJavaScriptSource());
  42246. $ctx1.sendIdx["nextPutAll:"]=12;
  42247. $self._nextPutAll_(")});");
  42248. $ctx1.sendIdx["nextPutAll:"]=13;
  42249. $self._lf();
  42250. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22);");
  42251. return self;
  42252. }, function($ctx1) {$ctx1.fill(self,"nextPutContextFor:during:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42253. },
  42254. args: ["aMethod", "aBlock"],
  42255. 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);'",
  42256. referencedClasses: [],
  42257. messageSends: ["ifFalse:", "requiresSmalltalkContext", "value", "nextPutAll:", "lf", ",", "alias", "scope", "asJavaScriptSource", "selector", "do:separatedBy:", "locals", "asVariableName", "theClass"]
  42258. }),
  42259. $globals.JSStream);
  42260. $core.addMethod(
  42261. $core.method({
  42262. selector: "nextPutFunctionWith:arguments:",
  42263. protocol: "streaming",
  42264. fn: function (aBlock,anArray){
  42265. var self=this,$self=this;
  42266. return $core.withContext(function($ctx1) {
  42267. var $1,$2,$3,$4,$5;
  42268. $recv($self["@stream"])._nextPutAll_("fn: function (");
  42269. $ctx1.sendIdx["nextPutAll:"]=1;
  42270. $recv(anArray)._do_separatedBy_((function(each){
  42271. return $core.withContext(function($ctx2) {
  42272. return $recv($self["@stream"])._nextPutAll_($recv(each)._asVariableName());
  42273. $ctx2.sendIdx["nextPutAll:"]=2;
  42274. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42275. }),(function(){
  42276. return $core.withContext(function($ctx2) {
  42277. return $recv($self["@stream"])._nextPut_(",");
  42278. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  42279. }));
  42280. $1=$self["@stream"];
  42281. $recv($1)._nextPutAll_("){");
  42282. $ctx1.sendIdx["nextPutAll:"]=3;
  42283. $2=$recv($1)._lf();
  42284. $ctx1.sendIdx["lf"]=1;
  42285. $3=$self["@stream"];
  42286. $recv($3)._nextPutAll_("var self=this,$self=this;");
  42287. $ctx1.sendIdx["nextPutAll:"]=4;
  42288. $4=$recv($3)._lf();
  42289. $ctx1.sendIdx["lf"]=2;
  42290. $recv(aBlock)._value();
  42291. $5=$self["@stream"];
  42292. $recv($5)._lf();
  42293. $recv($5)._nextPutAll_("}");
  42294. return self;
  42295. }, function($ctx1) {$ctx1.fill(self,"nextPutFunctionWith:arguments:",{aBlock:aBlock,anArray:anArray},$globals.JSStream)});
  42296. },
  42297. args: ["aBlock", "anArray"],
  42298. 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: '}'",
  42299. referencedClasses: [],
  42300. messageSends: ["nextPutAll:", "do:separatedBy:", "asVariableName", "nextPut:", "lf", "value"]
  42301. }),
  42302. $globals.JSStream);
  42303. $core.addMethod(
  42304. $core.method({
  42305. selector: "nextPutIf:then:",
  42306. protocol: "streaming",
  42307. fn: function (aBlock,anotherBlock){
  42308. var self=this,$self=this;
  42309. return $core.withContext(function($ctx1) {
  42310. var $1;
  42311. $recv($self["@stream"])._nextPutAll_("if(");
  42312. $ctx1.sendIdx["nextPutAll:"]=1;
  42313. $recv(aBlock)._value();
  42314. $ctx1.sendIdx["value"]=1;
  42315. $1=$self["@stream"];
  42316. $recv($1)._nextPutAll_("){");
  42317. $ctx1.sendIdx["nextPutAll:"]=2;
  42318. $recv($1)._lf();
  42319. $recv(anotherBlock)._value();
  42320. $recv($self["@stream"])._nextPutAll_("}");
  42321. $self._omitSemicolon_(true);
  42322. return self;
  42323. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:",{aBlock:aBlock,anotherBlock:anotherBlock},$globals.JSStream)});
  42324. },
  42325. args: ["aBlock", "anotherBlock"],
  42326. 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",
  42327. referencedClasses: [],
  42328. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42329. }),
  42330. $globals.JSStream);
  42331. $core.addMethod(
  42332. $core.method({
  42333. selector: "nextPutIf:then:else:",
  42334. protocol: "streaming",
  42335. fn: function (aBlock,ifBlock,elseBlock){
  42336. var self=this,$self=this;
  42337. return $core.withContext(function($ctx1) {
  42338. var $1,$2,$3;
  42339. $recv($self["@stream"])._nextPutAll_("if(");
  42340. $ctx1.sendIdx["nextPutAll:"]=1;
  42341. $recv(aBlock)._value();
  42342. $ctx1.sendIdx["value"]=1;
  42343. $1=$self["@stream"];
  42344. $recv($1)._nextPutAll_("){");
  42345. $ctx1.sendIdx["nextPutAll:"]=2;
  42346. $2=$recv($1)._lf();
  42347. $ctx1.sendIdx["lf"]=1;
  42348. $recv(ifBlock)._value();
  42349. $ctx1.sendIdx["value"]=2;
  42350. $3=$self["@stream"];
  42351. $recv($3)._nextPutAll_("} else {");
  42352. $ctx1.sendIdx["nextPutAll:"]=3;
  42353. $recv($3)._lf();
  42354. $recv(elseBlock)._value();
  42355. $recv($self["@stream"])._nextPutAll_("}");
  42356. $self._omitSemicolon_(true);
  42357. return self;
  42358. }, function($ctx1) {$ctx1.fill(self,"nextPutIf:then:else:",{aBlock:aBlock,ifBlock:ifBlock,elseBlock:elseBlock},$globals.JSStream)});
  42359. },
  42360. args: ["aBlock", "ifBlock", "elseBlock"],
  42361. 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",
  42362. referencedClasses: [],
  42363. messageSends: ["nextPutAll:", "value", "lf", "omitSemicolon:"]
  42364. }),
  42365. $globals.JSStream);
  42366. $core.addMethod(
  42367. $core.method({
  42368. selector: "nextPutMethodDeclaration:with:",
  42369. protocol: "streaming",
  42370. fn: function (aMethod,aBlock){
  42371. var self=this,$self=this;
  42372. return $core.withContext(function($ctx1) {
  42373. var $1,$4,$3,$2,$7,$6,$5,$8,$9,$12,$11,$10,$15,$14,$13,$18,$17,$16,$19,$20;
  42374. $1=$self["@stream"];
  42375. $recv($1)._nextPutAll_("$core.method({");
  42376. $ctx1.sendIdx["nextPutAll:"]=1;
  42377. $recv($1)._lf();
  42378. $ctx1.sendIdx["lf"]=1;
  42379. $4=$recv($recv(aMethod)._selector())._asJavaScriptSource();
  42380. $ctx1.sendIdx["asJavaScriptSource"]=1;
  42381. $3="selector: ".__comma($4);
  42382. $ctx1.sendIdx[","]=2;
  42383. $2=$recv($3).__comma(",");
  42384. $ctx1.sendIdx[","]=1;
  42385. $recv($1)._nextPutAll_($2);
  42386. $ctx1.sendIdx["nextPutAll:"]=2;
  42387. $recv($1)._lf();
  42388. $ctx1.sendIdx["lf"]=2;
  42389. $7=$recv($recv(aMethod)._source())._asJavaScriptSource();
  42390. $ctx1.sendIdx["asJavaScriptSource"]=2;
  42391. $6="source: ".__comma($7);
  42392. $ctx1.sendIdx[","]=4;
  42393. $5=$recv($6).__comma(",");
  42394. $ctx1.sendIdx[","]=3;
  42395. $recv($1)._nextPutAll_($5);
  42396. $ctx1.sendIdx["nextPutAll:"]=3;
  42397. $8=$recv($1)._lf();
  42398. $ctx1.sendIdx["lf"]=3;
  42399. $recv(aBlock)._value();
  42400. $ctx1.sendIdx["value"]=1;
  42401. $9=$self["@stream"];
  42402. $12=$recv($globals.String)._lf();
  42403. $ctx1.sendIdx["lf"]=4;
  42404. $11=",".__comma($12);
  42405. $ctx1.sendIdx[","]=6;
  42406. $10=$recv($11).__comma("messageSends: ");
  42407. $ctx1.sendIdx[","]=5;
  42408. $recv($9)._nextPutAll_($10);
  42409. $ctx1.sendIdx["nextPutAll:"]=4;
  42410. $15=$recv($recv(aMethod)._messageSends())._asArray();
  42411. $ctx1.sendIdx["asArray"]=1;
  42412. $14=$recv($15)._asJavaScriptSource();
  42413. $ctx1.sendIdx["asJavaScriptSource"]=3;
  42414. $13=$recv($14).__comma(",");
  42415. $ctx1.sendIdx[","]=7;
  42416. $recv($9)._nextPutAll_($13);
  42417. $ctx1.sendIdx["nextPutAll:"]=5;
  42418. $recv($9)._lf();
  42419. $ctx1.sendIdx["lf"]=5;
  42420. $18=$recv($recv($recv($recv(aMethod)._arguments())._collect_((function(each){
  42421. return $core.withContext(function($ctx2) {
  42422. return $recv(each)._value();
  42423. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  42424. })))._asArray())._asJavaScriptSource();
  42425. $ctx1.sendIdx["asJavaScriptSource"]=4;
  42426. $17="args: ".__comma($18);
  42427. $16=$recv($17).__comma(",");
  42428. $ctx1.sendIdx[","]=8;
  42429. $recv($9)._nextPutAll_($16);
  42430. $ctx1.sendIdx["nextPutAll:"]=6;
  42431. $recv($9)._lf();
  42432. $19=$recv($9)._nextPutAll_("referencedClasses: [");
  42433. $ctx1.sendIdx["nextPutAll:"]=7;
  42434. $recv($recv(aMethod)._classReferences())._do_separatedBy_((function(each){
  42435. return $core.withContext(function($ctx2) {
  42436. return $recv($self["@stream"])._nextPutAll_($recv(each)._asJavaScriptSource());
  42437. $ctx2.sendIdx["nextPutAll:"]=8;
  42438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  42439. }),(function(){
  42440. return $core.withContext(function($ctx2) {
  42441. return $recv($self["@stream"])._nextPutAll_(",");
  42442. $ctx2.sendIdx["nextPutAll:"]=9;
  42443. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  42444. }));
  42445. $20=$self["@stream"];
  42446. $recv($20)._nextPutAll_("]");
  42447. $ctx1.sendIdx["nextPutAll:"]=10;
  42448. $recv($20)._nextPutAll_("})");
  42449. return self;
  42450. }, function($ctx1) {$ctx1.fill(self,"nextPutMethodDeclaration:with:",{aMethod:aMethod,aBlock:aBlock},$globals.JSStream)});
  42451. },
  42452. args: ["aMethod", "aBlock"],
  42453. 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: '})'",
  42454. referencedClasses: ["String"],
  42455. messageSends: ["nextPutAll:", "lf", ",", "asJavaScriptSource", "selector", "source", "value", "asArray", "messageSends", "collect:", "arguments", "do:separatedBy:", "classReferences"]
  42456. }),
  42457. $globals.JSStream);
  42458. $core.addMethod(
  42459. $core.method({
  42460. selector: "nextPutNonLocalReturnHandlingWith:",
  42461. protocol: "streaming",
  42462. fn: function (aBlock){
  42463. var self=this,$self=this;
  42464. return $core.withContext(function($ctx1) {
  42465. var $1,$2,$3;
  42466. $1=$self["@stream"];
  42467. $recv($1)._nextPutAll_("var $early={};");
  42468. $ctx1.sendIdx["nextPutAll:"]=1;
  42469. $recv($1)._lf();
  42470. $ctx1.sendIdx["lf"]=1;
  42471. $recv($1)._nextPutAll_("try {");
  42472. $ctx1.sendIdx["nextPutAll:"]=2;
  42473. $2=$recv($1)._lf();
  42474. $ctx1.sendIdx["lf"]=2;
  42475. $recv(aBlock)._value();
  42476. $3=$self["@stream"];
  42477. $recv($3)._nextPutAll_("}");
  42478. $ctx1.sendIdx["nextPutAll:"]=3;
  42479. $recv($3)._lf();
  42480. $ctx1.sendIdx["lf"]=3;
  42481. $recv($3)._nextPutAll_("catch(e) {if(e===$early)return e[0]; throw e}");
  42482. $recv($3)._lf();
  42483. return self;
  42484. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnHandlingWith:",{aBlock:aBlock},$globals.JSStream)});
  42485. },
  42486. args: ["aBlock"],
  42487. 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",
  42488. referencedClasses: [],
  42489. messageSends: ["nextPutAll:", "lf", "value"]
  42490. }),
  42491. $globals.JSStream);
  42492. $core.addMethod(
  42493. $core.method({
  42494. selector: "nextPutNonLocalReturnWith:",
  42495. protocol: "streaming",
  42496. fn: function (aBlock){
  42497. var self=this,$self=this;
  42498. return $core.withContext(function($ctx1) {
  42499. $recv($self["@stream"])._nextPutAll_("throw $early=[");
  42500. $ctx1.sendIdx["nextPutAll:"]=1;
  42501. $recv(aBlock)._value();
  42502. $recv($self["@stream"])._nextPutAll_("]");
  42503. return self;
  42504. }, function($ctx1) {$ctx1.fill(self,"nextPutNonLocalReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42505. },
  42506. args: ["aBlock"],
  42507. source: "nextPutNonLocalReturnWith: aBlock\x0a\x09stream nextPutAll: 'throw $early=['.\x0a\x09aBlock value.\x0a\x09stream nextPutAll: ']'",
  42508. referencedClasses: [],
  42509. messageSends: ["nextPutAll:", "value"]
  42510. }),
  42511. $globals.JSStream);
  42512. $core.addMethod(
  42513. $core.method({
  42514. selector: "nextPutReturnWith:",
  42515. protocol: "streaming",
  42516. fn: function (aBlock){
  42517. var self=this,$self=this;
  42518. return $core.withContext(function($ctx1) {
  42519. $recv($self["@stream"])._nextPutAll_("return ");
  42520. $recv(aBlock)._value();
  42521. return self;
  42522. }, function($ctx1) {$ctx1.fill(self,"nextPutReturnWith:",{aBlock:aBlock},$globals.JSStream)});
  42523. },
  42524. args: ["aBlock"],
  42525. source: "nextPutReturnWith: aBlock\x0a\x09stream nextPutAll: 'return '.\x0a\x09aBlock value",
  42526. referencedClasses: [],
  42527. messageSends: ["nextPutAll:", "value"]
  42528. }),
  42529. $globals.JSStream);
  42530. $core.addMethod(
  42531. $core.method({
  42532. selector: "nextPutSendIndexFor:",
  42533. protocol: "streaming",
  42534. fn: function (anIRSend){
  42535. var self=this,$self=this;
  42536. return $core.withContext(function($ctx1) {
  42537. $self._nextPutAll_(";");
  42538. $ctx1.sendIdx["nextPutAll:"]=1;
  42539. $self._lf();
  42540. $ctx1.sendIdx["lf"]=1;
  42541. $self._nextPutAll_("//>>excludeStart(\x22ctx\x22, pragmas.excludeDebugContexts);");
  42542. $ctx1.sendIdx["nextPutAll:"]=2;
  42543. $self._lf();
  42544. $ctx1.sendIdx["lf"]=2;
  42545. $self._nextPutAll_($recv($recv(anIRSend)._scope())._alias());
  42546. $ctx1.sendIdx["nextPutAll:"]=3;
  42547. $self._nextPutAll_(".sendIdx[");
  42548. $ctx1.sendIdx["nextPutAll:"]=4;
  42549. $self._nextPutAll_($recv($recv(anIRSend)._selector())._asJavaScriptSource());
  42550. $ctx1.sendIdx["nextPutAll:"]=5;
  42551. $self._nextPutAll_("]=");
  42552. $ctx1.sendIdx["nextPutAll:"]=6;
  42553. $self._nextPutAll_($recv($recv(anIRSend)._index())._asString());
  42554. $ctx1.sendIdx["nextPutAll:"]=7;
  42555. $self._nextPutAll_(";");
  42556. $ctx1.sendIdx["nextPutAll:"]=8;
  42557. $self._lf();
  42558. $self._nextPutAll_("//>>excludeEnd(\x22ctx\x22)");
  42559. return self;
  42560. }, function($ctx1) {$ctx1.fill(self,"nextPutSendIndexFor:",{anIRSend:anIRSend},$globals.JSStream)});
  42561. },
  42562. args: ["anIRSend"],
  42563. 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)'",
  42564. referencedClasses: [],
  42565. messageSends: ["nextPutAll:", "lf", "alias", "scope", "asJavaScriptSource", "selector", "asString", "index"]
  42566. }),
  42567. $globals.JSStream);
  42568. $core.addMethod(
  42569. $core.method({
  42570. selector: "nextPutStatementWith:",
  42571. protocol: "streaming",
  42572. fn: function (aBlock){
  42573. var self=this,$self=this;
  42574. return $core.withContext(function($ctx1) {
  42575. var $1;
  42576. $self._omitSemicolon_(false);
  42577. $ctx1.sendIdx["omitSemicolon:"]=1;
  42578. $recv(aBlock)._value();
  42579. $1=$self._omitSemicolon();
  42580. if(!$core.assert($1)){
  42581. $recv($self["@stream"])._nextPutAll_(";");
  42582. }
  42583. $self._omitSemicolon_(false);
  42584. $recv($self["@stream"])._lf();
  42585. return self;
  42586. }, function($ctx1) {$ctx1.fill(self,"nextPutStatementWith:",{aBlock:aBlock},$globals.JSStream)});
  42587. },
  42588. args: ["aBlock"],
  42589. source: "nextPutStatementWith: aBlock\x0a\x09self omitSemicolon: false.\x0a\x09aBlock value.\x0a\x09self omitSemicolon ifFalse: [ stream nextPutAll: ';' ].\x0a\x09self omitSemicolon: false.\x0a\x09stream lf",
  42590. referencedClasses: [],
  42591. messageSends: ["omitSemicolon:", "value", "ifFalse:", "omitSemicolon", "nextPutAll:", "lf"]
  42592. }),
  42593. $globals.JSStream);
  42594. $core.addMethod(
  42595. $core.method({
  42596. selector: "nextPutVars:",
  42597. protocol: "streaming",
  42598. fn: function (aCollection){
  42599. var self=this,$self=this;
  42600. return $core.withContext(function($ctx1) {
  42601. var $1;
  42602. $recv(aCollection)._ifNotEmpty_((function(){
  42603. return $core.withContext(function($ctx2) {
  42604. $recv($self["@stream"])._nextPutAll_("var ");
  42605. $ctx2.sendIdx["nextPutAll:"]=1;
  42606. $recv(aCollection)._do_separatedBy_((function(each){
  42607. return $core.withContext(function($ctx3) {
  42608. return $recv($self["@stream"])._nextPutAll_(each);
  42609. $ctx3.sendIdx["nextPutAll:"]=2;
  42610. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42611. }),(function(){
  42612. return $core.withContext(function($ctx3) {
  42613. return $recv($self["@stream"])._nextPutAll_(",");
  42614. $ctx3.sendIdx["nextPutAll:"]=3;
  42615. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  42616. }));
  42617. $1=$self["@stream"];
  42618. $recv($1)._nextPutAll_(";");
  42619. return $recv($1)._lf();
  42620. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42621. }));
  42622. return self;
  42623. }, function($ctx1) {$ctx1.fill(self,"nextPutVars:",{aCollection:aCollection},$globals.JSStream)});
  42624. },
  42625. args: ["aCollection"],
  42626. 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 ]",
  42627. referencedClasses: [],
  42628. messageSends: ["ifNotEmpty:", "nextPutAll:", "do:separatedBy:", "lf"]
  42629. }),
  42630. $globals.JSStream);
  42631. $core.addMethod(
  42632. $core.method({
  42633. selector: "omitSemicolon",
  42634. protocol: "accessing",
  42635. fn: function (){
  42636. var self=this,$self=this;
  42637. return $self["@omitSemicolon"];
  42638. },
  42639. args: [],
  42640. source: "omitSemicolon\x0a\x09^ omitSemicolon",
  42641. referencedClasses: [],
  42642. messageSends: []
  42643. }),
  42644. $globals.JSStream);
  42645. $core.addMethod(
  42646. $core.method({
  42647. selector: "omitSemicolon:",
  42648. protocol: "accessing",
  42649. fn: function (aBoolean){
  42650. var self=this,$self=this;
  42651. $self["@omitSemicolon"]=aBoolean;
  42652. return self;
  42653. },
  42654. args: ["aBoolean"],
  42655. source: "omitSemicolon: aBoolean\x0a\x09omitSemicolon := aBoolean",
  42656. referencedClasses: [],
  42657. messageSends: []
  42658. }),
  42659. $globals.JSStream);
  42660. $core.addMethod(
  42661. $core.method({
  42662. selector: "isReferenced",
  42663. protocol: "*Compiler-IR",
  42664. fn: function (){
  42665. var self=this,$self=this;
  42666. return $core.withContext(function($ctx1) {
  42667. var $3,$2,$1;
  42668. $3=$self._parent();
  42669. $ctx1.sendIdx["parent"]=1;
  42670. $2=$recv($3)._isSequenceNode();
  42671. $1=$recv($2)._or_((function(){
  42672. return $core.withContext(function($ctx2) {
  42673. return $recv($self._parent())._isAssignmentNode();
  42674. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42675. }));
  42676. return $recv($1)._not();
  42677. }, function($ctx1) {$ctx1.fill(self,"isReferenced",{},$globals.ASTNode)});
  42678. },
  42679. args: [],
  42680. 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",
  42681. referencedClasses: [],
  42682. messageSends: ["not", "or:", "isSequenceNode", "parent", "isAssignmentNode"]
  42683. }),
  42684. $globals.ASTNode);
  42685. $core.addMethod(
  42686. $core.method({
  42687. selector: "subtreeNeedsAliasing",
  42688. protocol: "*Compiler-IR",
  42689. fn: function (){
  42690. var self=this,$self=this;
  42691. return $core.withContext(function($ctx1) {
  42692. return $recv($self._shouldBeAliased())._or_((function(){
  42693. return $core.withContext(function($ctx2) {
  42694. return $recv($self._dagChildren())._anySatisfy_((function(each){
  42695. return $core.withContext(function($ctx3) {
  42696. return $recv(each)._subtreeNeedsAliasing();
  42697. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  42698. }));
  42699. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42700. }));
  42701. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.ASTNode)});
  42702. },
  42703. args: [],
  42704. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased or: [\x0a\x09\x09self dagChildren anySatisfy: [ :each | each subtreeNeedsAliasing ] ]",
  42705. referencedClasses: [],
  42706. messageSends: ["or:", "shouldBeAliased", "anySatisfy:", "dagChildren", "subtreeNeedsAliasing"]
  42707. }),
  42708. $globals.ASTNode);
  42709. $core.addMethod(
  42710. $core.method({
  42711. selector: "shouldBeAliased",
  42712. protocol: "*Compiler-IR",
  42713. fn: function (){
  42714. var self=this,$self=this;
  42715. return $core.withContext(function($ctx1) {
  42716. var $1;
  42717. $1=(
  42718. $ctx1.supercall = true,
  42719. ($globals.AssignmentNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42720. $ctx1.supercall = false;
  42721. return $recv($1)._or_((function(){
  42722. return $core.withContext(function($ctx2) {
  42723. return $self._isReferenced();
  42724. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42725. }));
  42726. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{},$globals.AssignmentNode)});
  42727. },
  42728. args: [],
  42729. source: "shouldBeAliased\x0a\x09^ super shouldBeAliased or: [ self isReferenced ]",
  42730. referencedClasses: [],
  42731. messageSends: ["or:", "shouldBeAliased", "isReferenced"]
  42732. }),
  42733. $globals.AssignmentNode);
  42734. $core.addMethod(
  42735. $core.method({
  42736. selector: "appendToInstruction:",
  42737. protocol: "*Compiler-IR",
  42738. fn: function (anIRInstruction){
  42739. var self=this,$self=this;
  42740. return $core.withContext(function($ctx1) {
  42741. $recv(anIRInstruction)._appendBlock_(self);
  42742. return self;
  42743. }, function($ctx1) {$ctx1.fill(self,"appendToInstruction:",{anIRInstruction:anIRInstruction},$globals.BlockClosure)});
  42744. },
  42745. args: ["anIRInstruction"],
  42746. source: "appendToInstruction: anIRInstruction\x0a\x09anIRInstruction appendBlock: self",
  42747. referencedClasses: [],
  42748. messageSends: ["appendBlock:"]
  42749. }),
  42750. $globals.BlockClosure);
  42751. $core.addMethod(
  42752. $core.method({
  42753. selector: "subtreeNeedsAliasing",
  42754. protocol: "*Compiler-IR",
  42755. fn: function (){
  42756. var self=this,$self=this;
  42757. return $core.withContext(function($ctx1) {
  42758. return $self._shouldBeAliased();
  42759. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.BlockNode)});
  42760. },
  42761. args: [],
  42762. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeAliased",
  42763. referencedClasses: [],
  42764. messageSends: ["shouldBeAliased"]
  42765. }),
  42766. $globals.BlockNode);
  42767. $core.addMethod(
  42768. $core.method({
  42769. selector: "subtreeNeedsAliasing",
  42770. protocol: "*Compiler-IR",
  42771. fn: function (){
  42772. var self=this,$self=this;
  42773. return $core.withContext(function($ctx1) {
  42774. return $recv($recv($self._parent())._isSequenceNode())._not();
  42775. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.CascadeNode)});
  42776. },
  42777. args: [],
  42778. source: "subtreeNeedsAliasing\x0a\x09^ self parent isSequenceNode not",
  42779. referencedClasses: [],
  42780. messageSends: ["not", "isSequenceNode", "parent"]
  42781. }),
  42782. $globals.CascadeNode);
  42783. $core.addMethod(
  42784. $core.method({
  42785. selector: "shouldBeAliased",
  42786. protocol: "*Compiler-IR",
  42787. fn: function (){
  42788. var self=this,$self=this;
  42789. var sends;
  42790. return $core.withContext(function($ctx1) {
  42791. var $2,$1;
  42792. sends=$recv($recv($recv($self._method())._sendIndexes())._at_($self._selector()))._size();
  42793. $2=(
  42794. $ctx1.supercall = true,
  42795. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._shouldBeAliased.apply($self, []));
  42796. $ctx1.supercall = false;
  42797. $1=$recv($2)._or_((function(){
  42798. return $core.withContext(function($ctx2) {
  42799. return $recv($self._isReferenced())._and_((function(){
  42800. return $core.withContext(function($ctx3) {
  42801. return $recv($recv($self._index()).__lt(sends))._or_((function(){
  42802. return $core.withContext(function($ctx4) {
  42803. return $self._superSend();
  42804. }, function($ctx4) {$ctx4.fillBlock({},$ctx3,3)});
  42805. }));
  42806. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  42807. }));
  42808. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42809. }));
  42810. $ctx1.sendIdx["or:"]=1;
  42811. return $1;
  42812. }, function($ctx1) {$ctx1.fill(self,"shouldBeAliased",{sends:sends},$globals.SendNode)});
  42813. },
  42814. args: [],
  42815. 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 ] ] ])",
  42816. referencedClasses: [],
  42817. messageSends: ["size", "at:", "sendIndexes", "method", "selector", "or:", "shouldBeAliased", "and:", "isReferenced", "<", "index", "superSend"]
  42818. }),
  42819. $globals.SendNode);
  42820. $core.addMethod(
  42821. $core.method({
  42822. selector: "subtreeNeedsAliasing",
  42823. protocol: "*Compiler-IR",
  42824. fn: function (){
  42825. var self=this,$self=this;
  42826. return $core.withContext(function($ctx1) {
  42827. return $recv($self._shouldBeInlined())._or_((function(){
  42828. return $core.withContext(function($ctx2) {
  42829. return (
  42830. $ctx2.supercall = true,
  42831. ($globals.SendNode.superclass||$boot.nilAsClass).fn.prototype._subtreeNeedsAliasing.apply($self, []));
  42832. $ctx2.supercall = false;
  42833. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  42834. }));
  42835. }, function($ctx1) {$ctx1.fill(self,"subtreeNeedsAliasing",{},$globals.SendNode)});
  42836. },
  42837. args: [],
  42838. source: "subtreeNeedsAliasing\x0a\x09^ self shouldBeInlined or: [ super subtreeNeedsAliasing ]",
  42839. referencedClasses: [],
  42840. messageSends: ["or:", "shouldBeInlined", "subtreeNeedsAliasing"]
  42841. }),
  42842. $globals.SendNode);
  42843. });
  42844. 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";
  42845. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  42846. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  42847. $core.addPackage("Compiler-Inlining");
  42848. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].innerEval = function (expr) { return eval(expr); };
  42849. ($core.packageDescriptors||$core.packages)["Compiler-Inlining"].transport = {"type":"amd","amdNamespace":"amber_core"};
  42850. $core.addClass("ASTPreInliner", $globals.NodeVisitor, [], "Compiler-Inlining");
  42851. $core.addMethod(
  42852. $core.method({
  42853. selector: "visitSendNode:",
  42854. protocol: "visiting",
  42855. fn: function (aNode){
  42856. var self=this,$self=this;
  42857. return $core.withContext(function($ctx1) {
  42858. var $1,$2,$3,$4,$receiver;
  42859. $1=$recv(aNode)._superSend();
  42860. if(!$core.assert($1)){
  42861. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  42862. if($core.assert($2)){
  42863. $recv(aNode)._shouldBeInlined_(true);
  42864. $3=$recv(aNode)._receiver();
  42865. if(($receiver = $3) == null || $receiver.a$nil){
  42866. $3;
  42867. } else {
  42868. var receiver;
  42869. receiver=$receiver;
  42870. $recv(receiver)._shouldBeAliased_(true);
  42871. }
  42872. }
  42873. }
  42874. $4=(
  42875. $ctx1.supercall = true,
  42876. ($globals.ASTPreInliner.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  42877. $ctx1.supercall = false;
  42878. return $4;
  42879. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPreInliner)});
  42880. },
  42881. args: ["aNode"],
  42882. 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",
  42883. referencedClasses: ["IRSendInliner"],
  42884. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  42885. }),
  42886. $globals.ASTPreInliner);
  42887. $core.addClass("IRInlinedClosure", $globals.IRClosure, [], "Compiler-Inlining");
  42888. $globals.IRInlinedClosure.comment="I represent an inlined closure instruction.";
  42889. $core.addMethod(
  42890. $core.method({
  42891. selector: "acceptDagVisitor:",
  42892. protocol: "visiting",
  42893. fn: function (aVisitor){
  42894. var self=this,$self=this;
  42895. return $core.withContext(function($ctx1) {
  42896. $recv(aVisitor)._visitIRInlinedClosure_(self);
  42897. return self;
  42898. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedClosure)});
  42899. },
  42900. args: ["aVisitor"],
  42901. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedClosure: self",
  42902. referencedClasses: [],
  42903. messageSends: ["visitIRInlinedClosure:"]
  42904. }),
  42905. $globals.IRInlinedClosure);
  42906. $core.addMethod(
  42907. $core.method({
  42908. selector: "isInlined",
  42909. protocol: "testing",
  42910. fn: function (){
  42911. var self=this,$self=this;
  42912. return true;
  42913. },
  42914. args: [],
  42915. source: "isInlined\x0a\x09^ true",
  42916. referencedClasses: [],
  42917. messageSends: []
  42918. }),
  42919. $globals.IRInlinedClosure);
  42920. $core.addClass("IRInlinedSend", $globals.IRSend, [], "Compiler-Inlining");
  42921. $globals.IRInlinedSend.comment="I am the abstract super class of inlined message send instructions.";
  42922. $core.addMethod(
  42923. $core.method({
  42924. selector: "acceptDagVisitor:",
  42925. protocol: "visiting",
  42926. fn: function (aVisitor){
  42927. var self=this,$self=this;
  42928. return $core.withContext(function($ctx1) {
  42929. $recv(aVisitor)._visitInlinedSend_(self);
  42930. return self;
  42931. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSend)});
  42932. },
  42933. args: ["aVisitor"],
  42934. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitInlinedSend: self",
  42935. referencedClasses: [],
  42936. messageSends: ["visitInlinedSend:"]
  42937. }),
  42938. $globals.IRInlinedSend);
  42939. $core.addMethod(
  42940. $core.method({
  42941. selector: "internalVariables",
  42942. protocol: "accessing",
  42943. fn: function (){
  42944. var self=this,$self=this;
  42945. return [];
  42946. },
  42947. args: [],
  42948. source: "internalVariables\x0a\x09\x22Answer a collection of internal variables required \x0a\x09to perform the inlining\x22\x0a\x09\x0a\x09^ #()",
  42949. referencedClasses: [],
  42950. messageSends: []
  42951. }),
  42952. $globals.IRInlinedSend);
  42953. $core.addMethod(
  42954. $core.method({
  42955. selector: "isInlined",
  42956. protocol: "testing",
  42957. fn: function (){
  42958. var self=this,$self=this;
  42959. return true;
  42960. },
  42961. args: [],
  42962. source: "isInlined\x0a\x09^ true",
  42963. referencedClasses: [],
  42964. messageSends: []
  42965. }),
  42966. $globals.IRInlinedSend);
  42967. $core.addClass("IRInlinedIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42968. $globals.IRInlinedIfFalse.comment="I represent an inlined `#ifFalse:` message send instruction.";
  42969. $core.addMethod(
  42970. $core.method({
  42971. selector: "acceptDagVisitor:",
  42972. protocol: "visiting",
  42973. fn: function (aVisitor){
  42974. var self=this,$self=this;
  42975. return $core.withContext(function($ctx1) {
  42976. $recv(aVisitor)._visitIRInlinedIfFalse_(self);
  42977. return self;
  42978. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfFalse)});
  42979. },
  42980. args: ["aVisitor"],
  42981. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfFalse: self",
  42982. referencedClasses: [],
  42983. messageSends: ["visitIRInlinedIfFalse:"]
  42984. }),
  42985. $globals.IRInlinedIfFalse);
  42986. $core.addClass("IRInlinedIfNilIfNotNil", $globals.IRInlinedSend, [], "Compiler-Inlining");
  42987. $globals.IRInlinedIfNilIfNotNil.comment="I represent an inlined `#ifNil:ifNotNil:` message send instruction.";
  42988. $core.addMethod(
  42989. $core.method({
  42990. selector: "acceptDagVisitor:",
  42991. protocol: "visiting",
  42992. fn: function (aVisitor){
  42993. var self=this,$self=this;
  42994. return $core.withContext(function($ctx1) {
  42995. $recv(aVisitor)._visitIRInlinedIfNilIfNotNil_(self);
  42996. return self;
  42997. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfNilIfNotNil)});
  42998. },
  42999. args: ["aVisitor"],
  43000. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfNilIfNotNil: self",
  43001. referencedClasses: [],
  43002. messageSends: ["visitIRInlinedIfNilIfNotNil:"]
  43003. }),
  43004. $globals.IRInlinedIfNilIfNotNil);
  43005. $core.addMethod(
  43006. $core.method({
  43007. selector: "internalVariables",
  43008. protocol: "accessing",
  43009. fn: function (){
  43010. var self=this,$self=this;
  43011. return $core.withContext(function($ctx1) {
  43012. return $recv($globals.Array)._with_($self._receiverInternalVariable());
  43013. }, function($ctx1) {$ctx1.fill(self,"internalVariables",{},$globals.IRInlinedIfNilIfNotNil)});
  43014. },
  43015. args: [],
  43016. source: "internalVariables\x0a\x09^ Array with: self receiverInternalVariable",
  43017. referencedClasses: ["Array"],
  43018. messageSends: ["with:", "receiverInternalVariable"]
  43019. }),
  43020. $globals.IRInlinedIfNilIfNotNil);
  43021. $core.addMethod(
  43022. $core.method({
  43023. selector: "receiverInternalVariable",
  43024. protocol: "accessing",
  43025. fn: function (){
  43026. var self=this,$self=this;
  43027. return $core.withContext(function($ctx1) {
  43028. var $1;
  43029. $1=$recv($globals.IRVariable)._new();
  43030. $ctx1.sendIdx["new"]=1;
  43031. $recv($1)._variable_($recv($recv($globals.AliasVar)._new())._name_($self._receiverInternalVariableName()));
  43032. return $recv($1)._yourself();
  43033. }, function($ctx1) {$ctx1.fill(self,"receiverInternalVariable",{},$globals.IRInlinedIfNilIfNotNil)});
  43034. },
  43035. args: [],
  43036. source: "receiverInternalVariable\x0a\x09^ IRVariable new\x0a\x09\x09variable: (AliasVar new name: self receiverInternalVariableName);\x0a\x09\x09yourself.",
  43037. referencedClasses: ["IRVariable", "AliasVar"],
  43038. messageSends: ["variable:", "new", "name:", "receiverInternalVariableName", "yourself"]
  43039. }),
  43040. $globals.IRInlinedIfNilIfNotNil);
  43041. $core.addMethod(
  43042. $core.method({
  43043. selector: "receiverInternalVariableName",
  43044. protocol: "accessing",
  43045. fn: function (){
  43046. var self=this,$self=this;
  43047. return "$receiver";
  43048. },
  43049. args: [],
  43050. source: "receiverInternalVariableName\x0a\x09^ '$receiver'",
  43051. referencedClasses: [],
  43052. messageSends: []
  43053. }),
  43054. $globals.IRInlinedIfNilIfNotNil);
  43055. $core.addClass("IRInlinedIfTrue", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43056. $globals.IRInlinedIfTrue.comment="I represent an inlined `#ifTrue:` message send instruction.";
  43057. $core.addMethod(
  43058. $core.method({
  43059. selector: "acceptDagVisitor:",
  43060. protocol: "visiting",
  43061. fn: function (aVisitor){
  43062. var self=this,$self=this;
  43063. return $core.withContext(function($ctx1) {
  43064. $recv(aVisitor)._visitIRInlinedIfTrue_(self);
  43065. return self;
  43066. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrue)});
  43067. },
  43068. args: ["aVisitor"],
  43069. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrue: self",
  43070. referencedClasses: [],
  43071. messageSends: ["visitIRInlinedIfTrue:"]
  43072. }),
  43073. $globals.IRInlinedIfTrue);
  43074. $core.addClass("IRInlinedIfTrueIfFalse", $globals.IRInlinedSend, [], "Compiler-Inlining");
  43075. $globals.IRInlinedIfTrueIfFalse.comment="I represent an inlined `#ifTrue:ifFalse:` message send instruction.";
  43076. $core.addMethod(
  43077. $core.method({
  43078. selector: "acceptDagVisitor:",
  43079. protocol: "visiting",
  43080. fn: function (aVisitor){
  43081. var self=this,$self=this;
  43082. return $core.withContext(function($ctx1) {
  43083. $recv(aVisitor)._visitIRInlinedIfTrueIfFalse_(self);
  43084. return self;
  43085. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedIfTrueIfFalse)});
  43086. },
  43087. args: ["aVisitor"],
  43088. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedIfTrueIfFalse: self",
  43089. referencedClasses: [],
  43090. messageSends: ["visitIRInlinedIfTrueIfFalse:"]
  43091. }),
  43092. $globals.IRInlinedIfTrueIfFalse);
  43093. $core.addClass("IRInlinedSequence", $globals.IRBlockSequence, [], "Compiler-Inlining");
  43094. $globals.IRInlinedSequence.comment="I represent a (block) sequence inside an inlined closure instruction (instance of `IRInlinedClosure`).";
  43095. $core.addMethod(
  43096. $core.method({
  43097. selector: "acceptDagVisitor:",
  43098. protocol: "visiting",
  43099. fn: function (aVisitor){
  43100. var self=this,$self=this;
  43101. return $core.withContext(function($ctx1) {
  43102. $recv(aVisitor)._visitIRInlinedSequence_(self);
  43103. return self;
  43104. }, function($ctx1) {$ctx1.fill(self,"acceptDagVisitor:",{aVisitor:aVisitor},$globals.IRInlinedSequence)});
  43105. },
  43106. args: ["aVisitor"],
  43107. source: "acceptDagVisitor: aVisitor\x0a\x09aVisitor visitIRInlinedSequence: self",
  43108. referencedClasses: [],
  43109. messageSends: ["visitIRInlinedSequence:"]
  43110. }),
  43111. $globals.IRInlinedSequence);
  43112. $core.addMethod(
  43113. $core.method({
  43114. selector: "isInlined",
  43115. protocol: "testing",
  43116. fn: function (){
  43117. var self=this,$self=this;
  43118. return true;
  43119. },
  43120. args: [],
  43121. source: "isInlined\x0a\x09^ true",
  43122. referencedClasses: [],
  43123. messageSends: []
  43124. }),
  43125. $globals.IRInlinedSequence);
  43126. $core.addClass("IRInliner", $globals.IRVisitor, [], "Compiler-Inlining");
  43127. $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`";
  43128. $core.addMethod(
  43129. $core.method({
  43130. selector: "assignmentInliner",
  43131. protocol: "factory",
  43132. fn: function (){
  43133. var self=this,$self=this;
  43134. return $core.withContext(function($ctx1) {
  43135. var $1;
  43136. $1=$recv($globals.IRAssignmentInliner)._new();
  43137. $recv($1)._translator_(self);
  43138. return $recv($1)._yourself();
  43139. }, function($ctx1) {$ctx1.fill(self,"assignmentInliner",{},$globals.IRInliner)});
  43140. },
  43141. args: [],
  43142. source: "assignmentInliner\x0a\x09^ IRAssignmentInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43143. referencedClasses: ["IRAssignmentInliner"],
  43144. messageSends: ["translator:", "new", "yourself"]
  43145. }),
  43146. $globals.IRInliner);
  43147. $core.addMethod(
  43148. $core.method({
  43149. selector: "returnInliner",
  43150. protocol: "factory",
  43151. fn: function (){
  43152. var self=this,$self=this;
  43153. return $core.withContext(function($ctx1) {
  43154. var $1;
  43155. $1=$recv($globals.IRReturnInliner)._new();
  43156. $recv($1)._translator_(self);
  43157. return $recv($1)._yourself();
  43158. }, function($ctx1) {$ctx1.fill(self,"returnInliner",{},$globals.IRInliner)});
  43159. },
  43160. args: [],
  43161. source: "returnInliner\x0a\x09^ IRReturnInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43162. referencedClasses: ["IRReturnInliner"],
  43163. messageSends: ["translator:", "new", "yourself"]
  43164. }),
  43165. $globals.IRInliner);
  43166. $core.addMethod(
  43167. $core.method({
  43168. selector: "sendInliner",
  43169. protocol: "factory",
  43170. fn: function (){
  43171. var self=this,$self=this;
  43172. return $core.withContext(function($ctx1) {
  43173. var $1;
  43174. $1=$recv($globals.IRSendInliner)._new();
  43175. $recv($1)._translator_(self);
  43176. return $recv($1)._yourself();
  43177. }, function($ctx1) {$ctx1.fill(self,"sendInliner",{},$globals.IRInliner)});
  43178. },
  43179. args: [],
  43180. source: "sendInliner\x0a\x09^ IRSendInliner new\x0a\x09\x09translator: self;\x0a\x09\x09yourself",
  43181. referencedClasses: ["IRSendInliner"],
  43182. messageSends: ["translator:", "new", "yourself"]
  43183. }),
  43184. $globals.IRInliner);
  43185. $core.addMethod(
  43186. $core.method({
  43187. selector: "shouldInlineAssignment:",
  43188. protocol: "testing",
  43189. fn: function (anIRAssignment){
  43190. var self=this,$self=this;
  43191. return $core.withContext(function($ctx1) {
  43192. var $3,$2,$1;
  43193. $1=$recv($recv($recv(anIRAssignment)._isInlined())._not())._and_((function(){
  43194. return $core.withContext(function($ctx2) {
  43195. $3=$recv(anIRAssignment)._right();
  43196. $ctx2.sendIdx["right"]=1;
  43197. $2=$recv($3)._isSend();
  43198. return $recv($2)._and_((function(){
  43199. return $core.withContext(function($ctx3) {
  43200. return $self._shouldInlineSend_($recv(anIRAssignment)._right());
  43201. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43202. }));
  43203. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43204. }));
  43205. $ctx1.sendIdx["and:"]=1;
  43206. return $1;
  43207. }, function($ctx1) {$ctx1.fill(self,"shouldInlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43208. },
  43209. args: ["anIRAssignment"],
  43210. source: "shouldInlineAssignment: anIRAssignment\x0a\x09^ anIRAssignment isInlined not and: [\x0a\x09\x09anIRAssignment right isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRAssignment right ]]",
  43211. referencedClasses: [],
  43212. messageSends: ["and:", "not", "isInlined", "isSend", "right", "shouldInlineSend:"]
  43213. }),
  43214. $globals.IRInliner);
  43215. $core.addMethod(
  43216. $core.method({
  43217. selector: "shouldInlineReturn:",
  43218. protocol: "testing",
  43219. fn: function (anIRReturn){
  43220. var self=this,$self=this;
  43221. return $core.withContext(function($ctx1) {
  43222. var $3,$2,$1;
  43223. $1=$recv($recv($recv(anIRReturn)._isInlined())._not())._and_((function(){
  43224. return $core.withContext(function($ctx2) {
  43225. $3=$recv(anIRReturn)._expression();
  43226. $ctx2.sendIdx["expression"]=1;
  43227. $2=$recv($3)._isSend();
  43228. return $recv($2)._and_((function(){
  43229. return $core.withContext(function($ctx3) {
  43230. return $self._shouldInlineSend_($recv(anIRReturn)._expression());
  43231. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  43232. }));
  43233. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43234. }));
  43235. $ctx1.sendIdx["and:"]=1;
  43236. return $1;
  43237. }, function($ctx1) {$ctx1.fill(self,"shouldInlineReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43238. },
  43239. args: ["anIRReturn"],
  43240. source: "shouldInlineReturn: anIRReturn\x0a\x09^ anIRReturn isInlined not and: [\x0a\x09\x09anIRReturn expression isSend and: [\x0a\x09\x09\x09self shouldInlineSend: anIRReturn expression ]]",
  43241. referencedClasses: [],
  43242. messageSends: ["and:", "not", "isInlined", "isSend", "expression", "shouldInlineSend:"]
  43243. }),
  43244. $globals.IRInliner);
  43245. $core.addMethod(
  43246. $core.method({
  43247. selector: "shouldInlineSend:",
  43248. protocol: "testing",
  43249. fn: function (anIRSend){
  43250. var self=this,$self=this;
  43251. return $core.withContext(function($ctx1) {
  43252. return $recv($recv($recv(anIRSend)._isInlined())._not())._and_((function(){
  43253. return $core.withContext(function($ctx2) {
  43254. return $recv($globals.IRSendInliner)._shouldInline_(anIRSend);
  43255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43256. }));
  43257. }, function($ctx1) {$ctx1.fill(self,"shouldInlineSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43258. },
  43259. args: ["anIRSend"],
  43260. source: "shouldInlineSend: anIRSend\x0a\x09^ anIRSend isInlined not and: [\x0a\x09\x09IRSendInliner shouldInline: anIRSend ]",
  43261. referencedClasses: ["IRSendInliner"],
  43262. messageSends: ["and:", "not", "isInlined", "shouldInline:"]
  43263. }),
  43264. $globals.IRInliner);
  43265. $core.addMethod(
  43266. $core.method({
  43267. selector: "visitIRAssignment:",
  43268. protocol: "visiting",
  43269. fn: function (anIRAssignment){
  43270. var self=this,$self=this;
  43271. return $core.withContext(function($ctx1) {
  43272. var $1;
  43273. $1=$self._shouldInlineAssignment_(anIRAssignment);
  43274. if($core.assert($1)){
  43275. return $recv($self._assignmentInliner())._inlineAssignment_(anIRAssignment);
  43276. } else {
  43277. return (
  43278. $ctx1.supercall = true,
  43279. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRAssignment_.apply($self, [anIRAssignment]));
  43280. $ctx1.supercall = false;
  43281. }
  43282. }, function($ctx1) {$ctx1.fill(self,"visitIRAssignment:",{anIRAssignment:anIRAssignment},$globals.IRInliner)});
  43283. },
  43284. args: ["anIRAssignment"],
  43285. source: "visitIRAssignment: anIRAssignment\x0a\x09^ (self shouldInlineAssignment: anIRAssignment)\x0a\x09\x09ifTrue: [ self assignmentInliner inlineAssignment: anIRAssignment ]\x0a\x09\x09ifFalse: [ super visitIRAssignment: anIRAssignment ]",
  43286. referencedClasses: [],
  43287. messageSends: ["ifTrue:ifFalse:", "shouldInlineAssignment:", "inlineAssignment:", "assignmentInliner", "visitIRAssignment:"]
  43288. }),
  43289. $globals.IRInliner);
  43290. $core.addMethod(
  43291. $core.method({
  43292. selector: "visitIRNonLocalReturn:",
  43293. protocol: "visiting",
  43294. fn: function (anIRNonLocalReturn){
  43295. var self=this,$self=this;
  43296. var localReturn;
  43297. return $core.withContext(function($ctx1) {
  43298. var $2,$1,$4,$3,$5,$6,$7;
  43299. $2=$recv(anIRNonLocalReturn)._scope();
  43300. $ctx1.sendIdx["scope"]=1;
  43301. $1=$recv($2)._canInlineNonLocalReturns();
  43302. if($core.assert($1)){
  43303. $4=$recv(anIRNonLocalReturn)._scope();
  43304. $ctx1.sendIdx["scope"]=2;
  43305. $3=$recv($4)._methodScope();
  43306. $5=$recv(anIRNonLocalReturn)._scope();
  43307. $ctx1.sendIdx["scope"]=3;
  43308. $recv($3)._removeNonLocalReturn_($5);
  43309. $6=$recv($globals.IRReturn)._new();
  43310. $recv($6)._scope_($recv(anIRNonLocalReturn)._scope());
  43311. localReturn=$recv($6)._yourself();
  43312. $recv($recv(anIRNonLocalReturn)._dagChildren())._do_((function(each){
  43313. return $core.withContext(function($ctx2) {
  43314. return $recv(localReturn)._add_(each);
  43315. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43316. }));
  43317. $recv(anIRNonLocalReturn)._replaceWith_(localReturn);
  43318. return $self._visitIRReturn_(localReturn);
  43319. }
  43320. $7=(
  43321. $ctx1.supercall = true,
  43322. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRNonLocalReturn_.apply($self, [anIRNonLocalReturn]));
  43323. $ctx1.supercall = false;
  43324. return $7;
  43325. }, function($ctx1) {$ctx1.fill(self,"visitIRNonLocalReturn:",{anIRNonLocalReturn:anIRNonLocalReturn,localReturn:localReturn},$globals.IRInliner)});
  43326. },
  43327. args: ["anIRNonLocalReturn"],
  43328. 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",
  43329. referencedClasses: ["IRReturn"],
  43330. messageSends: ["ifTrue:", "canInlineNonLocalReturns", "scope", "removeNonLocalReturn:", "methodScope", "scope:", "new", "yourself", "do:", "dagChildren", "add:", "replaceWith:", "visitIRReturn:", "visitIRNonLocalReturn:"]
  43331. }),
  43332. $globals.IRInliner);
  43333. $core.addMethod(
  43334. $core.method({
  43335. selector: "visitIRReturn:",
  43336. protocol: "visiting",
  43337. fn: function (anIRReturn){
  43338. var self=this,$self=this;
  43339. return $core.withContext(function($ctx1) {
  43340. var $1;
  43341. $1=$self._shouldInlineReturn_(anIRReturn);
  43342. if($core.assert($1)){
  43343. return $recv($self._returnInliner())._inlineReturn_(anIRReturn);
  43344. } else {
  43345. return (
  43346. $ctx1.supercall = true,
  43347. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRReturn_.apply($self, [anIRReturn]));
  43348. $ctx1.supercall = false;
  43349. }
  43350. }, function($ctx1) {$ctx1.fill(self,"visitIRReturn:",{anIRReturn:anIRReturn},$globals.IRInliner)});
  43351. },
  43352. args: ["anIRReturn"],
  43353. source: "visitIRReturn: anIRReturn\x0a\x09^ (self shouldInlineReturn: anIRReturn)\x0a\x09\x09ifTrue: [ self returnInliner inlineReturn: anIRReturn ]\x0a\x09\x09ifFalse: [ super visitIRReturn: anIRReturn ]",
  43354. referencedClasses: [],
  43355. messageSends: ["ifTrue:ifFalse:", "shouldInlineReturn:", "inlineReturn:", "returnInliner", "visitIRReturn:"]
  43356. }),
  43357. $globals.IRInliner);
  43358. $core.addMethod(
  43359. $core.method({
  43360. selector: "visitIRSend:",
  43361. protocol: "visiting",
  43362. fn: function (anIRSend){
  43363. var self=this,$self=this;
  43364. return $core.withContext(function($ctx1) {
  43365. var $1;
  43366. $1=$self._shouldInlineSend_(anIRSend);
  43367. if($core.assert($1)){
  43368. return $recv($self._sendInliner())._inlineSend_(anIRSend);
  43369. } else {
  43370. return (
  43371. $ctx1.supercall = true,
  43372. ($globals.IRInliner.superclass||$boot.nilAsClass).fn.prototype._visitIRSend_.apply($self, [anIRSend]));
  43373. $ctx1.supercall = false;
  43374. }
  43375. }, function($ctx1) {$ctx1.fill(self,"visitIRSend:",{anIRSend:anIRSend},$globals.IRInliner)});
  43376. },
  43377. args: ["anIRSend"],
  43378. source: "visitIRSend: anIRSend\x0a\x09^ (self shouldInlineSend: anIRSend)\x0a\x09\x09ifTrue: [ self sendInliner inlineSend: anIRSend ]\x0a\x09\x09ifFalse: [ super visitIRSend: anIRSend ]",
  43379. referencedClasses: [],
  43380. messageSends: ["ifTrue:ifFalse:", "shouldInlineSend:", "inlineSend:", "sendInliner", "visitIRSend:"]
  43381. }),
  43382. $globals.IRInliner);
  43383. $core.addClass("IRInliningJSTranslator", $globals.IRJSTranslator, [], "Compiler-Inlining");
  43384. $globals.IRInliningJSTranslator.comment="I am a specialized JavaScript translator able to write inlined IR instructions to JavaScript stream (`JSStream` instance).";
  43385. $core.addMethod(
  43386. $core.method({
  43387. selector: "visitIRInlinedClosure:",
  43388. protocol: "visiting",
  43389. fn: function (anIRInlinedClosure){
  43390. var self=this,$self=this;
  43391. return $core.withContext(function($ctx1) {
  43392. $recv($self._stream())._nextPutVars_($recv($recv(anIRInlinedClosure)._tempDeclarations())._collect_((function(each){
  43393. return $core.withContext(function($ctx2) {
  43394. return $recv($recv(each)._name())._asVariableName();
  43395. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43396. })));
  43397. $self._visitAll_($recv(anIRInlinedClosure)._dagChildren());
  43398. return self;
  43399. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedClosure:",{anIRInlinedClosure:anIRInlinedClosure},$globals.IRInliningJSTranslator)});
  43400. },
  43401. args: ["anIRInlinedClosure"],
  43402. source: "visitIRInlinedClosure: anIRInlinedClosure\x0a\x09self stream nextPutVars: (anIRInlinedClosure tempDeclarations collect: [ :each |\x0a\x09\x09each name asVariableName ]).\x0a\x09self visitAll: anIRInlinedClosure dagChildren",
  43403. referencedClasses: [],
  43404. messageSends: ["nextPutVars:", "stream", "collect:", "tempDeclarations", "asVariableName", "name", "visitAll:", "dagChildren"]
  43405. }),
  43406. $globals.IRInliningJSTranslator);
  43407. $core.addMethod(
  43408. $core.method({
  43409. selector: "visitIRInlinedIfFalse:",
  43410. protocol: "visiting",
  43411. fn: function (anIRInlinedIfFalse){
  43412. var self=this,$self=this;
  43413. return $core.withContext(function($ctx1) {
  43414. var $1,$2,$4,$3;
  43415. $1=$self._stream();
  43416. $ctx1.sendIdx["stream"]=1;
  43417. $recv($1)._nextPutIf_then_((function(){
  43418. return $core.withContext(function($ctx2) {
  43419. $2=$self._stream();
  43420. $ctx2.sendIdx["stream"]=2;
  43421. $recv($2)._nextPutAll_("!$core.assert(");
  43422. $ctx2.sendIdx["nextPutAll:"]=1;
  43423. $4=$recv(anIRInlinedIfFalse)._dagChildren();
  43424. $ctx2.sendIdx["dagChildren"]=1;
  43425. $3=$recv($4)._first();
  43426. $self._visit_($3);
  43427. $ctx2.sendIdx["visit:"]=1;
  43428. return $recv($self._stream())._nextPutAll_(")");
  43429. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43430. }),(function(){
  43431. return $core.withContext(function($ctx2) {
  43432. return $self._visit_($recv($recv(anIRInlinedIfFalse)._dagChildren())._last());
  43433. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43434. }));
  43435. return self;
  43436. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfFalse:",{anIRInlinedIfFalse:anIRInlinedIfFalse},$globals.IRInliningJSTranslator)});
  43437. },
  43438. args: ["anIRInlinedIfFalse"],
  43439. 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 ]",
  43440. referencedClasses: [],
  43441. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43442. }),
  43443. $globals.IRInliningJSTranslator);
  43444. $core.addMethod(
  43445. $core.method({
  43446. selector: "visitIRInlinedIfNilIfNotNil:",
  43447. protocol: "visiting",
  43448. fn: function (anIRInlinedIfNilIfNotNil){
  43449. var self=this,$self=this;
  43450. return $core.withContext(function($ctx1) {
  43451. var $1,$2,$4,$3,$6,$5,$7,$8,$10,$9;
  43452. $1=$self._stream();
  43453. $ctx1.sendIdx["stream"]=1;
  43454. $recv($1)._nextPutIf_then_else_((function(){
  43455. var recvVarName;
  43456. return $core.withContext(function($ctx2) {
  43457. recvVarName=$recv(anIRInlinedIfNilIfNotNil)._receiverInternalVariableName();
  43458. $2=$self._stream();
  43459. $ctx2.sendIdx["stream"]=2;
  43460. $4="(".__comma(recvVarName);
  43461. $ctx2.sendIdx[","]=2;
  43462. $3=$recv($4).__comma(" = ");
  43463. $ctx2.sendIdx[","]=1;
  43464. $recv($2)._nextPutAll_($3);
  43465. $ctx2.sendIdx["nextPutAll:"]=1;
  43466. $6=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43467. $ctx2.sendIdx["dagChildren"]=1;
  43468. $5=$recv($6)._first();
  43469. $self._visit_($5);
  43470. $ctx2.sendIdx["visit:"]=1;
  43471. $7=$self._stream();
  43472. $8=$recv(") == null || ".__comma(recvVarName)).__comma(".a$nil");
  43473. $ctx2.sendIdx[","]=3;
  43474. return $recv($7)._nextPutAll_($8);
  43475. }, function($ctx2) {$ctx2.fillBlock({recvVarName:recvVarName},$ctx1,1)});
  43476. }),(function(){
  43477. return $core.withContext(function($ctx2) {
  43478. $10=$recv(anIRInlinedIfNilIfNotNil)._dagChildren();
  43479. $ctx2.sendIdx["dagChildren"]=2;
  43480. $9=$recv($10)._second();
  43481. return $self._visit_($9);
  43482. $ctx2.sendIdx["visit:"]=2;
  43483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43484. }),(function(){
  43485. return $core.withContext(function($ctx2) {
  43486. return $self._visit_($recv($recv(anIRInlinedIfNilIfNotNil)._dagChildren())._third());
  43487. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43488. }));
  43489. return self;
  43490. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfNilIfNotNil:",{anIRInlinedIfNilIfNotNil:anIRInlinedIfNilIfNotNil},$globals.IRInliningJSTranslator)});
  43491. },
  43492. args: ["anIRInlinedIfNilIfNotNil"],
  43493. 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 ]",
  43494. referencedClasses: [],
  43495. messageSends: ["nextPutIf:then:else:", "stream", "receiverInternalVariableName", "nextPutAll:", ",", "visit:", "first", "dagChildren", "second", "third"]
  43496. }),
  43497. $globals.IRInliningJSTranslator);
  43498. $core.addMethod(
  43499. $core.method({
  43500. selector: "visitIRInlinedIfTrue:",
  43501. protocol: "visiting",
  43502. fn: function (anIRInlinedIfTrue){
  43503. var self=this,$self=this;
  43504. return $core.withContext(function($ctx1) {
  43505. var $1,$2,$4,$3;
  43506. $1=$self._stream();
  43507. $ctx1.sendIdx["stream"]=1;
  43508. $recv($1)._nextPutIf_then_((function(){
  43509. return $core.withContext(function($ctx2) {
  43510. $2=$self._stream();
  43511. $ctx2.sendIdx["stream"]=2;
  43512. $recv($2)._nextPutAll_("$core.assert(");
  43513. $ctx2.sendIdx["nextPutAll:"]=1;
  43514. $4=$recv(anIRInlinedIfTrue)._dagChildren();
  43515. $ctx2.sendIdx["dagChildren"]=1;
  43516. $3=$recv($4)._first();
  43517. $self._visit_($3);
  43518. $ctx2.sendIdx["visit:"]=1;
  43519. return $recv($self._stream())._nextPutAll_(")");
  43520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43521. }),(function(){
  43522. return $core.withContext(function($ctx2) {
  43523. return $self._visit_($recv($recv(anIRInlinedIfTrue)._dagChildren())._last());
  43524. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43525. }));
  43526. return self;
  43527. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrue:",{anIRInlinedIfTrue:anIRInlinedIfTrue},$globals.IRInliningJSTranslator)});
  43528. },
  43529. args: ["anIRInlinedIfTrue"],
  43530. 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 ]",
  43531. referencedClasses: [],
  43532. messageSends: ["nextPutIf:then:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "last"]
  43533. }),
  43534. $globals.IRInliningJSTranslator);
  43535. $core.addMethod(
  43536. $core.method({
  43537. selector: "visitIRInlinedIfTrueIfFalse:",
  43538. protocol: "visiting",
  43539. fn: function (anIRInlinedIfTrueIfFalse){
  43540. var self=this,$self=this;
  43541. return $core.withContext(function($ctx1) {
  43542. var $1,$2,$4,$3,$6,$5;
  43543. $1=$self._stream();
  43544. $ctx1.sendIdx["stream"]=1;
  43545. $recv($1)._nextPutIf_then_else_((function(){
  43546. return $core.withContext(function($ctx2) {
  43547. $2=$self._stream();
  43548. $ctx2.sendIdx["stream"]=2;
  43549. $recv($2)._nextPutAll_("$core.assert(");
  43550. $ctx2.sendIdx["nextPutAll:"]=1;
  43551. $4=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43552. $ctx2.sendIdx["dagChildren"]=1;
  43553. $3=$recv($4)._first();
  43554. $self._visit_($3);
  43555. $ctx2.sendIdx["visit:"]=1;
  43556. return $recv($self._stream())._nextPutAll_(")");
  43557. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  43558. }),(function(){
  43559. return $core.withContext(function($ctx2) {
  43560. $6=$recv(anIRInlinedIfTrueIfFalse)._dagChildren();
  43561. $ctx2.sendIdx["dagChildren"]=2;
  43562. $5=$recv($6)._second();
  43563. return $self._visit_($5);
  43564. $ctx2.sendIdx["visit:"]=2;
  43565. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  43566. }),(function(){
  43567. return $core.withContext(function($ctx2) {
  43568. return $self._visit_($recv($recv(anIRInlinedIfTrueIfFalse)._dagChildren())._third());
  43569. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43570. }));
  43571. return self;
  43572. }, function($ctx1) {$ctx1.fill(self,"visitIRInlinedIfTrueIfFalse:",{anIRInlinedIfTrueIfFalse:anIRInlinedIfTrueIfFalse},$globals.IRInliningJSTranslator)});
  43573. },
  43574. args: ["anIRInlinedIfTrueIfFalse"],
  43575. 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 ]",
  43576. referencedClasses: [],
  43577. messageSends: ["nextPutIf:then:else:", "stream", "nextPutAll:", "visit:", "first", "dagChildren", "second", "third"]
  43578. }),
  43579. $globals.IRInliningJSTranslator);
  43580. $core.addClass("IRSendInliner", $globals.Object, ["send", "translator"], "Compiler-Inlining");
  43581. $globals.IRSendInliner.comment="I inline some message sends and block closure arguments. I heavily rely on #perform: to dispatch inlining methods.";
  43582. $core.addMethod(
  43583. $core.method({
  43584. selector: "ifFalse:",
  43585. protocol: "inlining",
  43586. fn: function (anIRInstruction){
  43587. var self=this,$self=this;
  43588. return $core.withContext(function($ctx1) {
  43589. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfFalse)._new(),anIRInstruction);
  43590. }, function($ctx1) {$ctx1.fill(self,"ifFalse:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43591. },
  43592. args: ["anIRInstruction"],
  43593. source: "ifFalse: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfFalse new withBlock: anIRInstruction",
  43594. referencedClasses: ["IRInlinedIfFalse"],
  43595. messageSends: ["inlinedSend:withBlock:", "new"]
  43596. }),
  43597. $globals.IRSendInliner);
  43598. $core.addMethod(
  43599. $core.method({
  43600. selector: "ifFalse:ifTrue:",
  43601. protocol: "inlining",
  43602. fn: function (anIRInstruction,anotherIRInstruction){
  43603. var self=this,$self=this;
  43604. return $core.withContext(function($ctx1) {
  43605. return $self._perform_withArguments_("ifTrue:ifFalse:",[anotherIRInstruction,anIRInstruction]);
  43606. }, function($ctx1) {$ctx1.fill(self,"ifFalse:ifTrue:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43607. },
  43608. args: ["anIRInstruction", "anotherIRInstruction"],
  43609. source: "ifFalse: anIRInstruction ifTrue: anotherIRInstruction\x0a\x09^ self perform: #ifTrue:ifFalse: withArguments: { anotherIRInstruction. anIRInstruction }",
  43610. referencedClasses: [],
  43611. messageSends: ["perform:withArguments:"]
  43612. }),
  43613. $globals.IRSendInliner);
  43614. $core.addMethod(
  43615. $core.method({
  43616. selector: "ifNil:",
  43617. protocol: "inlining",
  43618. fn: function (anIRInstruction){
  43619. var self=this,$self=this;
  43620. return $core.withContext(function($ctx1) {
  43621. var $1,$3,$5,$6,$4,$2;
  43622. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43623. $ctx1.sendIdx["new"]=1;
  43624. $3=$recv($globals.IRClosure)._new();
  43625. $ctx1.sendIdx["new"]=2;
  43626. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43627. $5=$recv($globals.IRBlockSequence)._new();
  43628. $recv($5)._add_($recv($self._send())._receiver());
  43629. $6=$recv($5)._yourself();
  43630. $ctx1.sendIdx["yourself"]=1;
  43631. $4=$6;
  43632. $recv($3)._add_($4);
  43633. $ctx1.sendIdx["add:"]=1;
  43634. $2=$recv($3)._yourself();
  43635. return $self._inlinedSend_withBlock_withBlock_($1,anIRInstruction,$2);
  43636. }, function($ctx1) {$ctx1.fill(self,"ifNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43637. },
  43638. args: ["anIRInstruction"],
  43639. 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)",
  43640. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43641. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43642. }),
  43643. $globals.IRSendInliner);
  43644. $core.addMethod(
  43645. $core.method({
  43646. selector: "ifNil:ifNotNil:",
  43647. protocol: "inlining",
  43648. fn: function (anIRInstruction,anotherIRInstruction){
  43649. var self=this,$self=this;
  43650. return $core.withContext(function($ctx1) {
  43651. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfNilIfNotNil)._new(),anIRInstruction,anotherIRInstruction);
  43652. }, function($ctx1) {$ctx1.fill(self,"ifNil:ifNotNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43653. },
  43654. args: ["anIRInstruction", "anotherIRInstruction"],
  43655. source: "ifNil: anIRInstruction ifNotNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43656. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43657. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43658. }),
  43659. $globals.IRSendInliner);
  43660. $core.addMethod(
  43661. $core.method({
  43662. selector: "ifNotNil:",
  43663. protocol: "inlining",
  43664. fn: function (anIRInstruction){
  43665. var self=this,$self=this;
  43666. return $core.withContext(function($ctx1) {
  43667. var $1,$3,$5,$6,$4,$2;
  43668. $1=$recv($globals.IRInlinedIfNilIfNotNil)._new();
  43669. $ctx1.sendIdx["new"]=1;
  43670. $3=$recv($globals.IRClosure)._new();
  43671. $ctx1.sendIdx["new"]=2;
  43672. $recv($3)._scope_($recv($recv(anIRInstruction)._scope())._copy());
  43673. $5=$recv($globals.IRBlockSequence)._new();
  43674. $recv($5)._add_($recv($self._send())._receiver());
  43675. $6=$recv($5)._yourself();
  43676. $ctx1.sendIdx["yourself"]=1;
  43677. $4=$6;
  43678. $recv($3)._add_($4);
  43679. $ctx1.sendIdx["add:"]=1;
  43680. $2=$recv($3)._yourself();
  43681. return $self._inlinedSend_withBlock_withBlock_($1,$2,anIRInstruction);
  43682. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43683. },
  43684. args: ["anIRInstruction"],
  43685. 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",
  43686. referencedClasses: ["IRInlinedIfNilIfNotNil", "IRClosure", "IRBlockSequence"],
  43687. messageSends: ["inlinedSend:withBlock:withBlock:", "new", "scope:", "copy", "scope", "add:", "receiver", "send", "yourself"]
  43688. }),
  43689. $globals.IRSendInliner);
  43690. $core.addMethod(
  43691. $core.method({
  43692. selector: "ifNotNil:ifNil:",
  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.IRInlinedIfNilIfNotNil)._new(),anotherIRInstruction,anIRInstruction);
  43698. }, function($ctx1) {$ctx1.fill(self,"ifNotNil:ifNil:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43699. },
  43700. args: ["anIRInstruction", "anotherIRInstruction"],
  43701. source: "ifNotNil: anIRInstruction ifNil: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfNilIfNotNil new withBlock: anotherIRInstruction withBlock: anIRInstruction",
  43702. referencedClasses: ["IRInlinedIfNilIfNotNil"],
  43703. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43704. }),
  43705. $globals.IRSendInliner);
  43706. $core.addMethod(
  43707. $core.method({
  43708. selector: "ifTrue:",
  43709. protocol: "inlining",
  43710. fn: function (anIRInstruction){
  43711. var self=this,$self=this;
  43712. return $core.withContext(function($ctx1) {
  43713. return $self._inlinedSend_withBlock_($recv($globals.IRInlinedIfTrue)._new(),anIRInstruction);
  43714. }, function($ctx1) {$ctx1.fill(self,"ifTrue:",{anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43715. },
  43716. args: ["anIRInstruction"],
  43717. source: "ifTrue: anIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrue new withBlock: anIRInstruction",
  43718. referencedClasses: ["IRInlinedIfTrue"],
  43719. messageSends: ["inlinedSend:withBlock:", "new"]
  43720. }),
  43721. $globals.IRSendInliner);
  43722. $core.addMethod(
  43723. $core.method({
  43724. selector: "ifTrue:ifFalse:",
  43725. protocol: "inlining",
  43726. fn: function (anIRInstruction,anotherIRInstruction){
  43727. var self=this,$self=this;
  43728. return $core.withContext(function($ctx1) {
  43729. return $self._inlinedSend_withBlock_withBlock_($recv($globals.IRInlinedIfTrueIfFalse)._new(),anIRInstruction,anotherIRInstruction);
  43730. }, function($ctx1) {$ctx1.fill(self,"ifTrue:ifFalse:",{anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction},$globals.IRSendInliner)});
  43731. },
  43732. args: ["anIRInstruction", "anotherIRInstruction"],
  43733. source: "ifTrue: anIRInstruction ifFalse: anotherIRInstruction\x0a\x09^ self inlinedSend: IRInlinedIfTrueIfFalse new withBlock: anIRInstruction withBlock: anotherIRInstruction",
  43734. referencedClasses: ["IRInlinedIfTrueIfFalse"],
  43735. messageSends: ["inlinedSend:withBlock:withBlock:", "new"]
  43736. }),
  43737. $globals.IRSendInliner);
  43738. $core.addMethod(
  43739. $core.method({
  43740. selector: "inlineClosure:",
  43741. protocol: "inlining",
  43742. fn: function (anIRClosure){
  43743. var self=this,$self=this;
  43744. var inlinedClosure,sequence,statements;
  43745. return $core.withContext(function($ctx1) {
  43746. var $1,$2,$3,$5,$6,$4,$7,$9,$11,$13,$14,$15,$12,$10,$17,$19,$20,$18,$16,$8;
  43747. inlinedClosure=$self._inlinedClosure();
  43748. $1=inlinedClosure;
  43749. $2=$recv(anIRClosure)._scope();
  43750. $ctx1.sendIdx["scope"]=1;
  43751. $recv($1)._scope_($2);
  43752. $ctx1.sendIdx["scope:"]=1;
  43753. $recv($1)._parent_($recv(anIRClosure)._parent());
  43754. $recv($recv(anIRClosure)._tempDeclarations())._do_((function(each){
  43755. return $core.withContext(function($ctx2) {
  43756. return $recv(inlinedClosure)._add_(each);
  43757. $ctx2.sendIdx["add:"]=1;
  43758. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  43759. }));
  43760. $ctx1.sendIdx["do:"]=1;
  43761. sequence=$self._inlinedSequence();
  43762. $recv($recv(anIRClosure)._arguments())._do_((function(each){
  43763. return $core.withContext(function($ctx2) {
  43764. $3=inlinedClosure;
  43765. $5=$recv($globals.IRTempDeclaration)._new();
  43766. $ctx2.sendIdx["new"]=1;
  43767. $recv($5)._name_(each);
  43768. $ctx2.sendIdx["name:"]=1;
  43769. $6=$recv($5)._yourself();
  43770. $ctx2.sendIdx["yourself"]=1;
  43771. $4=$6;
  43772. $recv($3)._add_($4);
  43773. $ctx2.sendIdx["add:"]=2;
  43774. $7=sequence;
  43775. $9=$recv($globals.IRAssignment)._new();
  43776. $ctx2.sendIdx["new"]=2;
  43777. $11=$recv($globals.IRVariable)._new();
  43778. $ctx2.sendIdx["new"]=3;
  43779. $13=$recv($globals.AliasVar)._new();
  43780. $ctx2.sendIdx["new"]=4;
  43781. $14=$recv(inlinedClosure)._scope();
  43782. $ctx2.sendIdx["scope"]=2;
  43783. $recv($13)._scope_($14);
  43784. $ctx2.sendIdx["scope:"]=2;
  43785. $recv($13)._name_(each);
  43786. $ctx2.sendIdx["name:"]=2;
  43787. $15=$recv($13)._yourself();
  43788. $ctx2.sendIdx["yourself"]=2;
  43789. $12=$15;
  43790. $10=$recv($11)._variable_($12);
  43791. $ctx2.sendIdx["variable:"]=1;
  43792. $recv($9)._add_($10);
  43793. $ctx2.sendIdx["add:"]=4;
  43794. $17=$recv($globals.IRVariable)._new();
  43795. $ctx2.sendIdx["new"]=5;
  43796. $19=$recv($globals.AliasVar)._new();
  43797. $recv($19)._scope_($recv(inlinedClosure)._scope());
  43798. $recv($19)._name_("$receiver");
  43799. $20=$recv($19)._yourself();
  43800. $ctx2.sendIdx["yourself"]=3;
  43801. $18=$20;
  43802. $16=$recv($17)._variable_($18);
  43803. $recv($9)._add_($16);
  43804. $ctx2.sendIdx["add:"]=5;
  43805. $8=$recv($9)._yourself();
  43806. return $recv($7)._add_($8);
  43807. $ctx2.sendIdx["add:"]=3;
  43808. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  43809. }));
  43810. $ctx1.sendIdx["do:"]=2;
  43811. $recv(inlinedClosure)._add_(sequence);
  43812. $ctx1.sendIdx["add:"]=6;
  43813. statements=$recv($recv(anIRClosure)._sequence())._dagChildren();
  43814. $recv(statements)._ifNotEmpty_((function(){
  43815. return $core.withContext(function($ctx2) {
  43816. $recv($recv(statements)._allButLast())._do_((function(each){
  43817. return $core.withContext(function($ctx3) {
  43818. return $recv(sequence)._add_(each);
  43819. $ctx3.sendIdx["add:"]=7;
  43820. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,4)});
  43821. }));
  43822. return $recv(sequence)._add_($recv($recv(statements)._last())._asInlinedBlockResult());
  43823. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  43824. }));
  43825. return inlinedClosure;
  43826. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,inlinedClosure:inlinedClosure,sequence:sequence,statements:statements},$globals.IRSendInliner)});
  43827. },
  43828. args: ["anIRClosure"],
  43829. 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",
  43830. referencedClasses: ["IRTempDeclaration", "IRAssignment", "IRVariable", "AliasVar"],
  43831. messageSends: ["inlinedClosure", "scope:", "scope", "parent:", "parent", "do:", "tempDeclarations", "add:", "inlinedSequence", "arguments", "name:", "new", "yourself", "variable:", "dagChildren", "sequence", "ifNotEmpty:", "allButLast", "asInlinedBlockResult", "last"]
  43832. }),
  43833. $globals.IRSendInliner);
  43834. $core.addMethod(
  43835. $core.method({
  43836. selector: "inlineSend:",
  43837. protocol: "inlining",
  43838. fn: function (anIRSend){
  43839. var self=this,$self=this;
  43840. return $core.withContext(function($ctx1) {
  43841. var $2,$1;
  43842. $self._send_(anIRSend);
  43843. $2=$self._send();
  43844. $ctx1.sendIdx["send"]=1;
  43845. $1=$recv($2)._selector();
  43846. return $self._perform_withArguments_($1,$recv($self._send())._arguments());
  43847. }, function($ctx1) {$ctx1.fill(self,"inlineSend:",{anIRSend:anIRSend},$globals.IRSendInliner)});
  43848. },
  43849. args: ["anIRSend"],
  43850. source: "inlineSend: anIRSend\x0a\x09self send: anIRSend.\x0a\x09^ self\x0a\x09\x09perform: self send selector\x0a\x09\x09withArguments: self send arguments",
  43851. referencedClasses: [],
  43852. messageSends: ["send:", "perform:withArguments:", "selector", "send", "arguments"]
  43853. }),
  43854. $globals.IRSendInliner);
  43855. $core.addMethod(
  43856. $core.method({
  43857. selector: "inlineSend:andReplace:",
  43858. protocol: "private",
  43859. fn: function (anIRSend,anIRInstruction){
  43860. var self=this,$self=this;
  43861. return $core.withContext(function($ctx1) {
  43862. $recv(anIRInstruction)._replaceWith_(anIRSend);
  43863. return $self._inlineSend_(anIRSend);
  43864. }, function($ctx1) {$ctx1.fill(self,"inlineSend:andReplace:",{anIRSend:anIRSend,anIRInstruction:anIRInstruction},$globals.IRSendInliner)});
  43865. },
  43866. args: ["anIRSend", "anIRInstruction"],
  43867. source: "inlineSend: anIRSend andReplace: anIRInstruction\x0a\x09anIRInstruction replaceWith: anIRSend.\x0a\x09^ self inlineSend: anIRSend",
  43868. referencedClasses: [],
  43869. messageSends: ["replaceWith:", "inlineSend:"]
  43870. }),
  43871. $globals.IRSendInliner);
  43872. $core.addMethod(
  43873. $core.method({
  43874. selector: "inlinedClosure",
  43875. protocol: "factory",
  43876. fn: function (){
  43877. var self=this,$self=this;
  43878. return $core.withContext(function($ctx1) {
  43879. return $recv($globals.IRInlinedClosure)._new();
  43880. }, function($ctx1) {$ctx1.fill(self,"inlinedClosure",{},$globals.IRSendInliner)});
  43881. },
  43882. args: [],
  43883. source: "inlinedClosure\x0a\x09^ IRInlinedClosure new",
  43884. referencedClasses: ["IRInlinedClosure"],
  43885. messageSends: ["new"]
  43886. }),
  43887. $globals.IRSendInliner);
  43888. $core.addMethod(
  43889. $core.method({
  43890. selector: "inlinedSend:withBlock:",
  43891. protocol: "private",
  43892. fn: function (inlinedSend,anIRInstruction){
  43893. var self=this,$self=this;
  43894. var inlinedClosure;
  43895. return $core.withContext(function($ctx1) {
  43896. var $1,$2,$4,$3,$5;
  43897. $1=$recv(anIRInstruction)._isClosure();
  43898. if(!$core.assert($1)){
  43899. $self._inliningError_("Message argument should be a block");
  43900. $ctx1.sendIdx["inliningError:"]=1;
  43901. }
  43902. $2=$recv($recv($recv(anIRInstruction)._arguments())._size()).__eq((0));
  43903. if(!$core.assert($2)){
  43904. $self._inliningError_("Inlined block should have zero argument");
  43905. }
  43906. inlinedClosure=$recv($self._translator())._visit_($self._inlineClosure_(anIRInstruction));
  43907. $4=$self._send();
  43908. $ctx1.sendIdx["send"]=1;
  43909. $3=$recv($4)._receiver();
  43910. $recv(inlinedSend)._add_($3);
  43911. $ctx1.sendIdx["add:"]=1;
  43912. $recv(inlinedSend)._add_(inlinedClosure);
  43913. $recv($self._send())._replaceWith_(inlinedSend);
  43914. $5=$recv($recv(inlinedSend)._method())._internalVariables();
  43915. $ctx1.sendIdx["internalVariables"]=1;
  43916. $recv($5)._addAll_($recv(inlinedSend)._internalVariables());
  43917. return inlinedSend;
  43918. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,inlinedClosure:inlinedClosure},$globals.IRSendInliner)});
  43919. },
  43920. args: ["inlinedSend", "anIRInstruction"],
  43921. 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",
  43922. referencedClasses: [],
  43923. messageSends: ["ifFalse:", "isClosure", "inliningError:", "=", "size", "arguments", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43924. }),
  43925. $globals.IRSendInliner);
  43926. $core.addMethod(
  43927. $core.method({
  43928. selector: "inlinedSend:withBlock:withBlock:",
  43929. protocol: "private",
  43930. fn: function (inlinedSend,anIRInstruction,anotherIRInstruction){
  43931. var self=this,$self=this;
  43932. var inlinedClosure1,inlinedClosure2;
  43933. return $core.withContext(function($ctx1) {
  43934. var $1,$2,$3,$4,$6,$5,$7;
  43935. $1=$recv(anIRInstruction)._isClosure();
  43936. $ctx1.sendIdx["isClosure"]=1;
  43937. if(!$core.assert($1)){
  43938. $self._inliningError_("Message argument should be a block");
  43939. $ctx1.sendIdx["inliningError:"]=1;
  43940. }
  43941. $2=$recv(anotherIRInstruction)._isClosure();
  43942. if(!$core.assert($2)){
  43943. $self._inliningError_("Message argument should be a block");
  43944. }
  43945. $3=$self._translator();
  43946. $ctx1.sendIdx["translator"]=1;
  43947. $4=$self._inlineClosure_(anIRInstruction);
  43948. $ctx1.sendIdx["inlineClosure:"]=1;
  43949. inlinedClosure1=$recv($3)._visit_($4);
  43950. $ctx1.sendIdx["visit:"]=1;
  43951. inlinedClosure2=$recv($self._translator())._visit_($self._inlineClosure_(anotherIRInstruction));
  43952. $6=$self._send();
  43953. $ctx1.sendIdx["send"]=1;
  43954. $5=$recv($6)._receiver();
  43955. $recv(inlinedSend)._add_($5);
  43956. $ctx1.sendIdx["add:"]=1;
  43957. $recv(inlinedSend)._add_(inlinedClosure1);
  43958. $ctx1.sendIdx["add:"]=2;
  43959. $recv(inlinedSend)._add_(inlinedClosure2);
  43960. $recv($self._send())._replaceWith_(inlinedSend);
  43961. $7=$recv($recv(inlinedSend)._method())._internalVariables();
  43962. $ctx1.sendIdx["internalVariables"]=1;
  43963. $recv($7)._addAll_($recv(inlinedSend)._internalVariables());
  43964. return inlinedSend;
  43965. }, function($ctx1) {$ctx1.fill(self,"inlinedSend:withBlock:withBlock:",{inlinedSend:inlinedSend,anIRInstruction:anIRInstruction,anotherIRInstruction:anotherIRInstruction,inlinedClosure1:inlinedClosure1,inlinedClosure2:inlinedClosure2},$globals.IRSendInliner)});
  43966. },
  43967. args: ["inlinedSend", "anIRInstruction", "anotherIRInstruction"],
  43968. 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",
  43969. referencedClasses: [],
  43970. messageSends: ["ifFalse:", "isClosure", "inliningError:", "visit:", "translator", "inlineClosure:", "add:", "receiver", "send", "replaceWith:", "addAll:", "internalVariables", "method"]
  43971. }),
  43972. $globals.IRSendInliner);
  43973. $core.addMethod(
  43974. $core.method({
  43975. selector: "inlinedSequence",
  43976. protocol: "factory",
  43977. fn: function (){
  43978. var self=this,$self=this;
  43979. return $core.withContext(function($ctx1) {
  43980. return $recv($globals.IRInlinedSequence)._new();
  43981. }, function($ctx1) {$ctx1.fill(self,"inlinedSequence",{},$globals.IRSendInliner)});
  43982. },
  43983. args: [],
  43984. source: "inlinedSequence\x0a\x09^ IRInlinedSequence new",
  43985. referencedClasses: ["IRInlinedSequence"],
  43986. messageSends: ["new"]
  43987. }),
  43988. $globals.IRSendInliner);
  43989. $core.addMethod(
  43990. $core.method({
  43991. selector: "inliningError:",
  43992. protocol: "error handling",
  43993. fn: function (aString){
  43994. var self=this,$self=this;
  43995. return $core.withContext(function($ctx1) {
  43996. $recv($globals.InliningError)._signal_(aString);
  43997. return self;
  43998. }, function($ctx1) {$ctx1.fill(self,"inliningError:",{aString:aString},$globals.IRSendInliner)});
  43999. },
  44000. args: ["aString"],
  44001. source: "inliningError: aString\x0a\x09InliningError signal: aString",
  44002. referencedClasses: ["InliningError"],
  44003. messageSends: ["signal:"]
  44004. }),
  44005. $globals.IRSendInliner);
  44006. $core.addMethod(
  44007. $core.method({
  44008. selector: "send",
  44009. protocol: "accessing",
  44010. fn: function (){
  44011. var self=this,$self=this;
  44012. return $self["@send"];
  44013. },
  44014. args: [],
  44015. source: "send\x0a\x09^ send",
  44016. referencedClasses: [],
  44017. messageSends: []
  44018. }),
  44019. $globals.IRSendInliner);
  44020. $core.addMethod(
  44021. $core.method({
  44022. selector: "send:",
  44023. protocol: "accessing",
  44024. fn: function (anIRSend){
  44025. var self=this,$self=this;
  44026. $self["@send"]=anIRSend;
  44027. return self;
  44028. },
  44029. args: ["anIRSend"],
  44030. source: "send: anIRSend\x0a\x09send := anIRSend",
  44031. referencedClasses: [],
  44032. messageSends: []
  44033. }),
  44034. $globals.IRSendInliner);
  44035. $core.addMethod(
  44036. $core.method({
  44037. selector: "translator",
  44038. protocol: "accessing",
  44039. fn: function (){
  44040. var self=this,$self=this;
  44041. return $self["@translator"];
  44042. },
  44043. args: [],
  44044. source: "translator\x0a\x09^ translator",
  44045. referencedClasses: [],
  44046. messageSends: []
  44047. }),
  44048. $globals.IRSendInliner);
  44049. $core.addMethod(
  44050. $core.method({
  44051. selector: "translator:",
  44052. protocol: "accessing",
  44053. fn: function (anASTTranslator){
  44054. var self=this,$self=this;
  44055. $self["@translator"]=anASTTranslator;
  44056. return self;
  44057. },
  44058. args: ["anASTTranslator"],
  44059. source: "translator: anASTTranslator\x0a\x09translator := anASTTranslator",
  44060. referencedClasses: [],
  44061. messageSends: []
  44062. }),
  44063. $globals.IRSendInliner);
  44064. $core.addMethod(
  44065. $core.method({
  44066. selector: "inlinedSelectors",
  44067. protocol: "accessing",
  44068. fn: function (){
  44069. var self=this,$self=this;
  44070. return ["ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:", "ifNil:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"];
  44071. },
  44072. args: [],
  44073. source: "inlinedSelectors\x0a\x09^ #('ifTrue:' 'ifFalse:' 'ifTrue:ifFalse:' 'ifFalse:ifTrue:' 'ifNil:' 'ifNotNil:' 'ifNil:ifNotNil:' 'ifNotNil:ifNil:')",
  44074. referencedClasses: [],
  44075. messageSends: []
  44076. }),
  44077. $globals.IRSendInliner.a$cls);
  44078. $core.addMethod(
  44079. $core.method({
  44080. selector: "shouldInline:",
  44081. protocol: "accessing",
  44082. fn: function (anIRSend){
  44083. var self=this,$self=this;
  44084. return $core.withContext(function($ctx1) {
  44085. var $1;
  44086. $1=$recv($self._inlinedSelectors())._includes_($recv(anIRSend)._selector());
  44087. if(!$core.assert($1)){
  44088. return false;
  44089. }
  44090. return $recv($recv(anIRSend)._arguments())._allSatisfy_((function(each){
  44091. return $core.withContext(function($ctx2) {
  44092. return $recv(each)._isClosure();
  44093. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  44094. }));
  44095. }, function($ctx1) {$ctx1.fill(self,"shouldInline:",{anIRSend:anIRSend},$globals.IRSendInliner.a$cls)});
  44096. },
  44097. args: ["anIRSend"],
  44098. source: "shouldInline: anIRSend\x0a\x09(self inlinedSelectors includes: anIRSend selector) ifFalse: [ ^ false ].\x0a\x09^ anIRSend arguments allSatisfy: [ :each | each isClosure ]",
  44099. referencedClasses: [],
  44100. messageSends: ["ifFalse:", "includes:", "inlinedSelectors", "selector", "allSatisfy:", "arguments", "isClosure"]
  44101. }),
  44102. $globals.IRSendInliner.a$cls);
  44103. $core.addClass("IRAssignmentInliner", $globals.IRSendInliner, ["target"], "Compiler-Inlining");
  44104. $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};";
  44105. $core.addMethod(
  44106. $core.method({
  44107. selector: "inlineAssignment:",
  44108. protocol: "inlining",
  44109. fn: function (anIRAssignment){
  44110. var self=this,$self=this;
  44111. return $core.withContext(function($ctx1) {
  44112. $self._target_($recv(anIRAssignment)._left());
  44113. return $self._inlineSend_andReplace_($recv(anIRAssignment)._right(),anIRAssignment);
  44114. }, function($ctx1) {$ctx1.fill(self,"inlineAssignment:",{anIRAssignment:anIRAssignment},$globals.IRAssignmentInliner)});
  44115. },
  44116. args: ["anIRAssignment"],
  44117. source: "inlineAssignment: anIRAssignment\x0a\x09self target: anIRAssignment left.\x0a\x09^ self inlineSend: anIRAssignment right andReplace: anIRAssignment",
  44118. referencedClasses: [],
  44119. messageSends: ["target:", "left", "inlineSend:andReplace:", "right"]
  44120. }),
  44121. $globals.IRAssignmentInliner);
  44122. $core.addMethod(
  44123. $core.method({
  44124. selector: "inlineClosure:",
  44125. protocol: "inlining",
  44126. fn: function (anIRClosure){
  44127. var self=this,$self=this;
  44128. var closure,sequence,statements;
  44129. return $core.withContext(function($ctx1) {
  44130. var $1,$2,$3,$5,$4;
  44131. closure=(
  44132. $ctx1.supercall = true,
  44133. ($globals.IRAssignmentInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44134. $ctx1.supercall = false;
  44135. sequence=$recv(closure)._sequence();
  44136. statements=$recv(sequence)._dagChildren();
  44137. $recv(statements)._ifNotEmpty_((function(){
  44138. var final;
  44139. return $core.withContext(function($ctx2) {
  44140. final=$recv(statements)._last();
  44141. $1=$recv(final)._yieldsValue();
  44142. if($core.assert($1)){
  44143. $2=sequence;
  44144. $3=final;
  44145. $5=$recv($globals.IRAssignment)._new();
  44146. $recv($5)._add_($self._target());
  44147. $ctx2.sendIdx["add:"]=1;
  44148. $recv($5)._add_($recv(final)._copy());
  44149. $4=$recv($5)._yourself();
  44150. return $recv($2)._replace_with_($3,$4);
  44151. }
  44152. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44153. }));
  44154. return closure;
  44155. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRAssignmentInliner)});
  44156. },
  44157. args: ["anIRClosure"],
  44158. 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",
  44159. referencedClasses: ["IRAssignment"],
  44160. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "target", "copy", "yourself"]
  44161. }),
  44162. $globals.IRAssignmentInliner);
  44163. $core.addMethod(
  44164. $core.method({
  44165. selector: "target",
  44166. protocol: "accessing",
  44167. fn: function (){
  44168. var self=this,$self=this;
  44169. return $self["@target"];
  44170. },
  44171. args: [],
  44172. source: "target\x0a\x09^ target",
  44173. referencedClasses: [],
  44174. messageSends: []
  44175. }),
  44176. $globals.IRAssignmentInliner);
  44177. $core.addMethod(
  44178. $core.method({
  44179. selector: "target:",
  44180. protocol: "accessing",
  44181. fn: function (anObject){
  44182. var self=this,$self=this;
  44183. $self["@target"]=anObject;
  44184. return self;
  44185. },
  44186. args: ["anObject"],
  44187. source: "target: anObject\x0a\x09target := anObject",
  44188. referencedClasses: [],
  44189. messageSends: []
  44190. }),
  44191. $globals.IRAssignmentInliner);
  44192. $core.addClass("IRReturnInliner", $globals.IRSendInliner, [], "Compiler-Inlining");
  44193. $globals.IRReturnInliner.comment="I inline message sends with inlined closure together with a return instruction.";
  44194. $core.addMethod(
  44195. $core.method({
  44196. selector: "inlineClosure:",
  44197. protocol: "inlining",
  44198. fn: function (anIRClosure){
  44199. var self=this,$self=this;
  44200. var closure,sequence,statements;
  44201. return $core.withContext(function($ctx1) {
  44202. var $1,$2,$3,$5,$4;
  44203. closure=(
  44204. $ctx1.supercall = true,
  44205. ($globals.IRReturnInliner.superclass||$boot.nilAsClass).fn.prototype._inlineClosure_.apply($self, [anIRClosure]));
  44206. $ctx1.supercall = false;
  44207. sequence=$recv(closure)._sequence();
  44208. statements=$recv(sequence)._dagChildren();
  44209. $recv(statements)._ifNotEmpty_((function(){
  44210. var final;
  44211. return $core.withContext(function($ctx2) {
  44212. final=$recv(statements)._last();
  44213. $1=$recv(final)._yieldsValue();
  44214. if($core.assert($1)){
  44215. $2=sequence;
  44216. $3=final;
  44217. $5=$recv($globals.IRReturn)._new();
  44218. $recv($5)._add_($recv(final)._copy());
  44219. $4=$recv($5)._yourself();
  44220. return $recv($2)._replace_with_($3,$4);
  44221. }
  44222. }, function($ctx2) {$ctx2.fillBlock({final:final},$ctx1,1)});
  44223. }));
  44224. return closure;
  44225. }, function($ctx1) {$ctx1.fill(self,"inlineClosure:",{anIRClosure:anIRClosure,closure:closure,sequence:sequence,statements:statements},$globals.IRReturnInliner)});
  44226. },
  44227. args: ["anIRClosure"],
  44228. 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",
  44229. referencedClasses: ["IRReturn"],
  44230. messageSends: ["inlineClosure:", "sequence", "dagChildren", "ifNotEmpty:", "last", "ifTrue:", "yieldsValue", "replace:with:", "add:", "new", "copy", "yourself"]
  44231. }),
  44232. $globals.IRReturnInliner);
  44233. $core.addMethod(
  44234. $core.method({
  44235. selector: "inlineReturn:",
  44236. protocol: "inlining",
  44237. fn: function (anIRReturn){
  44238. var self=this,$self=this;
  44239. return $core.withContext(function($ctx1) {
  44240. return $self._inlineSend_andReplace_($recv(anIRReturn)._expression(),anIRReturn);
  44241. }, function($ctx1) {$ctx1.fill(self,"inlineReturn:",{anIRReturn:anIRReturn},$globals.IRReturnInliner)});
  44242. },
  44243. args: ["anIRReturn"],
  44244. source: "inlineReturn: anIRReturn\x0a\x09^ self inlineSend: anIRReturn expression andReplace: anIRReturn",
  44245. referencedClasses: [],
  44246. messageSends: ["inlineSend:andReplace:", "expression"]
  44247. }),
  44248. $globals.IRReturnInliner);
  44249. $core.addClass("InliningCodeGenerator", $globals.CodeGenerator, [], "Compiler-Inlining");
  44250. $globals.InliningCodeGenerator.comment="I am a specialized code generator that uses inlining to produce more optimized JavaScript output";
  44251. $core.addMethod(
  44252. $core.method({
  44253. selector: "inliner",
  44254. protocol: "compiling",
  44255. fn: function (){
  44256. var self=this,$self=this;
  44257. return $core.withContext(function($ctx1) {
  44258. return $recv($globals.IRInliner)._new();
  44259. }, function($ctx1) {$ctx1.fill(self,"inliner",{},$globals.InliningCodeGenerator)});
  44260. },
  44261. args: [],
  44262. source: "inliner\x0a\x09^ IRInliner new",
  44263. referencedClasses: ["IRInliner"],
  44264. messageSends: ["new"]
  44265. }),
  44266. $globals.InliningCodeGenerator);
  44267. $core.addMethod(
  44268. $core.method({
  44269. selector: "irTranslatorClass",
  44270. protocol: "compiling",
  44271. fn: function (){
  44272. var self=this,$self=this;
  44273. return $globals.IRInliningJSTranslator;
  44274. },
  44275. args: [],
  44276. source: "irTranslatorClass\x0a\x09^ IRInliningJSTranslator",
  44277. referencedClasses: ["IRInliningJSTranslator"],
  44278. messageSends: []
  44279. }),
  44280. $globals.InliningCodeGenerator);
  44281. $core.addMethod(
  44282. $core.method({
  44283. selector: "preInliner",
  44284. protocol: "compiling",
  44285. fn: function (){
  44286. var self=this,$self=this;
  44287. return $core.withContext(function($ctx1) {
  44288. return $recv($globals.ASTPreInliner)._new();
  44289. }, function($ctx1) {$ctx1.fill(self,"preInliner",{},$globals.InliningCodeGenerator)});
  44290. },
  44291. args: [],
  44292. source: "preInliner\x0a\x09^ ASTPreInliner new",
  44293. referencedClasses: ["ASTPreInliner"],
  44294. messageSends: ["new"]
  44295. }),
  44296. $globals.InliningCodeGenerator);
  44297. $core.addMethod(
  44298. $core.method({
  44299. selector: "transformersDictionary",
  44300. protocol: "compiling",
  44301. fn: function (){
  44302. var self=this,$self=this;
  44303. return $core.withContext(function($ctx1) {
  44304. var $1,$2,$receiver;
  44305. $1=$self["@transformersDictionary"];
  44306. if(($receiver = $1) == null || $receiver.a$nil){
  44307. $2=(
  44308. $ctx1.supercall = true,
  44309. ($globals.InliningCodeGenerator.superclass||$boot.nilAsClass).fn.prototype._transformersDictionary.apply($self, []));
  44310. $ctx1.supercall = false;
  44311. $recv($2)._at_put_("3000-inlinerTagging",$self._preInliner());
  44312. $ctx1.sendIdx["at:put:"]=1;
  44313. $recv($2)._at_put_("6000-inliner",$self._inliner());
  44314. $ctx1.sendIdx["at:put:"]=2;
  44315. $recv($2)._at_put_("8000-irToJs",$self._irTranslator());
  44316. $self["@transformersDictionary"]=$recv($2)._yourself();
  44317. return $self["@transformersDictionary"];
  44318. } else {
  44319. return $1;
  44320. }
  44321. }, function($ctx1) {$ctx1.fill(self,"transformersDictionary",{},$globals.InliningCodeGenerator)});
  44322. },
  44323. args: [],
  44324. 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 ]",
  44325. referencedClasses: [],
  44326. messageSends: ["ifNil:", "at:put:", "transformersDictionary", "preInliner", "inliner", "irTranslator", "yourself"]
  44327. }),
  44328. $globals.InliningCodeGenerator);
  44329. $core.addClass("InliningError", $globals.SemanticError, [], "Compiler-Inlining");
  44330. $globals.InliningError.comment="Instances of InliningError are signaled when using an `InliningCodeGenerator`in a `Compiler`.";
  44331. $core.addClass("InliningSemanticAnalyzer", $globals.SemanticAnalyzer, [], "Compiler-Inlining");
  44332. $core.addMethod(
  44333. $core.method({
  44334. selector: "visitSendNode:",
  44335. protocol: "visiting",
  44336. fn: function (aNode){
  44337. var self=this,$self=this;
  44338. return $core.withContext(function($ctx1) {
  44339. var $1,$2,$3,$receiver;
  44340. $1=$recv(aNode)._superSend();
  44341. if(!$core.assert($1)){
  44342. $2=$recv($recv($globals.IRSendInliner)._inlinedSelectors())._includes_($recv(aNode)._selector());
  44343. if($core.assert($2)){
  44344. $recv(aNode)._shouldBeInlined_(true);
  44345. $3=$recv(aNode)._receiver();
  44346. if(($receiver = $3) == null || $receiver.a$nil){
  44347. $3;
  44348. } else {
  44349. var receiver;
  44350. receiver=$receiver;
  44351. $recv(receiver)._shouldBeAliased_(true);
  44352. }
  44353. }
  44354. }
  44355. (
  44356. $ctx1.supercall = true,
  44357. ($globals.InliningSemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  44358. $ctx1.supercall = false;
  44359. return self;
  44360. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.InliningSemanticAnalyzer)});
  44361. },
  44362. args: ["aNode"],
  44363. 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",
  44364. referencedClasses: ["IRSendInliner"],
  44365. messageSends: ["ifFalse:", "superSend", "ifTrue:", "includes:", "inlinedSelectors", "selector", "shouldBeInlined:", "ifNotNil:", "receiver", "shouldBeAliased:", "visitSendNode:"]
  44366. }),
  44367. $globals.InliningSemanticAnalyzer);
  44368. $core.addMethod(
  44369. $core.method({
  44370. selector: "asInlinedBlockResult",
  44371. protocol: "*Compiler-Inlining",
  44372. fn: function (){
  44373. var self=this,$self=this;
  44374. return $core.withContext(function($ctx1) {
  44375. return $self._expression();
  44376. }, function($ctx1) {$ctx1.fill(self,"asInlinedBlockResult",{},$globals.IRBlockReturn)});
  44377. },
  44378. args: [],
  44379. source: "asInlinedBlockResult\x0a\x09^ self expression",
  44380. referencedClasses: [],
  44381. messageSends: ["expression"]
  44382. }),
  44383. $globals.IRBlockReturn);
  44384. $core.addMethod(
  44385. $core.method({
  44386. selector: "asInlinedBlockResult",
  44387. protocol: "*Compiler-Inlining",
  44388. fn: function (){
  44389. var self=this,$self=this;
  44390. return self;
  44391. },
  44392. args: [],
  44393. source: "asInlinedBlockResult\x0a\x09^ self",
  44394. referencedClasses: [],
  44395. messageSends: []
  44396. }),
  44397. $globals.IRInstruction);
  44398. });
  44399. 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";
  44400. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  44401. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  44402. $core.addPackage("Compiler-Interpreter");
  44403. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].innerEval = function (expr) { return eval(expr); };
  44404. ($core.packageDescriptors||$core.packages)["Compiler-Interpreter"].transport = {"type":"amd","amdNamespace":"amber_core"};
  44405. $core.addClass("AIBlockClosure", $globals.BlockClosure, ["node", "outerContext"], "Compiler-Interpreter");
  44406. $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`).";
  44407. $core.addMethod(
  44408. $core.method({
  44409. selector: "applyTo:arguments:",
  44410. protocol: "evaluating",
  44411. fn: function (anObject,aCollection){
  44412. var self=this,$self=this;
  44413. return $core.withContext(function($ctx1) {
  44414. $self._interpreterError();
  44415. return self;
  44416. }, function($ctx1) {$ctx1.fill(self,"applyTo:arguments:",{anObject:anObject,aCollection:aCollection},$globals.AIBlockClosure)});
  44417. },
  44418. args: ["anObject", "aCollection"],
  44419. source: "applyTo: anObject arguments: aCollection\x0a\x09self interpreterError",
  44420. referencedClasses: [],
  44421. messageSends: ["interpreterError"]
  44422. }),
  44423. $globals.AIBlockClosure);
  44424. $core.addMethod(
  44425. $core.method({
  44426. selector: "compiledSource",
  44427. protocol: "accessing",
  44428. fn: function (){
  44429. var self=this,$self=this;
  44430. return "[ AST Block closure ]";
  44431. },
  44432. args: [],
  44433. source: "compiledSource\x0a\x09\x22Unlike blocks, the receiver doesn't represent a JS function\x22\x0a\x09\x0a\x09^ '[ AST Block closure ]'",
  44434. referencedClasses: [],
  44435. messageSends: []
  44436. }),
  44437. $globals.AIBlockClosure);
  44438. $core.addMethod(
  44439. $core.method({
  44440. selector: "currySelf",
  44441. protocol: "converting",
  44442. fn: function (){
  44443. var self=this,$self=this;
  44444. return $core.withContext(function($ctx1) {
  44445. $self._interpreterError();
  44446. return self;
  44447. }, function($ctx1) {$ctx1.fill(self,"currySelf",{},$globals.AIBlockClosure)});
  44448. },
  44449. args: [],
  44450. source: "currySelf\x0a\x09self interpreterError",
  44451. referencedClasses: [],
  44452. messageSends: ["interpreterError"]
  44453. }),
  44454. $globals.AIBlockClosure);
  44455. $core.addMethod(
  44456. $core.method({
  44457. selector: "initializeWithContext:node:",
  44458. protocol: "initialization",
  44459. fn: function (aContext,aNode){
  44460. var self=this,$self=this;
  44461. $self["@node"]=aNode;
  44462. $self["@outerContext"]=aContext;
  44463. return self;
  44464. },
  44465. args: ["aContext", "aNode"],
  44466. source: "initializeWithContext: aContext node: aNode\x0a\x09node := aNode.\x0a\x09outerContext := aContext",
  44467. referencedClasses: [],
  44468. messageSends: []
  44469. }),
  44470. $globals.AIBlockClosure);
  44471. $core.addMethod(
  44472. $core.method({
  44473. selector: "interpreterError",
  44474. protocol: "error handling",
  44475. fn: function (){
  44476. var self=this,$self=this;
  44477. return $core.withContext(function($ctx1) {
  44478. $recv($globals.ASTInterpreterError)._signal_("Method cannot be interpreted by the interpreter.");
  44479. return self;
  44480. }, function($ctx1) {$ctx1.fill(self,"interpreterError",{},$globals.AIBlockClosure)});
  44481. },
  44482. args: [],
  44483. source: "interpreterError\x0a\x09ASTInterpreterError signal: 'Method cannot be interpreted by the interpreter.'",
  44484. referencedClasses: ["ASTInterpreterError"],
  44485. messageSends: ["signal:"]
  44486. }),
  44487. $globals.AIBlockClosure);
  44488. $core.addMethod(
  44489. $core.method({
  44490. selector: "numArgs",
  44491. protocol: "accessing",
  44492. fn: function (){
  44493. var self=this,$self=this;
  44494. return $core.withContext(function($ctx1) {
  44495. return $recv($recv($self["@node"])._temps())._size();
  44496. }, function($ctx1) {$ctx1.fill(self,"numArgs",{},$globals.AIBlockClosure)});
  44497. },
  44498. args: [],
  44499. source: "numArgs\x0a\x09^ node temps size",
  44500. referencedClasses: [],
  44501. messageSends: ["size", "temps"]
  44502. }),
  44503. $globals.AIBlockClosure);
  44504. $core.addMethod(
  44505. $core.method({
  44506. selector: "value",
  44507. protocol: "evaluating",
  44508. fn: function (){
  44509. var self=this,$self=this;
  44510. return $core.withContext(function($ctx1) {
  44511. return $self._valueWithPossibleArguments_([]);
  44512. }, function($ctx1) {$ctx1.fill(self,"value",{},$globals.AIBlockClosure)});
  44513. },
  44514. args: [],
  44515. source: "value\x0a\x09^ self valueWithPossibleArguments: #()",
  44516. referencedClasses: [],
  44517. messageSends: ["valueWithPossibleArguments:"]
  44518. }),
  44519. $globals.AIBlockClosure);
  44520. $core.addMethod(
  44521. $core.method({
  44522. selector: "value:",
  44523. protocol: "evaluating",
  44524. fn: function (anArgument){
  44525. var self=this,$self=this;
  44526. return $core.withContext(function($ctx1) {
  44527. return $self._valueWithPossibleArguments_([anArgument]);
  44528. }, function($ctx1) {$ctx1.fill(self,"value:",{anArgument:anArgument},$globals.AIBlockClosure)});
  44529. },
  44530. args: ["anArgument"],
  44531. source: "value: anArgument\x0a\x09^ self valueWithPossibleArguments: {anArgument}",
  44532. referencedClasses: [],
  44533. messageSends: ["valueWithPossibleArguments:"]
  44534. }),
  44535. $globals.AIBlockClosure);
  44536. $core.addMethod(
  44537. $core.method({
  44538. selector: "value:value:",
  44539. protocol: "evaluating",
  44540. fn: function (firstArgument,secondArgument){
  44541. var self=this,$self=this;
  44542. return $core.withContext(function($ctx1) {
  44543. return $self._valueWithPossibleArguments_([firstArgument,secondArgument]);
  44544. }, function($ctx1) {$ctx1.fill(self,"value:value:",{firstArgument:firstArgument,secondArgument:secondArgument},$globals.AIBlockClosure)});
  44545. },
  44546. args: ["firstArgument", "secondArgument"],
  44547. source: "value: firstArgument value: secondArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument}",
  44548. referencedClasses: [],
  44549. messageSends: ["valueWithPossibleArguments:"]
  44550. }),
  44551. $globals.AIBlockClosure);
  44552. $core.addMethod(
  44553. $core.method({
  44554. selector: "value:value:value:",
  44555. protocol: "evaluating",
  44556. fn: function (firstArgument,secondArgument,thirdArgument){
  44557. var self=this,$self=this;
  44558. return $core.withContext(function($ctx1) {
  44559. return $self._valueWithPossibleArguments_([firstArgument,secondArgument,thirdArgument]);
  44560. }, function($ctx1) {$ctx1.fill(self,"value:value:value:",{firstArgument:firstArgument,secondArgument:secondArgument,thirdArgument:thirdArgument},$globals.AIBlockClosure)});
  44561. },
  44562. args: ["firstArgument", "secondArgument", "thirdArgument"],
  44563. source: "value: firstArgument value: secondArgument value: thirdArgument\x0a\x09^ self valueWithPossibleArguments: {firstArgument . secondArgument . thirdArgument}",
  44564. referencedClasses: [],
  44565. messageSends: ["valueWithPossibleArguments:"]
  44566. }),
  44567. $globals.AIBlockClosure);
  44568. $core.addMethod(
  44569. $core.method({
  44570. selector: "valueWithPossibleArguments:",
  44571. protocol: "evaluating",
  44572. fn: function (aCollection){
  44573. var self=this,$self=this;
  44574. var context,sequenceNode;
  44575. return $core.withContext(function($ctx1) {
  44576. var $1,$2,$3;
  44577. context=$recv($self["@outerContext"])._newInnerContext();
  44578. $1=$recv($recv($recv($self["@node"])._dagChildren())._first())._copy();
  44579. $recv($1)._parent_(nil);
  44580. sequenceNode=$recv($1)._yourself();
  44581. $recv($recv(sequenceNode)._temps())._do_((function(each){
  44582. return $core.withContext(function($ctx2) {
  44583. return $recv(context)._defineLocal_(each);
  44584. $ctx2.sendIdx["defineLocal:"]=1;
  44585. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44586. }));
  44587. $recv($recv($self["@node"])._parameters())._withIndexDo_((function(each,index){
  44588. return $core.withContext(function($ctx2) {
  44589. $recv(context)._defineLocal_(each);
  44590. return $recv(context)._localAt_put_(each,$recv(aCollection)._at_ifAbsent_(index,(function(){
  44591. return nil;
  44592. })));
  44593. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,2)});
  44594. }));
  44595. $2=$recv(context)._interpreter();
  44596. $ctx1.sendIdx["interpreter"]=1;
  44597. $recv($2)._node_(sequenceNode);
  44598. $recv($2)._enterNode();
  44599. $recv($2)._proceed();
  44600. $3=$recv($self["@outerContext"])._interpreter();
  44601. $ctx1.sendIdx["interpreter"]=2;
  44602. $recv($3)._setNonLocalReturnFromContext_(context);
  44603. return $recv($recv(context)._interpreter())._pop();
  44604. }, function($ctx1) {$ctx1.fill(self,"valueWithPossibleArguments:",{aCollection:aCollection,context:context,sequenceNode:sequenceNode},$globals.AIBlockClosure)});
  44605. },
  44606. args: ["aCollection"],
  44607. 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",
  44608. referencedClasses: [],
  44609. messageSends: ["newInnerContext", "parent:", "copy", "first", "dagChildren", "yourself", "do:", "temps", "defineLocal:", "withIndexDo:", "parameters", "localAt:put:", "at:ifAbsent:", "node:", "interpreter", "enterNode", "proceed", "setNonLocalReturnFromContext:", "pop"]
  44610. }),
  44611. $globals.AIBlockClosure);
  44612. $core.addMethod(
  44613. $core.method({
  44614. selector: "forContext:node:",
  44615. protocol: "instance creation",
  44616. fn: function (aContext,aNode){
  44617. var self=this,$self=this;
  44618. return $core.withContext(function($ctx1) {
  44619. var $1;
  44620. $1=$self._new();
  44621. $recv($1)._initializeWithContext_node_(aContext,aNode);
  44622. return $recv($1)._yourself();
  44623. }, function($ctx1) {$ctx1.fill(self,"forContext:node:",{aContext:aContext,aNode:aNode},$globals.AIBlockClosure.a$cls)});
  44624. },
  44625. args: ["aContext", "aNode"],
  44626. source: "forContext: aContext node: aNode\x0a\x09^ self new\x0a\x09\x09initializeWithContext: aContext node: aNode;\x0a\x09\x09yourself",
  44627. referencedClasses: [],
  44628. messageSends: ["initializeWithContext:node:", "new", "yourself"]
  44629. }),
  44630. $globals.AIBlockClosure.a$cls);
  44631. $core.addClass("AIContext", $globals.MethodContext, ["outerContext", "innerContext", "pc", "locals", "selector", "index", "sendIndexes", "evaluatedSelector", "ast", "interpreter", "supercall"], "Compiler-Interpreter");
  44632. $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)";
  44633. $core.addMethod(
  44634. $core.method({
  44635. selector: "arguments",
  44636. protocol: "interpreting",
  44637. fn: function (){
  44638. var self=this,$self=this;
  44639. return $core.withContext(function($ctx1) {
  44640. return $recv($recv($self._ast())._arguments())._collect_((function(each){
  44641. return $core.withContext(function($ctx2) {
  44642. return $self._localAt_ifAbsent_(each,(function(){
  44643. return $core.withContext(function($ctx3) {
  44644. return $self._error_("Argument not in context");
  44645. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  44646. }));
  44647. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  44648. }));
  44649. }, function($ctx1) {$ctx1.fill(self,"arguments",{},$globals.AIContext)});
  44650. },
  44651. args: [],
  44652. source: "arguments\x0a\x09^ self ast arguments collect: [ :each |\x0a\x09\x09self localAt: each ifAbsent: [ self error: 'Argument not in context' ] ]",
  44653. referencedClasses: [],
  44654. messageSends: ["collect:", "arguments", "ast", "localAt:ifAbsent:", "error:"]
  44655. }),
  44656. $globals.AIContext);
  44657. $core.addMethod(
  44658. $core.method({
  44659. selector: "ast",
  44660. protocol: "interpreting",
  44661. fn: function (){
  44662. var self=this,$self=this;
  44663. return $core.withContext(function($ctx1) {
  44664. var $1,$2,$3,$receiver;
  44665. $1=$self._isBlockContext();
  44666. if($core.assert($1)){
  44667. $2=$self._outerContext();
  44668. if(($receiver = $2) == null || $receiver.a$nil){
  44669. return $2;
  44670. } else {
  44671. var context;
  44672. context=$receiver;
  44673. return $recv(context)._ast();
  44674. }
  44675. }
  44676. $3=$self["@ast"];
  44677. if(($receiver = $3) == null || $receiver.a$nil){
  44678. $self._initializeAST();
  44679. } else {
  44680. $3;
  44681. }
  44682. return $self["@ast"];
  44683. }, function($ctx1) {$ctx1.fill(self,"ast",{},$globals.AIContext)});
  44684. },
  44685. args: [],
  44686. source: "ast\x0a\x09self isBlockContext ifTrue: [ \x0a\x09\x09^ self outerContext ifNotNil: [ :context | context ast ] ].\x0a\x0a\x09ast ifNil: [ self initializeAST ].\x0a\x09^ ast",
  44687. referencedClasses: [],
  44688. messageSends: ["ifTrue:", "isBlockContext", "ifNotNil:", "outerContext", "ast", "ifNil:", "initializeAST"]
  44689. }),
  44690. $globals.AIContext);
  44691. $core.addMethod(
  44692. $core.method({
  44693. selector: "basicLocalAt:",
  44694. protocol: "private",
  44695. fn: function (aString){
  44696. var self=this,$self=this;
  44697. return $core.withContext(function($ctx1) {
  44698. return $recv($self._locals())._at_(aString);
  44699. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:",{aString:aString},$globals.AIContext)});
  44700. },
  44701. args: ["aString"],
  44702. source: "basicLocalAt: aString\x0a\x09^ self locals at: aString",
  44703. referencedClasses: [],
  44704. messageSends: ["at:", "locals"]
  44705. }),
  44706. $globals.AIContext);
  44707. $core.addMethod(
  44708. $core.method({
  44709. selector: "basicLocalAt:put:",
  44710. protocol: "private",
  44711. fn: function (aString,anObject){
  44712. var self=this,$self=this;
  44713. return $core.withContext(function($ctx1) {
  44714. $recv($self._locals())._at_put_(aString,anObject);
  44715. return self;
  44716. }, function($ctx1) {$ctx1.fill(self,"basicLocalAt:put:",{aString:aString,anObject:anObject},$globals.AIContext)});
  44717. },
  44718. args: ["aString", "anObject"],
  44719. source: "basicLocalAt: aString put: anObject\x0a\x09self locals at: aString put: anObject",
  44720. referencedClasses: [],
  44721. messageSends: ["at:put:", "locals"]
  44722. }),
  44723. $globals.AIContext);
  44724. $core.addMethod(
  44725. $core.method({
  44726. selector: "basicReceiver",
  44727. protocol: "interpreting",
  44728. fn: function (){
  44729. var self=this,$self=this;
  44730. return $core.withContext(function($ctx1) {
  44731. return $self._localAt_("self");
  44732. }, function($ctx1) {$ctx1.fill(self,"basicReceiver",{},$globals.AIContext)});
  44733. },
  44734. args: [],
  44735. source: "basicReceiver\x0a\x09^ self localAt: 'self'",
  44736. referencedClasses: [],
  44737. messageSends: ["localAt:"]
  44738. }),
  44739. $globals.AIContext);
  44740. $core.addMethod(
  44741. $core.method({
  44742. selector: "defineLocal:",
  44743. protocol: "accessing",
  44744. fn: function (aString){
  44745. var self=this,$self=this;
  44746. return $core.withContext(function($ctx1) {
  44747. $recv($self._locals())._at_put_(aString,nil);
  44748. return self;
  44749. }, function($ctx1) {$ctx1.fill(self,"defineLocal:",{aString:aString},$globals.AIContext)});
  44750. },
  44751. args: ["aString"],
  44752. source: "defineLocal: aString\x0a\x09self locals at: aString put: nil",
  44753. referencedClasses: [],
  44754. messageSends: ["at:put:", "locals"]
  44755. }),
  44756. $globals.AIContext);
  44757. $core.addMethod(
  44758. $core.method({
  44759. selector: "evaluate:on:",
  44760. protocol: "evaluating",
  44761. fn: function (aString,anEvaluator){
  44762. var self=this,$self=this;
  44763. return $core.withContext(function($ctx1) {
  44764. return $recv(anEvaluator)._evaluate_context_(aString,self);
  44765. }, function($ctx1) {$ctx1.fill(self,"evaluate:on:",{aString:aString,anEvaluator:anEvaluator},$globals.AIContext)});
  44766. },
  44767. args: ["aString", "anEvaluator"],
  44768. source: "evaluate: aString on: anEvaluator\x0a\x09^ anEvaluator evaluate: aString context: self",
  44769. referencedClasses: [],
  44770. messageSends: ["evaluate:context:"]
  44771. }),
  44772. $globals.AIContext);
  44773. $core.addMethod(
  44774. $core.method({
  44775. selector: "evaluateNode:",
  44776. protocol: "evaluating",
  44777. fn: function (aNode){
  44778. var self=this,$self=this;
  44779. return $core.withContext(function($ctx1) {
  44780. var $1;
  44781. $1=$recv($globals.ASTInterpreter)._new();
  44782. $recv($1)._context_(self);
  44783. $recv($1)._node_(aNode);
  44784. $recv($1)._enterNode();
  44785. $recv($1)._proceed();
  44786. return $recv($1)._result();
  44787. }, function($ctx1) {$ctx1.fill(self,"evaluateNode:",{aNode:aNode},$globals.AIContext)});
  44788. },
  44789. args: ["aNode"],
  44790. source: "evaluateNode: aNode\x0a\x09^ ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09node: aNode;\x0a\x09\x09enterNode;\x0a\x09\x09proceed;\x0a\x09\x09result",
  44791. referencedClasses: ["ASTInterpreter"],
  44792. messageSends: ["context:", "new", "node:", "enterNode", "proceed", "result"]
  44793. }),
  44794. $globals.AIContext);
  44795. $core.addMethod(
  44796. $core.method({
  44797. selector: "evaluatedSelector",
  44798. protocol: "accessing",
  44799. fn: function (){
  44800. var self=this,$self=this;
  44801. return $self["@evaluatedSelector"];
  44802. },
  44803. args: [],
  44804. source: "evaluatedSelector\x0a\x09^ evaluatedSelector",
  44805. referencedClasses: [],
  44806. messageSends: []
  44807. }),
  44808. $globals.AIContext);
  44809. $core.addMethod(
  44810. $core.method({
  44811. selector: "evaluatedSelector:",
  44812. protocol: "accessing",
  44813. fn: function (aString){
  44814. var self=this,$self=this;
  44815. $self["@evaluatedSelector"]=aString;
  44816. return self;
  44817. },
  44818. args: ["aString"],
  44819. source: "evaluatedSelector: aString\x0a\x09evaluatedSelector := aString",
  44820. referencedClasses: [],
  44821. messageSends: []
  44822. }),
  44823. $globals.AIContext);
  44824. $core.addMethod(
  44825. $core.method({
  44826. selector: "index",
  44827. protocol: "accessing",
  44828. fn: function (){
  44829. var self=this,$self=this;
  44830. return $core.withContext(function($ctx1) {
  44831. var $1,$receiver;
  44832. $1=$self["@index"];
  44833. if(($receiver = $1) == null || $receiver.a$nil){
  44834. return (0);
  44835. } else {
  44836. return $1;
  44837. }
  44838. }, function($ctx1) {$ctx1.fill(self,"index",{},$globals.AIContext)});
  44839. },
  44840. args: [],
  44841. source: "index\x0a\x09^ index ifNil: [ 0 ]",
  44842. referencedClasses: [],
  44843. messageSends: ["ifNil:"]
  44844. }),
  44845. $globals.AIContext);
  44846. $core.addMethod(
  44847. $core.method({
  44848. selector: "index:",
  44849. protocol: "accessing",
  44850. fn: function (anInteger){
  44851. var self=this,$self=this;
  44852. $self["@index"]=anInteger;
  44853. return self;
  44854. },
  44855. args: ["anInteger"],
  44856. source: "index: anInteger\x0a\x09index := anInteger",
  44857. referencedClasses: [],
  44858. messageSends: []
  44859. }),
  44860. $globals.AIContext);
  44861. $core.addMethod(
  44862. $core.method({
  44863. selector: "initializeAST",
  44864. protocol: "initialization",
  44865. fn: function (){
  44866. var self=this,$self=this;
  44867. return $core.withContext(function($ctx1) {
  44868. var $1;
  44869. $1=$self._method();
  44870. $ctx1.sendIdx["method"]=1;
  44871. $self["@ast"]=$recv($1)._ast();
  44872. $recv($recv($globals.SemanticAnalyzer)._on_($recv($self._method())._methodClass()))._visit_($self["@ast"]);
  44873. return self;
  44874. }, function($ctx1) {$ctx1.fill(self,"initializeAST",{},$globals.AIContext)});
  44875. },
  44876. args: [],
  44877. source: "initializeAST\x0a\x09ast := self method ast.\x0a\x09(SemanticAnalyzer on: self method methodClass)\x0a\x09\x09visit: ast",
  44878. referencedClasses: ["SemanticAnalyzer"],
  44879. messageSends: ["ast", "method", "visit:", "on:", "methodClass"]
  44880. }),
  44881. $globals.AIContext);
  44882. $core.addMethod(
  44883. $core.method({
  44884. selector: "initializeFromMethodContext:",
  44885. protocol: "initialization",
  44886. fn: function (aMethodContext){
  44887. var self=this,$self=this;
  44888. return $core.withContext(function($ctx1) {
  44889. var $1,$2,$3,$receiver;
  44890. $self._evaluatedSelector_($recv(aMethodContext)._evaluatedSelector());
  44891. $self._index_($recv(aMethodContext)._index());
  44892. $self._sendIndexes_($recv(aMethodContext)._sendIndexes());
  44893. $self._receiver_($recv(aMethodContext)._receiver());
  44894. $self._supercall_($recv(aMethodContext)._supercall());
  44895. $self._selector_($recv(aMethodContext)._selector());
  44896. $1=$recv(aMethodContext)._outerContext();
  44897. $ctx1.sendIdx["outerContext"]=1;
  44898. if(($receiver = $1) == null || $receiver.a$nil){
  44899. $1;
  44900. } else {
  44901. var outer;
  44902. outer=$receiver;
  44903. $2=$recv(outer)._methodContext();
  44904. if(($receiver = $2) == null || $receiver.a$nil){
  44905. $2;
  44906. } else {
  44907. $self._outerContext_($recv($self._class())._fromMethodContext_($recv(aMethodContext)._outerContext()));
  44908. }
  44909. $3=$recv(aMethodContext)._locals();
  44910. $ctx1.sendIdx["locals"]=1;
  44911. $recv($3)._keysAndValuesDo_((function(key,value){
  44912. return $core.withContext(function($ctx2) {
  44913. return $recv($self._locals())._at_put_(key,value);
  44914. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  44915. }));
  44916. }
  44917. return self;
  44918. }, function($ctx1) {$ctx1.fill(self,"initializeFromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext)});
  44919. },
  44920. args: ["aMethodContext"],
  44921. 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 ] ]",
  44922. referencedClasses: [],
  44923. messageSends: ["evaluatedSelector:", "evaluatedSelector", "index:", "index", "sendIndexes:", "sendIndexes", "receiver:", "receiver", "supercall:", "supercall", "selector:", "selector", "ifNotNil:", "outerContext", "methodContext", "outerContext:", "fromMethodContext:", "class", "keysAndValuesDo:", "locals", "at:put:"]
  44924. }),
  44925. $globals.AIContext);
  44926. $core.addMethod(
  44927. $core.method({
  44928. selector: "initializeInterpreter",
  44929. protocol: "initialization",
  44930. fn: function (){
  44931. var self=this,$self=this;
  44932. return $core.withContext(function($ctx1) {
  44933. var $1,$2,$receiver;
  44934. $1=$recv($globals.ASTInterpreter)._new();
  44935. $recv($1)._context_(self);
  44936. $self["@interpreter"]=$recv($1)._yourself();
  44937. $2=$self._innerContext();
  44938. if(($receiver = $2) == null || $receiver.a$nil){
  44939. $2;
  44940. } else {
  44941. $self._setupInterpreter_($self["@interpreter"]);
  44942. }
  44943. return self;
  44944. }, function($ctx1) {$ctx1.fill(self,"initializeInterpreter",{},$globals.AIContext)});
  44945. },
  44946. args: [],
  44947. source: "initializeInterpreter\x0a\x09interpreter := ASTInterpreter new\x0a\x09\x09context: self;\x0a\x09\x09yourself.\x0a\x09\x0a\x09self innerContext ifNotNil: [\x0a\x09\x09self setupInterpreter: interpreter ]",
  44948. referencedClasses: ["ASTInterpreter"],
  44949. messageSends: ["context:", "new", "yourself", "ifNotNil:", "innerContext", "setupInterpreter:"]
  44950. }),
  44951. $globals.AIContext);
  44952. $core.addMethod(
  44953. $core.method({
  44954. selector: "initializeLocals",
  44955. protocol: "initialization",
  44956. fn: function (){
  44957. var self=this,$self=this;
  44958. return $core.withContext(function($ctx1) {
  44959. $self["@locals"]=$recv($globals.Dictionary)._new();
  44960. $recv($self["@locals"])._at_put_("thisContext",self);
  44961. return self;
  44962. }, function($ctx1) {$ctx1.fill(self,"initializeLocals",{},$globals.AIContext)});
  44963. },
  44964. args: [],
  44965. source: "initializeLocals\x0a\x09locals := Dictionary new.\x0a\x09locals at: 'thisContext' put: self.",
  44966. referencedClasses: ["Dictionary"],
  44967. messageSends: ["new", "at:put:"]
  44968. }),
  44969. $globals.AIContext);
  44970. $core.addMethod(
  44971. $core.method({
  44972. selector: "innerContext",
  44973. protocol: "accessing",
  44974. fn: function (){
  44975. var self=this,$self=this;
  44976. return $self["@innerContext"];
  44977. },
  44978. args: [],
  44979. source: "innerContext\x0a\x09^ innerContext",
  44980. referencedClasses: [],
  44981. messageSends: []
  44982. }),
  44983. $globals.AIContext);
  44984. $core.addMethod(
  44985. $core.method({
  44986. selector: "innerContext:",
  44987. protocol: "accessing",
  44988. fn: function (anAIContext){
  44989. var self=this,$self=this;
  44990. $self["@innerContext"]=anAIContext;
  44991. return self;
  44992. },
  44993. args: ["anAIContext"],
  44994. source: "innerContext: anAIContext\x0a\x09innerContext := anAIContext",
  44995. referencedClasses: [],
  44996. messageSends: []
  44997. }),
  44998. $globals.AIContext);
  44999. $core.addMethod(
  45000. $core.method({
  45001. selector: "interpreter",
  45002. protocol: "interpreting",
  45003. fn: function (){
  45004. var self=this,$self=this;
  45005. return $core.withContext(function($ctx1) {
  45006. var $1,$receiver;
  45007. $1=$self["@interpreter"];
  45008. if(($receiver = $1) == null || $receiver.a$nil){
  45009. $self._initializeInterpreter();
  45010. } else {
  45011. $1;
  45012. }
  45013. return $self["@interpreter"];
  45014. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.AIContext)});
  45015. },
  45016. args: [],
  45017. source: "interpreter\x0a\x09interpreter ifNil: [ self initializeInterpreter ].\x0a\x09^ interpreter",
  45018. referencedClasses: [],
  45019. messageSends: ["ifNil:", "initializeInterpreter"]
  45020. }),
  45021. $globals.AIContext);
  45022. $core.addMethod(
  45023. $core.method({
  45024. selector: "interpreter:",
  45025. protocol: "interpreting",
  45026. fn: function (anInterpreter){
  45027. var self=this,$self=this;
  45028. $self["@interpreter"]=anInterpreter;
  45029. return self;
  45030. },
  45031. args: ["anInterpreter"],
  45032. source: "interpreter: anInterpreter\x0a\x09interpreter := anInterpreter",
  45033. referencedClasses: [],
  45034. messageSends: []
  45035. }),
  45036. $globals.AIContext);
  45037. $core.addMethod(
  45038. $core.method({
  45039. selector: "isTopContext",
  45040. protocol: "testing",
  45041. fn: function (){
  45042. var self=this,$self=this;
  45043. return $core.withContext(function($ctx1) {
  45044. return $recv($self._innerContext())._isNil();
  45045. }, function($ctx1) {$ctx1.fill(self,"isTopContext",{},$globals.AIContext)});
  45046. },
  45047. args: [],
  45048. source: "isTopContext\x0a\x09^ self innerContext isNil",
  45049. referencedClasses: [],
  45050. messageSends: ["isNil", "innerContext"]
  45051. }),
  45052. $globals.AIContext);
  45053. $core.addMethod(
  45054. $core.method({
  45055. selector: "localAt:",
  45056. protocol: "accessing",
  45057. fn: function (aString){
  45058. var self=this,$self=this;
  45059. var context;
  45060. return $core.withContext(function($ctx1) {
  45061. context=$self._lookupContextForLocal_(aString);
  45062. return $recv(context)._basicLocalAt_(aString);
  45063. }, function($ctx1) {$ctx1.fill(self,"localAt:",{aString:aString,context:context},$globals.AIContext)});
  45064. },
  45065. args: ["aString"],
  45066. 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",
  45067. referencedClasses: [],
  45068. messageSends: ["lookupContextForLocal:", "basicLocalAt:"]
  45069. }),
  45070. $globals.AIContext);
  45071. $core.addMethod(
  45072. $core.method({
  45073. selector: "localAt:ifAbsent:",
  45074. protocol: "accessing",
  45075. fn: function (aString,aBlock){
  45076. var self=this,$self=this;
  45077. var context;
  45078. return $core.withContext(function($ctx1) {
  45079. var $early={};
  45080. try {
  45081. context=$self._lookupContextForLocal_ifNone_(aString,(function(){
  45082. return $core.withContext(function($ctx2) {
  45083. throw $early=[$recv(aBlock)._value()];
  45084. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45085. }));
  45086. return $recv(context)._basicLocalAt_(aString);
  45087. }
  45088. catch(e) {if(e===$early)return e[0]; throw e}
  45089. }, function($ctx1) {$ctx1.fill(self,"localAt:ifAbsent:",{aString:aString,aBlock:aBlock,context:context},$globals.AIContext)});
  45090. },
  45091. args: ["aString", "aBlock"],
  45092. 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",
  45093. referencedClasses: [],
  45094. messageSends: ["lookupContextForLocal:ifNone:", "value", "basicLocalAt:"]
  45095. }),
  45096. $globals.AIContext);
  45097. $core.addMethod(
  45098. $core.method({
  45099. selector: "localAt:put:",
  45100. protocol: "accessing",
  45101. fn: function (aString,anObject){
  45102. var self=this,$self=this;
  45103. var context;
  45104. return $core.withContext(function($ctx1) {
  45105. context=$self._lookupContextForLocal_(aString);
  45106. $recv(context)._basicLocalAt_put_(aString,anObject);
  45107. return self;
  45108. }, function($ctx1) {$ctx1.fill(self,"localAt:put:",{aString:aString,anObject:anObject,context:context},$globals.AIContext)});
  45109. },
  45110. args: ["aString", "anObject"],
  45111. source: "localAt: aString put: anObject\x0a\x09| context |\x0a\x09\x0a\x09context := self lookupContextForLocal: aString.\x0a\x09context basicLocalAt: aString put: anObject",
  45112. referencedClasses: [],
  45113. messageSends: ["lookupContextForLocal:", "basicLocalAt:put:"]
  45114. }),
  45115. $globals.AIContext);
  45116. $core.addMethod(
  45117. $core.method({
  45118. selector: "locals",
  45119. protocol: "accessing",
  45120. fn: function (){
  45121. var self=this,$self=this;
  45122. return $core.withContext(function($ctx1) {
  45123. var $1,$receiver;
  45124. $1=$self["@locals"];
  45125. if(($receiver = $1) == null || $receiver.a$nil){
  45126. $self._initializeLocals();
  45127. } else {
  45128. $1;
  45129. }
  45130. return $self["@locals"];
  45131. }, function($ctx1) {$ctx1.fill(self,"locals",{},$globals.AIContext)});
  45132. },
  45133. args: [],
  45134. source: "locals\x0a\x09locals ifNil: [ self initializeLocals ].\x0a\x09\x0a\x09^ locals",
  45135. referencedClasses: [],
  45136. messageSends: ["ifNil:", "initializeLocals"]
  45137. }),
  45138. $globals.AIContext);
  45139. $core.addMethod(
  45140. $core.method({
  45141. selector: "lookupContextForLocal:",
  45142. protocol: "private",
  45143. fn: function (aString){
  45144. var self=this,$self=this;
  45145. return $core.withContext(function($ctx1) {
  45146. return $self._lookupContextForLocal_ifNone_(aString,(function(){
  45147. return $core.withContext(function($ctx2) {
  45148. return $self._variableNotFound();
  45149. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45150. }));
  45151. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:",{aString:aString},$globals.AIContext)});
  45152. },
  45153. args: ["aString"],
  45154. 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 ]",
  45155. referencedClasses: [],
  45156. messageSends: ["lookupContextForLocal:ifNone:", "variableNotFound"]
  45157. }),
  45158. $globals.AIContext);
  45159. $core.addMethod(
  45160. $core.method({
  45161. selector: "lookupContextForLocal:ifNone:",
  45162. protocol: "private",
  45163. fn: function (aString,aBlock){
  45164. var self=this,$self=this;
  45165. return $core.withContext(function($ctx1) {
  45166. var $1;
  45167. return $recv($self._locals())._at_ifPresent_ifAbsent_(aString,(function(){
  45168. return self;
  45169. }),(function(){
  45170. return $core.withContext(function($ctx2) {
  45171. $1=$self._outerContext();
  45172. return $recv($1)._ifNil_ifNotNil_(aBlock,(function(context){
  45173. return $core.withContext(function($ctx3) {
  45174. return $recv(context)._lookupContextForLocal_(aString);
  45175. }, function($ctx3) {$ctx3.fillBlock({context:context},$ctx2,3)});
  45176. }));
  45177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45178. }));
  45179. }, function($ctx1) {$ctx1.fill(self,"lookupContextForLocal:ifNone:",{aString:aString,aBlock:aBlock},$globals.AIContext)});
  45180. },
  45181. args: ["aString", "aBlock"],
  45182. 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 ] ]",
  45183. referencedClasses: [],
  45184. messageSends: ["at:ifPresent:ifAbsent:", "locals", "ifNil:ifNotNil:", "outerContext", "lookupContextForLocal:"]
  45185. }),
  45186. $globals.AIContext);
  45187. $core.addMethod(
  45188. $core.method({
  45189. selector: "newInnerContext",
  45190. protocol: "factory",
  45191. fn: function (){
  45192. var self=this,$self=this;
  45193. return $core.withContext(function($ctx1) {
  45194. var $1;
  45195. $1=$recv($self._class())._new();
  45196. $recv($1)._outerContext_(self);
  45197. return $recv($1)._yourself();
  45198. }, function($ctx1) {$ctx1.fill(self,"newInnerContext",{},$globals.AIContext)});
  45199. },
  45200. args: [],
  45201. source: "newInnerContext\x0a\x09^ self class new\x0a\x09\x09outerContext: self;\x0a\x09\x09yourself",
  45202. referencedClasses: [],
  45203. messageSends: ["outerContext:", "new", "class", "yourself"]
  45204. }),
  45205. $globals.AIContext);
  45206. $core.addMethod(
  45207. $core.method({
  45208. selector: "outerContext",
  45209. protocol: "accessing",
  45210. fn: function (){
  45211. var self=this,$self=this;
  45212. return $self["@outerContext"];
  45213. },
  45214. args: [],
  45215. source: "outerContext\x0a\x09^ outerContext",
  45216. referencedClasses: [],
  45217. messageSends: []
  45218. }),
  45219. $globals.AIContext);
  45220. $core.addMethod(
  45221. $core.method({
  45222. selector: "outerContext:",
  45223. protocol: "accessing",
  45224. fn: function (anAIContext){
  45225. var self=this,$self=this;
  45226. return $core.withContext(function($ctx1) {
  45227. var $1,$receiver;
  45228. $self["@outerContext"]=anAIContext;
  45229. $1=$self["@outerContext"];
  45230. if(($receiver = $1) == null || $receiver.a$nil){
  45231. $1;
  45232. } else {
  45233. var context;
  45234. context=$receiver;
  45235. $recv(context)._innerContext_(self);
  45236. }
  45237. return self;
  45238. }, function($ctx1) {$ctx1.fill(self,"outerContext:",{anAIContext:anAIContext},$globals.AIContext)});
  45239. },
  45240. args: ["anAIContext"],
  45241. source: "outerContext: anAIContext\x0a\x09outerContext := anAIContext.\x0a\x09outerContext ifNotNil: [ :context | \x0a\x09\x09context innerContext: self ]",
  45242. referencedClasses: [],
  45243. messageSends: ["ifNotNil:", "innerContext:"]
  45244. }),
  45245. $globals.AIContext);
  45246. $core.addMethod(
  45247. $core.method({
  45248. selector: "receiver:",
  45249. protocol: "interpreting",
  45250. fn: function (anObject){
  45251. var self=this,$self=this;
  45252. return $core.withContext(function($ctx1) {
  45253. $recv($self._locals())._at_put_("self",anObject);
  45254. return self;
  45255. }, function($ctx1) {$ctx1.fill(self,"receiver:",{anObject:anObject},$globals.AIContext)});
  45256. },
  45257. args: ["anObject"],
  45258. source: "receiver: anObject\x0a\x09self locals at: 'self' put: anObject",
  45259. referencedClasses: [],
  45260. messageSends: ["at:put:", "locals"]
  45261. }),
  45262. $globals.AIContext);
  45263. $core.addMethod(
  45264. $core.method({
  45265. selector: "selector",
  45266. protocol: "accessing",
  45267. fn: function (){
  45268. var self=this,$self=this;
  45269. return $self["@selector"];
  45270. },
  45271. args: [],
  45272. source: "selector\x0a\x09^ selector",
  45273. referencedClasses: [],
  45274. messageSends: []
  45275. }),
  45276. $globals.AIContext);
  45277. $core.addMethod(
  45278. $core.method({
  45279. selector: "selector:",
  45280. protocol: "accessing",
  45281. fn: function (aString){
  45282. var self=this,$self=this;
  45283. $self["@selector"]=aString;
  45284. return self;
  45285. },
  45286. args: ["aString"],
  45287. source: "selector: aString\x0a\x09selector := aString",
  45288. referencedClasses: [],
  45289. messageSends: []
  45290. }),
  45291. $globals.AIContext);
  45292. $core.addMethod(
  45293. $core.method({
  45294. selector: "sendIndexAt:",
  45295. protocol: "accessing",
  45296. fn: function (aString){
  45297. var self=this,$self=this;
  45298. return $core.withContext(function($ctx1) {
  45299. return $recv($self._sendIndexes())._at_ifAbsent_(aString,(function(){
  45300. return (0);
  45301. }));
  45302. }, function($ctx1) {$ctx1.fill(self,"sendIndexAt:",{aString:aString},$globals.AIContext)});
  45303. },
  45304. args: ["aString"],
  45305. source: "sendIndexAt: aString\x0a\x09^ self sendIndexes at: aString ifAbsent: [ 0 ]",
  45306. referencedClasses: [],
  45307. messageSends: ["at:ifAbsent:", "sendIndexes"]
  45308. }),
  45309. $globals.AIContext);
  45310. $core.addMethod(
  45311. $core.method({
  45312. selector: "sendIndexes",
  45313. protocol: "accessing",
  45314. fn: function (){
  45315. var self=this,$self=this;
  45316. return $core.withContext(function($ctx1) {
  45317. var $1,$receiver;
  45318. $1=$self["@sendIndexes"];
  45319. if(($receiver = $1) == null || $receiver.a$nil){
  45320. return $recv($globals.Dictionary)._new();
  45321. } else {
  45322. return $1;
  45323. }
  45324. }, function($ctx1) {$ctx1.fill(self,"sendIndexes",{},$globals.AIContext)});
  45325. },
  45326. args: [],
  45327. source: "sendIndexes\x0a\x09^ sendIndexes ifNil: [ Dictionary new ]",
  45328. referencedClasses: ["Dictionary"],
  45329. messageSends: ["ifNil:", "new"]
  45330. }),
  45331. $globals.AIContext);
  45332. $core.addMethod(
  45333. $core.method({
  45334. selector: "sendIndexes:",
  45335. protocol: "accessing",
  45336. fn: function (aDictionary){
  45337. var self=this,$self=this;
  45338. $self["@sendIndexes"]=aDictionary;
  45339. return self;
  45340. },
  45341. args: ["aDictionary"],
  45342. source: "sendIndexes: aDictionary\x0a\x09sendIndexes := aDictionary",
  45343. referencedClasses: [],
  45344. messageSends: []
  45345. }),
  45346. $globals.AIContext);
  45347. $core.addMethod(
  45348. $core.method({
  45349. selector: "setupInterpreter:",
  45350. protocol: "interpreting",
  45351. fn: function (anInterpreter){
  45352. var self=this,$self=this;
  45353. var currentNode;
  45354. return $core.withContext(function($ctx1) {
  45355. var $1,$2,$3,$4,$7,$6,$5,$receiver;
  45356. $1=$recv($globals.ASTPCNodeVisitor)._new();
  45357. $2=$self._evaluatedSelector();
  45358. $ctx1.sendIdx["evaluatedSelector"]=1;
  45359. $recv($1)._selector_($2);
  45360. $recv($1)._index_($self._sendIndexAt_($self._evaluatedSelector()));
  45361. $3=$self._ast();
  45362. $ctx1.sendIdx["ast"]=1;
  45363. $recv($1)._visit_($3);
  45364. currentNode=$recv($1)._currentNode();
  45365. $4=$recv($self._ast())._sequenceNode();
  45366. if(($receiver = $4) == null || $receiver.a$nil){
  45367. $4;
  45368. } else {
  45369. var sequence;
  45370. sequence=$receiver;
  45371. $recv($recv(sequence)._temps())._do_((function(each){
  45372. return $core.withContext(function($ctx2) {
  45373. return $self._defineLocal_(each);
  45374. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  45375. }));
  45376. $ctx1.sendIdx["do:"]=1;
  45377. }
  45378. $recv(anInterpreter)._node_(currentNode);
  45379. $7=$self._innerContext();
  45380. $ctx1.sendIdx["innerContext"]=1;
  45381. $6=$recv($7)._arguments();
  45382. $5=$recv($6)._reversed();
  45383. $recv($5)._do_((function(each){
  45384. return $core.withContext(function($ctx2) {
  45385. return $recv(anInterpreter)._push_(each);
  45386. $ctx2.sendIdx["push:"]=1;
  45387. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  45388. }));
  45389. $recv(anInterpreter)._push_($recv($self._innerContext())._receiver());
  45390. return self;
  45391. }, function($ctx1) {$ctx1.fill(self,"setupInterpreter:",{anInterpreter:anInterpreter,currentNode:currentNode},$globals.AIContext)});
  45392. },
  45393. args: ["anInterpreter"],
  45394. 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)",
  45395. referencedClasses: ["ASTPCNodeVisitor"],
  45396. messageSends: ["selector:", "new", "evaluatedSelector", "index:", "sendIndexAt:", "visit:", "ast", "currentNode", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "node:", "reversed", "arguments", "innerContext", "push:", "receiver"]
  45397. }),
  45398. $globals.AIContext);
  45399. $core.addMethod(
  45400. $core.method({
  45401. selector: "supercall",
  45402. protocol: "interpreting",
  45403. fn: function (){
  45404. var self=this,$self=this;
  45405. return $core.withContext(function($ctx1) {
  45406. var $1,$receiver;
  45407. $1=$self["@supercall"];
  45408. if(($receiver = $1) == null || $receiver.a$nil){
  45409. return false;
  45410. } else {
  45411. return $1;
  45412. }
  45413. }, function($ctx1) {$ctx1.fill(self,"supercall",{},$globals.AIContext)});
  45414. },
  45415. args: [],
  45416. source: "supercall\x0a\x09^ supercall ifNil: [ false ]",
  45417. referencedClasses: [],
  45418. messageSends: ["ifNil:"]
  45419. }),
  45420. $globals.AIContext);
  45421. $core.addMethod(
  45422. $core.method({
  45423. selector: "supercall:",
  45424. protocol: "interpreting",
  45425. fn: function (aBoolean){
  45426. var self=this,$self=this;
  45427. $self["@supercall"]=aBoolean;
  45428. return self;
  45429. },
  45430. args: ["aBoolean"],
  45431. source: "supercall: aBoolean\x0a\x09supercall := aBoolean",
  45432. referencedClasses: [],
  45433. messageSends: []
  45434. }),
  45435. $globals.AIContext);
  45436. $core.addMethod(
  45437. $core.method({
  45438. selector: "variableNotFound",
  45439. protocol: "error handling",
  45440. fn: function (){
  45441. var self=this,$self=this;
  45442. return $core.withContext(function($ctx1) {
  45443. $self._error_("Variable missing");
  45444. return self;
  45445. }, function($ctx1) {$ctx1.fill(self,"variableNotFound",{},$globals.AIContext)});
  45446. },
  45447. args: [],
  45448. source: "variableNotFound\x0a\x09\x22Error thrown whenever a variable lookup fails\x22\x0a\x09\x0a\x09self error: 'Variable missing'",
  45449. referencedClasses: [],
  45450. messageSends: ["error:"]
  45451. }),
  45452. $globals.AIContext);
  45453. $core.addMethod(
  45454. $core.method({
  45455. selector: "fromMethodContext:",
  45456. protocol: "instance creation",
  45457. fn: function (aMethodContext){
  45458. var self=this,$self=this;
  45459. return $core.withContext(function($ctx1) {
  45460. var $1;
  45461. $1=$self._new();
  45462. $recv($1)._initializeFromMethodContext_(aMethodContext);
  45463. return $recv($1)._yourself();
  45464. }, function($ctx1) {$ctx1.fill(self,"fromMethodContext:",{aMethodContext:aMethodContext},$globals.AIContext.a$cls)});
  45465. },
  45466. args: ["aMethodContext"],
  45467. source: "fromMethodContext: aMethodContext\x0a\x09^ self new\x0a\x09\x09initializeFromMethodContext: aMethodContext;\x0a\x09\x09yourself",
  45468. referencedClasses: [],
  45469. messageSends: ["initializeFromMethodContext:", "new", "yourself"]
  45470. }),
  45471. $globals.AIContext.a$cls);
  45472. $core.addClass("AISemanticAnalyzer", $globals.SemanticAnalyzer, ["context"], "Compiler-Interpreter");
  45473. $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.";
  45474. $core.addMethod(
  45475. $core.method({
  45476. selector: "context",
  45477. protocol: "accessing",
  45478. fn: function (){
  45479. var self=this,$self=this;
  45480. return $self["@context"];
  45481. },
  45482. args: [],
  45483. source: "context\x0a\x09^ context",
  45484. referencedClasses: [],
  45485. messageSends: []
  45486. }),
  45487. $globals.AISemanticAnalyzer);
  45488. $core.addMethod(
  45489. $core.method({
  45490. selector: "context:",
  45491. protocol: "accessing",
  45492. fn: function (anAIContext){
  45493. var self=this,$self=this;
  45494. $self["@context"]=anAIContext;
  45495. return self;
  45496. },
  45497. args: ["anAIContext"],
  45498. source: "context: anAIContext\x0a\x09context := anAIContext",
  45499. referencedClasses: [],
  45500. messageSends: []
  45501. }),
  45502. $globals.AISemanticAnalyzer);
  45503. $core.addMethod(
  45504. $core.method({
  45505. selector: "visitVariableNode:",
  45506. protocol: "visiting",
  45507. fn: function (aNode){
  45508. var self=this,$self=this;
  45509. return $core.withContext(function($ctx1) {
  45510. var $1;
  45511. var $early={};
  45512. try {
  45513. $recv($self._context())._localAt_ifAbsent_($recv(aNode)._value(),(function(){
  45514. return $core.withContext(function($ctx2) {
  45515. $1=(
  45516. $ctx2.supercall = true,
  45517. ($globals.AISemanticAnalyzer.superclass||$boot.nilAsClass).fn.prototype._visitVariableNode_.apply($self, [aNode]));
  45518. $ctx2.supercall = false;
  45519. throw $early=[$1];
  45520. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45521. }));
  45522. $recv(aNode)._binding_($recv($globals.ASTContextVar)._new());
  45523. return self;
  45524. }
  45525. catch(e) {if(e===$early)return e[0]; throw e}
  45526. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.AISemanticAnalyzer)});
  45527. },
  45528. args: ["aNode"],
  45529. source: "visitVariableNode: aNode\x0a\x09self context \x0a\x09\x09localAt: aNode value \x0a\x09\x09ifAbsent: [ ^ super visitVariableNode: aNode ].\x0a\x0a\x09aNode binding: ASTContextVar new",
  45530. referencedClasses: ["ASTContextVar"],
  45531. messageSends: ["localAt:ifAbsent:", "context", "value", "visitVariableNode:", "binding:", "new"]
  45532. }),
  45533. $globals.AISemanticAnalyzer);
  45534. $core.addClass("ASTContextVar", $globals.ScopeVar, ["context"], "Compiler-Interpreter");
  45535. $globals.ASTContextVar.comment="I am a variable defined in a `context`.";
  45536. $core.addMethod(
  45537. $core.method({
  45538. selector: "context",
  45539. protocol: "accessing",
  45540. fn: function (){
  45541. var self=this,$self=this;
  45542. return $self["@context"];
  45543. },
  45544. args: [],
  45545. source: "context\x0a\x09^ context",
  45546. referencedClasses: [],
  45547. messageSends: []
  45548. }),
  45549. $globals.ASTContextVar);
  45550. $core.addMethod(
  45551. $core.method({
  45552. selector: "context:",
  45553. protocol: "accessing",
  45554. fn: function (anObject){
  45555. var self=this,$self=this;
  45556. $self["@context"]=anObject;
  45557. return self;
  45558. },
  45559. args: ["anObject"],
  45560. source: "context: anObject\x0a\x09context := anObject",
  45561. referencedClasses: [],
  45562. messageSends: []
  45563. }),
  45564. $globals.ASTContextVar);
  45565. $core.addClass("ASTDebugger", $globals.Object, ["interpreter", "context", "result"], "Compiler-Interpreter");
  45566. $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.";
  45567. $core.addMethod(
  45568. $core.method({
  45569. selector: "atEnd",
  45570. protocol: "testing",
  45571. fn: function (){
  45572. var self=this,$self=this;
  45573. return $core.withContext(function($ctx1) {
  45574. var $1,$receiver;
  45575. $1=$self._context();
  45576. $ctx1.sendIdx["context"]=1;
  45577. if(($receiver = $1) == null || $receiver.a$nil){
  45578. return true;
  45579. } else {
  45580. $1;
  45581. }
  45582. return $recv($recv($self._interpreter())._atEnd())._and_((function(){
  45583. return $core.withContext(function($ctx2) {
  45584. return $recv($self._context())._isTopContext();
  45585. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45586. }));
  45587. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTDebugger)});
  45588. },
  45589. args: [],
  45590. source: "atEnd\x09\x0a\x09self context ifNil: [ ^ true ].\x0a\x09\x0a\x09^ self interpreter atEnd and: [ \x0a\x09\x09self context isTopContext ]",
  45591. referencedClasses: [],
  45592. messageSends: ["ifNil:", "context", "and:", "atEnd", "interpreter", "isTopContext"]
  45593. }),
  45594. $globals.ASTDebugger);
  45595. $core.addMethod(
  45596. $core.method({
  45597. selector: "context",
  45598. protocol: "accessing",
  45599. fn: function (){
  45600. var self=this,$self=this;
  45601. return $self["@context"];
  45602. },
  45603. args: [],
  45604. source: "context\x0a\x09^ context",
  45605. referencedClasses: [],
  45606. messageSends: []
  45607. }),
  45608. $globals.ASTDebugger);
  45609. $core.addMethod(
  45610. $core.method({
  45611. selector: "context:",
  45612. protocol: "accessing",
  45613. fn: function (aContext){
  45614. var self=this,$self=this;
  45615. $self["@context"]=aContext;
  45616. return self;
  45617. },
  45618. args: ["aContext"],
  45619. source: "context: aContext\x0a\x09context := aContext",
  45620. referencedClasses: [],
  45621. messageSends: []
  45622. }),
  45623. $globals.ASTDebugger);
  45624. $core.addMethod(
  45625. $core.method({
  45626. selector: "flushInnerContexts",
  45627. protocol: "actions",
  45628. fn: function (){
  45629. var self=this,$self=this;
  45630. return $core.withContext(function($ctx1) {
  45631. var $1,$receiver;
  45632. $1=$self._context();
  45633. if(($receiver = $1) == null || $receiver.a$nil){
  45634. $1;
  45635. } else {
  45636. var cxt;
  45637. cxt=$receiver;
  45638. $recv(cxt)._innerContext_(nil);
  45639. }
  45640. return self;
  45641. }, function($ctx1) {$ctx1.fill(self,"flushInnerContexts",{},$globals.ASTDebugger)});
  45642. },
  45643. args: [],
  45644. 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 ]",
  45645. referencedClasses: [],
  45646. messageSends: ["ifNotNil:", "context", "innerContext:"]
  45647. }),
  45648. $globals.ASTDebugger);
  45649. $core.addMethod(
  45650. $core.method({
  45651. selector: "interpreter",
  45652. protocol: "accessing",
  45653. fn: function (){
  45654. var self=this,$self=this;
  45655. return $core.withContext(function($ctx1) {
  45656. var $1,$receiver;
  45657. $1=$self._context();
  45658. if(($receiver = $1) == null || $receiver.a$nil){
  45659. return $1;
  45660. } else {
  45661. var ctx;
  45662. ctx=$receiver;
  45663. return $recv(ctx)._interpreter();
  45664. }
  45665. }, function($ctx1) {$ctx1.fill(self,"interpreter",{},$globals.ASTDebugger)});
  45666. },
  45667. args: [],
  45668. source: "interpreter\x0a\x09^ self context ifNotNil: [ :ctx | \x0a\x09\x09ctx interpreter ]",
  45669. referencedClasses: [],
  45670. messageSends: ["ifNotNil:", "context", "interpreter"]
  45671. }),
  45672. $globals.ASTDebugger);
  45673. $core.addMethod(
  45674. $core.method({
  45675. selector: "method",
  45676. protocol: "accessing",
  45677. fn: function (){
  45678. var self=this,$self=this;
  45679. return $core.withContext(function($ctx1) {
  45680. return $recv($self._context())._method();
  45681. }, function($ctx1) {$ctx1.fill(self,"method",{},$globals.ASTDebugger)});
  45682. },
  45683. args: [],
  45684. source: "method\x0a\x09^ self context method",
  45685. referencedClasses: [],
  45686. messageSends: ["method", "context"]
  45687. }),
  45688. $globals.ASTDebugger);
  45689. $core.addMethod(
  45690. $core.method({
  45691. selector: "node",
  45692. protocol: "accessing",
  45693. fn: function (){
  45694. var self=this,$self=this;
  45695. return $core.withContext(function($ctx1) {
  45696. var $1,$receiver;
  45697. $1=$self._interpreter();
  45698. $ctx1.sendIdx["interpreter"]=1;
  45699. if(($receiver = $1) == null || $receiver.a$nil){
  45700. return $1;
  45701. } else {
  45702. return $recv($self._interpreter())._node();
  45703. }
  45704. }, function($ctx1) {$ctx1.fill(self,"node",{},$globals.ASTDebugger)});
  45705. },
  45706. args: [],
  45707. source: "node\x0a\x09^ self interpreter ifNotNil: [\x0a\x09\x09self interpreter node ]",
  45708. referencedClasses: [],
  45709. messageSends: ["ifNotNil:", "interpreter", "node"]
  45710. }),
  45711. $globals.ASTDebugger);
  45712. $core.addMethod(
  45713. $core.method({
  45714. selector: "onStep",
  45715. protocol: "private",
  45716. fn: function (){
  45717. var self=this,$self=this;
  45718. return $core.withContext(function($ctx1) {
  45719. var $1,$3,$2,$4,$6,$5,$receiver;
  45720. $1=$self._interpreter();
  45721. $ctx1.sendIdx["interpreter"]=1;
  45722. $self["@result"]=$recv($1)._result();
  45723. $3=$self._interpreter();
  45724. $ctx1.sendIdx["interpreter"]=2;
  45725. $2=$recv($3)._atEnd();
  45726. $ctx1.sendIdx["atEnd"]=1;
  45727. if($core.assert($2)){
  45728. $4=$recv($self._context())._outerContext();
  45729. if(($receiver = $4) == null || $receiver.a$nil){
  45730. $4;
  45731. } else {
  45732. var outerContext;
  45733. outerContext=$receiver;
  45734. $self._context_(outerContext);
  45735. }
  45736. $6=$self._interpreter();
  45737. $ctx1.sendIdx["interpreter"]=3;
  45738. $5=$recv($6)._atEnd();
  45739. if(!$core.assert($5)){
  45740. $recv($self._interpreter())._skip();
  45741. }
  45742. }
  45743. $self._flushInnerContexts();
  45744. return self;
  45745. }, function($ctx1) {$ctx1.fill(self,"onStep",{},$globals.ASTDebugger)});
  45746. },
  45747. args: [],
  45748. 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",
  45749. referencedClasses: [],
  45750. messageSends: ["result", "interpreter", "ifTrue:", "atEnd", "ifNotNil:", "outerContext", "context", "context:", "ifFalse:", "skip", "flushInnerContexts"]
  45751. }),
  45752. $globals.ASTDebugger);
  45753. $core.addMethod(
  45754. $core.method({
  45755. selector: "proceed",
  45756. protocol: "stepping",
  45757. fn: function (){
  45758. var self=this,$self=this;
  45759. return $core.withContext(function($ctx1) {
  45760. $recv((function(){
  45761. return $core.withContext(function($ctx2) {
  45762. return $self._atEnd();
  45763. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  45764. }))._whileFalse_((function(){
  45765. return $core.withContext(function($ctx2) {
  45766. return $self._stepOver();
  45767. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  45768. }));
  45769. return self;
  45770. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTDebugger)});
  45771. },
  45772. args: [],
  45773. source: "proceed\x0a\x09[ self atEnd ] whileFalse: [ self stepOver ]",
  45774. referencedClasses: [],
  45775. messageSends: ["whileFalse:", "atEnd", "stepOver"]
  45776. }),
  45777. $globals.ASTDebugger);
  45778. $core.addMethod(
  45779. $core.method({
  45780. selector: "restart",
  45781. protocol: "stepping",
  45782. fn: function (){
  45783. var self=this,$self=this;
  45784. return $core.withContext(function($ctx1) {
  45785. $recv($self._interpreter())._restart();
  45786. $self._flushInnerContexts();
  45787. return self;
  45788. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTDebugger)});
  45789. },
  45790. args: [],
  45791. source: "restart\x0a\x09self interpreter restart.\x0a\x09self flushInnerContexts",
  45792. referencedClasses: [],
  45793. messageSends: ["restart", "interpreter", "flushInnerContexts"]
  45794. }),
  45795. $globals.ASTDebugger);
  45796. $core.addMethod(
  45797. $core.method({
  45798. selector: "result",
  45799. protocol: "accessing",
  45800. fn: function (){
  45801. var self=this,$self=this;
  45802. return $self["@result"];
  45803. },
  45804. args: [],
  45805. source: "result\x0a\x09^ result",
  45806. referencedClasses: [],
  45807. messageSends: []
  45808. }),
  45809. $globals.ASTDebugger);
  45810. $core.addMethod(
  45811. $core.method({
  45812. selector: "stepInto",
  45813. protocol: "stepping",
  45814. fn: function (){
  45815. var self=this,$self=this;
  45816. return $core.withContext(function($ctx1) {
  45817. $self._shouldBeImplemented();
  45818. return self;
  45819. }, function($ctx1) {$ctx1.fill(self,"stepInto",{},$globals.ASTDebugger)});
  45820. },
  45821. args: [],
  45822. source: "stepInto\x0a\x09self shouldBeImplemented",
  45823. referencedClasses: [],
  45824. messageSends: ["shouldBeImplemented"]
  45825. }),
  45826. $globals.ASTDebugger);
  45827. $core.addMethod(
  45828. $core.method({
  45829. selector: "stepOver",
  45830. protocol: "stepping",
  45831. fn: function (){
  45832. var self=this,$self=this;
  45833. return $core.withContext(function($ctx1) {
  45834. var $1,$2;
  45835. $1=$recv($self._context())._isTopContext();
  45836. if($core.assert($1)){
  45837. $recv($self._interpreter())._stepOver();
  45838. } else {
  45839. $2=$self._interpreter();
  45840. $ctx1.sendIdx["interpreter"]=1;
  45841. $recv($2)._skip();
  45842. }
  45843. $self._onStep();
  45844. return self;
  45845. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTDebugger)});
  45846. },
  45847. args: [],
  45848. source: "stepOver\x0a\x09self context isTopContext \x0a\x09\x09ifFalse: [ self interpreter skip ]\x0a\x09\x09ifTrue: [ self interpreter stepOver ].\x0a\x09self onStep",
  45849. referencedClasses: [],
  45850. messageSends: ["ifFalse:ifTrue:", "isTopContext", "context", "skip", "interpreter", "stepOver", "onStep"]
  45851. }),
  45852. $globals.ASTDebugger);
  45853. $core.addMethod(
  45854. $core.method({
  45855. selector: "context:",
  45856. protocol: "instance creation",
  45857. fn: function (aContext){
  45858. var self=this,$self=this;
  45859. return $core.withContext(function($ctx1) {
  45860. var $1;
  45861. $1=$self._new();
  45862. $recv($1)._context_(aContext);
  45863. return $recv($1)._yourself();
  45864. }, function($ctx1) {$ctx1.fill(self,"context:",{aContext:aContext},$globals.ASTDebugger.a$cls)});
  45865. },
  45866. args: ["aContext"],
  45867. source: "context: aContext\x0a\x09^ self new\x0a\x09\x09context: aContext;\x0a\x09\x09yourself",
  45868. referencedClasses: [],
  45869. messageSends: ["context:", "new", "yourself"]
  45870. }),
  45871. $globals.ASTDebugger.a$cls);
  45872. $core.addClass("ASTEnterNode", $globals.NodeVisitor, ["interpreter"], "Compiler-Interpreter");
  45873. $core.addMethod(
  45874. $core.method({
  45875. selector: "interpreter",
  45876. protocol: "accessing",
  45877. fn: function (){
  45878. var self=this,$self=this;
  45879. return $self["@interpreter"];
  45880. },
  45881. args: [],
  45882. source: "interpreter\x0a\x09^ interpreter",
  45883. referencedClasses: [],
  45884. messageSends: []
  45885. }),
  45886. $globals.ASTEnterNode);
  45887. $core.addMethod(
  45888. $core.method({
  45889. selector: "interpreter:",
  45890. protocol: "accessing",
  45891. fn: function (anObject){
  45892. var self=this,$self=this;
  45893. $self["@interpreter"]=anObject;
  45894. return self;
  45895. },
  45896. args: ["anObject"],
  45897. source: "interpreter: anObject\x0a\x09interpreter := anObject",
  45898. referencedClasses: [],
  45899. messageSends: []
  45900. }),
  45901. $globals.ASTEnterNode);
  45902. $core.addMethod(
  45903. $core.method({
  45904. selector: "visitBlockNode:",
  45905. protocol: "visiting",
  45906. fn: function (aNode){
  45907. var self=this,$self=this;
  45908. return aNode;
  45909. },
  45910. args: ["aNode"],
  45911. source: "visitBlockNode: aNode\x0a\x09\x22Answer the node as we want to avoid eager evaluation\x22\x0a\x09\x0a\x09^ aNode",
  45912. referencedClasses: [],
  45913. messageSends: []
  45914. }),
  45915. $globals.ASTEnterNode);
  45916. $core.addMethod(
  45917. $core.method({
  45918. selector: "visitDagNode:",
  45919. protocol: "visiting",
  45920. fn: function (aNode){
  45921. var self=this,$self=this;
  45922. return $core.withContext(function($ctx1) {
  45923. var $early={};
  45924. try {
  45925. $recv($recv(aNode)._dagChildren())._ifEmpty_ifNotEmpty_((function(){
  45926. throw $early=[aNode];
  45927. }),(function(nodes){
  45928. return $core.withContext(function($ctx2) {
  45929. throw $early=[$self._visit_($recv(nodes)._first())];
  45930. }, function($ctx2) {$ctx2.fillBlock({nodes:nodes},$ctx1,2)});
  45931. }));
  45932. return self;
  45933. }
  45934. catch(e) {if(e===$early)return e[0]; throw e}
  45935. }, function($ctx1) {$ctx1.fill(self,"visitDagNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45936. },
  45937. args: ["aNode"],
  45938. source: "visitDagNode: aNode\x0a\x09aNode dagChildren\x0a\x09\x09ifEmpty: [ ^ aNode ]\x0a\x09\x09ifNotEmpty: [ :nodes | ^ self visit: nodes first ]",
  45939. referencedClasses: [],
  45940. messageSends: ["ifEmpty:ifNotEmpty:", "dagChildren", "visit:", "first"]
  45941. }),
  45942. $globals.ASTEnterNode);
  45943. $core.addMethod(
  45944. $core.method({
  45945. selector: "visitSequenceNode:",
  45946. protocol: "visiting",
  45947. fn: function (aNode){
  45948. var self=this,$self=this;
  45949. return $core.withContext(function($ctx1) {
  45950. var $1;
  45951. $recv($recv(aNode)._temps())._do_((function(each){
  45952. return $core.withContext(function($ctx2) {
  45953. return $recv($recv($self._interpreter())._context())._defineLocal_(each);
  45954. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  45955. }));
  45956. $1=(
  45957. $ctx1.supercall = true,
  45958. ($globals.ASTEnterNode.superclass||$boot.nilAsClass).fn.prototype._visitSequenceNode_.apply($self, [aNode]));
  45959. $ctx1.supercall = false;
  45960. return $1;
  45961. }, function($ctx1) {$ctx1.fill(self,"visitSequenceNode:",{aNode:aNode},$globals.ASTEnterNode)});
  45962. },
  45963. args: ["aNode"],
  45964. source: "visitSequenceNode: aNode\x0a\x09aNode temps do: [ :each |\x0a\x09\x09self interpreter context defineLocal: each ].\x0a\x09^ super visitSequenceNode: aNode",
  45965. referencedClasses: [],
  45966. messageSends: ["do:", "temps", "defineLocal:", "context", "interpreter", "visitSequenceNode:"]
  45967. }),
  45968. $globals.ASTEnterNode);
  45969. $core.addMethod(
  45970. $core.method({
  45971. selector: "on:",
  45972. protocol: "instance creation",
  45973. fn: function (anInterpreter){
  45974. var self=this,$self=this;
  45975. return $core.withContext(function($ctx1) {
  45976. var $1;
  45977. $1=$self._new();
  45978. $recv($1)._interpreter_(anInterpreter);
  45979. return $recv($1)._yourself();
  45980. }, function($ctx1) {$ctx1.fill(self,"on:",{anInterpreter:anInterpreter},$globals.ASTEnterNode.a$cls)});
  45981. },
  45982. args: ["anInterpreter"],
  45983. source: "on: anInterpreter\x0a\x09^ self new\x0a\x09\x09interpreter: anInterpreter;\x0a\x09\x09yourself",
  45984. referencedClasses: [],
  45985. messageSends: ["interpreter:", "new", "yourself"]
  45986. }),
  45987. $globals.ASTEnterNode.a$cls);
  45988. $core.addClass("ASTInterpreter", $globals.NodeVisitor, ["node", "context", "stack", "returnValue", "returned", "forceAtEnd"], "Compiler-Interpreter");
  45989. $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";
  45990. $core.addMethod(
  45991. $core.method({
  45992. selector: "assign:to:",
  45993. protocol: "private",
  45994. fn: function (aNode,anObject){
  45995. var self=this,$self=this;
  45996. return $core.withContext(function($ctx1) {
  45997. var $1,$3,$2,$4;
  45998. $1=$recv($recv(aNode)._binding())._isInstanceVar();
  45999. if($core.assert($1)){
  46000. $3=$self._context();
  46001. $ctx1.sendIdx["context"]=1;
  46002. $2=$recv($3)._receiver();
  46003. $4=$recv(aNode)._value();
  46004. $ctx1.sendIdx["value"]=1;
  46005. $recv($2)._instVarAt_put_($4,anObject);
  46006. } else {
  46007. $recv($self._context())._localAt_put_($recv(aNode)._value(),anObject);
  46008. }
  46009. return self;
  46010. }, function($ctx1) {$ctx1.fill(self,"assign:to:",{aNode:aNode,anObject:anObject},$globals.ASTInterpreter)});
  46011. },
  46012. args: ["aNode", "anObject"],
  46013. 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 ]",
  46014. referencedClasses: [],
  46015. messageSends: ["ifTrue:ifFalse:", "isInstanceVar", "binding", "instVarAt:put:", "receiver", "context", "value", "localAt:put:"]
  46016. }),
  46017. $globals.ASTInterpreter);
  46018. $core.addMethod(
  46019. $core.method({
  46020. selector: "atEnd",
  46021. protocol: "testing",
  46022. fn: function (){
  46023. var self=this,$self=this;
  46024. return $core.withContext(function($ctx1) {
  46025. var $1;
  46026. $1=$self["@forceAtEnd"];
  46027. if($core.assert($1)){
  46028. return true;
  46029. }
  46030. return $recv($self._hasReturned())._or_((function(){
  46031. return $core.withContext(function($ctx2) {
  46032. return $recv($self._node())._isNil();
  46033. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46034. }));
  46035. }, function($ctx1) {$ctx1.fill(self,"atEnd",{},$globals.ASTInterpreter)});
  46036. },
  46037. args: [],
  46038. source: "atEnd\x0a\x09forceAtEnd ifTrue: [ ^ true ].\x0a\x09\x0a\x09^ self hasReturned or: [ self node isNil ]",
  46039. referencedClasses: [],
  46040. messageSends: ["ifTrue:", "or:", "hasReturned", "isNil", "node"]
  46041. }),
  46042. $globals.ASTInterpreter);
  46043. $core.addMethod(
  46044. $core.method({
  46045. selector: "context",
  46046. protocol: "accessing",
  46047. fn: function (){
  46048. var self=this,$self=this;
  46049. return $self["@context"];
  46050. },
  46051. args: [],
  46052. source: "context\x0a\x09^ context",
  46053. referencedClasses: [],
  46054. messageSends: []
  46055. }),
  46056. $globals.ASTInterpreter);
  46057. $core.addMethod(
  46058. $core.method({
  46059. selector: "context:",
  46060. protocol: "accessing",
  46061. fn: function (aContext){
  46062. var self=this,$self=this;
  46063. $self["@context"]=aContext;
  46064. return self;
  46065. },
  46066. args: ["aContext"],
  46067. source: "context: aContext\x0a\x09context := aContext",
  46068. referencedClasses: [],
  46069. messageSends: []
  46070. }),
  46071. $globals.ASTInterpreter);
  46072. $core.addMethod(
  46073. $core.method({
  46074. selector: "enterNode",
  46075. protocol: "interpreting",
  46076. fn: function (){
  46077. var self=this,$self=this;
  46078. return $core.withContext(function($ctx1) {
  46079. $self._node_($recv($recv($globals.ASTEnterNode)._on_(self))._visit_($self._node()));
  46080. return self;
  46081. }, function($ctx1) {$ctx1.fill(self,"enterNode",{},$globals.ASTInterpreter)});
  46082. },
  46083. args: [],
  46084. source: "enterNode\x0a\x09self node: ((ASTEnterNode on: self) visit: self node)",
  46085. referencedClasses: ["ASTEnterNode"],
  46086. messageSends: ["node:", "visit:", "on:", "node"]
  46087. }),
  46088. $globals.ASTInterpreter);
  46089. $core.addMethod(
  46090. $core.method({
  46091. selector: "eval:",
  46092. protocol: "private",
  46093. fn: function (aString){
  46094. var self=this,$self=this;
  46095. var source,function_;
  46096. return $core.withContext(function($ctx1) {
  46097. var $3,$2,$1;
  46098. source=$recv($globals.String)._streamContents_((function(str){
  46099. return $core.withContext(function($ctx2) {
  46100. $recv(str)._nextPutAll_("0,(function(");
  46101. $ctx2.sendIdx["nextPutAll:"]=1;
  46102. $3=$self._context();
  46103. $ctx2.sendIdx["context"]=1;
  46104. $2=$recv($3)._locals();
  46105. $ctx2.sendIdx["locals"]=1;
  46106. $1=$recv($2)._keys();
  46107. $recv($1)._do_separatedBy_((function(each){
  46108. return $core.withContext(function($ctx3) {
  46109. return $recv(str)._nextPutAll_(each);
  46110. $ctx3.sendIdx["nextPutAll:"]=2;
  46111. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,2)});
  46112. }),(function(){
  46113. return $core.withContext(function($ctx3) {
  46114. return $recv(str)._nextPutAll_(",");
  46115. $ctx3.sendIdx["nextPutAll:"]=3;
  46116. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  46117. }));
  46118. $recv(str)._nextPutAll_("){ return (function() {");
  46119. $ctx2.sendIdx["nextPutAll:"]=4;
  46120. $recv(str)._nextPutAll_(aString);
  46121. $ctx2.sendIdx["nextPutAll:"]=5;
  46122. return $recv(str)._nextPutAll_("})()})");
  46123. }, function($ctx2) {$ctx2.fillBlock({str:str},$ctx1,1)});
  46124. }));
  46125. function_=$recv($globals.Compiler)._eval_(source);
  46126. return $recv(function_)._valueWithPossibleArguments_($recv($recv($self._context())._locals())._values());
  46127. }, function($ctx1) {$ctx1.fill(self,"eval:",{aString:aString,source:source,function_:function_},$globals.ASTInterpreter)});
  46128. },
  46129. args: ["aString"],
  46130. 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",
  46131. referencedClasses: ["String", "Compiler"],
  46132. messageSends: ["streamContents:", "nextPutAll:", "do:separatedBy:", "keys", "locals", "context", "eval:", "valueWithPossibleArguments:", "values"]
  46133. }),
  46134. $globals.ASTInterpreter);
  46135. $core.addMethod(
  46136. $core.method({
  46137. selector: "hasReturned",
  46138. protocol: "testing",
  46139. fn: function (){
  46140. var self=this,$self=this;
  46141. return $core.withContext(function($ctx1) {
  46142. var $1,$receiver;
  46143. $1=$self["@returned"];
  46144. if(($receiver = $1) == null || $receiver.a$nil){
  46145. return false;
  46146. } else {
  46147. return $1;
  46148. }
  46149. }, function($ctx1) {$ctx1.fill(self,"hasReturned",{},$globals.ASTInterpreter)});
  46150. },
  46151. args: [],
  46152. source: "hasReturned\x0a\x09^ returned ifNil: [ false ]",
  46153. referencedClasses: [],
  46154. messageSends: ["ifNil:"]
  46155. }),
  46156. $globals.ASTInterpreter);
  46157. $core.addMethod(
  46158. $core.method({
  46159. selector: "initialize",
  46160. protocol: "initialization",
  46161. fn: function (){
  46162. var self=this,$self=this;
  46163. return $core.withContext(function($ctx1) {
  46164. (
  46165. $ctx1.supercall = true,
  46166. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  46167. $ctx1.supercall = false;
  46168. $self["@forceAtEnd"]=false;
  46169. return self;
  46170. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.ASTInterpreter)});
  46171. },
  46172. args: [],
  46173. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09forceAtEnd := false",
  46174. referencedClasses: [],
  46175. messageSends: ["initialize"]
  46176. }),
  46177. $globals.ASTInterpreter);
  46178. $core.addMethod(
  46179. $core.method({
  46180. selector: "interpret",
  46181. protocol: "interpreting",
  46182. fn: function (){
  46183. var self=this,$self=this;
  46184. return $core.withContext(function($ctx1) {
  46185. $self._visit_($self._node());
  46186. return self;
  46187. }, function($ctx1) {$ctx1.fill(self,"interpret",{},$globals.ASTInterpreter)});
  46188. },
  46189. args: [],
  46190. source: "interpret\x0a\x09\x22Interpret the next node to be evaluated\x22\x0a\x09\x0a\x09self visit: self node",
  46191. referencedClasses: [],
  46192. messageSends: ["visit:", "node"]
  46193. }),
  46194. $globals.ASTInterpreter);
  46195. $core.addMethod(
  46196. $core.method({
  46197. selector: "messageFromSendNode:arguments:",
  46198. protocol: "private",
  46199. fn: function (aSendNode,aCollection){
  46200. var self=this,$self=this;
  46201. return $core.withContext(function($ctx1) {
  46202. var $1;
  46203. $1=$recv($globals.Message)._new();
  46204. $recv($1)._selector_($recv(aSendNode)._selector());
  46205. $recv($1)._arguments_(aCollection);
  46206. return $recv($1)._yourself();
  46207. }, function($ctx1) {$ctx1.fill(self,"messageFromSendNode:arguments:",{aSendNode:aSendNode,aCollection:aCollection},$globals.ASTInterpreter)});
  46208. },
  46209. args: ["aSendNode", "aCollection"],
  46210. source: "messageFromSendNode: aSendNode arguments: aCollection\x0a\x09^ Message new\x0a\x09\x09selector: aSendNode selector;\x0a\x09\x09arguments: aCollection;\x0a\x09\x09yourself",
  46211. referencedClasses: ["Message"],
  46212. messageSends: ["selector:", "new", "selector", "arguments:", "yourself"]
  46213. }),
  46214. $globals.ASTInterpreter);
  46215. $core.addMethod(
  46216. $core.method({
  46217. selector: "messageNotUnderstood:receiver:",
  46218. protocol: "private",
  46219. fn: function (aMessage,anObject){
  46220. var self=this,$self=this;
  46221. return $core.withContext(function($ctx1) {
  46222. var $1;
  46223. $1=$recv($globals.MessageNotUnderstood)._new();
  46224. $recv($1)._message_(aMessage);
  46225. $recv($1)._receiver_(anObject);
  46226. $recv($1)._signal();
  46227. return self;
  46228. }, function($ctx1) {$ctx1.fill(self,"messageNotUnderstood:receiver:",{aMessage:aMessage,anObject:anObject},$globals.ASTInterpreter)});
  46229. },
  46230. args: ["aMessage", "anObject"],
  46231. source: "messageNotUnderstood: aMessage receiver: anObject\x0a\x09MessageNotUnderstood new\x0a\x09\x09message: aMessage;\x0a\x09\x09receiver: anObject;\x0a\x09\x09signal",
  46232. referencedClasses: ["MessageNotUnderstood"],
  46233. messageSends: ["message:", "new", "receiver:", "signal"]
  46234. }),
  46235. $globals.ASTInterpreter);
  46236. $core.addMethod(
  46237. $core.method({
  46238. selector: "next",
  46239. protocol: "interpreting",
  46240. fn: function (){
  46241. var self=this,$self=this;
  46242. var nd,nextNode;
  46243. return $core.withContext(function($ctx1) {
  46244. var $1,$2,$receiver;
  46245. nd=$self._node();
  46246. $1=$recv(nd)._parent();
  46247. if(($receiver = $1) == null || $receiver.a$nil){
  46248. nextNode=$1;
  46249. } else {
  46250. var parent;
  46251. parent=$receiver;
  46252. $2=$recv(parent)._nextSiblingNode_(nd);
  46253. if(($receiver = $2) == null || $receiver.a$nil){
  46254. nextNode=parent;
  46255. } else {
  46256. var sibling;
  46257. sibling=$receiver;
  46258. nextNode=$recv($recv($globals.ASTEnterNode)._on_(self))._visit_(sibling);
  46259. }
  46260. }
  46261. $self._node_(nextNode);
  46262. return self;
  46263. }, function($ctx1) {$ctx1.fill(self,"next",{nd:nd,nextNode:nextNode},$globals.ASTInterpreter)});
  46264. },
  46265. args: [],
  46266. 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",
  46267. referencedClasses: ["ASTEnterNode"],
  46268. messageSends: ["node", "ifNotNil:", "parent", "ifNil:ifNotNil:", "nextSiblingNode:", "visit:", "on:", "node:"]
  46269. }),
  46270. $globals.ASTInterpreter);
  46271. $core.addMethod(
  46272. $core.method({
  46273. selector: "node",
  46274. protocol: "accessing",
  46275. fn: function (){
  46276. var self=this,$self=this;
  46277. return $self["@node"];
  46278. },
  46279. args: [],
  46280. source: "node\x0a\x09\x22Answer the next node, ie the node to be evaluated in the next step\x22\x0a\x09\x0a\x09^ node",
  46281. referencedClasses: [],
  46282. messageSends: []
  46283. }),
  46284. $globals.ASTInterpreter);
  46285. $core.addMethod(
  46286. $core.method({
  46287. selector: "node:",
  46288. protocol: "accessing",
  46289. fn: function (aNode){
  46290. var self=this,$self=this;
  46291. $self["@node"]=aNode;
  46292. return self;
  46293. },
  46294. args: ["aNode"],
  46295. source: "node: aNode\x0a\x09node := aNode",
  46296. referencedClasses: [],
  46297. messageSends: []
  46298. }),
  46299. $globals.ASTInterpreter);
  46300. $core.addMethod(
  46301. $core.method({
  46302. selector: "peek",
  46303. protocol: "stack",
  46304. fn: function (){
  46305. var self=this,$self=this;
  46306. return $core.withContext(function($ctx1) {
  46307. var $1;
  46308. var $early={};
  46309. try {
  46310. $1=$self._stack();
  46311. $ctx1.sendIdx["stack"]=1;
  46312. $recv($1)._ifEmpty_((function(){
  46313. throw $early=[nil];
  46314. }));
  46315. return $recv($self._stack())._last();
  46316. }
  46317. catch(e) {if(e===$early)return e[0]; throw e}
  46318. }, function($ctx1) {$ctx1.fill(self,"peek",{},$globals.ASTInterpreter)});
  46319. },
  46320. args: [],
  46321. 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",
  46322. referencedClasses: [],
  46323. messageSends: ["ifEmpty:", "stack", "last"]
  46324. }),
  46325. $globals.ASTInterpreter);
  46326. $core.addMethod(
  46327. $core.method({
  46328. selector: "pop",
  46329. protocol: "stack",
  46330. fn: function (){
  46331. var self=this,$self=this;
  46332. var peekedValue;
  46333. return $core.withContext(function($ctx1) {
  46334. peekedValue=$self._peek();
  46335. $recv($self._stack())._removeLast();
  46336. return peekedValue;
  46337. }, function($ctx1) {$ctx1.fill(self,"pop",{peekedValue:peekedValue},$globals.ASTInterpreter)});
  46338. },
  46339. args: [],
  46340. 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",
  46341. referencedClasses: [],
  46342. messageSends: ["peek", "removeLast", "stack"]
  46343. }),
  46344. $globals.ASTInterpreter);
  46345. $core.addMethod(
  46346. $core.method({
  46347. selector: "proceed",
  46348. protocol: "interpreting",
  46349. fn: function (){
  46350. var self=this,$self=this;
  46351. return $core.withContext(function($ctx1) {
  46352. $recv((function(){
  46353. return $core.withContext(function($ctx2) {
  46354. return $self._atEnd();
  46355. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46356. }))._whileFalse_((function(){
  46357. return $core.withContext(function($ctx2) {
  46358. return $self._step();
  46359. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46360. }));
  46361. return self;
  46362. }, function($ctx1) {$ctx1.fill(self,"proceed",{},$globals.ASTInterpreter)});
  46363. },
  46364. args: [],
  46365. source: "proceed\x0a\x09\x22Eagerly evaluate the ast\x22\x0a\x09\x0a\x09[ self atEnd ] \x0a\x09\x09whileFalse: [ self step ]",
  46366. referencedClasses: [],
  46367. messageSends: ["whileFalse:", "atEnd", "step"]
  46368. }),
  46369. $globals.ASTInterpreter);
  46370. $core.addMethod(
  46371. $core.method({
  46372. selector: "push:",
  46373. protocol: "stack",
  46374. fn: function (anObject){
  46375. var self=this,$self=this;
  46376. return $core.withContext(function($ctx1) {
  46377. return $recv($self._stack())._add_(anObject);
  46378. }, function($ctx1) {$ctx1.fill(self,"push:",{anObject:anObject},$globals.ASTInterpreter)});
  46379. },
  46380. args: ["anObject"],
  46381. source: "push: anObject\x0a\x09\x22Push an object to the context stack\x22\x0a\x09\x0a\x09^ self stack add: anObject",
  46382. referencedClasses: [],
  46383. messageSends: ["add:", "stack"]
  46384. }),
  46385. $globals.ASTInterpreter);
  46386. $core.addMethod(
  46387. $core.method({
  46388. selector: "restart",
  46389. protocol: "interpreting",
  46390. fn: function (){
  46391. var self=this,$self=this;
  46392. return $core.withContext(function($ctx1) {
  46393. $self._node_($recv($self._context())._ast());
  46394. $self._enterNode();
  46395. return self;
  46396. }, function($ctx1) {$ctx1.fill(self,"restart",{},$globals.ASTInterpreter)});
  46397. },
  46398. args: [],
  46399. source: "restart\x0a\x09self node: self context ast; enterNode",
  46400. referencedClasses: [],
  46401. messageSends: ["node:", "ast", "context", "enterNode"]
  46402. }),
  46403. $globals.ASTInterpreter);
  46404. $core.addMethod(
  46405. $core.method({
  46406. selector: "result",
  46407. protocol: "accessing",
  46408. fn: function (){
  46409. var self=this,$self=this;
  46410. return $core.withContext(function($ctx1) {
  46411. var $1;
  46412. $1=$self._hasReturned();
  46413. if($core.assert($1)){
  46414. return $self._returnValue();
  46415. } else {
  46416. return $recv($self._context())._receiver();
  46417. }
  46418. }, function($ctx1) {$ctx1.fill(self,"result",{},$globals.ASTInterpreter)});
  46419. },
  46420. args: [],
  46421. source: "result\x0a\x09^ self hasReturned \x0a\x09\x09ifTrue: [ self returnValue ] \x0a\x09\x09ifFalse: [ self context receiver ]",
  46422. referencedClasses: [],
  46423. messageSends: ["ifTrue:ifFalse:", "hasReturned", "returnValue", "receiver", "context"]
  46424. }),
  46425. $globals.ASTInterpreter);
  46426. $core.addMethod(
  46427. $core.method({
  46428. selector: "returnValue",
  46429. protocol: "accessing",
  46430. fn: function (){
  46431. var self=this,$self=this;
  46432. return $self["@returnValue"];
  46433. },
  46434. args: [],
  46435. source: "returnValue\x0a\x09^ returnValue",
  46436. referencedClasses: [],
  46437. messageSends: []
  46438. }),
  46439. $globals.ASTInterpreter);
  46440. $core.addMethod(
  46441. $core.method({
  46442. selector: "returnValue:",
  46443. protocol: "accessing",
  46444. fn: function (anObject){
  46445. var self=this,$self=this;
  46446. $self["@returnValue"]=anObject;
  46447. return self;
  46448. },
  46449. args: ["anObject"],
  46450. source: "returnValue: anObject\x0a\x09returnValue := anObject",
  46451. referencedClasses: [],
  46452. messageSends: []
  46453. }),
  46454. $globals.ASTInterpreter);
  46455. $core.addMethod(
  46456. $core.method({
  46457. selector: "sendMessage:to:superSend:",
  46458. protocol: "private",
  46459. fn: function (aMessage,anObject,aBoolean){
  46460. var self=this,$self=this;
  46461. var method;
  46462. return $core.withContext(function($ctx1) {
  46463. var $2,$1,$3,$receiver;
  46464. var $early={};
  46465. try {
  46466. if(!$core.assert(aBoolean)){
  46467. return $recv(aMessage)._sendTo_(anObject);
  46468. }
  46469. $2=$recv(anObject)._class();
  46470. $ctx1.sendIdx["class"]=1;
  46471. $1=$recv($2)._superclass();
  46472. $ctx1.sendIdx["superclass"]=1;
  46473. if(($receiver = $1) == null || $receiver.a$nil){
  46474. $3=$self._messageNotUnderstood_receiver_(aMessage,anObject);
  46475. $ctx1.sendIdx["messageNotUnderstood:receiver:"]=1;
  46476. return $3;
  46477. } else {
  46478. $1;
  46479. }
  46480. method=$recv($recv($recv($recv(anObject)._class())._superclass())._methodDictionary())._at_ifAbsent_($recv(aMessage)._selector(),(function(){
  46481. return $core.withContext(function($ctx2) {
  46482. throw $early=[$self._messageNotUnderstood_receiver_(aMessage,anObject)];
  46483. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46484. }));
  46485. return $recv(method)._sendTo_arguments_(anObject,$recv(aMessage)._arguments());
  46486. }
  46487. catch(e) {if(e===$early)return e[0]; throw e}
  46488. }, function($ctx1) {$ctx1.fill(self,"sendMessage:to:superSend:",{aMessage:aMessage,anObject:anObject,aBoolean:aBoolean,method:method},$globals.ASTInterpreter)});
  46489. },
  46490. args: ["aMessage", "anObject", "aBoolean"],
  46491. 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",
  46492. referencedClasses: [],
  46493. messageSends: ["ifFalse:", "sendTo:", "ifNil:", "superclass", "class", "messageNotUnderstood:receiver:", "at:ifAbsent:", "methodDictionary", "selector", "sendTo:arguments:", "arguments"]
  46494. }),
  46495. $globals.ASTInterpreter);
  46496. $core.addMethod(
  46497. $core.method({
  46498. selector: "setNonLocalReturnFromContext:",
  46499. protocol: "interpreting",
  46500. fn: function (aContext){
  46501. var self=this,$self=this;
  46502. return $core.withContext(function($ctx1) {
  46503. var $2,$1;
  46504. $2=$recv(aContext)._interpreter();
  46505. $ctx1.sendIdx["interpreter"]=1;
  46506. $1=$recv($2)._hasReturned();
  46507. if($core.assert($1)){
  46508. $self["@returned"]=true;
  46509. $self._returnValue_($recv($recv(aContext)._interpreter())._returnValue());
  46510. }
  46511. return self;
  46512. }, function($ctx1) {$ctx1.fill(self,"setNonLocalReturnFromContext:",{aContext:aContext},$globals.ASTInterpreter)});
  46513. },
  46514. args: ["aContext"],
  46515. source: "setNonLocalReturnFromContext: aContext\x0a\x09aContext interpreter hasReturned ifTrue: [\x0a\x09\x09returned := true.\x0a\x09\x09self returnValue: aContext interpreter returnValue ]",
  46516. referencedClasses: [],
  46517. messageSends: ["ifTrue:", "hasReturned", "interpreter", "returnValue:", "returnValue"]
  46518. }),
  46519. $globals.ASTInterpreter);
  46520. $core.addMethod(
  46521. $core.method({
  46522. selector: "skip",
  46523. protocol: "interpreting",
  46524. fn: function (){
  46525. var self=this,$self=this;
  46526. return $core.withContext(function($ctx1) {
  46527. $self._next();
  46528. return self;
  46529. }, function($ctx1) {$ctx1.fill(self,"skip",{},$globals.ASTInterpreter)});
  46530. },
  46531. args: [],
  46532. source: "skip\x0a\x09self next",
  46533. referencedClasses: [],
  46534. messageSends: ["next"]
  46535. }),
  46536. $globals.ASTInterpreter);
  46537. $core.addMethod(
  46538. $core.method({
  46539. selector: "stack",
  46540. protocol: "accessing",
  46541. fn: function (){
  46542. var self=this,$self=this;
  46543. return $core.withContext(function($ctx1) {
  46544. var $1,$receiver;
  46545. $1=$self["@stack"];
  46546. if(($receiver = $1) == null || $receiver.a$nil){
  46547. $self["@stack"]=$recv($globals.OrderedCollection)._new();
  46548. return $self["@stack"];
  46549. } else {
  46550. return $1;
  46551. }
  46552. }, function($ctx1) {$ctx1.fill(self,"stack",{},$globals.ASTInterpreter)});
  46553. },
  46554. args: [],
  46555. source: "stack\x0a\x09^ stack ifNil: [ stack := OrderedCollection new ]",
  46556. referencedClasses: ["OrderedCollection"],
  46557. messageSends: ["ifNil:", "new"]
  46558. }),
  46559. $globals.ASTInterpreter);
  46560. $core.addMethod(
  46561. $core.method({
  46562. selector: "step",
  46563. protocol: "interpreting",
  46564. fn: function (){
  46565. var self=this,$self=this;
  46566. return $core.withContext(function($ctx1) {
  46567. $self._interpret();
  46568. $self._next();
  46569. return self;
  46570. }, function($ctx1) {$ctx1.fill(self,"step",{},$globals.ASTInterpreter)});
  46571. },
  46572. args: [],
  46573. source: "step\x0a\x09self \x0a\x09\x09interpret; \x0a\x09\x09next",
  46574. referencedClasses: [],
  46575. messageSends: ["interpret", "next"]
  46576. }),
  46577. $globals.ASTInterpreter);
  46578. $core.addMethod(
  46579. $core.method({
  46580. selector: "stepOver",
  46581. protocol: "interpreting",
  46582. fn: function (){
  46583. var self=this,$self=this;
  46584. return $core.withContext(function($ctx1) {
  46585. var $2,$1;
  46586. $self._step();
  46587. $ctx1.sendIdx["step"]=1;
  46588. $recv((function(){
  46589. return $core.withContext(function($ctx2) {
  46590. $2=$self._node();
  46591. $ctx2.sendIdx["node"]=1;
  46592. $1=$recv($2)._isNil();
  46593. return $recv($1)._or_((function(){
  46594. return $core.withContext(function($ctx3) {
  46595. return $recv($self._node())._isSteppingNode();
  46596. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  46597. }));
  46598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  46599. }))._whileFalse_((function(){
  46600. return $core.withContext(function($ctx2) {
  46601. return $self._step();
  46602. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  46603. }));
  46604. return self;
  46605. }, function($ctx1) {$ctx1.fill(self,"stepOver",{},$globals.ASTInterpreter)});
  46606. },
  46607. args: [],
  46608. source: "stepOver\x0a\x09self step.\x0a\x09\x0a\x09[ self node isNil or: [ self node isSteppingNode ] ] whileFalse: [ \x0a\x09\x09self step ]",
  46609. referencedClasses: [],
  46610. messageSends: ["step", "whileFalse:", "or:", "isNil", "node", "isSteppingNode"]
  46611. }),
  46612. $globals.ASTInterpreter);
  46613. $core.addMethod(
  46614. $core.method({
  46615. selector: "visit:",
  46616. protocol: "visiting",
  46617. fn: function (aNode){
  46618. var self=this,$self=this;
  46619. return $core.withContext(function($ctx1) {
  46620. var $1;
  46621. $1=$self._hasReturned();
  46622. if(!$core.assert($1)){
  46623. (
  46624. $ctx1.supercall = true,
  46625. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visit_.apply($self, [aNode]));
  46626. $ctx1.supercall = false;
  46627. }
  46628. return self;
  46629. }, function($ctx1) {$ctx1.fill(self,"visit:",{aNode:aNode},$globals.ASTInterpreter)});
  46630. },
  46631. args: ["aNode"],
  46632. source: "visit: aNode\x0a\x09self hasReturned ifFalse: [ super visit: aNode ]",
  46633. referencedClasses: [],
  46634. messageSends: ["ifFalse:", "hasReturned", "visit:"]
  46635. }),
  46636. $globals.ASTInterpreter);
  46637. $core.addMethod(
  46638. $core.method({
  46639. selector: "visitAssignmentNode:",
  46640. protocol: "visiting",
  46641. fn: function (aNode){
  46642. var self=this,$self=this;
  46643. var poppedValue;
  46644. return $core.withContext(function($ctx1) {
  46645. poppedValue=$self._pop();
  46646. $ctx1.sendIdx["pop"]=1;
  46647. $self._pop();
  46648. $self._push_(poppedValue);
  46649. $self._assign_to_($recv(aNode)._left(),poppedValue);
  46650. return self;
  46651. }, function($ctx1) {$ctx1.fill(self,"visitAssignmentNode:",{aNode:aNode,poppedValue:poppedValue},$globals.ASTInterpreter)});
  46652. },
  46653. args: ["aNode"],
  46654. 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",
  46655. referencedClasses: [],
  46656. messageSends: ["pop", "push:", "assign:to:", "left"]
  46657. }),
  46658. $globals.ASTInterpreter);
  46659. $core.addMethod(
  46660. $core.method({
  46661. selector: "visitBlockNode:",
  46662. protocol: "visiting",
  46663. fn: function (aNode){
  46664. var self=this,$self=this;
  46665. var block;
  46666. return $core.withContext(function($ctx1) {
  46667. block=$recv($globals.AIBlockClosure)._forContext_node_($self._context(),aNode);
  46668. $self._push_(block);
  46669. return self;
  46670. }, function($ctx1) {$ctx1.fill(self,"visitBlockNode:",{aNode:aNode,block:block},$globals.ASTInterpreter)});
  46671. },
  46672. args: ["aNode"],
  46673. 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",
  46674. referencedClasses: ["AIBlockClosure"],
  46675. messageSends: ["forContext:node:", "context", "push:"]
  46676. }),
  46677. $globals.ASTInterpreter);
  46678. $core.addMethod(
  46679. $core.method({
  46680. selector: "visitBlockSequenceNode:",
  46681. protocol: "visiting",
  46682. fn: function (aNode){
  46683. var self=this,$self=this;
  46684. return $core.withContext(function($ctx1) {
  46685. (
  46686. $ctx1.supercall = true,
  46687. ($globals.ASTInterpreter.superclass||$boot.nilAsClass).fn.prototype._visitBlockSequenceNode_.apply($self, [aNode]));
  46688. $ctx1.supercall = false;
  46689. $self["@forceAtEnd"]=true;
  46690. return self;
  46691. }, function($ctx1) {$ctx1.fill(self,"visitBlockSequenceNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46692. },
  46693. args: ["aNode"],
  46694. 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",
  46695. referencedClasses: [],
  46696. messageSends: ["visitBlockSequenceNode:"]
  46697. }),
  46698. $globals.ASTInterpreter);
  46699. $core.addMethod(
  46700. $core.method({
  46701. selector: "visitDagNode:",
  46702. protocol: "visiting",
  46703. fn: function (aNode){
  46704. var self=this,$self=this;
  46705. return self;
  46706. },
  46707. args: ["aNode"],
  46708. source: "visitDagNode: aNode\x0a\x09\x22Do nothing by default. Especially, do not visit children recursively.\x22",
  46709. referencedClasses: [],
  46710. messageSends: []
  46711. }),
  46712. $globals.ASTInterpreter);
  46713. $core.addMethod(
  46714. $core.method({
  46715. selector: "visitDynamicArrayNode:",
  46716. protocol: "visiting",
  46717. fn: function (aNode){
  46718. var self=this,$self=this;
  46719. var array;
  46720. return $core.withContext(function($ctx1) {
  46721. array=[];
  46722. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46723. return $core.withContext(function($ctx2) {
  46724. return $recv(array)._addFirst_($self._pop());
  46725. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46726. }));
  46727. $self._push_(array);
  46728. return self;
  46729. }, function($ctx1) {$ctx1.fill(self,"visitDynamicArrayNode:",{aNode:aNode,array:array},$globals.ASTInterpreter)});
  46730. },
  46731. args: ["aNode"],
  46732. 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",
  46733. referencedClasses: [],
  46734. messageSends: ["do:", "dagChildren", "addFirst:", "pop", "push:"]
  46735. }),
  46736. $globals.ASTInterpreter);
  46737. $core.addMethod(
  46738. $core.method({
  46739. selector: "visitDynamicDictionaryNode:",
  46740. protocol: "visiting",
  46741. fn: function (aNode){
  46742. var self=this,$self=this;
  46743. var keyValueList;
  46744. return $core.withContext(function($ctx1) {
  46745. keyValueList=$recv($globals.OrderedCollection)._new();
  46746. $recv($recv(aNode)._dagChildren())._do_((function(each){
  46747. return $core.withContext(function($ctx2) {
  46748. return $recv(keyValueList)._add_($self._pop());
  46749. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46750. }));
  46751. $self._push_($recv($globals.HashedCollection)._newFromPairs_($recv(keyValueList)._reversed()));
  46752. return self;
  46753. }, function($ctx1) {$ctx1.fill(self,"visitDynamicDictionaryNode:",{aNode:aNode,keyValueList:keyValueList},$globals.ASTInterpreter)});
  46754. },
  46755. args: ["aNode"],
  46756. 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)",
  46757. referencedClasses: ["OrderedCollection", "HashedCollection"],
  46758. messageSends: ["new", "do:", "dagChildren", "add:", "pop", "push:", "newFromPairs:", "reversed"]
  46759. }),
  46760. $globals.ASTInterpreter);
  46761. $core.addMethod(
  46762. $core.method({
  46763. selector: "visitJSStatementNode:",
  46764. protocol: "visiting",
  46765. fn: function (aNode){
  46766. var self=this,$self=this;
  46767. return $core.withContext(function($ctx1) {
  46768. $self["@returned"]=true;
  46769. $self._returnValue_($self._eval_($recv(aNode)._source()));
  46770. return self;
  46771. }, function($ctx1) {$ctx1.fill(self,"visitJSStatementNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46772. },
  46773. args: ["aNode"],
  46774. source: "visitJSStatementNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: (self eval: aNode source)",
  46775. referencedClasses: [],
  46776. messageSends: ["returnValue:", "eval:", "source"]
  46777. }),
  46778. $globals.ASTInterpreter);
  46779. $core.addMethod(
  46780. $core.method({
  46781. selector: "visitReturnNode:",
  46782. protocol: "visiting",
  46783. fn: function (aNode){
  46784. var self=this,$self=this;
  46785. return $core.withContext(function($ctx1) {
  46786. $self["@returned"]=true;
  46787. $self._returnValue_($self._pop());
  46788. return self;
  46789. }, function($ctx1) {$ctx1.fill(self,"visitReturnNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46790. },
  46791. args: ["aNode"],
  46792. source: "visitReturnNode: aNode\x0a\x09returned := true.\x0a\x09self returnValue: self pop",
  46793. referencedClasses: [],
  46794. messageSends: ["returnValue:", "pop"]
  46795. }),
  46796. $globals.ASTInterpreter);
  46797. $core.addMethod(
  46798. $core.method({
  46799. selector: "visitSendNode:",
  46800. protocol: "visiting",
  46801. fn: function (aNode){
  46802. var self=this,$self=this;
  46803. var receiver,args,message,result;
  46804. return $core.withContext(function($ctx1) {
  46805. var $1;
  46806. args=$recv($recv(aNode)._arguments())._collect_((function(each){
  46807. return $core.withContext(function($ctx2) {
  46808. return $self._pop();
  46809. $ctx2.sendIdx["pop"]=1;
  46810. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  46811. }));
  46812. receiver=$self._peek();
  46813. message=$self._messageFromSendNode_arguments_(aNode,$recv(args)._reversed());
  46814. result=$self._sendMessage_to_superSend_(message,receiver,$recv(aNode)._superSend());
  46815. $1=$recv($recv(aNode)._isCascadeSendNode())._and_((function(){
  46816. return $core.withContext(function($ctx2) {
  46817. return $recv($recv(aNode)._isLastChild())._not();
  46818. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46819. }));
  46820. if(!$core.assert($1)){
  46821. $self._pop();
  46822. $self._push_(result);
  46823. }
  46824. return self;
  46825. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode,receiver:receiver,args:args,message:message,result:result},$globals.ASTInterpreter)});
  46826. },
  46827. args: ["aNode"],
  46828. 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 ]",
  46829. referencedClasses: [],
  46830. messageSends: ["collect:", "arguments", "pop", "peek", "messageFromSendNode:arguments:", "reversed", "sendMessage:to:superSend:", "superSend", "ifFalse:", "and:", "isCascadeSendNode", "not", "isLastChild", "push:"]
  46831. }),
  46832. $globals.ASTInterpreter);
  46833. $core.addMethod(
  46834. $core.method({
  46835. selector: "visitValueNode:",
  46836. protocol: "visiting",
  46837. fn: function (aNode){
  46838. var self=this,$self=this;
  46839. return $core.withContext(function($ctx1) {
  46840. $self._push_($recv(aNode)._value());
  46841. return self;
  46842. }, function($ctx1) {$ctx1.fill(self,"visitValueNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46843. },
  46844. args: ["aNode"],
  46845. source: "visitValueNode: aNode\x0a\x09self push: aNode value",
  46846. referencedClasses: [],
  46847. messageSends: ["push:", "value"]
  46848. }),
  46849. $globals.ASTInterpreter);
  46850. $core.addMethod(
  46851. $core.method({
  46852. selector: "visitVariableNode:",
  46853. protocol: "visiting",
  46854. fn: function (aNode){
  46855. var self=this,$self=this;
  46856. return $core.withContext(function($ctx1) {
  46857. var $2,$1,$5,$6,$4,$3,$8,$10,$9,$11,$12,$13,$15,$14,$16,$17,$7;
  46858. $2=$recv(aNode)._binding();
  46859. $ctx1.sendIdx["binding"]=1;
  46860. $1=$recv($2)._isUnknownVar();
  46861. if($core.assert($1)){
  46862. $5=$recv($globals.Platform)._globals();
  46863. $ctx1.sendIdx["globals"]=1;
  46864. $6=$recv(aNode)._value();
  46865. $ctx1.sendIdx["value"]=1;
  46866. $4=$recv($5)._at_ifAbsent_($6,(function(){
  46867. return $core.withContext(function($ctx2) {
  46868. return $self._error_("Unknown variable");
  46869. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  46870. }));
  46871. $ctx1.sendIdx["at:ifAbsent:"]=1;
  46872. $3=$self._push_($4);
  46873. $ctx1.sendIdx["push:"]=1;
  46874. return $3;
  46875. }
  46876. $8=$recv($recv(aNode)._binding())._isInstanceVar();
  46877. if($core.assert($8)){
  46878. $10=$self._context();
  46879. $ctx1.sendIdx["context"]=1;
  46880. $9=$recv($10)._receiver();
  46881. $11=$recv(aNode)._value();
  46882. $ctx1.sendIdx["value"]=2;
  46883. $7=$recv($9)._instVarAt_($11);
  46884. } else {
  46885. $12=$self._context();
  46886. $13=$recv(aNode)._value();
  46887. $ctx1.sendIdx["value"]=3;
  46888. $7=$recv($12)._localAt_ifAbsent_($13,(function(){
  46889. return $core.withContext(function($ctx2) {
  46890. $15=$recv(aNode)._value();
  46891. $ctx2.sendIdx["value"]=4;
  46892. $14=$recv($15)._isCapitalized();
  46893. if($core.assert($14)){
  46894. $16=$recv($globals.Smalltalk)._globals();
  46895. $ctx2.sendIdx["globals"]=2;
  46896. $17=$recv(aNode)._value();
  46897. $ctx2.sendIdx["value"]=5;
  46898. return $recv($16)._at_ifAbsent_($17,(function(){
  46899. return $core.withContext(function($ctx3) {
  46900. return $recv($recv($globals.Platform)._globals())._at_($recv(aNode)._value());
  46901. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  46902. }));
  46903. }
  46904. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  46905. }));
  46906. }
  46907. $self._push_($7);
  46908. return self;
  46909. }, function($ctx1) {$ctx1.fill(self,"visitVariableNode:",{aNode:aNode},$globals.ASTInterpreter)});
  46910. },
  46911. args: ["aNode"],
  46912. 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 ] ] ] ])",
  46913. referencedClasses: ["Platform", "Smalltalk"],
  46914. messageSends: ["ifTrue:", "isUnknownVar", "binding", "push:", "at:ifAbsent:", "globals", "value", "error:", "ifTrue:ifFalse:", "isInstanceVar", "instVarAt:", "receiver", "context", "localAt:ifAbsent:", "isCapitalized", "at:"]
  46915. }),
  46916. $globals.ASTInterpreter);
  46917. $core.addClass("ASTInterpreterError", $globals.Error, [], "Compiler-Interpreter");
  46918. $globals.ASTInterpreterError.comment="I get signaled when an AST interpreter is unable to interpret a node.";
  46919. $core.addClass("ASTPCNodeVisitor", $globals.NodeVisitor, ["index", "trackedIndex", "selector", "currentNode"], "Compiler-Interpreter");
  46920. $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`";
  46921. $core.addMethod(
  46922. $core.method({
  46923. selector: "currentNode",
  46924. protocol: "accessing",
  46925. fn: function (){
  46926. var self=this,$self=this;
  46927. return $self["@currentNode"];
  46928. },
  46929. args: [],
  46930. source: "currentNode\x0a\x09^ currentNode",
  46931. referencedClasses: [],
  46932. messageSends: []
  46933. }),
  46934. $globals.ASTPCNodeVisitor);
  46935. $core.addMethod(
  46936. $core.method({
  46937. selector: "increaseTrackedIndex",
  46938. protocol: "accessing",
  46939. fn: function (){
  46940. var self=this,$self=this;
  46941. return $core.withContext(function($ctx1) {
  46942. $self["@trackedIndex"]=$recv($self._trackedIndex()).__plus((1));
  46943. return self;
  46944. }, function($ctx1) {$ctx1.fill(self,"increaseTrackedIndex",{},$globals.ASTPCNodeVisitor)});
  46945. },
  46946. args: [],
  46947. source: "increaseTrackedIndex\x0a\x09trackedIndex := self trackedIndex + 1",
  46948. referencedClasses: [],
  46949. messageSends: ["+", "trackedIndex"]
  46950. }),
  46951. $globals.ASTPCNodeVisitor);
  46952. $core.addMethod(
  46953. $core.method({
  46954. selector: "index",
  46955. protocol: "accessing",
  46956. fn: function (){
  46957. var self=this,$self=this;
  46958. return $self["@index"];
  46959. },
  46960. args: [],
  46961. source: "index\x0a\x09^ index",
  46962. referencedClasses: [],
  46963. messageSends: []
  46964. }),
  46965. $globals.ASTPCNodeVisitor);
  46966. $core.addMethod(
  46967. $core.method({
  46968. selector: "index:",
  46969. protocol: "accessing",
  46970. fn: function (aNumber){
  46971. var self=this,$self=this;
  46972. $self["@index"]=aNumber;
  46973. return self;
  46974. },
  46975. args: ["aNumber"],
  46976. source: "index: aNumber\x0a\x09index := aNumber",
  46977. referencedClasses: [],
  46978. messageSends: []
  46979. }),
  46980. $globals.ASTPCNodeVisitor);
  46981. $core.addMethod(
  46982. $core.method({
  46983. selector: "selector",
  46984. protocol: "accessing",
  46985. fn: function (){
  46986. var self=this,$self=this;
  46987. return $self["@selector"];
  46988. },
  46989. args: [],
  46990. source: "selector\x0a\x09^ selector",
  46991. referencedClasses: [],
  46992. messageSends: []
  46993. }),
  46994. $globals.ASTPCNodeVisitor);
  46995. $core.addMethod(
  46996. $core.method({
  46997. selector: "selector:",
  46998. protocol: "accessing",
  46999. fn: function (aString){
  47000. var self=this,$self=this;
  47001. $self["@selector"]=aString;
  47002. return self;
  47003. },
  47004. args: ["aString"],
  47005. source: "selector: aString\x0a\x09selector := aString",
  47006. referencedClasses: [],
  47007. messageSends: []
  47008. }),
  47009. $globals.ASTPCNodeVisitor);
  47010. $core.addMethod(
  47011. $core.method({
  47012. selector: "trackedIndex",
  47013. protocol: "accessing",
  47014. fn: function (){
  47015. var self=this,$self=this;
  47016. return $core.withContext(function($ctx1) {
  47017. var $1,$receiver;
  47018. $1=$self["@trackedIndex"];
  47019. if(($receiver = $1) == null || $receiver.a$nil){
  47020. $self["@trackedIndex"]=(0);
  47021. return $self["@trackedIndex"];
  47022. } else {
  47023. return $1;
  47024. }
  47025. }, function($ctx1) {$ctx1.fill(self,"trackedIndex",{},$globals.ASTPCNodeVisitor)});
  47026. },
  47027. args: [],
  47028. source: "trackedIndex\x0a\x09^ trackedIndex ifNil: [ trackedIndex := 0 ]",
  47029. referencedClasses: [],
  47030. messageSends: ["ifNil:"]
  47031. }),
  47032. $globals.ASTPCNodeVisitor);
  47033. $core.addMethod(
  47034. $core.method({
  47035. selector: "visitJSStatementNode:",
  47036. protocol: "visiting",
  47037. fn: function (aNode){
  47038. var self=this,$self=this;
  47039. $self["@currentNode"]=aNode;
  47040. return self;
  47041. },
  47042. args: ["aNode"],
  47043. 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",
  47044. referencedClasses: [],
  47045. messageSends: []
  47046. }),
  47047. $globals.ASTPCNodeVisitor);
  47048. $core.addMethod(
  47049. $core.method({
  47050. selector: "visitSendNode:",
  47051. protocol: "visiting",
  47052. fn: function (aNode){
  47053. var self=this,$self=this;
  47054. return $core.withContext(function($ctx1) {
  47055. var $2,$1,$3;
  47056. (
  47057. $ctx1.supercall = true,
  47058. ($globals.ASTPCNodeVisitor.superclass||$boot.nilAsClass).fn.prototype._visitSendNode_.apply($self, [aNode]));
  47059. $ctx1.supercall = false;
  47060. $2=$self._selector();
  47061. $ctx1.sendIdx["selector"]=1;
  47062. $1=$recv($2).__eq($recv(aNode)._selector());
  47063. $ctx1.sendIdx["="]=1;
  47064. if($core.assert($1)){
  47065. $3=$recv($self._trackedIndex()).__eq($self._index());
  47066. if($core.assert($3)){
  47067. $self["@currentNode"]=aNode;
  47068. $self["@currentNode"];
  47069. }
  47070. $self._increaseTrackedIndex();
  47071. }
  47072. return self;
  47073. }, function($ctx1) {$ctx1.fill(self,"visitSendNode:",{aNode:aNode},$globals.ASTPCNodeVisitor)});
  47074. },
  47075. args: ["aNode"],
  47076. 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 ]",
  47077. referencedClasses: [],
  47078. messageSends: ["visitSendNode:", "ifTrue:", "=", "selector", "trackedIndex", "index", "increaseTrackedIndex"]
  47079. }),
  47080. $globals.ASTPCNodeVisitor);
  47081. $core.addMethod(
  47082. $core.method({
  47083. selector: "isLastChild",
  47084. protocol: "*Compiler-Interpreter",
  47085. fn: function (){
  47086. var self=this,$self=this;
  47087. return $core.withContext(function($ctx1) {
  47088. return $recv($recv($recv($self._parent())._dagChildren())._last()).__eq(self);
  47089. }, function($ctx1) {$ctx1.fill(self,"isLastChild",{},$globals.ASTNode)});
  47090. },
  47091. args: [],
  47092. source: "isLastChild\x0a\x09^ self parent dagChildren last = self",
  47093. referencedClasses: [],
  47094. messageSends: ["=", "last", "dagChildren", "parent"]
  47095. }),
  47096. $globals.ASTNode);
  47097. $core.addMethod(
  47098. $core.method({
  47099. selector: "isSteppingNode",
  47100. protocol: "*Compiler-Interpreter",
  47101. fn: function (){
  47102. var self=this,$self=this;
  47103. return false;
  47104. },
  47105. args: [],
  47106. source: "isSteppingNode\x0a\x09^ false",
  47107. referencedClasses: [],
  47108. messageSends: []
  47109. }),
  47110. $globals.ASTNode);
  47111. $core.addMethod(
  47112. $core.method({
  47113. selector: "nextSiblingNode:",
  47114. protocol: "*Compiler-Interpreter",
  47115. fn: function (aNode){
  47116. var self=this,$self=this;
  47117. return $core.withContext(function($ctx1) {
  47118. var $1;
  47119. var $early={};
  47120. try {
  47121. $1=$self._dagChildren();
  47122. $ctx1.sendIdx["dagChildren"]=1;
  47123. return $recv($1)._at_ifAbsent_($recv($recv($self._dagChildren())._indexOf_(aNode)).__plus((1)),(function(){
  47124. throw $early=[nil];
  47125. }));
  47126. }
  47127. catch(e) {if(e===$early)return e[0]; throw e}
  47128. }, function($ctx1) {$ctx1.fill(self,"nextSiblingNode:",{aNode:aNode},$globals.ASTNode)});
  47129. },
  47130. args: ["aNode"],
  47131. 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 ]",
  47132. referencedClasses: [],
  47133. messageSends: ["at:ifAbsent:", "dagChildren", "+", "indexOf:"]
  47134. }),
  47135. $globals.ASTNode);
  47136. $core.addMethod(
  47137. $core.method({
  47138. selector: "isSteppingNode",
  47139. protocol: "*Compiler-Interpreter",
  47140. fn: function (){
  47141. var self=this,$self=this;
  47142. return true;
  47143. },
  47144. args: [],
  47145. source: "isSteppingNode\x0a\x09^ true",
  47146. referencedClasses: [],
  47147. messageSends: []
  47148. }),
  47149. $globals.AssignmentNode);
  47150. $core.addMethod(
  47151. $core.method({
  47152. selector: "isSteppingNode",
  47153. protocol: "*Compiler-Interpreter",
  47154. fn: function (){
  47155. var self=this,$self=this;
  47156. return true;
  47157. },
  47158. args: [],
  47159. source: "isSteppingNode\x0a\x09^ true",
  47160. referencedClasses: [],
  47161. messageSends: []
  47162. }),
  47163. $globals.BlockNode);
  47164. $core.addMethod(
  47165. $core.method({
  47166. selector: "nextSiblingNode:",
  47167. protocol: "*Compiler-Interpreter",
  47168. fn: function (aNode){
  47169. var self=this,$self=this;
  47170. return nil;
  47171. },
  47172. args: ["aNode"],
  47173. 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",
  47174. referencedClasses: [],
  47175. messageSends: []
  47176. }),
  47177. $globals.BlockNode);
  47178. $core.addMethod(
  47179. $core.method({
  47180. selector: "isSteppingNode",
  47181. protocol: "*Compiler-Interpreter",
  47182. fn: function (){
  47183. var self=this,$self=this;
  47184. return true;
  47185. },
  47186. args: [],
  47187. source: "isSteppingNode\x0a\x09^ true",
  47188. referencedClasses: [],
  47189. messageSends: []
  47190. }),
  47191. $globals.DynamicArrayNode);
  47192. $core.addMethod(
  47193. $core.method({
  47194. selector: "isSteppingNode",
  47195. protocol: "*Compiler-Interpreter",
  47196. fn: function (){
  47197. var self=this,$self=this;
  47198. return true;
  47199. },
  47200. args: [],
  47201. source: "isSteppingNode\x0a\x09^ true",
  47202. referencedClasses: [],
  47203. messageSends: []
  47204. }),
  47205. $globals.DynamicDictionaryNode);
  47206. $core.addMethod(
  47207. $core.method({
  47208. selector: "isSteppingNode",
  47209. protocol: "*Compiler-Interpreter",
  47210. fn: function (){
  47211. var self=this,$self=this;
  47212. return true;
  47213. },
  47214. args: [],
  47215. source: "isSteppingNode\x0a\x09^ true",
  47216. referencedClasses: [],
  47217. messageSends: []
  47218. }),
  47219. $globals.JSStatementNode);
  47220. $core.addMethod(
  47221. $core.method({
  47222. selector: "isCascadeSendNode",
  47223. protocol: "*Compiler-Interpreter",
  47224. fn: function (){
  47225. var self=this,$self=this;
  47226. return $core.withContext(function($ctx1) {
  47227. return $recv($self._parent())._isCascadeNode();
  47228. }, function($ctx1) {$ctx1.fill(self,"isCascadeSendNode",{},$globals.SendNode)});
  47229. },
  47230. args: [],
  47231. source: "isCascadeSendNode\x0a\x09^ self parent isCascadeNode",
  47232. referencedClasses: [],
  47233. messageSends: ["isCascadeNode", "parent"]
  47234. }),
  47235. $globals.SendNode);
  47236. $core.addMethod(
  47237. $core.method({
  47238. selector: "isSteppingNode",
  47239. protocol: "*Compiler-Interpreter",
  47240. fn: function (){
  47241. var self=this,$self=this;
  47242. return true;
  47243. },
  47244. args: [],
  47245. source: "isSteppingNode\x0a\x09^ true",
  47246. referencedClasses: [],
  47247. messageSends: []
  47248. }),
  47249. $globals.SendNode);
  47250. });
  47251. define('amber/lang',[
  47252. './deploy',
  47253. './boot', // pre-fetch, dep of ./helpers
  47254. './helpers', // pre-fetch, dep of ./deploy
  47255. './parser',
  47256. // --- packages for the Amber reflection begin here ---
  47257. 'amber_core/Platform-ImportExport',
  47258. 'amber_core/Compiler-Core',
  47259. 'amber_core/Compiler-AST',
  47260. 'amber_core/Compiler-Semantic',
  47261. 'amber_core/Compiler-IR',
  47262. 'amber_core/Compiler-Inlining',
  47263. 'amber_core/Compiler-Interpreter'
  47264. // --- packages for the Amber reflection end here ---
  47265. ], function (amber) {
  47266. return amber;
  47267. });
  47268. define('amber_core/Platform-DOM',["amber/boot", "amber_core/Kernel-Collections", "amber_core/Kernel-Infrastructure", "amber_core/Kernel-Objects"], function($boot){"use strict";
  47269. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47270. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47271. $core.addPackage("Platform-DOM");
  47272. ($core.packageDescriptors||$core.packages)["Platform-DOM"].innerEval = function (expr) { return eval(expr); };
  47273. ($core.packageDescriptors||$core.packages)["Platform-DOM"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47274. $core.addClass("PlatformDom", $globals.Object, [], "Platform-DOM");
  47275. $core.addMethod(
  47276. $core.method({
  47277. selector: "isDomNode:",
  47278. protocol: "testing",
  47279. fn: function (anObject){
  47280. var self=this,$self=this;
  47281. return $core.withContext(function($ctx1) {
  47282. return anObject.nodeType > 0 &&
  47283. Object.prototype.toString.call(anObject) !== "[object Object]";
  47284. return self;
  47285. }, function($ctx1) {$ctx1.fill(self,"isDomNode:",{anObject:anObject},$globals.PlatformDom.a$cls)});
  47286. },
  47287. args: ["anObject"],
  47288. source: "isDomNode: anObject\x0a<inlineJS: '\x0a\x09return anObject.nodeType > 0 &&\x0a\x09\x09Object.prototype.toString.call(anObject) !== \x22[object Object]\x22\x0a'>",
  47289. referencedClasses: [],
  47290. messageSends: []
  47291. }),
  47292. $globals.PlatformDom.a$cls);
  47293. $core.addMethod(
  47294. $core.method({
  47295. selector: "isFeasible",
  47296. protocol: "testing",
  47297. fn: function (){
  47298. var self=this,$self=this;
  47299. return $core.withContext(function($ctx1) {
  47300. if (typeof document === "undefined") return false;
  47301. try {
  47302. var d = document.createElement("div"),
  47303. f = document.createDocumentFragment(),
  47304. t = document.createTextNode("Hello, Amber!");
  47305. f.appendChild(t);
  47306. d.insertBefore(f, null);
  47307. return d.innerHTML === "Hello, Amber!";
  47308. } catch (e) {
  47309. return false;
  47310. };
  47311. return self;
  47312. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.PlatformDom.a$cls)});
  47313. },
  47314. args: [],
  47315. 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'>",
  47316. referencedClasses: [],
  47317. messageSends: []
  47318. }),
  47319. $globals.PlatformDom.a$cls);
  47320. $core.addMethod(
  47321. $core.method({
  47322. selector: "newCustomEvent:detail:",
  47323. protocol: "creation",
  47324. fn: function (aString,anObject){
  47325. var self=this,$self=this;
  47326. return $core.withContext(function($ctx1) {
  47327. return new CustomEvent(aString, {detail: anObject});
  47328. return self;
  47329. }, function($ctx1) {$ctx1.fill(self,"newCustomEvent:detail:",{aString:aString,anObject:anObject},$globals.PlatformDom.a$cls)});
  47330. },
  47331. args: ["aString", "anObject"],
  47332. source: "newCustomEvent: aString detail: anObject\x0a<inlineJS: 'return new CustomEvent(aString, {detail: anObject})'>",
  47333. referencedClasses: [],
  47334. messageSends: []
  47335. }),
  47336. $globals.PlatformDom.a$cls);
  47337. $core.addMethod(
  47338. $core.method({
  47339. selector: "toArray:",
  47340. protocol: "converting",
  47341. fn: function (aDomList){
  47342. var self=this,$self=this;
  47343. return $core.withContext(function($ctx1) {
  47344. return Array.prototype.slice.call(aDomList);
  47345. return self;
  47346. }, function($ctx1) {$ctx1.fill(self,"toArray:",{aDomList:aDomList},$globals.PlatformDom.a$cls)});
  47347. },
  47348. args: ["aDomList"],
  47349. source: "toArray: aDomList\x0a<inlineJS: 'return Array.prototype.slice.call(aDomList)'>",
  47350. referencedClasses: [],
  47351. messageSends: []
  47352. }),
  47353. $globals.PlatformDom.a$cls);
  47354. $core.addMethod(
  47355. $core.method({
  47356. selector: "asDomNode",
  47357. protocol: "*Platform-DOM",
  47358. fn: function (){
  47359. var self=this,$self=this;
  47360. return $core.withContext(function($ctx1) {
  47361. return $recv(document)._createTextNode_($self._asString());
  47362. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.CharacterArray)});
  47363. },
  47364. args: [],
  47365. source: "asDomNode\x0a\x09^ document createTextNode: self asString",
  47366. referencedClasses: [],
  47367. messageSends: ["createTextNode:", "asString"]
  47368. }),
  47369. $globals.CharacterArray);
  47370. $core.addMethod(
  47371. $core.method({
  47372. selector: "asDomNode",
  47373. protocol: "*Platform-DOM",
  47374. fn: function (){
  47375. var self=this,$self=this;
  47376. var fragment;
  47377. return $core.withContext(function($ctx1) {
  47378. fragment=$recv(document)._createDocumentFragment();
  47379. $self._do_((function(each){
  47380. return $core.withContext(function($ctx2) {
  47381. return $recv(fragment)._appendChild_($recv(each)._asDomNode());
  47382. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47383. }));
  47384. return fragment;
  47385. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{fragment:fragment},$globals.Collection)});
  47386. },
  47387. args: [],
  47388. source: "asDomNode\x0a\x09| fragment |\x0a\x09fragment := document createDocumentFragment.\x0a\x09self do: [ :each | fragment appendChild: each asDomNode ].\x0a\x09^ fragment",
  47389. referencedClasses: [],
  47390. messageSends: ["createDocumentFragment", "do:", "appendChild:", "asDomNode"]
  47391. }),
  47392. $globals.Collection);
  47393. $core.addMethod(
  47394. $core.method({
  47395. selector: "asDomNode",
  47396. protocol: "*Platform-DOM",
  47397. fn: function (){
  47398. var self=this,$self=this;
  47399. return $core.withContext(function($ctx1) {
  47400. var $1,$2;
  47401. $1=$recv($globals.PlatformDom)._isDomNode_($self["@jsObject"]);
  47402. if($core.assert($1)){
  47403. return $self["@jsObject"];
  47404. } else {
  47405. $2=(
  47406. $ctx1.supercall = true,
  47407. ($globals.JSObjectProxy.superclass||$boot.nilAsClass).fn.prototype._asDomNode.apply($self, []));
  47408. $ctx1.supercall = false;
  47409. return $2;
  47410. }
  47411. return self;
  47412. }, function($ctx1) {$ctx1.fill(self,"asDomNode",{},$globals.JSObjectProxy)});
  47413. },
  47414. args: [],
  47415. source: "asDomNode\x0a\x09(PlatformDom isDomNode: jsObject)\x0a\x09\x09ifTrue: [ ^ jsObject ]\x0a\x09\x09ifFalse: [ ^ super asDomNode ]",
  47416. referencedClasses: ["PlatformDom"],
  47417. messageSends: ["ifTrue:ifFalse:", "isDomNode:", "asDomNode"]
  47418. }),
  47419. $globals.JSObjectProxy);
  47420. $core.addMethod(
  47421. $core.method({
  47422. selector: "htmlTextContent",
  47423. protocol: "*Platform-DOM",
  47424. fn: function (){
  47425. var self=this,$self=this;
  47426. return $core.withContext(function($ctx1) {
  47427. var d=document.createElement("div");d.innerHTML=self;return d.textContent||d.innerText;;
  47428. return self;
  47429. }, function($ctx1) {$ctx1.fill(self,"htmlTextContent",{},$globals.String)});
  47430. },
  47431. args: [],
  47432. source: "htmlTextContent\x0a<inlineJS: 'var d=document.createElement(\x22div\x22);d.innerHTML=self;return d.textContent||d.innerText;'>",
  47433. referencedClasses: [],
  47434. messageSends: []
  47435. }),
  47436. $globals.String);
  47437. });
  47438. 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";
  47439. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  47440. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  47441. $core.addPackage("SUnit");
  47442. ($core.packageDescriptors||$core.packages)["SUnit"].innerEval = function (expr) { return eval(expr); };
  47443. ($core.packageDescriptors||$core.packages)["SUnit"].transport = {"type":"amd","amdNamespace":"amber_core"};
  47444. $core.addClass("ResultAnnouncement", $globals.Object, ["result"], "SUnit");
  47445. $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.";
  47446. $core.addMethod(
  47447. $core.method({
  47448. selector: "result",
  47449. protocol: "accessing",
  47450. fn: function (){
  47451. var self=this,$self=this;
  47452. return $self["@result"];
  47453. },
  47454. args: [],
  47455. source: "result\x0a\x09^ result",
  47456. referencedClasses: [],
  47457. messageSends: []
  47458. }),
  47459. $globals.ResultAnnouncement);
  47460. $core.addMethod(
  47461. $core.method({
  47462. selector: "result:",
  47463. protocol: "accessing",
  47464. fn: function (aTestResult){
  47465. var self=this,$self=this;
  47466. $self["@result"]=aTestResult;
  47467. return self;
  47468. },
  47469. args: ["aTestResult"],
  47470. source: "result: aTestResult\x0a\x09result := aTestResult",
  47471. referencedClasses: [],
  47472. messageSends: []
  47473. }),
  47474. $globals.ResultAnnouncement);
  47475. $core.addClass("TestCase", $globals.Object, ["testSelector", "asyncTimeout", "context"], "SUnit");
  47476. $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.";
  47477. $core.addMethod(
  47478. $core.method({
  47479. selector: "assert:",
  47480. protocol: "testing",
  47481. fn: function (aBoolean){
  47482. var self=this,$self=this;
  47483. return $core.withContext(function($ctx1) {
  47484. $self._assert_description_(aBoolean,"Assertion failed");
  47485. return self;
  47486. }, function($ctx1) {$ctx1.fill(self,"assert:",{aBoolean:aBoolean},$globals.TestCase)});
  47487. },
  47488. args: ["aBoolean"],
  47489. source: "assert: aBoolean\x0a\x09self assert: aBoolean description: 'Assertion failed'",
  47490. referencedClasses: [],
  47491. messageSends: ["assert:description:"]
  47492. }),
  47493. $globals.TestCase);
  47494. $core.addMethod(
  47495. $core.method({
  47496. selector: "assert:description:",
  47497. protocol: "testing",
  47498. fn: function (aBoolean,aString){
  47499. var self=this,$self=this;
  47500. return $core.withContext(function($ctx1) {
  47501. if(!$core.assert(aBoolean)){
  47502. $self._signalFailure_(aString);
  47503. }
  47504. return self;
  47505. }, function($ctx1) {$ctx1.fill(self,"assert:description:",{aBoolean:aBoolean,aString:aString},$globals.TestCase)});
  47506. },
  47507. args: ["aBoolean", "aString"],
  47508. source: "assert: aBoolean description: aString\x0a\x09aBoolean ifFalse: [ self signalFailure: aString ]",
  47509. referencedClasses: [],
  47510. messageSends: ["ifFalse:", "signalFailure:"]
  47511. }),
  47512. $globals.TestCase);
  47513. $core.addMethod(
  47514. $core.method({
  47515. selector: "assert:equals:",
  47516. protocol: "testing",
  47517. fn: function (actual,expected){
  47518. var self=this,$self=this;
  47519. return $core.withContext(function($ctx1) {
  47520. var $1,$5,$4,$3,$2;
  47521. $1=$recv(actual).__eq(expected);
  47522. $5=$recv(expected)._printString();
  47523. $ctx1.sendIdx["printString"]=1;
  47524. $4="Expected: ".__comma($5);
  47525. $3=$recv($4).__comma(" but was: ");
  47526. $ctx1.sendIdx[","]=2;
  47527. $2=$recv($3).__comma($recv(actual)._printString());
  47528. $ctx1.sendIdx[","]=1;
  47529. return $self._assert_description_($1,$2);
  47530. }, function($ctx1) {$ctx1.fill(self,"assert:equals:",{actual:actual,expected:expected},$globals.TestCase)});
  47531. },
  47532. args: ["actual", "expected"],
  47533. source: "assert: actual equals: expected\x0a\x09^ self assert: (actual = expected) description: 'Expected: ', expected printString, ' but was: ', actual printString",
  47534. referencedClasses: [],
  47535. messageSends: ["assert:description:", "=", ",", "printString"]
  47536. }),
  47537. $globals.TestCase);
  47538. $core.addMethod(
  47539. $core.method({
  47540. selector: "async:",
  47541. protocol: "async",
  47542. fn: function (aBlock){
  47543. var self=this,$self=this;
  47544. var c;
  47545. return $core.withContext(function($ctx1) {
  47546. var $1;
  47547. $self._errorIfNotAsync_("#async");
  47548. c=$self["@context"];
  47549. return (function(){
  47550. return $core.withContext(function($ctx2) {
  47551. $1=$self._isAsync();
  47552. if($core.assert($1)){
  47553. return $recv(c)._execute_(aBlock);
  47554. }
  47555. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47556. });
  47557. }, function($ctx1) {$ctx1.fill(self,"async:",{aBlock:aBlock,c:c},$globals.TestCase)});
  47558. },
  47559. args: ["aBlock"],
  47560. source: "async: aBlock\x0a\x09| c |\x0a\x09self errorIfNotAsync: '#async'.\x0a\x09c := context.\x0a\x09^ [ self isAsync ifTrue: [ c execute: aBlock ] ]",
  47561. referencedClasses: [],
  47562. messageSends: ["errorIfNotAsync:", "ifTrue:", "isAsync", "execute:"]
  47563. }),
  47564. $globals.TestCase);
  47565. $core.addMethod(
  47566. $core.method({
  47567. selector: "context:",
  47568. protocol: "accessing",
  47569. fn: function (aRunningTestContext){
  47570. var self=this,$self=this;
  47571. $self["@context"]=aRunningTestContext;
  47572. return self;
  47573. },
  47574. args: ["aRunningTestContext"],
  47575. source: "context: aRunningTestContext\x0a\x09context := aRunningTestContext",
  47576. referencedClasses: [],
  47577. messageSends: []
  47578. }),
  47579. $globals.TestCase);
  47580. $core.addMethod(
  47581. $core.method({
  47582. selector: "deny:",
  47583. protocol: "testing",
  47584. fn: function (aBoolean){
  47585. var self=this,$self=this;
  47586. return $core.withContext(function($ctx1) {
  47587. $self._assert_($recv(aBoolean)._not());
  47588. return self;
  47589. }, function($ctx1) {$ctx1.fill(self,"deny:",{aBoolean:aBoolean},$globals.TestCase)});
  47590. },
  47591. args: ["aBoolean"],
  47592. source: "deny: aBoolean\x0a\x09self assert: aBoolean not",
  47593. referencedClasses: [],
  47594. messageSends: ["assert:", "not"]
  47595. }),
  47596. $globals.TestCase);
  47597. $core.addMethod(
  47598. $core.method({
  47599. selector: "errorIfNotAsync:",
  47600. protocol: "error handling",
  47601. fn: function (aString){
  47602. var self=this,$self=this;
  47603. return $core.withContext(function($ctx1) {
  47604. var $1;
  47605. $1=$self._isAsync();
  47606. if(!$core.assert($1)){
  47607. $self._error_($recv(aString).__comma(" used without prior #timeout:"));
  47608. }
  47609. return self;
  47610. }, function($ctx1) {$ctx1.fill(self,"errorIfNotAsync:",{aString:aString},$globals.TestCase)});
  47611. },
  47612. args: ["aString"],
  47613. source: "errorIfNotAsync: aString\x0a\x09self isAsync ifFalse: [\x0a\x09\x09self error: aString, ' used without prior #timeout:' ]",
  47614. referencedClasses: [],
  47615. messageSends: ["ifFalse:", "isAsync", "error:", ","]
  47616. }),
  47617. $globals.TestCase);
  47618. $core.addMethod(
  47619. $core.method({
  47620. selector: "finished",
  47621. protocol: "async",
  47622. fn: function (){
  47623. var self=this,$self=this;
  47624. return $core.withContext(function($ctx1) {
  47625. $self._errorIfNotAsync_("#finished");
  47626. $self["@asyncTimeout"]=nil;
  47627. return self;
  47628. }, function($ctx1) {$ctx1.fill(self,"finished",{},$globals.TestCase)});
  47629. },
  47630. args: [],
  47631. source: "finished\x0a\x09self errorIfNotAsync: '#finished'.\x0a\x09asyncTimeout := nil",
  47632. referencedClasses: [],
  47633. messageSends: ["errorIfNotAsync:"]
  47634. }),
  47635. $globals.TestCase);
  47636. $core.addMethod(
  47637. $core.method({
  47638. selector: "isAsync",
  47639. protocol: "testing",
  47640. fn: function (){
  47641. var self=this,$self=this;
  47642. return $core.withContext(function($ctx1) {
  47643. return $recv($self["@asyncTimeout"])._notNil();
  47644. }, function($ctx1) {$ctx1.fill(self,"isAsync",{},$globals.TestCase)});
  47645. },
  47646. args: [],
  47647. source: "isAsync\x0a\x09^ asyncTimeout notNil",
  47648. referencedClasses: [],
  47649. messageSends: ["notNil"]
  47650. }),
  47651. $globals.TestCase);
  47652. $core.addMethod(
  47653. $core.method({
  47654. selector: "performTest",
  47655. protocol: "running",
  47656. fn: function (){
  47657. var self=this,$self=this;
  47658. return $core.withContext(function($ctx1) {
  47659. $self["@asyncTimeout"]=nil;
  47660. $self._perform_($self._selector());
  47661. return self;
  47662. }, function($ctx1) {$ctx1.fill(self,"performTest",{},$globals.TestCase)});
  47663. },
  47664. args: [],
  47665. source: "performTest\x0a\x09asyncTimeout := nil.\x0a\x09self perform: self selector",
  47666. referencedClasses: [],
  47667. messageSends: ["perform:", "selector"]
  47668. }),
  47669. $globals.TestCase);
  47670. $core.addMethod(
  47671. $core.method({
  47672. selector: "runCase",
  47673. protocol: "running",
  47674. fn: function (){
  47675. var self=this,$self=this;
  47676. return $core.withContext(function($ctx1) {
  47677. $recv($recv($globals.TestContext)._testCase_(self))._start();
  47678. return self;
  47679. }, function($ctx1) {$ctx1.fill(self,"runCase",{},$globals.TestCase)});
  47680. },
  47681. args: [],
  47682. source: "runCase\x0a\x09\x22Runs a test case in isolated context, leaking all errors.\x22\x0a\x0a\x09(TestContext testCase: self) start",
  47683. referencedClasses: ["TestContext"],
  47684. messageSends: ["start", "testCase:"]
  47685. }),
  47686. $globals.TestCase);
  47687. $core.addMethod(
  47688. $core.method({
  47689. selector: "selector",
  47690. protocol: "accessing",
  47691. fn: function (){
  47692. var self=this,$self=this;
  47693. return $self["@testSelector"];
  47694. },
  47695. args: [],
  47696. source: "selector\x0a\x09^ testSelector",
  47697. referencedClasses: [],
  47698. messageSends: []
  47699. }),
  47700. $globals.TestCase);
  47701. $core.addMethod(
  47702. $core.method({
  47703. selector: "setTestSelector:",
  47704. protocol: "accessing",
  47705. fn: function (aSelector){
  47706. var self=this,$self=this;
  47707. $self["@testSelector"]=aSelector;
  47708. return self;
  47709. },
  47710. args: ["aSelector"],
  47711. source: "setTestSelector: aSelector\x0a\x09testSelector := aSelector",
  47712. referencedClasses: [],
  47713. messageSends: []
  47714. }),
  47715. $globals.TestCase);
  47716. $core.addMethod(
  47717. $core.method({
  47718. selector: "setUp",
  47719. protocol: "running",
  47720. fn: function (){
  47721. var self=this,$self=this;
  47722. return self;
  47723. },
  47724. args: [],
  47725. source: "setUp",
  47726. referencedClasses: [],
  47727. messageSends: []
  47728. }),
  47729. $globals.TestCase);
  47730. $core.addMethod(
  47731. $core.method({
  47732. selector: "should:",
  47733. protocol: "testing",
  47734. fn: function (aBlock){
  47735. var self=this,$self=this;
  47736. return $core.withContext(function($ctx1) {
  47737. $self._assert_($recv(aBlock)._value());
  47738. return self;
  47739. }, function($ctx1) {$ctx1.fill(self,"should:",{aBlock:aBlock},$globals.TestCase)});
  47740. },
  47741. args: ["aBlock"],
  47742. source: "should: aBlock\x0a\x09self assert: aBlock value",
  47743. referencedClasses: [],
  47744. messageSends: ["assert:", "value"]
  47745. }),
  47746. $globals.TestCase);
  47747. $core.addMethod(
  47748. $core.method({
  47749. selector: "should:raise:",
  47750. protocol: "testing",
  47751. fn: function (aBlock,anExceptionClass){
  47752. var self=this,$self=this;
  47753. return $core.withContext(function($ctx1) {
  47754. $self._assert_($recv((function(){
  47755. return $core.withContext(function($ctx2) {
  47756. $recv(aBlock)._value();
  47757. return false;
  47758. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47759. }))._on_do_(anExceptionClass,(function(ex){
  47760. return true;
  47761. })));
  47762. return self;
  47763. }, function($ctx1) {$ctx1.fill(self,"should:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47764. },
  47765. args: ["aBlock", "anExceptionClass"],
  47766. source: "should: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. false ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | true ])",
  47767. referencedClasses: [],
  47768. messageSends: ["assert:", "on:do:", "value"]
  47769. }),
  47770. $globals.TestCase);
  47771. $core.addMethod(
  47772. $core.method({
  47773. selector: "shouldnt:raise:",
  47774. protocol: "testing",
  47775. fn: function (aBlock,anExceptionClass){
  47776. var self=this,$self=this;
  47777. return $core.withContext(function($ctx1) {
  47778. $self._assert_($recv((function(){
  47779. return $core.withContext(function($ctx2) {
  47780. $recv(aBlock)._value();
  47781. return true;
  47782. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  47783. }))._on_do_(anExceptionClass,(function(ex){
  47784. return false;
  47785. })));
  47786. return self;
  47787. }, function($ctx1) {$ctx1.fill(self,"shouldnt:raise:",{aBlock:aBlock,anExceptionClass:anExceptionClass},$globals.TestCase)});
  47788. },
  47789. args: ["aBlock", "anExceptionClass"],
  47790. source: "shouldnt: aBlock raise: anExceptionClass\x0a\x09self assert: ([ aBlock value. true ]\x0a\x09\x09on: anExceptionClass\x0a\x09\x09do: [ :ex | false ])",
  47791. referencedClasses: [],
  47792. messageSends: ["assert:", "on:do:", "value"]
  47793. }),
  47794. $globals.TestCase);
  47795. $core.addMethod(
  47796. $core.method({
  47797. selector: "signalFailure:",
  47798. protocol: "private",
  47799. fn: function (aString){
  47800. var self=this,$self=this;
  47801. return $core.withContext(function($ctx1) {
  47802. var $1;
  47803. $1=$recv($globals.TestFailure)._new();
  47804. $recv($1)._messageText_(aString);
  47805. $recv($1)._signal();
  47806. return self;
  47807. }, function($ctx1) {$ctx1.fill(self,"signalFailure:",{aString:aString},$globals.TestCase)});
  47808. },
  47809. args: ["aString"],
  47810. source: "signalFailure: aString\x0a\x09TestFailure new\x0a\x09\x09messageText: aString;\x0a\x09\x09signal",
  47811. referencedClasses: ["TestFailure"],
  47812. messageSends: ["messageText:", "new", "signal"]
  47813. }),
  47814. $globals.TestCase);
  47815. $core.addMethod(
  47816. $core.method({
  47817. selector: "tearDown",
  47818. protocol: "running",
  47819. fn: function (){
  47820. var self=this,$self=this;
  47821. return self;
  47822. },
  47823. args: [],
  47824. source: "tearDown",
  47825. referencedClasses: [],
  47826. messageSends: []
  47827. }),
  47828. $globals.TestCase);
  47829. $core.addMethod(
  47830. $core.method({
  47831. selector: "timeout:",
  47832. protocol: "async",
  47833. fn: function (aNumber){
  47834. var self=this,$self=this;
  47835. return $core.withContext(function($ctx1) {
  47836. var $1,$receiver;
  47837. $1=$self["@asyncTimeout"];
  47838. if(($receiver = $1) == null || $receiver.a$nil){
  47839. $1;
  47840. } else {
  47841. $recv($self["@asyncTimeout"])._clearTimeout();
  47842. }
  47843. $self["@asyncTimeout"]=(0);
  47844. $self["@asyncTimeout"]=$recv($self._async_((function(){
  47845. return $core.withContext(function($ctx2) {
  47846. return $self._assert_description_(false,"SUnit grace time exhausted");
  47847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  47848. })))._valueWithTimeout_(aNumber);
  47849. return self;
  47850. }, function($ctx1) {$ctx1.fill(self,"timeout:",{aNumber:aNumber},$globals.TestCase)});
  47851. },
  47852. args: ["aNumber"],
  47853. 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",
  47854. referencedClasses: [],
  47855. messageSends: ["ifNotNil:", "clearTimeout", "valueWithTimeout:", "async:", "assert:description:"]
  47856. }),
  47857. $globals.TestCase);
  47858. $core.addMethod(
  47859. $core.method({
  47860. selector: "allTestSelectors",
  47861. protocol: "accessing",
  47862. fn: function (){
  47863. var self=this,$self=this;
  47864. var selectors;
  47865. return $core.withContext(function($ctx1) {
  47866. var $1;
  47867. selectors=$self._testSelectors();
  47868. $1=$self._shouldInheritSelectors();
  47869. if($core.assert($1)){
  47870. $recv(selectors)._addAll_($recv($self._superclass())._allTestSelectors());
  47871. }
  47872. return selectors;
  47873. }, function($ctx1) {$ctx1.fill(self,"allTestSelectors",{selectors:selectors},$globals.TestCase.a$cls)});
  47874. },
  47875. args: [],
  47876. source: "allTestSelectors\x0a\x09| selectors |\x0a\x09selectors := self testSelectors.\x0a\x09self shouldInheritSelectors ifTrue: [\x0a\x09\x09selectors addAll: self superclass allTestSelectors ].\x0a\x09^ selectors",
  47877. referencedClasses: [],
  47878. messageSends: ["testSelectors", "ifTrue:", "shouldInheritSelectors", "addAll:", "allTestSelectors", "superclass"]
  47879. }),
  47880. $globals.TestCase.a$cls);
  47881. $core.addMethod(
  47882. $core.method({
  47883. selector: "buildSuite",
  47884. protocol: "accessing",
  47885. fn: function (){
  47886. var self=this,$self=this;
  47887. return $core.withContext(function($ctx1) {
  47888. return $recv($self._allTestSelectors())._collect_((function(each){
  47889. return $core.withContext(function($ctx2) {
  47890. return $self._selector_(each);
  47891. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  47892. }));
  47893. }, function($ctx1) {$ctx1.fill(self,"buildSuite",{},$globals.TestCase.a$cls)});
  47894. },
  47895. args: [],
  47896. source: "buildSuite\x0a\x09^ self allTestSelectors collect: [ :each | self selector: each ]",
  47897. referencedClasses: [],
  47898. messageSends: ["collect:", "allTestSelectors", "selector:"]
  47899. }),
  47900. $globals.TestCase.a$cls);
  47901. $core.addMethod(
  47902. $core.method({
  47903. selector: "classTag",
  47904. protocol: "accessing",
  47905. fn: function (){
  47906. var self=this,$self=this;
  47907. return "test";
  47908. },
  47909. args: [],
  47910. 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'",
  47911. referencedClasses: [],
  47912. messageSends: []
  47913. }),
  47914. $globals.TestCase.a$cls);
  47915. $core.addMethod(
  47916. $core.method({
  47917. selector: "isAbstract",
  47918. protocol: "testing",
  47919. fn: function (){
  47920. var self=this,$self=this;
  47921. return $core.withContext(function($ctx1) {
  47922. return $recv($self._name()).__eq("TestCase");
  47923. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.TestCase.a$cls)});
  47924. },
  47925. args: [],
  47926. source: "isAbstract\x0a\x09^ self name = 'TestCase'",
  47927. referencedClasses: [],
  47928. messageSends: ["=", "name"]
  47929. }),
  47930. $globals.TestCase.a$cls);
  47931. $core.addMethod(
  47932. $core.method({
  47933. selector: "isTestClass",
  47934. protocol: "testing",
  47935. fn: function (){
  47936. var self=this,$self=this;
  47937. return $core.withContext(function($ctx1) {
  47938. return $recv($self._isAbstract())._not();
  47939. }, function($ctx1) {$ctx1.fill(self,"isTestClass",{},$globals.TestCase.a$cls)});
  47940. },
  47941. args: [],
  47942. source: "isTestClass\x0a\x09^ self isAbstract not",
  47943. referencedClasses: [],
  47944. messageSends: ["not", "isAbstract"]
  47945. }),
  47946. $globals.TestCase.a$cls);
  47947. $core.addMethod(
  47948. $core.method({
  47949. selector: "lookupHierarchyRoot",
  47950. protocol: "accessing",
  47951. fn: function (){
  47952. var self=this,$self=this;
  47953. return $globals.TestCase;
  47954. },
  47955. args: [],
  47956. source: "lookupHierarchyRoot\x0a\x09^ TestCase",
  47957. referencedClasses: ["TestCase"],
  47958. messageSends: []
  47959. }),
  47960. $globals.TestCase.a$cls);
  47961. $core.addMethod(
  47962. $core.method({
  47963. selector: "selector:",
  47964. protocol: "accessing",
  47965. fn: function (aSelector){
  47966. var self=this,$self=this;
  47967. return $core.withContext(function($ctx1) {
  47968. var $1;
  47969. $1=$self._new();
  47970. $recv($1)._setTestSelector_(aSelector);
  47971. return $recv($1)._yourself();
  47972. }, function($ctx1) {$ctx1.fill(self,"selector:",{aSelector:aSelector},$globals.TestCase.a$cls)});
  47973. },
  47974. args: ["aSelector"],
  47975. source: "selector: aSelector\x0a\x09^ self new\x0a\x09\x09setTestSelector: aSelector;\x0a\x09\x09yourself",
  47976. referencedClasses: [],
  47977. messageSends: ["setTestSelector:", "new", "yourself"]
  47978. }),
  47979. $globals.TestCase.a$cls);
  47980. $core.addMethod(
  47981. $core.method({
  47982. selector: "shouldInheritSelectors",
  47983. protocol: "testing",
  47984. fn: function (){
  47985. var self=this,$self=this;
  47986. return $core.withContext(function($ctx1) {
  47987. return $self.__tild_eq($self._lookupHierarchyRoot());
  47988. }, function($ctx1) {$ctx1.fill(self,"shouldInheritSelectors",{},$globals.TestCase.a$cls)});
  47989. },
  47990. args: [],
  47991. source: "shouldInheritSelectors\x0a\x09^ self ~= self lookupHierarchyRoot",
  47992. referencedClasses: [],
  47993. messageSends: ["~=", "lookupHierarchyRoot"]
  47994. }),
  47995. $globals.TestCase.a$cls);
  47996. $core.addMethod(
  47997. $core.method({
  47998. selector: "testSelectors",
  47999. protocol: "accessing",
  48000. fn: function (){
  48001. var self=this,$self=this;
  48002. return $core.withContext(function($ctx1) {
  48003. return $recv($recv($self._methodDictionary())._keys())._select_((function(each){
  48004. return $core.withContext(function($ctx2) {
  48005. return $recv(each)._match_("^test");
  48006. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48007. }));
  48008. }, function($ctx1) {$ctx1.fill(self,"testSelectors",{},$globals.TestCase.a$cls)});
  48009. },
  48010. args: [],
  48011. source: "testSelectors\x0a\x09^ self methodDictionary keys select: [ :each | each match: '^test' ]",
  48012. referencedClasses: [],
  48013. messageSends: ["select:", "keys", "methodDictionary", "match:"]
  48014. }),
  48015. $globals.TestCase.a$cls);
  48016. $core.addClass("TestContext", $globals.Object, ["testCase"], "SUnit");
  48017. $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).";
  48018. $core.addMethod(
  48019. $core.method({
  48020. selector: "execute:",
  48021. protocol: "running",
  48022. fn: function (aBlock){
  48023. var self=this,$self=this;
  48024. var failed;
  48025. return $core.withContext(function($ctx1) {
  48026. var $1,$2;
  48027. $recv($self["@testCase"])._context_(self);
  48028. $ctx1.sendIdx["context:"]=1;
  48029. $recv((function(){
  48030. return $core.withContext(function($ctx2) {
  48031. failed=true;
  48032. $recv(aBlock)._value();
  48033. failed=false;
  48034. return failed;
  48035. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48036. }))._ensure_((function(){
  48037. return $core.withContext(function($ctx2) {
  48038. $recv($self["@testCase"])._context_(nil);
  48039. $1=$recv(failed)._and_((function(){
  48040. return $core.withContext(function($ctx3) {
  48041. return $recv($self["@testCase"])._isAsync();
  48042. $ctx3.sendIdx["isAsync"]=1;
  48043. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  48044. }));
  48045. if($core.assert($1)){
  48046. $recv($self["@testCase"])._finished();
  48047. }
  48048. $2=$recv($self["@testCase"])._isAsync();
  48049. if(!$core.assert($2)){
  48050. return $recv($self["@testCase"])._tearDown();
  48051. }
  48052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48053. }));
  48054. return self;
  48055. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock,failed:failed},$globals.TestContext)});
  48056. },
  48057. args: ["aBlock"],
  48058. 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 ] ]",
  48059. referencedClasses: [],
  48060. messageSends: ["context:", "ensure:", "value", "ifTrue:", "and:", "isAsync", "finished", "ifFalse:", "tearDown"]
  48061. }),
  48062. $globals.TestContext);
  48063. $core.addMethod(
  48064. $core.method({
  48065. selector: "start",
  48066. protocol: "running",
  48067. fn: function (){
  48068. var self=this,$self=this;
  48069. return $core.withContext(function($ctx1) {
  48070. $self._execute_((function(){
  48071. return $core.withContext(function($ctx2) {
  48072. $recv($self["@testCase"])._setUp();
  48073. return $recv($self["@testCase"])._performTest();
  48074. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48075. }));
  48076. return self;
  48077. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.TestContext)});
  48078. },
  48079. args: [],
  48080. source: "start\x0a\x09self execute: [\x0a\x09\x09testCase setUp.\x0a\x09\x09testCase performTest ]",
  48081. referencedClasses: [],
  48082. messageSends: ["execute:", "setUp", "performTest"]
  48083. }),
  48084. $globals.TestContext);
  48085. $core.addMethod(
  48086. $core.method({
  48087. selector: "testCase:",
  48088. protocol: "accessing",
  48089. fn: function (aTestCase){
  48090. var self=this,$self=this;
  48091. $self["@testCase"]=aTestCase;
  48092. return self;
  48093. },
  48094. args: ["aTestCase"],
  48095. source: "testCase: aTestCase\x0a\x09testCase := aTestCase",
  48096. referencedClasses: [],
  48097. messageSends: []
  48098. }),
  48099. $globals.TestContext);
  48100. $core.addMethod(
  48101. $core.method({
  48102. selector: "testCase:",
  48103. protocol: "instance creation",
  48104. fn: function (aTestCase){
  48105. var self=this,$self=this;
  48106. return $core.withContext(function($ctx1) {
  48107. var $1;
  48108. $1=$self._new();
  48109. $recv($1)._testCase_(aTestCase);
  48110. return $recv($1)._yourself();
  48111. }, function($ctx1) {$ctx1.fill(self,"testCase:",{aTestCase:aTestCase},$globals.TestContext.a$cls)});
  48112. },
  48113. args: ["aTestCase"],
  48114. source: "testCase: aTestCase\x0a\x09^ self new\x0a\x09\x09testCase: aTestCase;\x0a\x09\x09yourself",
  48115. referencedClasses: [],
  48116. messageSends: ["testCase:", "new", "yourself"]
  48117. }),
  48118. $globals.TestContext.a$cls);
  48119. $core.addClass("ReportingTestContext", $globals.TestContext, ["finished", "result"], "SUnit");
  48120. $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`.";
  48121. $core.addMethod(
  48122. $core.method({
  48123. selector: "execute:",
  48124. protocol: "running",
  48125. fn: function (aBlock){
  48126. var self=this,$self=this;
  48127. return $core.withContext(function($ctx1) {
  48128. var $1;
  48129. $recv((function(){
  48130. return $core.withContext(function($ctx2) {
  48131. return $self._withErrorReporting_((function(){
  48132. return $core.withContext(function($ctx3) {
  48133. return (
  48134. $ctx3.supercall = true,
  48135. ($globals.ReportingTestContext.superclass||$boot.nilAsClass).fn.prototype._execute_.apply($self, [aBlock]));
  48136. $ctx3.supercall = false;
  48137. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48138. }));
  48139. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48140. }))._ensure_((function(){
  48141. return $core.withContext(function($ctx2) {
  48142. $1=$recv($self["@testCase"])._isAsync();
  48143. if(!$core.assert($1)){
  48144. $recv($self["@result"])._increaseRuns();
  48145. return $recv($self["@finished"])._value();
  48146. }
  48147. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  48148. }));
  48149. return self;
  48150. }, function($ctx1) {$ctx1.fill(self,"execute:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48151. },
  48152. args: ["aBlock"],
  48153. 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 ] ]",
  48154. referencedClasses: [],
  48155. messageSends: ["ensure:", "withErrorReporting:", "execute:", "ifFalse:", "isAsync", "increaseRuns", "value"]
  48156. }),
  48157. $globals.ReportingTestContext);
  48158. $core.addMethod(
  48159. $core.method({
  48160. selector: "finished:",
  48161. protocol: "accessing",
  48162. fn: function (aBlock){
  48163. var self=this,$self=this;
  48164. $self["@finished"]=aBlock;
  48165. return self;
  48166. },
  48167. args: ["aBlock"],
  48168. source: "finished: aBlock\x0a\x09finished := aBlock",
  48169. referencedClasses: [],
  48170. messageSends: []
  48171. }),
  48172. $globals.ReportingTestContext);
  48173. $core.addMethod(
  48174. $core.method({
  48175. selector: "result:",
  48176. protocol: "accessing",
  48177. fn: function (aTestResult){
  48178. var self=this,$self=this;
  48179. $self["@result"]=aTestResult;
  48180. return self;
  48181. },
  48182. args: ["aTestResult"],
  48183. source: "result: aTestResult\x0a\x09result := aTestResult",
  48184. referencedClasses: [],
  48185. messageSends: []
  48186. }),
  48187. $globals.ReportingTestContext);
  48188. $core.addMethod(
  48189. $core.method({
  48190. selector: "withErrorReporting:",
  48191. protocol: "private",
  48192. fn: function (aBlock){
  48193. var self=this,$self=this;
  48194. return $core.withContext(function($ctx1) {
  48195. $recv((function(){
  48196. return $core.withContext(function($ctx2) {
  48197. return $recv(aBlock)._on_do_($globals.TestFailure,(function(ex){
  48198. return $core.withContext(function($ctx3) {
  48199. return $recv($self["@result"])._addFailure_($self["@testCase"]);
  48200. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,2)});
  48201. }));
  48202. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48203. }))._on_do_($globals.Error,(function(ex){
  48204. return $core.withContext(function($ctx2) {
  48205. return $recv($self["@result"])._addError_($self["@testCase"]);
  48206. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,3)});
  48207. }));
  48208. $ctx1.sendIdx["on:do:"]=1;
  48209. return self;
  48210. }, function($ctx1) {$ctx1.fill(self,"withErrorReporting:",{aBlock:aBlock},$globals.ReportingTestContext)});
  48211. },
  48212. args: ["aBlock"],
  48213. 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 ]",
  48214. referencedClasses: ["TestFailure", "Error"],
  48215. messageSends: ["on:do:", "addFailure:", "addError:"]
  48216. }),
  48217. $globals.ReportingTestContext);
  48218. $core.addMethod(
  48219. $core.method({
  48220. selector: "testCase:result:finished:",
  48221. protocol: "instance creation",
  48222. fn: function (aTestCase,aTestResult,aBlock){
  48223. var self=this,$self=this;
  48224. return $core.withContext(function($ctx1) {
  48225. var $1;
  48226. $1=(
  48227. $ctx1.supercall = true,
  48228. ($globals.ReportingTestContext.a$cls.superclass||$boot.nilAsClass).fn.prototype._testCase_.apply($self, [aTestCase]));
  48229. $ctx1.supercall = false;
  48230. $recv($1)._result_(aTestResult);
  48231. $recv($1)._finished_(aBlock);
  48232. return $recv($1)._yourself();
  48233. }, function($ctx1) {$ctx1.fill(self,"testCase:result:finished:",{aTestCase:aTestCase,aTestResult:aTestResult,aBlock:aBlock},$globals.ReportingTestContext.a$cls)});
  48234. },
  48235. args: ["aTestCase", "aTestResult", "aBlock"],
  48236. source: "testCase: aTestCase result: aTestResult finished: aBlock\x0a\x09^ (super testCase: aTestCase)\x0a\x09\x09result: aTestResult;\x0a\x09\x09finished: aBlock;\x0a\x09\x09yourself",
  48237. referencedClasses: [],
  48238. messageSends: ["result:", "testCase:", "finished:", "yourself"]
  48239. }),
  48240. $globals.ReportingTestContext.a$cls);
  48241. $core.addClass("TestFailure", $globals.Error, [], "SUnit");
  48242. $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.";
  48243. $core.addClass("TestResult", $globals.Object, ["timestamp", "runs", "errors", "failures", "total"], "SUnit");
  48244. $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";
  48245. $core.addMethod(
  48246. $core.method({
  48247. selector: "addError:",
  48248. protocol: "accessing",
  48249. fn: function (anError){
  48250. var self=this,$self=this;
  48251. return $core.withContext(function($ctx1) {
  48252. $recv($self._errors())._add_(anError);
  48253. return self;
  48254. }, function($ctx1) {$ctx1.fill(self,"addError:",{anError:anError},$globals.TestResult)});
  48255. },
  48256. args: ["anError"],
  48257. source: "addError: anError\x0a\x09self errors add: anError",
  48258. referencedClasses: [],
  48259. messageSends: ["add:", "errors"]
  48260. }),
  48261. $globals.TestResult);
  48262. $core.addMethod(
  48263. $core.method({
  48264. selector: "addFailure:",
  48265. protocol: "accessing",
  48266. fn: function (aFailure){
  48267. var self=this,$self=this;
  48268. return $core.withContext(function($ctx1) {
  48269. $recv($self._failures())._add_(aFailure);
  48270. return self;
  48271. }, function($ctx1) {$ctx1.fill(self,"addFailure:",{aFailure:aFailure},$globals.TestResult)});
  48272. },
  48273. args: ["aFailure"],
  48274. source: "addFailure: aFailure\x0a\x09self failures add: aFailure",
  48275. referencedClasses: [],
  48276. messageSends: ["add:", "failures"]
  48277. }),
  48278. $globals.TestResult);
  48279. $core.addMethod(
  48280. $core.method({
  48281. selector: "errors",
  48282. protocol: "accessing",
  48283. fn: function (){
  48284. var self=this,$self=this;
  48285. return $self["@errors"];
  48286. },
  48287. args: [],
  48288. source: "errors\x0a\x09^ errors",
  48289. referencedClasses: [],
  48290. messageSends: []
  48291. }),
  48292. $globals.TestResult);
  48293. $core.addMethod(
  48294. $core.method({
  48295. selector: "failures",
  48296. protocol: "accessing",
  48297. fn: function (){
  48298. var self=this,$self=this;
  48299. return $self["@failures"];
  48300. },
  48301. args: [],
  48302. source: "failures\x0a\x09^ failures",
  48303. referencedClasses: [],
  48304. messageSends: []
  48305. }),
  48306. $globals.TestResult);
  48307. $core.addMethod(
  48308. $core.method({
  48309. selector: "increaseRuns",
  48310. protocol: "accessing",
  48311. fn: function (){
  48312. var self=this,$self=this;
  48313. return $core.withContext(function($ctx1) {
  48314. $self["@runs"]=$recv($self["@runs"]).__plus((1));
  48315. return self;
  48316. }, function($ctx1) {$ctx1.fill(self,"increaseRuns",{},$globals.TestResult)});
  48317. },
  48318. args: [],
  48319. source: "increaseRuns\x0a\x09runs := runs + 1",
  48320. referencedClasses: [],
  48321. messageSends: ["+"]
  48322. }),
  48323. $globals.TestResult);
  48324. $core.addMethod(
  48325. $core.method({
  48326. selector: "initialize",
  48327. protocol: "initialization",
  48328. fn: function (){
  48329. var self=this,$self=this;
  48330. return $core.withContext(function($ctx1) {
  48331. (
  48332. $ctx1.supercall = true,
  48333. ($globals.TestResult.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48334. $ctx1.supercall = false;
  48335. $self["@timestamp"]=$recv($globals.Date)._now();
  48336. $self["@runs"]=(0);
  48337. $self["@errors"]=$recv($globals.Array)._new();
  48338. $ctx1.sendIdx["new"]=1;
  48339. $self["@failures"]=$recv($globals.Array)._new();
  48340. $self["@total"]=(0);
  48341. return self;
  48342. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestResult)});
  48343. },
  48344. args: [],
  48345. source: "initialize\x0a\x09super initialize.\x0a\x09timestamp := Date now.\x0a\x09runs := 0.\x0a\x09errors := Array new.\x0a\x09failures := Array new.\x0a\x09total := 0",
  48346. referencedClasses: ["Date", "Array"],
  48347. messageSends: ["initialize", "now", "new"]
  48348. }),
  48349. $globals.TestResult);
  48350. $core.addMethod(
  48351. $core.method({
  48352. selector: "nextRunDo:",
  48353. protocol: "running",
  48354. fn: function (aBlock){
  48355. var self=this,$self=this;
  48356. return $core.withContext(function($ctx1) {
  48357. var $2,$1;
  48358. $2=$self._runs();
  48359. $ctx1.sendIdx["runs"]=1;
  48360. $1=$recv($2).__eq_eq($self._total());
  48361. if(!$core.assert($1)){
  48362. return $recv(aBlock)._value_($recv($self._runs()).__plus((1)));
  48363. }
  48364. }, function($ctx1) {$ctx1.fill(self,"nextRunDo:",{aBlock:aBlock},$globals.TestResult)});
  48365. },
  48366. args: ["aBlock"],
  48367. 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 ]",
  48368. referencedClasses: [],
  48369. messageSends: ["ifFalse:", "==", "runs", "total", "value:", "+"]
  48370. }),
  48371. $globals.TestResult);
  48372. $core.addMethod(
  48373. $core.method({
  48374. selector: "runCase:",
  48375. protocol: "running",
  48376. fn: function (aTestCase){
  48377. var self=this,$self=this;
  48378. return $core.withContext(function($ctx1) {
  48379. $recv((function(){
  48380. return $core.withContext(function($ctx2) {
  48381. return $recv((function(){
  48382. return $core.withContext(function($ctx3) {
  48383. $self._increaseRuns();
  48384. return $recv(aTestCase)._runCase();
  48385. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  48386. }))._on_do_($globals.TestFailure,(function(ex){
  48387. return $core.withContext(function($ctx3) {
  48388. return $self._addFailure_(aTestCase);
  48389. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  48390. }));
  48391. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48392. }))._on_do_($globals.Error,(function(ex){
  48393. return $core.withContext(function($ctx2) {
  48394. return $self._addError_(aTestCase);
  48395. }, function($ctx2) {$ctx2.fillBlock({ex:ex},$ctx1,4)});
  48396. }));
  48397. $ctx1.sendIdx["on:do:"]=1;
  48398. return self;
  48399. }, function($ctx1) {$ctx1.fill(self,"runCase:",{aTestCase:aTestCase},$globals.TestResult)});
  48400. },
  48401. args: ["aTestCase"],
  48402. 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 ]",
  48403. referencedClasses: ["TestFailure", "Error"],
  48404. messageSends: ["on:do:", "increaseRuns", "runCase", "addFailure:", "addError:"]
  48405. }),
  48406. $globals.TestResult);
  48407. $core.addMethod(
  48408. $core.method({
  48409. selector: "runs",
  48410. protocol: "accessing",
  48411. fn: function (){
  48412. var self=this,$self=this;
  48413. return $self["@runs"];
  48414. },
  48415. args: [],
  48416. source: "runs\x0a\x09^ runs",
  48417. referencedClasses: [],
  48418. messageSends: []
  48419. }),
  48420. $globals.TestResult);
  48421. $core.addMethod(
  48422. $core.method({
  48423. selector: "status",
  48424. protocol: "accessing",
  48425. fn: function (){
  48426. var self=this,$self=this;
  48427. return $core.withContext(function($ctx1) {
  48428. var $1;
  48429. $1=$recv($self._errors())._ifNotEmpty_ifEmpty_((function(){
  48430. return "error";
  48431. }),(function(){
  48432. return $core.withContext(function($ctx2) {
  48433. return $recv($self._failures())._ifNotEmpty_ifEmpty_((function(){
  48434. return "failure";
  48435. }),(function(){
  48436. return "success";
  48437. }));
  48438. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  48439. }));
  48440. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  48441. return $1;
  48442. }, function($ctx1) {$ctx1.fill(self,"status",{},$globals.TestResult)});
  48443. },
  48444. args: [],
  48445. source: "status\x0a\x09^ self errors ifNotEmpty: [ 'error' ] ifEmpty: [\x0a\x09\x09self failures ifNotEmpty: [ 'failure' ] ifEmpty: [\x0a\x09\x09\x09'success' ]]",
  48446. referencedClasses: [],
  48447. messageSends: ["ifNotEmpty:ifEmpty:", "errors", "failures"]
  48448. }),
  48449. $globals.TestResult);
  48450. $core.addMethod(
  48451. $core.method({
  48452. selector: "timestamp",
  48453. protocol: "accessing",
  48454. fn: function (){
  48455. var self=this,$self=this;
  48456. return $self["@timestamp"];
  48457. },
  48458. args: [],
  48459. source: "timestamp\x0a\x09^ timestamp",
  48460. referencedClasses: [],
  48461. messageSends: []
  48462. }),
  48463. $globals.TestResult);
  48464. $core.addMethod(
  48465. $core.method({
  48466. selector: "total",
  48467. protocol: "accessing",
  48468. fn: function (){
  48469. var self=this,$self=this;
  48470. return $self["@total"];
  48471. },
  48472. args: [],
  48473. source: "total\x0a\x09^ total",
  48474. referencedClasses: [],
  48475. messageSends: []
  48476. }),
  48477. $globals.TestResult);
  48478. $core.addMethod(
  48479. $core.method({
  48480. selector: "total:",
  48481. protocol: "accessing",
  48482. fn: function (aNumber){
  48483. var self=this,$self=this;
  48484. $self["@total"]=aNumber;
  48485. return self;
  48486. },
  48487. args: ["aNumber"],
  48488. source: "total: aNumber\x0a\x09total := aNumber",
  48489. referencedClasses: [],
  48490. messageSends: []
  48491. }),
  48492. $globals.TestResult);
  48493. $core.addClass("TestSuiteRunner", $globals.Object, ["suite", "result", "announcer", "runNextTest"], "SUnit");
  48494. $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`.";
  48495. $core.addMethod(
  48496. $core.method({
  48497. selector: "announcer",
  48498. protocol: "accessing",
  48499. fn: function (){
  48500. var self=this,$self=this;
  48501. return $self["@announcer"];
  48502. },
  48503. args: [],
  48504. source: "announcer\x0a\x09^ announcer",
  48505. referencedClasses: [],
  48506. messageSends: []
  48507. }),
  48508. $globals.TestSuiteRunner);
  48509. $core.addMethod(
  48510. $core.method({
  48511. selector: "contextOf:",
  48512. protocol: "private",
  48513. fn: function (anInteger){
  48514. var self=this,$self=this;
  48515. return $core.withContext(function($ctx1) {
  48516. return $recv($globals.ReportingTestContext)._testCase_result_finished_($recv($self["@suite"])._at_(anInteger),$self["@result"],(function(){
  48517. return $core.withContext(function($ctx2) {
  48518. return $self._resume();
  48519. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  48520. }));
  48521. }, function($ctx1) {$ctx1.fill(self,"contextOf:",{anInteger:anInteger},$globals.TestSuiteRunner)});
  48522. },
  48523. args: ["anInteger"],
  48524. source: "contextOf: anInteger\x0a\x09^ ReportingTestContext testCase: (suite at: anInteger) result: result finished: [ self resume ]",
  48525. referencedClasses: ["ReportingTestContext"],
  48526. messageSends: ["testCase:result:finished:", "at:", "resume"]
  48527. }),
  48528. $globals.TestSuiteRunner);
  48529. $core.addMethod(
  48530. $core.method({
  48531. selector: "initialize",
  48532. protocol: "initialization",
  48533. fn: function (){
  48534. var self=this,$self=this;
  48535. return $core.withContext(function($ctx1) {
  48536. var $1;
  48537. (
  48538. $ctx1.supercall = true,
  48539. ($globals.TestSuiteRunner.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  48540. $ctx1.supercall = false;
  48541. $self["@announcer"]=$recv($globals.Announcer)._new();
  48542. $ctx1.sendIdx["new"]=1;
  48543. $self["@result"]=$recv($globals.TestResult)._new();
  48544. $self["@runNextTest"]=(function(){
  48545. var runs;
  48546. return $core.withContext(function($ctx2) {
  48547. runs=$recv($self["@result"])._runs();
  48548. $1=$recv(runs).__lt($recv($self["@result"])._total());
  48549. if($core.assert($1)){
  48550. return $recv($self._contextOf_($recv(runs).__plus((1))))._start();
  48551. }
  48552. }, function($ctx2) {$ctx2.fillBlock({runs:runs},$ctx1,1)});
  48553. });
  48554. return self;
  48555. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.TestSuiteRunner)});
  48556. },
  48557. args: [],
  48558. 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 ] ].",
  48559. referencedClasses: ["Announcer", "TestResult"],
  48560. messageSends: ["initialize", "new", "runs", "ifTrue:", "<", "total", "start", "contextOf:", "+"]
  48561. }),
  48562. $globals.TestSuiteRunner);
  48563. $core.addMethod(
  48564. $core.method({
  48565. selector: "result",
  48566. protocol: "accessing",
  48567. fn: function (){
  48568. var self=this,$self=this;
  48569. return $self["@result"];
  48570. },
  48571. args: [],
  48572. source: "result\x0a\x09^ result",
  48573. referencedClasses: [],
  48574. messageSends: []
  48575. }),
  48576. $globals.TestSuiteRunner);
  48577. $core.addMethod(
  48578. $core.method({
  48579. selector: "resume",
  48580. protocol: "actions",
  48581. fn: function (){
  48582. var self=this,$self=this;
  48583. return $core.withContext(function($ctx1) {
  48584. $recv($self["@runNextTest"])._fork();
  48585. $recv($self["@announcer"])._announce_($recv($recv($globals.ResultAnnouncement)._new())._result_($self["@result"]));
  48586. return self;
  48587. }, function($ctx1) {$ctx1.fill(self,"resume",{},$globals.TestSuiteRunner)});
  48588. },
  48589. args: [],
  48590. source: "resume\x0a\x09runNextTest fork.\x0a\x09announcer announce: (ResultAnnouncement new result: result)",
  48591. referencedClasses: ["ResultAnnouncement"],
  48592. messageSends: ["fork", "announce:", "result:", "new"]
  48593. }),
  48594. $globals.TestSuiteRunner);
  48595. $core.addMethod(
  48596. $core.method({
  48597. selector: "run",
  48598. protocol: "actions",
  48599. fn: function (){
  48600. var self=this,$self=this;
  48601. return $core.withContext(function($ctx1) {
  48602. $recv($self["@result"])._total_($recv($self["@suite"])._size());
  48603. $self._resume();
  48604. return self;
  48605. }, function($ctx1) {$ctx1.fill(self,"run",{},$globals.TestSuiteRunner)});
  48606. },
  48607. args: [],
  48608. source: "run\x0a\x09result total: suite size.\x0a\x09self resume",
  48609. referencedClasses: [],
  48610. messageSends: ["total:", "size", "resume"]
  48611. }),
  48612. $globals.TestSuiteRunner);
  48613. $core.addMethod(
  48614. $core.method({
  48615. selector: "suite:",
  48616. protocol: "accessing",
  48617. fn: function (aCollection){
  48618. var self=this,$self=this;
  48619. $self["@suite"]=aCollection;
  48620. return self;
  48621. },
  48622. args: ["aCollection"],
  48623. source: "suite: aCollection\x0a\x09suite := aCollection",
  48624. referencedClasses: [],
  48625. messageSends: []
  48626. }),
  48627. $globals.TestSuiteRunner);
  48628. $core.addMethod(
  48629. $core.method({
  48630. selector: "new",
  48631. protocol: "instance creation",
  48632. fn: function (){
  48633. var self=this,$self=this;
  48634. return $core.withContext(function($ctx1) {
  48635. $self._shouldNotImplement();
  48636. return self;
  48637. }, function($ctx1) {$ctx1.fill(self,"new",{},$globals.TestSuiteRunner.a$cls)});
  48638. },
  48639. args: [],
  48640. source: "new\x0a\x09self shouldNotImplement",
  48641. referencedClasses: [],
  48642. messageSends: ["shouldNotImplement"]
  48643. }),
  48644. $globals.TestSuiteRunner.a$cls);
  48645. $core.addMethod(
  48646. $core.method({
  48647. selector: "on:",
  48648. protocol: "instance creation",
  48649. fn: function (aCollection){
  48650. var self=this,$self=this;
  48651. return $core.withContext(function($ctx1) {
  48652. var $1;
  48653. $1=(
  48654. $ctx1.supercall = true,
  48655. ($globals.TestSuiteRunner.a$cls.superclass||$boot.nilAsClass).fn.prototype._new.apply($self, []));
  48656. $ctx1.supercall = false;
  48657. return $recv($1)._suite_(aCollection);
  48658. }, function($ctx1) {$ctx1.fill(self,"on:",{aCollection:aCollection},$globals.TestSuiteRunner.a$cls)});
  48659. },
  48660. args: ["aCollection"],
  48661. source: "on: aCollection\x0a\x09^ super new suite: aCollection",
  48662. referencedClasses: [],
  48663. messageSends: ["suite:", "new"]
  48664. }),
  48665. $globals.TestSuiteRunner.a$cls);
  48666. $core.addMethod(
  48667. $core.method({
  48668. selector: "isTestPackage",
  48669. protocol: "*SUnit",
  48670. fn: function (){
  48671. var self=this,$self=this;
  48672. return $core.withContext(function($ctx1) {
  48673. return $recv($self._classes())._anySatisfy_((function(each){
  48674. return $core.withContext(function($ctx2) {
  48675. return $recv(each)._isTestClass();
  48676. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  48677. }));
  48678. }, function($ctx1) {$ctx1.fill(self,"isTestPackage",{},$globals.Package)});
  48679. },
  48680. args: [],
  48681. source: "isTestPackage\x0a\x09^ self classes anySatisfy: [ :each | each isTestClass ]",
  48682. referencedClasses: [],
  48683. messageSends: ["anySatisfy:", "classes", "isTestClass"]
  48684. }),
  48685. $globals.Package);
  48686. $core.addMethod(
  48687. $core.method({
  48688. selector: "isTestClass",
  48689. protocol: "*SUnit",
  48690. fn: function (){
  48691. var self=this,$self=this;
  48692. return false;
  48693. },
  48694. args: [],
  48695. source: "isTestClass\x0a\x09^ false",
  48696. referencedClasses: [],
  48697. messageSends: []
  48698. }),
  48699. $globals.TBehaviorDefaults);
  48700. });
  48701. define('amber_core/Compiler-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  48702. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  48703. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  48704. $core.addPackage("Compiler-Tests");
  48705. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].innerEval = function (expr) { return eval(expr); };
  48706. ($core.packageDescriptors||$core.packages)["Compiler-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  48707. $core.addClass("ASTParsingTest", $globals.TestCase, [], "Compiler-Tests");
  48708. $core.addMethod(
  48709. $core.method({
  48710. selector: "parse:forClass:",
  48711. protocol: "parsing",
  48712. fn: function (aString,aClass){
  48713. var self=this,$self=this;
  48714. return $core.withContext(function($ctx1) {
  48715. return $recv($recv($globals.Compiler)._new())._ast_forClass_protocol_(aString,aClass,"test");
  48716. }, function($ctx1) {$ctx1.fill(self,"parse:forClass:",{aString:aString,aClass:aClass},$globals.ASTParsingTest)});
  48717. },
  48718. args: ["aString", "aClass"],
  48719. source: "parse: aString forClass: aClass\x0a\x09^ Compiler new\x0a\x09\x09ast: aString\x0a\x09\x09forClass: aClass\x0a\x09\x09protocol: 'test'",
  48720. referencedClasses: ["Compiler"],
  48721. messageSends: ["ast:forClass:protocol:", "new"]
  48722. }),
  48723. $globals.ASTParsingTest);
  48724. $core.addClass("ASTPCNodeVisitorTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48725. $core.addMethod(
  48726. $core.method({
  48727. selector: "astPCNodeVisitor",
  48728. protocol: "factory",
  48729. fn: function (){
  48730. var self=this,$self=this;
  48731. return $core.withContext(function($ctx1) {
  48732. var $1;
  48733. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48734. $recv($1)._index_((0));
  48735. return $recv($1)._yourself();
  48736. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitor",{},$globals.ASTPCNodeVisitorTest)});
  48737. },
  48738. args: [],
  48739. source: "astPCNodeVisitor\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48740. referencedClasses: ["ASTPCNodeVisitor"],
  48741. messageSends: ["index:", "new", "yourself"]
  48742. }),
  48743. $globals.ASTPCNodeVisitorTest);
  48744. $core.addMethod(
  48745. $core.method({
  48746. selector: "astPCNodeVisitorForSelector:",
  48747. protocol: "factory",
  48748. fn: function (aString){
  48749. var self=this,$self=this;
  48750. return $core.withContext(function($ctx1) {
  48751. var $1;
  48752. $1=$recv($globals.ASTPCNodeVisitor)._new();
  48753. $recv($1)._selector_(aString);
  48754. $recv($1)._index_((0));
  48755. return $recv($1)._yourself();
  48756. }, function($ctx1) {$ctx1.fill(self,"astPCNodeVisitorForSelector:",{aString:aString},$globals.ASTPCNodeVisitorTest)});
  48757. },
  48758. args: ["aString"],
  48759. source: "astPCNodeVisitorForSelector: aString\x0a\x09^ ASTPCNodeVisitor new\x0a\x09\x09selector: aString;\x0a\x09\x09index: 0;\x0a\x09\x09yourself",
  48760. referencedClasses: ["ASTPCNodeVisitor"],
  48761. messageSends: ["selector:", "new", "index:", "yourself"]
  48762. }),
  48763. $globals.ASTPCNodeVisitorTest);
  48764. $core.addMethod(
  48765. $core.method({
  48766. selector: "testJSStatementNode",
  48767. protocol: "tests",
  48768. fn: function (){
  48769. var self=this,$self=this;
  48770. var ast,visitor;
  48771. return $core.withContext(function($ctx1) {
  48772. var $3,$2,$1;
  48773. ast=$self._parse_forClass_("foo <inlineJS: 'consolee.log(1)'>",$globals.Object);
  48774. $3=$self._astPCNodeVisitor();
  48775. $recv($3)._visit_(ast);
  48776. $2=$recv($3)._currentNode();
  48777. $1=$recv($2)._isJSStatementNode();
  48778. $self._assert_($1);
  48779. return self;
  48780. }, function($ctx1) {$ctx1.fill(self,"testJSStatementNode",{ast:ast,visitor:visitor},$globals.ASTPCNodeVisitorTest)});
  48781. },
  48782. args: [],
  48783. 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",
  48784. referencedClasses: ["Object"],
  48785. messageSends: ["parse:forClass:", "assert:", "isJSStatementNode", "visit:", "astPCNodeVisitor", "currentNode"]
  48786. }),
  48787. $globals.ASTPCNodeVisitorTest);
  48788. $core.addMethod(
  48789. $core.method({
  48790. selector: "testMessageSend",
  48791. protocol: "tests",
  48792. fn: function (){
  48793. var self=this,$self=this;
  48794. var ast;
  48795. return $core.withContext(function($ctx1) {
  48796. var $3,$2,$1;
  48797. ast=$self._parse_forClass_("foo self asString yourself. ^ self asBoolean",$globals.Object);
  48798. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48799. $recv($3)._visit_(ast);
  48800. $2=$recv($3)._currentNode();
  48801. $1=$recv($2)._selector();
  48802. $self._assert_equals_($1,"yourself");
  48803. return self;
  48804. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48805. },
  48806. args: [],
  48807. 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'",
  48808. referencedClasses: ["Object"],
  48809. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48810. }),
  48811. $globals.ASTPCNodeVisitorTest);
  48812. $core.addMethod(
  48813. $core.method({
  48814. selector: "testMessageSendWithBlocks",
  48815. protocol: "tests",
  48816. fn: function (){
  48817. var self=this,$self=this;
  48818. var ast;
  48819. return $core.withContext(function($ctx1) {
  48820. var $3,$2,$1;
  48821. ast=$self._parse_forClass_("foo true ifTrue: [ [ self asString yourself ] value. ]. ^ self asBoolean",$globals.Object);
  48822. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48823. $recv($3)._visit_(ast);
  48824. $2=$recv($3)._currentNode();
  48825. $1=$recv($2)._selector();
  48826. $self._assert_equals_($1,"yourself");
  48827. return self;
  48828. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithBlocks",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48829. },
  48830. args: [],
  48831. 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'",
  48832. referencedClasses: ["Object"],
  48833. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48834. }),
  48835. $globals.ASTPCNodeVisitorTest);
  48836. $core.addMethod(
  48837. $core.method({
  48838. selector: "testMessageSendWithInlining",
  48839. protocol: "tests",
  48840. fn: function (){
  48841. var self=this,$self=this;
  48842. var ast;
  48843. return $core.withContext(function($ctx1) {
  48844. var $3,$4,$2,$1,$7,$6,$5;
  48845. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48846. $ctx1.sendIdx["parse:forClass:"]=1;
  48847. $3=$self._astPCNodeVisitorForSelector_("yourself");
  48848. $ctx1.sendIdx["astPCNodeVisitorForSelector:"]=1;
  48849. $recv($3)._visit_(ast);
  48850. $ctx1.sendIdx["visit:"]=1;
  48851. $4=$recv($3)._currentNode();
  48852. $ctx1.sendIdx["currentNode"]=1;
  48853. $2=$4;
  48854. $1=$recv($2)._selector();
  48855. $ctx1.sendIdx["selector"]=1;
  48856. $self._assert_equals_($1,"yourself");
  48857. $ctx1.sendIdx["assert:equals:"]=1;
  48858. ast=$self._parse_forClass_("foo true ifTrue: [ self asString yourself ]. ^ self asBoolean",$globals.Object);
  48859. $7=$self._astPCNodeVisitorForSelector_("asBoolean");
  48860. $recv($7)._visit_(ast);
  48861. $6=$recv($7)._currentNode();
  48862. $5=$recv($6)._selector();
  48863. $self._assert_equals_($5,"asBoolean");
  48864. return self;
  48865. }, function($ctx1) {$ctx1.fill(self,"testMessageSendWithInlining",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48866. },
  48867. args: [],
  48868. 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'",
  48869. referencedClasses: ["Object"],
  48870. messageSends: ["parse:forClass:", "assert:equals:", "selector", "visit:", "astPCNodeVisitorForSelector:", "currentNode"]
  48871. }),
  48872. $globals.ASTPCNodeVisitorTest);
  48873. $core.addMethod(
  48874. $core.method({
  48875. selector: "testNoMessageSend",
  48876. protocol: "tests",
  48877. fn: function (){
  48878. var self=this,$self=this;
  48879. var ast;
  48880. return $core.withContext(function($ctx1) {
  48881. var $3,$2,$1;
  48882. ast=$self._parse_forClass_("foo ^ self",$globals.Object);
  48883. $3=$self._astPCNodeVisitor();
  48884. $recv($3)._visit_(ast);
  48885. $2=$recv($3)._currentNode();
  48886. $1=$recv($2)._isNil();
  48887. $self._assert_($1);
  48888. return self;
  48889. }, function($ctx1) {$ctx1.fill(self,"testNoMessageSend",{ast:ast},$globals.ASTPCNodeVisitorTest)});
  48890. },
  48891. args: [],
  48892. 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",
  48893. referencedClasses: ["Object"],
  48894. messageSends: ["parse:forClass:", "assert:", "isNil", "visit:", "astPCNodeVisitor", "currentNode"]
  48895. }),
  48896. $globals.ASTPCNodeVisitorTest);
  48897. $core.addClass("ASTPositionTest", $globals.ASTParsingTest, [], "Compiler-Tests");
  48898. $core.addMethod(
  48899. $core.method({
  48900. selector: "testNodeAtPosition",
  48901. protocol: "tests",
  48902. fn: function (){
  48903. var self=this,$self=this;
  48904. var node;
  48905. return $core.withContext(function($ctx1) {
  48906. var $3,$4,$2,$1,$7,$8,$6,$5;
  48907. node=$self._parse_forClass_("yourself\x0a\x09^ self",$globals.Object);
  48908. $ctx1.sendIdx["parse:forClass:"]=1;
  48909. $3=node;
  48910. $4=(2).__at((4));
  48911. $ctx1.sendIdx["@"]=1;
  48912. $2=$recv($3)._navigationNodeAt_ifAbsent_($4,(function(){
  48913. return nil;
  48914. }));
  48915. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=1;
  48916. $1=$recv($2)._source();
  48917. $self._assert_equals_($1,"self");
  48918. $ctx1.sendIdx["assert:equals:"]=1;
  48919. node=$self._parse_forClass_("foo\x0a\x09true ifTrue: [ 1 ]",$globals.Object);
  48920. $ctx1.sendIdx["parse:forClass:"]=2;
  48921. $7=node;
  48922. $8=(2).__at((7));
  48923. $ctx1.sendIdx["@"]=2;
  48924. $6=$recv($7)._navigationNodeAt_ifAbsent_($8,(function(){
  48925. return nil;
  48926. }));
  48927. $ctx1.sendIdx["navigationNodeAt:ifAbsent:"]=2;
  48928. $5=$recv($6)._selector();
  48929. $ctx1.sendIdx["selector"]=1;
  48930. $self._assert_equals_($5,"ifTrue:");
  48931. $ctx1.sendIdx["assert:equals:"]=2;
  48932. node=$self._parse_forClass_("foo\x0a\x09self foo; bar; baz",$globals.Object);
  48933. $self._assert_equals_($recv($recv(node)._navigationNodeAt_ifAbsent_((2).__at((8)),(function(){
  48934. return nil;
  48935. })))._selector(),"foo");
  48936. return self;
  48937. }, function($ctx1) {$ctx1.fill(self,"testNodeAtPosition",{node:node},$globals.ASTPositionTest)});
  48938. },
  48939. args: [],
  48940. 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'",
  48941. referencedClasses: ["Object"],
  48942. messageSends: ["parse:forClass:", "assert:equals:", "source", "navigationNodeAt:ifAbsent:", "@", "selector"]
  48943. }),
  48944. $globals.ASTPositionTest);
  48945. $core.addClass("CodeGeneratorTest", $globals.ASTParsingTest, ["receiver"], "Compiler-Tests");
  48946. $core.addMethod(
  48947. $core.method({
  48948. selector: "codeGeneratorClass",
  48949. protocol: "accessing",
  48950. fn: function (){
  48951. var self=this,$self=this;
  48952. return $globals.CodeGenerator;
  48953. },
  48954. args: [],
  48955. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  48956. referencedClasses: ["CodeGenerator"],
  48957. messageSends: []
  48958. }),
  48959. $globals.CodeGeneratorTest);
  48960. $core.addMethod(
  48961. $core.method({
  48962. selector: "compiler",
  48963. protocol: "factory",
  48964. fn: function (){
  48965. var self=this,$self=this;
  48966. return $core.withContext(function($ctx1) {
  48967. var $1;
  48968. $1=$recv($globals.Compiler)._new();
  48969. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  48970. return $recv($1)._yourself();
  48971. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.CodeGeneratorTest)});
  48972. },
  48973. args: [],
  48974. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  48975. referencedClasses: ["Compiler"],
  48976. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  48977. }),
  48978. $globals.CodeGeneratorTest);
  48979. $core.addMethod(
  48980. $core.method({
  48981. selector: "setUp",
  48982. protocol: "initialization",
  48983. fn: function (){
  48984. var self=this,$self=this;
  48985. return $core.withContext(function($ctx1) {
  48986. $self["@receiver"]=$recv($globals.DoIt)._new();
  48987. return self;
  48988. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.CodeGeneratorTest)});
  48989. },
  48990. args: [],
  48991. source: "setUp\x0a\x09receiver := DoIt new",
  48992. referencedClasses: ["DoIt"],
  48993. messageSends: ["new"]
  48994. }),
  48995. $globals.CodeGeneratorTest);
  48996. $core.addMethod(
  48997. $core.method({
  48998. selector: "should:receiver:raise:",
  48999. protocol: "testing",
  49000. fn: function (aString,anObject,anErrorClass){
  49001. var self=this,$self=this;
  49002. var method,result;
  49003. return $core.withContext(function($ctx1) {
  49004. var $1,$2,$3,$receiver;
  49005. $self["@receiver"]=anObject;
  49006. $recv((function(){
  49007. return $core.withContext(function($ctx2) {
  49008. return $self._should_raise_((function(){
  49009. return $core.withContext(function($ctx3) {
  49010. $1=$self._compiler();
  49011. $2=$recv(anObject)._class();
  49012. $ctx3.sendIdx["class"]=1;
  49013. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  49014. return $recv($self["@receiver"])._perform_($recv(method)._selector());
  49015. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  49016. }),anErrorClass);
  49017. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  49018. }))._ensure_((function(){
  49019. return $core.withContext(function($ctx2) {
  49020. $3=method;
  49021. if(($receiver = $3) == null || $receiver.a$nil){
  49022. return $3;
  49023. } else {
  49024. return $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  49025. }
  49026. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  49027. }));
  49028. return self;
  49029. }, function($ctx1) {$ctx1.fill(self,"should:receiver:raise:",{aString:aString,anObject:anObject,anErrorClass:anErrorClass,method:method,result:result},$globals.CodeGeneratorTest)});
  49030. },
  49031. args: ["aString", "anObject", "anErrorClass"],
  49032. 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 ] ]",
  49033. referencedClasses: [],
  49034. messageSends: ["ensure:", "should:raise:", "install:forClass:protocol:", "compiler", "class", "perform:", "selector", "ifNotNil:", "removeCompiledMethod:"]
  49035. }),
  49036. $globals.CodeGeneratorTest);
  49037. $core.addMethod(
  49038. $core.method({
  49039. selector: "should:receiver:return:",
  49040. protocol: "testing",
  49041. fn: function (aString,anObject,aResult){
  49042. var self=this,$self=this;
  49043. var method,result;
  49044. return $core.withContext(function($ctx1) {
  49045. var $1,$2;
  49046. $self["@receiver"]=anObject;
  49047. $1=$self._compiler();
  49048. $2=$recv(anObject)._class();
  49049. $ctx1.sendIdx["class"]=1;
  49050. method=$recv($1)._install_forClass_protocol_(aString,$2,"tests");
  49051. result=$recv($self["@receiver"])._perform_($recv(method)._selector());
  49052. $recv($recv(anObject)._class())._removeCompiledMethod_(method);
  49053. $self._assert_equals_(aResult,result);
  49054. return self;
  49055. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult,method:method,result:result},$globals.CodeGeneratorTest)});
  49056. },
  49057. args: ["aString", "anObject", "aResult"],
  49058. 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",
  49059. referencedClasses: [],
  49060. messageSends: ["install:forClass:protocol:", "compiler", "class", "perform:", "selector", "removeCompiledMethod:", "assert:equals:"]
  49061. }),
  49062. $globals.CodeGeneratorTest);
  49063. $core.addMethod(
  49064. $core.method({
  49065. selector: "should:return:",
  49066. protocol: "testing",
  49067. fn: function (aString,anObject){
  49068. var self=this,$self=this;
  49069. return $core.withContext(function($ctx1) {
  49070. return $self._should_receiver_return_(aString,$self["@receiver"],anObject);
  49071. }, function($ctx1) {$ctx1.fill(self,"should:return:",{aString:aString,anObject:anObject},$globals.CodeGeneratorTest)});
  49072. },
  49073. args: ["aString", "anObject"],
  49074. source: "should: aString return: anObject\x0a\x09^ self \x0a\x09\x09should: aString \x0a\x09\x09receiver: receiver \x0a\x09\x09return: anObject",
  49075. referencedClasses: [],
  49076. messageSends: ["should:receiver:return:"]
  49077. }),
  49078. $globals.CodeGeneratorTest);
  49079. $core.addMethod(
  49080. $core.method({
  49081. selector: "tearDown",
  49082. protocol: "initialization",
  49083. fn: function (){
  49084. var self=this,$self=this;
  49085. return self;
  49086. },
  49087. args: [],
  49088. source: "tearDown\x0a\x09\x22receiver := nil\x22",
  49089. referencedClasses: [],
  49090. messageSends: []
  49091. }),
  49092. $globals.CodeGeneratorTest);
  49093. $core.addMethod(
  49094. $core.method({
  49095. selector: "testAssignment",
  49096. protocol: "tests",
  49097. fn: function (){
  49098. var self=this,$self=this;
  49099. return $core.withContext(function($ctx1) {
  49100. $self._should_return_("foo | a | a := true ifTrue: [ 1 ]. ^ a",(1));
  49101. $ctx1.sendIdx["should:return:"]=1;
  49102. $self._should_return_("foo | a | a := false ifTrue: [ 1 ]. ^ a",nil);
  49103. $ctx1.sendIdx["should:return:"]=2;
  49104. $self._should_return_("foo | a | ^ a := true ifTrue: [ 1 ]",(1));
  49105. return self;
  49106. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{},$globals.CodeGeneratorTest)});
  49107. },
  49108. args: [],
  49109. 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",
  49110. referencedClasses: [],
  49111. messageSends: ["should:return:"]
  49112. }),
  49113. $globals.CodeGeneratorTest);
  49114. $core.addMethod(
  49115. $core.method({
  49116. selector: "testBackslashSelectors",
  49117. protocol: "tests",
  49118. fn: function (){
  49119. var self=this,$self=this;
  49120. return $core.withContext(function($ctx1) {
  49121. $self._should_return_("\x5c arg ^ 4",(4));
  49122. $ctx1.sendIdx["should:return:"]=1;
  49123. $self._should_return_("\x5c\x5c arg ^ 42",(42));
  49124. return self;
  49125. }, function($ctx1) {$ctx1.fill(self,"testBackslashSelectors",{},$globals.CodeGeneratorTest)});
  49126. },
  49127. args: [],
  49128. source: "testBackslashSelectors\x0a\x09\x0a\x09self should: '\x5c arg ^ 4' return: 4.\x0a\x09self should: '\x5c\x5c arg ^ 42' return: 42",
  49129. referencedClasses: [],
  49130. messageSends: ["should:return:"]
  49131. }),
  49132. $globals.CodeGeneratorTest);
  49133. $core.addMethod(
  49134. $core.method({
  49135. selector: "testBlockReturn",
  49136. protocol: "tests",
  49137. fn: function (){
  49138. var self=this,$self=this;
  49139. return $core.withContext(function($ctx1) {
  49140. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | true ifTrue: [ each + 1 ] ]",[(2), (3), (4)]);
  49141. $ctx1.sendIdx["should:return:"]=1;
  49142. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | false ifFalse: [ each + 1 ] ]",[(2), (3), (4)]);
  49143. $ctx1.sendIdx["should:return:"]=2;
  49144. $self._should_return_("foo ^ #(1 2 3) collect: [ :each | each odd ifTrue: [ each + 1 ] ifFalse: [ each - 1 ] ]",[(2), (1), (4)]);
  49145. return self;
  49146. }, function($ctx1) {$ctx1.fill(self,"testBlockReturn",{},$globals.CodeGeneratorTest)});
  49147. },
  49148. args: [],
  49149. 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).",
  49150. referencedClasses: [],
  49151. messageSends: ["should:return:"]
  49152. }),
  49153. $globals.CodeGeneratorTest);
  49154. $core.addMethod(
  49155. $core.method({
  49156. selector: "testCascades",
  49157. protocol: "tests",
  49158. fn: function (){
  49159. var self=this,$self=this;
  49160. return $core.withContext(function($ctx1) {
  49161. $self._should_return_("foo ^ Array new add: 3; add: 4; yourself",[(3), (4)]);
  49162. return self;
  49163. }, function($ctx1) {$ctx1.fill(self,"testCascades",{},$globals.CodeGeneratorTest)});
  49164. },
  49165. args: [],
  49166. source: "testCascades\x0a\x09\x0a\x09self should: 'foo ^ Array new add: 3; add: 4; yourself' return: #(3 4)",
  49167. referencedClasses: [],
  49168. messageSends: ["should:return:"]
  49169. }),
  49170. $globals.CodeGeneratorTest);
  49171. $core.addMethod(
  49172. $core.method({
  49173. selector: "testCascadesInDynamicArray",
  49174. protocol: "tests",
  49175. fn: function (){
  49176. var self=this,$self=this;
  49177. return $core.withContext(function($ctx1) {
  49178. $self._should_return_("foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}",[(1), (2)]);
  49179. return self;
  49180. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicArray",{},$globals.CodeGeneratorTest)});
  49181. },
  49182. args: [],
  49183. source: "testCascadesInDynamicArray\x0a\x09self should: 'foo | x | x := 1. ^ {x. [x:=2] value; in: [x]}' return: #(1 2)",
  49184. referencedClasses: [],
  49185. messageSends: ["should:return:"]
  49186. }),
  49187. $globals.CodeGeneratorTest);
  49188. $core.addMethod(
  49189. $core.method({
  49190. selector: "testCascadesInDynamicDictioary",
  49191. protocol: "tests",
  49192. fn: function (){
  49193. var self=this,$self=this;
  49194. return $core.withContext(function($ctx1) {
  49195. $self._should_return_("foo | x | x := 1. ^ #{'one' -> x. 'two' -> ([x:=2] value; in: [x])}",$globals.HashedCollection._newFromPairs_(["one",(1),"two",(2)]));
  49196. return self;
  49197. }, function($ctx1) {$ctx1.fill(self,"testCascadesInDynamicDictioary",{},$globals.CodeGeneratorTest)});
  49198. },
  49199. args: [],
  49200. source: "testCascadesInDynamicDictioary\x0a\x09self should: 'foo | x | x := 1. ^ #{''one'' -> x. ''two'' -> ([x:=2] value; in: [x])}' return: #{'one' -> 1. 'two' -> 2}",
  49201. referencedClasses: [],
  49202. messageSends: ["should:return:"]
  49203. }),
  49204. $globals.CodeGeneratorTest);
  49205. $core.addMethod(
  49206. $core.method({
  49207. selector: "testCascadesInSend",
  49208. protocol: "tests",
  49209. fn: function (){
  49210. var self=this,$self=this;
  49211. return $core.withContext(function($ctx1) {
  49212. $self._should_return_("foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])",[(1), (2)]);
  49213. return self;
  49214. }, function($ctx1) {$ctx1.fill(self,"testCascadesInSend",{},$globals.CodeGeneratorTest)});
  49215. },
  49216. args: [],
  49217. source: "testCascadesInSend\x0a\x09self should: 'foo | x | x := 1. ^ Array with: x with: ([x:=2] value; in: [x])' return: #(1 2)",
  49218. referencedClasses: [],
  49219. messageSends: ["should:return:"]
  49220. }),
  49221. $globals.CodeGeneratorTest);
  49222. $core.addMethod(
  49223. $core.method({
  49224. selector: "testCascadesWithInlining",
  49225. protocol: "tests",
  49226. fn: function (){
  49227. var self=this,$self=this;
  49228. return $core.withContext(function($ctx1) {
  49229. $self._should_return_("foo ^ true class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(1));
  49230. $ctx1.sendIdx["should:return:"]=1;
  49231. $self._should_return_("foo ^ false class; ifTrue: [ 1 ] ifFalse: [ 2 ]",(2));
  49232. return self;
  49233. }, function($ctx1) {$ctx1.fill(self,"testCascadesWithInlining",{},$globals.CodeGeneratorTest)});
  49234. },
  49235. args: [],
  49236. 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",
  49237. referencedClasses: [],
  49238. messageSends: ["should:return:"]
  49239. }),
  49240. $globals.CodeGeneratorTest);
  49241. $core.addMethod(
  49242. $core.method({
  49243. selector: "testDynamicArrayElementsOrdered",
  49244. protocol: "tests",
  49245. fn: function (){
  49246. var self=this,$self=this;
  49247. return $core.withContext(function($ctx1) {
  49248. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. x := 2 }\x0a",[(1), (2)]);
  49249. $ctx1.sendIdx["should:return:"]=1;
  49250. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { x. true ifTrue: [ x := 2 ] }\x0a",[(1), (2)]);
  49251. return self;
  49252. }, function($ctx1) {$ctx1.fill(self,"testDynamicArrayElementsOrdered",{},$globals.CodeGeneratorTest)});
  49253. },
  49254. args: [],
  49255. 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).",
  49256. referencedClasses: [],
  49257. messageSends: ["should:return:"]
  49258. }),
  49259. $globals.CodeGeneratorTest);
  49260. $core.addMethod(
  49261. $core.method({
  49262. selector: "testDynamicDictionaryElementsOrdered",
  49263. protocol: "tests",
  49264. fn: function (){
  49265. var self=this,$self=this;
  49266. return $core.withContext(function($ctx1) {
  49267. $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)]));
  49268. return self;
  49269. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryElementsOrdered",{},$globals.CodeGeneratorTest)});
  49270. },
  49271. args: [],
  49272. 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}.",
  49273. referencedClasses: [],
  49274. messageSends: ["should:return:"]
  49275. }),
  49276. $globals.CodeGeneratorTest);
  49277. $core.addMethod(
  49278. $core.method({
  49279. selector: "testDynamicDictionaryWithMoreArrows",
  49280. protocol: "tests",
  49281. fn: function (){
  49282. var self=this,$self=this;
  49283. return $core.withContext(function($ctx1) {
  49284. var $2,$1;
  49285. $2=$recv((1).__minus_gt((2))).__minus_gt((3));
  49286. $ctx1.sendIdx["->"]=1;
  49287. $1=$recv($globals.HashedCollection)._with_($2);
  49288. $self._should_return_("foo ^ #{1->2->3}",$1);
  49289. return self;
  49290. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},$globals.CodeGeneratorTest)});
  49291. },
  49292. args: [],
  49293. source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
  49294. referencedClasses: ["HashedCollection"],
  49295. messageSends: ["should:return:", "with:", "->"]
  49296. }),
  49297. $globals.CodeGeneratorTest);
  49298. $core.addMethod(
  49299. $core.method({
  49300. selector: "testGlobalVar",
  49301. protocol: "tests",
  49302. fn: function (){
  49303. var self=this,$self=this;
  49304. return $core.withContext(function($ctx1) {
  49305. $self._should_return_("foo ^ eval class",$globals.BlockClosure);
  49306. $ctx1.sendIdx["should:return:"]=1;
  49307. $self._should_return_("foo ^ Math cos: 0",(1));
  49308. $ctx1.sendIdx["should:return:"]=2;
  49309. $self._should_return_("foo ^ NonExistingVar",nil);
  49310. return self;
  49311. }, function($ctx1) {$ctx1.fill(self,"testGlobalVar",{},$globals.CodeGeneratorTest)});
  49312. },
  49313. args: [],
  49314. 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",
  49315. referencedClasses: ["BlockClosure"],
  49316. messageSends: ["should:return:"]
  49317. }),
  49318. $globals.CodeGeneratorTest);
  49319. $core.addMethod(
  49320. $core.method({
  49321. selector: "testInnerTemporalDependentElementsOrdered",
  49322. protocol: "tests",
  49323. fn: function (){
  49324. var self=this,$self=this;
  49325. return $core.withContext(function($ctx1) {
  49326. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$10;
  49327. $2="foo".__minus_gt($globals.Array);
  49328. $ctx1.sendIdx["->"]=1;
  49329. $3="bar".__minus_gt((2));
  49330. $ctx1.sendIdx["->"]=2;
  49331. $1=[$2,$3];
  49332. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(x := 2)\x0a",$1);
  49333. $ctx1.sendIdx["should:return:"]=1;
  49334. $5="foo".__minus_gt($globals.Array);
  49335. $ctx1.sendIdx["->"]=3;
  49336. $6="bar".__minus_gt((2));
  49337. $ctx1.sendIdx["->"]=4;
  49338. $4=[$5,$6];
  49339. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$4);
  49340. $ctx1.sendIdx["should:return:"]=2;
  49341. $8="foo".__minus_gt((1));
  49342. $ctx1.sendIdx["->"]=5;
  49343. $9="bar".__minus_gt((2));
  49344. $ctx1.sendIdx["->"]=6;
  49345. $7=[$8,$9];
  49346. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: 'foo'->x with: 'bar'->(true ifTrue: [ x := 2 ])\x0a",$7);
  49347. $ctx1.sendIdx["should:return:"]=3;
  49348. $11="foo".__minus_gt((1));
  49349. $ctx1.sendIdx["->"]=7;
  49350. $10=[$11,"bar".__minus_gt((2))];
  49351. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ { 'foo'->x. 'bar'->(true ifTrue: [ x := 2 ]) }\x0a",$10);
  49352. $ctx1.sendIdx["should:return:"]=4;
  49353. $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)]));
  49354. return self;
  49355. }, function($ctx1) {$ctx1.fill(self,"testInnerTemporalDependentElementsOrdered",{},$globals.CodeGeneratorTest)});
  49356. },
  49357. args: [],
  49358. 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}.",
  49359. referencedClasses: ["Array"],
  49360. messageSends: ["should:return:", "->"]
  49361. }),
  49362. $globals.CodeGeneratorTest);
  49363. $core.addMethod(
  49364. $core.method({
  49365. selector: "testLexicalScope",
  49366. protocol: "tests",
  49367. fn: function (){
  49368. var self=this,$self=this;
  49369. return $core.withContext(function($ctx1) {
  49370. $self._should_return_("foo | a | a := 1. [ a := 2 ] value. ^ a",(2));
  49371. return self;
  49372. }, function($ctx1) {$ctx1.fill(self,"testLexicalScope",{},$globals.CodeGeneratorTest)});
  49373. },
  49374. args: [],
  49375. source: "testLexicalScope\x0a\x09self should: 'foo | a | a := 1. [ a := 2 ] value. ^ a' return: 2",
  49376. referencedClasses: [],
  49377. messageSends: ["should:return:"]
  49378. }),
  49379. $globals.CodeGeneratorTest);
  49380. $core.addMethod(
  49381. $core.method({
  49382. selector: "testLiterals",
  49383. protocol: "tests",
  49384. fn: function (){
  49385. var self=this,$self=this;
  49386. return $core.withContext(function($ctx1) {
  49387. $self._should_return_("foo ^ 1",(1));
  49388. $ctx1.sendIdx["should:return:"]=1;
  49389. $self._should_return_("foo ^ 'hello'","hello");
  49390. $ctx1.sendIdx["should:return:"]=2;
  49391. $self._should_return_("foo ^ #(1 2 3 4)",[(1), (2), (3), (4)]);
  49392. $ctx1.sendIdx["should:return:"]=3;
  49393. $self._should_return_("foo ^ {1. [:x | x ] value: 2. 3. [4] value}",[(1), (2), (3), (4)]);
  49394. $ctx1.sendIdx["should:return:"]=4;
  49395. $self._should_return_("foo ^ true",true);
  49396. $ctx1.sendIdx["should:return:"]=5;
  49397. $self._should_return_("foo ^ false",false);
  49398. $ctx1.sendIdx["should:return:"]=6;
  49399. $self._should_return_("foo ^ #{1->2. 3->4}",$globals.HashedCollection._newFromPairs_([(1),(2),(3),(4)]));
  49400. $ctx1.sendIdx["should:return:"]=7;
  49401. $self._should_return_("foo ^ #hello","hello");
  49402. $ctx1.sendIdx["should:return:"]=8;
  49403. $self._should_return_("foo ^ $h","h");
  49404. $ctx1.sendIdx["should:return:"]=9;
  49405. $self._should_return_("foo ^ -123.456",(-123.456));
  49406. $ctx1.sendIdx["should:return:"]=10;
  49407. $self._should_return_("foo ^ -2.5e4",(-25000));
  49408. return self;
  49409. }, function($ctx1) {$ctx1.fill(self,"testLiterals",{},$globals.CodeGeneratorTest)});
  49410. },
  49411. args: [],
  49412. 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.",
  49413. referencedClasses: [],
  49414. messageSends: ["should:return:"]
  49415. }),
  49416. $globals.CodeGeneratorTest);
  49417. $core.addMethod(
  49418. $core.method({
  49419. selector: "testLocalReturn",
  49420. protocol: "tests",
  49421. fn: function (){
  49422. var self=this,$self=this;
  49423. return $core.withContext(function($ctx1) {
  49424. $self._should_return_("foo ^ 1",(1));
  49425. $ctx1.sendIdx["should:return:"]=1;
  49426. $self._should_return_("foo ^ 1 + 1",(2));
  49427. $ctx1.sendIdx["should:return:"]=2;
  49428. $self._should_return_("foo ",$self["@receiver"]);
  49429. $ctx1.sendIdx["should:return:"]=3;
  49430. $self._should_return_("foo self asString",$self["@receiver"]);
  49431. $ctx1.sendIdx["should:return:"]=4;
  49432. $self._should_return_("foo | a b | a := 1. b := 2. ^ a + b",(3));
  49433. return self;
  49434. }, function($ctx1) {$ctx1.fill(self,"testLocalReturn",{},$globals.CodeGeneratorTest)});
  49435. },
  49436. args: [],
  49437. 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",
  49438. referencedClasses: [],
  49439. messageSends: ["should:return:"]
  49440. }),
  49441. $globals.CodeGeneratorTest);
  49442. $core.addMethod(
  49443. $core.method({
  49444. selector: "testMessageSends",
  49445. protocol: "tests",
  49446. fn: function (){
  49447. var self=this,$self=this;
  49448. return $core.withContext(function($ctx1) {
  49449. $self._should_return_("foo ^ 1 asString","1");
  49450. $ctx1.sendIdx["should:return:"]=1;
  49451. $self._should_return_("foo ^ 1 + 1",(2));
  49452. $ctx1.sendIdx["should:return:"]=2;
  49453. $self._should_return_("foo ^ 1 + 2 * 3",(9));
  49454. $ctx1.sendIdx["should:return:"]=3;
  49455. $self._should_return_("foo ^ 1 to: 3",[(1), (2), (3)]);
  49456. $ctx1.sendIdx["should:return:"]=4;
  49457. $self._should_return_("foo ^ 1 to: 5 by: 2",[(1), (3), (5)]);
  49458. return self;
  49459. }, function($ctx1) {$ctx1.fill(self,"testMessageSends",{},$globals.CodeGeneratorTest)});
  49460. },
  49461. args: [],
  49462. 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)",
  49463. referencedClasses: [],
  49464. messageSends: ["should:return:"]
  49465. }),
  49466. $globals.CodeGeneratorTest);
  49467. $core.addMethod(
  49468. $core.method({
  49469. selector: "testMistypedPragmaJSStatement",
  49470. protocol: "tests",
  49471. fn: function (){
  49472. var self=this,$self=this;
  49473. return $core.withContext(function($ctx1) {
  49474. $self._should_receiver_raise_("foo < inlineJS: 'return 'foo'' >",$self["@receiver"],$globals.ParseError);
  49475. return self;
  49476. }, function($ctx1) {$ctx1.fill(self,"testMistypedPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49477. },
  49478. args: [],
  49479. source: "testMistypedPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return ''foo'''' >' receiver: receiver raise: ParseError",
  49480. referencedClasses: ["ParseError"],
  49481. messageSends: ["should:receiver:raise:"]
  49482. }),
  49483. $globals.CodeGeneratorTest);
  49484. $core.addMethod(
  49485. $core.method({
  49486. selector: "testMultipleSequences",
  49487. protocol: "tests",
  49488. fn: function (){
  49489. var self=this,$self=this;
  49490. return $core.withContext(function($ctx1) {
  49491. $self._should_return_("foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6",(30));
  49492. return self;
  49493. }, function($ctx1) {$ctx1.fill(self,"testMultipleSequences",{},$globals.CodeGeneratorTest)});
  49494. },
  49495. args: [],
  49496. source: "testMultipleSequences\x0a\x09self should: 'foo | a b c | a := 2. b := 3. c := a + b. ^ c * 6' return: 30",
  49497. referencedClasses: [],
  49498. messageSends: ["should:return:"]
  49499. }),
  49500. $globals.CodeGeneratorTest);
  49501. $core.addMethod(
  49502. $core.method({
  49503. selector: "testMutableLiterals",
  49504. protocol: "tests",
  49505. fn: function (){
  49506. var self=this,$self=this;
  49507. return $core.withContext(function($ctx1) {
  49508. $self._should_return_("foo ^ #( 1 2 ) at: 1 put: 3; yourself",[(3), (2)]);
  49509. return self;
  49510. }, function($ctx1) {$ctx1.fill(self,"testMutableLiterals",{},$globals.CodeGeneratorTest)});
  49511. },
  49512. args: [],
  49513. 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)",
  49514. referencedClasses: [],
  49515. messageSends: ["should:return:"]
  49516. }),
  49517. $globals.CodeGeneratorTest);
  49518. $core.addMethod(
  49519. $core.method({
  49520. selector: "testNestedIfTrue",
  49521. protocol: "tests",
  49522. fn: function (){
  49523. var self=this,$self=this;
  49524. return $core.withContext(function($ctx1) {
  49525. $self._should_return_("foo ^ true ifTrue: [ false ifFalse: [ 1 ] ]",(1));
  49526. $ctx1.sendIdx["should:return:"]=1;
  49527. $self._should_return_("foo ^ true ifTrue: [ false ifTrue: [ 1 ] ]",nil);
  49528. $ctx1.sendIdx["should:return:"]=2;
  49529. $self._should_return_("foo true ifTrue: [ false ifFalse: [ ^ 1 ] ]",(1));
  49530. $ctx1.sendIdx["should:return:"]=3;
  49531. $self._should_return_("foo true ifTrue: [ false ifTrue: [ ^ 1 ] ]",$self["@receiver"]);
  49532. return self;
  49533. }, function($ctx1) {$ctx1.fill(self,"testNestedIfTrue",{},$globals.CodeGeneratorTest)});
  49534. },
  49535. args: [],
  49536. 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.",
  49537. referencedClasses: [],
  49538. messageSends: ["should:return:"]
  49539. }),
  49540. $globals.CodeGeneratorTest);
  49541. $core.addMethod(
  49542. $core.method({
  49543. selector: "testNestedSends",
  49544. protocol: "tests",
  49545. fn: function (){
  49546. var self=this,$self=this;
  49547. return $core.withContext(function($ctx1) {
  49548. $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());
  49549. return self;
  49550. }, function($ctx1) {$ctx1.fill(self,"testNestedSends",{},$globals.CodeGeneratorTest)});
  49551. },
  49552. args: [],
  49553. source: "testNestedSends\x0a\x09self should: 'foo ^ (Point x: (Point x: 2 y: 3) y: 4) asString' return: (Point x: (2@3) y: 4) asString",
  49554. referencedClasses: ["Point"],
  49555. messageSends: ["should:return:", "asString", "x:y:", "@"]
  49556. }),
  49557. $globals.CodeGeneratorTest);
  49558. $core.addMethod(
  49559. $core.method({
  49560. selector: "testNonLocalReturn",
  49561. protocol: "tests",
  49562. fn: function (){
  49563. var self=this,$self=this;
  49564. return $core.withContext(function($ctx1) {
  49565. $self._should_return_("foo [ ^ 1 ] value",(1));
  49566. $ctx1.sendIdx["should:return:"]=1;
  49567. $self._should_return_("foo [ ^ 1 + 1 ] value",(2));
  49568. $ctx1.sendIdx["should:return:"]=2;
  49569. $self._should_return_("foo | a b | a := 1. b := 2. [ ^ a + b ] value. self halt",(3));
  49570. $ctx1.sendIdx["should:return:"]=3;
  49571. $self._should_return_("foo [ :x | ^ x + x ] value: 4. ^ 2",(8));
  49572. return self;
  49573. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{},$globals.CodeGeneratorTest)});
  49574. },
  49575. args: [],
  49576. 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",
  49577. referencedClasses: [],
  49578. messageSends: ["should:return:"]
  49579. }),
  49580. $globals.CodeGeneratorTest);
  49581. $core.addMethod(
  49582. $core.method({
  49583. selector: "testPascalCaseGlobal",
  49584. protocol: "tests",
  49585. fn: function (){
  49586. var self=this,$self=this;
  49587. return $core.withContext(function($ctx1) {
  49588. $self._should_return_("foo ^Object",$recv($recv($globals.Smalltalk)._globals())._at_("Object"));
  49589. $ctx1.sendIdx["should:return:"]=1;
  49590. $self._should_return_("foo ^NonExistent",nil);
  49591. return self;
  49592. }, function($ctx1) {$ctx1.fill(self,"testPascalCaseGlobal",{},$globals.CodeGeneratorTest)});
  49593. },
  49594. args: [],
  49595. source: "testPascalCaseGlobal\x0a\x09self should: 'foo ^Object' return: (Smalltalk globals at: 'Object').\x0a\x09self should: 'foo ^NonExistent' return: nil",
  49596. referencedClasses: ["Smalltalk"],
  49597. messageSends: ["should:return:", "at:", "globals"]
  49598. }),
  49599. $globals.CodeGeneratorTest);
  49600. $core.addMethod(
  49601. $core.method({
  49602. selector: "testPragmaInBlock",
  49603. protocol: "tests",
  49604. fn: function (){
  49605. var self=this,$self=this;
  49606. return $core.withContext(function($ctx1) {
  49607. $self._should_receiver_raise_("foo ^ [ < fooBar > 4 ] value",$self["@receiver"],$globals.CompilerError);
  49608. return self;
  49609. }, function($ctx1) {$ctx1.fill(self,"testPragmaInBlock",{},$globals.CodeGeneratorTest)});
  49610. },
  49611. args: [],
  49612. source: "testPragmaInBlock\x0a\x09self should: 'foo ^ [ < fooBar > 4 ] value' receiver: receiver raise: CompilerError",
  49613. referencedClasses: ["CompilerError"],
  49614. messageSends: ["should:receiver:raise:"]
  49615. }),
  49616. $globals.CodeGeneratorTest);
  49617. $core.addMethod(
  49618. $core.method({
  49619. selector: "testPragmaJSStatement",
  49620. protocol: "tests",
  49621. fn: function (){
  49622. var self=this,$self=this;
  49623. return $core.withContext(function($ctx1) {
  49624. $self._should_return_("foo < inlineJS: 'return 2+3' >",(5));
  49625. return self;
  49626. }, function($ctx1) {$ctx1.fill(self,"testPragmaJSStatement",{},$globals.CodeGeneratorTest)});
  49627. },
  49628. args: [],
  49629. source: "testPragmaJSStatement\x0a\x09self should: 'foo < inlineJS: ''return 2+3'' >' return: 5",
  49630. referencedClasses: [],
  49631. messageSends: ["should:return:"]
  49632. }),
  49633. $globals.CodeGeneratorTest);
  49634. $core.addMethod(
  49635. $core.method({
  49636. selector: "testRootSuperSend",
  49637. protocol: "tests",
  49638. fn: function (){
  49639. var self=this,$self=this;
  49640. return $core.withContext(function($ctx1) {
  49641. $self._should_receiver_raise_("foo ^ super class",$recv($globals.ProtoObject)._new(),$globals.MessageNotUnderstood);
  49642. return self;
  49643. }, function($ctx1) {$ctx1.fill(self,"testRootSuperSend",{},$globals.CodeGeneratorTest)});
  49644. },
  49645. args: [],
  49646. source: "testRootSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super class' \x0a\x09\x09receiver: ProtoObject new\x0a\x09\x09raise: MessageNotUnderstood",
  49647. referencedClasses: ["ProtoObject", "MessageNotUnderstood"],
  49648. messageSends: ["should:receiver:raise:", "new"]
  49649. }),
  49650. $globals.CodeGeneratorTest);
  49651. $core.addMethod(
  49652. $core.method({
  49653. selector: "testSendReceiverAndArgumentsOrdered",
  49654. protocol: "tests",
  49655. fn: function (){
  49656. var self=this,$self=this;
  49657. return $core.withContext(function($ctx1) {
  49658. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := 1.\x0a\x09^ Array with: x with: (true ifTrue: [ x := 2 ])\x0a",[(1), (2)]);
  49659. $ctx1.sendIdx["should:return:"]=1;
  49660. $self._should_return_("foo\x0a\x09| x |\x0a\x09x := Array.\x0a\x09^ x with: x with: (true ifTrue: [ x := 2 ])\x0a",[$globals.Array,(2)]);
  49661. return self;
  49662. }, function($ctx1) {$ctx1.fill(self,"testSendReceiverAndArgumentsOrdered",{},$globals.CodeGeneratorTest)});
  49663. },
  49664. args: [],
  49665. 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}.",
  49666. referencedClasses: ["Array"],
  49667. messageSends: ["should:return:"]
  49668. }),
  49669. $globals.CodeGeneratorTest);
  49670. $core.addMethod(
  49671. $core.method({
  49672. selector: "testSuperSend",
  49673. protocol: "tests",
  49674. fn: function (){
  49675. var self=this,$self=this;
  49676. return $core.withContext(function($ctx1) {
  49677. $self._should_receiver_return_("foo ^ super isBoolean",true,false);
  49678. return self;
  49679. }, function($ctx1) {$ctx1.fill(self,"testSuperSend",{},$globals.CodeGeneratorTest)});
  49680. },
  49681. args: [],
  49682. source: "testSuperSend\x0a\x09self \x0a\x09\x09should: 'foo ^ super isBoolean' \x0a\x09\x09receiver: true\x0a\x09\x09return: false",
  49683. referencedClasses: [],
  49684. messageSends: ["should:receiver:return:"]
  49685. }),
  49686. $globals.CodeGeneratorTest);
  49687. $core.addMethod(
  49688. $core.method({
  49689. selector: "testTempVariables",
  49690. protocol: "tests",
  49691. fn: function (){
  49692. var self=this,$self=this;
  49693. return $core.withContext(function($ctx1) {
  49694. $self._should_return_("foo | a | ^ a",nil);
  49695. $ctx1.sendIdx["should:return:"]=1;
  49696. $self._should_return_("foo | AVariable | ^ AVariable",nil);
  49697. $ctx1.sendIdx["should:return:"]=2;
  49698. $self._should_return_("foo | a b c | ^ c",nil);
  49699. $ctx1.sendIdx["should:return:"]=3;
  49700. $self._should_return_("foo | a | [ | d | ^ d ] value",nil);
  49701. $ctx1.sendIdx["should:return:"]=4;
  49702. $self._should_return_("foo | a | a:= 1. ^ a",(1));
  49703. $ctx1.sendIdx["should:return:"]=5;
  49704. $self._should_return_("foo | AVariable | AVariable := 1. ^ AVariable",(1));
  49705. return self;
  49706. }, function($ctx1) {$ctx1.fill(self,"testTempVariables",{},$globals.CodeGeneratorTest)});
  49707. },
  49708. args: [],
  49709. 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.",
  49710. referencedClasses: [],
  49711. messageSends: ["should:return:"]
  49712. }),
  49713. $globals.CodeGeneratorTest);
  49714. $core.addMethod(
  49715. $core.method({
  49716. selector: "testThisContext",
  49717. protocol: "tests",
  49718. fn: function (){
  49719. var self=this,$self=this;
  49720. return $core.withContext(function($ctx1) {
  49721. $self._should_return_("foo ^ [ thisContext ] value outerContext == thisContext",true);
  49722. return self;
  49723. }, function($ctx1) {$ctx1.fill(self,"testThisContext",{},$globals.CodeGeneratorTest)});
  49724. },
  49725. args: [],
  49726. source: "testThisContext\x0a\x09self should: 'foo ^ [ thisContext ] value outerContext == thisContext' return: true",
  49727. referencedClasses: [],
  49728. messageSends: ["should:return:"]
  49729. }),
  49730. $globals.CodeGeneratorTest);
  49731. $core.addMethod(
  49732. $core.method({
  49733. selector: "testUnknownPragma",
  49734. protocol: "tests",
  49735. fn: function (){
  49736. var self=this,$self=this;
  49737. return $core.withContext(function($ctx1) {
  49738. $self._should_return_("foo < fooBar: 'return 2+3' > | x | ^ x := 6",(6));
  49739. $ctx1.sendIdx["should:return:"]=1;
  49740. $self._should_return_("foo | x | < fooBar: 'return 2+3' > ^ x := 6",(6));
  49741. return self;
  49742. }, function($ctx1) {$ctx1.fill(self,"testUnknownPragma",{},$globals.CodeGeneratorTest)});
  49743. },
  49744. args: [],
  49745. 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",
  49746. referencedClasses: [],
  49747. messageSends: ["should:return:"]
  49748. }),
  49749. $globals.CodeGeneratorTest);
  49750. $core.addMethod(
  49751. $core.method({
  49752. selector: "testifFalse",
  49753. protocol: "tests",
  49754. fn: function (){
  49755. var self=this,$self=this;
  49756. return $core.withContext(function($ctx1) {
  49757. $self._should_return_("foo true ifFalse: [ ^ 1 ]",$self["@receiver"]);
  49758. $ctx1.sendIdx["should:return:"]=1;
  49759. $self._should_return_("foo false ifFalse: [ ^ 2 ]",(2));
  49760. $ctx1.sendIdx["should:return:"]=2;
  49761. $self._should_return_("foo ^ true ifFalse: [ 1 ]",nil);
  49762. $ctx1.sendIdx["should:return:"]=3;
  49763. $self._should_return_("foo ^ false ifFalse: [ 2 ]",(2));
  49764. return self;
  49765. }, function($ctx1) {$ctx1.fill(self,"testifFalse",{},$globals.CodeGeneratorTest)});
  49766. },
  49767. args: [],
  49768. 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.",
  49769. referencedClasses: [],
  49770. messageSends: ["should:return:"]
  49771. }),
  49772. $globals.CodeGeneratorTest);
  49773. $core.addMethod(
  49774. $core.method({
  49775. selector: "testifFalseIfTrue",
  49776. protocol: "tests",
  49777. fn: function (){
  49778. var self=this,$self=this;
  49779. return $core.withContext(function($ctx1) {
  49780. $self._should_return_("foo true ifFalse: [ ^ 1 ] ifTrue: [ ^ 2 ]",(2));
  49781. $ctx1.sendIdx["should:return:"]=1;
  49782. $self._should_return_("foo false ifFalse: [ ^ 2 ] ifTrue: [ ^1 ]",(2));
  49783. $ctx1.sendIdx["should:return:"]=2;
  49784. $self._should_return_("foo ^ true ifFalse: [ 1 ] ifTrue: [ 2 ]",(2));
  49785. $ctx1.sendIdx["should:return:"]=3;
  49786. $self._should_return_("foo ^ false ifFalse: [ 2 ] ifTrue: [ 1 ]",(2));
  49787. return self;
  49788. }, function($ctx1) {$ctx1.fill(self,"testifFalseIfTrue",{},$globals.CodeGeneratorTest)});
  49789. },
  49790. args: [],
  49791. 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.",
  49792. referencedClasses: [],
  49793. messageSends: ["should:return:"]
  49794. }),
  49795. $globals.CodeGeneratorTest);
  49796. $core.addMethod(
  49797. $core.method({
  49798. selector: "testifNil",
  49799. protocol: "tests",
  49800. fn: function (){
  49801. var self=this,$self=this;
  49802. return $core.withContext(function($ctx1) {
  49803. $self._should_return_("foo ^ 1 ifNil: [ 2 ]",(1));
  49804. $ctx1.sendIdx["should:return:"]=1;
  49805. $self._should_return_("foo ^ nil ifNil: [ 2 ]",(2));
  49806. $ctx1.sendIdx["should:return:"]=2;
  49807. $self._should_return_("foo 1 ifNil: [ ^ 2 ]",$self["@receiver"]);
  49808. $ctx1.sendIdx["should:return:"]=3;
  49809. $self._should_return_("foo nil ifNil: [ ^ 2 ]",(2));
  49810. return self;
  49811. }, function($ctx1) {$ctx1.fill(self,"testifNil",{},$globals.CodeGeneratorTest)});
  49812. },
  49813. args: [],
  49814. 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.",
  49815. referencedClasses: [],
  49816. messageSends: ["should:return:"]
  49817. }),
  49818. $globals.CodeGeneratorTest);
  49819. $core.addMethod(
  49820. $core.method({
  49821. selector: "testifNilIfNotNil",
  49822. protocol: "tests",
  49823. fn: function (){
  49824. var self=this,$self=this;
  49825. return $core.withContext(function($ctx1) {
  49826. $self._should_return_("foo ^ 1 ifNil: [ 2 ] ifNotNil: [ 3 ]",(3));
  49827. $ctx1.sendIdx["should:return:"]=1;
  49828. $self._should_return_("foo ^ nil ifNil: [ 2 ] ifNotNil: [ 3 ]",(2));
  49829. $ctx1.sendIdx["should:return:"]=2;
  49830. $self._should_return_("foo 1 ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(3));
  49831. $ctx1.sendIdx["should:return:"]=3;
  49832. $self._should_return_("foo nil ifNil: [ ^ 2 ] ifNotNil: [ ^3 ]",(2));
  49833. return self;
  49834. }, function($ctx1) {$ctx1.fill(self,"testifNilIfNotNil",{},$globals.CodeGeneratorTest)});
  49835. },
  49836. args: [],
  49837. 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.",
  49838. referencedClasses: [],
  49839. messageSends: ["should:return:"]
  49840. }),
  49841. $globals.CodeGeneratorTest);
  49842. $core.addMethod(
  49843. $core.method({
  49844. selector: "testifNotNil",
  49845. protocol: "tests",
  49846. fn: function (){
  49847. var self=this,$self=this;
  49848. return $core.withContext(function($ctx1) {
  49849. $self._should_return_("foo ^ 1 ifNotNil: [ 2 ]",(2));
  49850. $ctx1.sendIdx["should:return:"]=1;
  49851. $self._should_return_("foo ^ nil ifNotNil: [ 2 ]",nil);
  49852. $ctx1.sendIdx["should:return:"]=2;
  49853. $self._should_return_("foo 1 ifNotNil: [ ^ 2 ]",(2));
  49854. $ctx1.sendIdx["should:return:"]=3;
  49855. $self._should_return_("foo nil ifNotNil: [ ^ 2 ]",$self["@receiver"]);
  49856. return self;
  49857. }, function($ctx1) {$ctx1.fill(self,"testifNotNil",{},$globals.CodeGeneratorTest)});
  49858. },
  49859. args: [],
  49860. 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.",
  49861. referencedClasses: [],
  49862. messageSends: ["should:return:"]
  49863. }),
  49864. $globals.CodeGeneratorTest);
  49865. $core.addMethod(
  49866. $core.method({
  49867. selector: "testifNotNilWithArgument",
  49868. protocol: "tests",
  49869. fn: function (){
  49870. var self=this,$self=this;
  49871. return $core.withContext(function($ctx1) {
  49872. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ]",(3));
  49873. $ctx1.sendIdx["should:return:"]=1;
  49874. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ]",nil);
  49875. $ctx1.sendIdx["should:return:"]=2;
  49876. $self._should_return_("foo ^ 1 ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(3));
  49877. $ctx1.sendIdx["should:return:"]=3;
  49878. $self._should_return_("foo ^ nil ifNil: [ 5 ] ifNotNil: [ :val | val + 2 ]",(5));
  49879. $ctx1.sendIdx["should:return:"]=4;
  49880. $self._should_return_("foo ^ 1 ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(3));
  49881. $ctx1.sendIdx["should:return:"]=5;
  49882. $self._should_return_("foo ^ nil ifNotNil: [ :val | val + 2 ] ifNil: [ 5 ]",(5));
  49883. return self;
  49884. }, function($ctx1) {$ctx1.fill(self,"testifNotNilWithArgument",{},$globals.CodeGeneratorTest)});
  49885. },
  49886. args: [],
  49887. 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",
  49888. referencedClasses: [],
  49889. messageSends: ["should:return:"]
  49890. }),
  49891. $globals.CodeGeneratorTest);
  49892. $core.addMethod(
  49893. $core.method({
  49894. selector: "testifTrue",
  49895. protocol: "tests",
  49896. fn: function (){
  49897. var self=this,$self=this;
  49898. return $core.withContext(function($ctx1) {
  49899. $self._should_return_("foo false ifTrue: [ ^ 1 ]",$self["@receiver"]);
  49900. $ctx1.sendIdx["should:return:"]=1;
  49901. $self._should_return_("foo true ifTrue: [ ^ 2 ]",(2));
  49902. $ctx1.sendIdx["should:return:"]=2;
  49903. $self._should_return_("foo ^ false ifTrue: [ 1 ]",nil);
  49904. $ctx1.sendIdx["should:return:"]=3;
  49905. $self._should_return_("foo ^ true ifTrue: [ 2 ]",(2));
  49906. return self;
  49907. }, function($ctx1) {$ctx1.fill(self,"testifTrue",{},$globals.CodeGeneratorTest)});
  49908. },
  49909. args: [],
  49910. 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.",
  49911. referencedClasses: [],
  49912. messageSends: ["should:return:"]
  49913. }),
  49914. $globals.CodeGeneratorTest);
  49915. $core.addMethod(
  49916. $core.method({
  49917. selector: "testifTrueIfFalse",
  49918. protocol: "tests",
  49919. fn: function (){
  49920. var self=this,$self=this;
  49921. return $core.withContext(function($ctx1) {
  49922. $self._should_return_("foo false ifTrue: [ ^ 1 ] ifFalse: [ ^2 ]",(2));
  49923. $ctx1.sendIdx["should:return:"]=1;
  49924. $self._should_return_("foo true ifTrue: [ ^ 1 ] ifFalse: [ ^ 2 ]",(1));
  49925. $ctx1.sendIdx["should:return:"]=2;
  49926. $self._should_return_("foo ^ false ifTrue: [ 2 ] ifFalse: [ 1 ]",(1));
  49927. $ctx1.sendIdx["should:return:"]=3;
  49928. $self._should_return_("foo ^ true ifTrue: [ 2 ] ifFalse: [ 1 ]",(2));
  49929. return self;
  49930. }, function($ctx1) {$ctx1.fill(self,"testifTrueIfFalse",{},$globals.CodeGeneratorTest)});
  49931. },
  49932. args: [],
  49933. 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.",
  49934. referencedClasses: [],
  49935. messageSends: ["should:return:"]
  49936. }),
  49937. $globals.CodeGeneratorTest);
  49938. $core.addClass("ASTInterpreterTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  49939. $core.addMethod(
  49940. $core.method({
  49941. selector: "interpret:receiver:withArguments:",
  49942. protocol: "private",
  49943. fn: function (aString,anObject,aDictionary){
  49944. var self=this,$self=this;
  49945. var ctx,ast,interpreter;
  49946. return $core.withContext(function($ctx1) {
  49947. var $1,$2,$3,$receiver;
  49948. interpreter=$recv($globals.ASTInterpreter)._new();
  49949. $ctx1.sendIdx["new"]=1;
  49950. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  49951. $1=$recv($globals.AIContext)._new();
  49952. $recv($1)._receiver_(anObject);
  49953. $recv($1)._interpreter_(interpreter);
  49954. ctx=$recv($1)._yourself();
  49955. $2=$recv(ast)._sequenceNode();
  49956. if(($receiver = $2) == null || $receiver.a$nil){
  49957. $2;
  49958. } else {
  49959. var sequence;
  49960. sequence=$receiver;
  49961. $recv($recv(sequence)._temps())._do_((function(each){
  49962. return $core.withContext(function($ctx2) {
  49963. return $recv(ctx)._defineLocal_(each);
  49964. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  49965. }));
  49966. }
  49967. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  49968. return $core.withContext(function($ctx2) {
  49969. return $recv(ctx)._localAt_put_(key,value);
  49970. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  49971. }));
  49972. $3=interpreter;
  49973. $recv($3)._context_(ctx);
  49974. $recv($3)._node_(ast);
  49975. $recv($3)._enterNode();
  49976. $recv($3)._proceed();
  49977. return $recv($3)._result();
  49978. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,interpreter:interpreter},$globals.ASTInterpreterTest)});
  49979. },
  49980. args: ["aString", "anObject", "aDictionary"],
  49981. 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",
  49982. referencedClasses: ["ASTInterpreter", "AIContext"],
  49983. messageSends: ["new", "parse:forClass:", "class", "receiver:", "interpreter:", "yourself", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "node:", "enterNode", "proceed", "result"]
  49984. }),
  49985. $globals.ASTInterpreterTest);
  49986. $core.addMethod(
  49987. $core.method({
  49988. selector: "should:receiver:return:",
  49989. protocol: "testing",
  49990. fn: function (aString,anObject,aResult){
  49991. var self=this,$self=this;
  49992. return $core.withContext(function($ctx1) {
  49993. $self["@receiver"]=anObject;
  49994. return $self._assert_equals_($self._interpret_receiver_withArguments_(aString,$self["@receiver"],$globals.HashedCollection._newFromPairs_([])),aResult);
  49995. }, function($ctx1) {$ctx1.fill(self,"should:receiver:return:",{aString:aString,anObject:anObject,aResult:aResult},$globals.ASTInterpreterTest)});
  49996. },
  49997. args: ["aString", "anObject", "aResult"],
  49998. 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",
  49999. referencedClasses: [],
  50000. messageSends: ["assert:equals:", "interpret:receiver:withArguments:"]
  50001. }),
  50002. $globals.ASTInterpreterTest);
  50003. $core.addClass("ASTDebuggerTest", $globals.ASTInterpreterTest, [], "Compiler-Tests");
  50004. $core.addMethod(
  50005. $core.method({
  50006. selector: "interpret:receiver:withArguments:",
  50007. protocol: "private",
  50008. fn: function (aString,anObject,aDictionary){
  50009. var self=this,$self=this;
  50010. var ctx,ast,debugger_;
  50011. return $core.withContext(function($ctx1) {
  50012. var $1,$2,$3,$4,$5,$receiver;
  50013. $1=$recv($globals.AIContext)._new();
  50014. $ctx1.sendIdx["new"]=1;
  50015. $recv($1)._receiver_(anObject);
  50016. $recv($1)._interpreter_($recv($globals.ASTInterpreter)._new());
  50017. ctx=$recv($1)._yourself();
  50018. ast=$self._parse_forClass_(aString,$recv(anObject)._class());
  50019. $2=$recv(ast)._sequenceNode();
  50020. if(($receiver = $2) == null || $receiver.a$nil){
  50021. $2;
  50022. } else {
  50023. var sequence;
  50024. sequence=$receiver;
  50025. $recv($recv(sequence)._temps())._do_((function(each){
  50026. return $core.withContext(function($ctx2) {
  50027. return $recv(ctx)._defineLocal_(each);
  50028. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  50029. }));
  50030. }
  50031. $recv(aDictionary)._keysAndValuesDo_((function(key,value){
  50032. return $core.withContext(function($ctx2) {
  50033. return $recv(ctx)._localAt_put_(key,value);
  50034. }, function($ctx2) {$ctx2.fillBlock({key:key,value:value},$ctx1,3)});
  50035. }));
  50036. $3=$recv(ctx)._interpreter();
  50037. $ctx1.sendIdx["interpreter"]=1;
  50038. $recv($3)._context_(ctx);
  50039. $ctx1.sendIdx["context:"]=1;
  50040. $4=$recv(ctx)._interpreter();
  50041. $recv($4)._node_(ast);
  50042. $recv($4)._enterNode();
  50043. debugger_=$recv($globals.ASTDebugger)._context_(ctx);
  50044. $5=debugger_;
  50045. $recv($5)._proceed();
  50046. return $recv($5)._result();
  50047. }, function($ctx1) {$ctx1.fill(self,"interpret:receiver:withArguments:",{aString:aString,anObject:anObject,aDictionary:aDictionary,ctx:ctx,ast:ast,debugger_:debugger_},$globals.ASTDebuggerTest)});
  50048. },
  50049. args: ["aString", "anObject", "aDictionary"],
  50050. 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",
  50051. referencedClasses: ["AIContext", "ASTInterpreter", "ASTDebugger"],
  50052. messageSends: ["receiver:", "new", "interpreter:", "yourself", "parse:forClass:", "class", "ifNotNil:", "sequenceNode", "do:", "temps", "defineLocal:", "keysAndValuesDo:", "localAt:put:", "context:", "interpreter", "node:", "enterNode", "proceed", "result"]
  50053. }),
  50054. $globals.ASTDebuggerTest);
  50055. $core.addClass("InliningCodeGeneratorTest", $globals.CodeGeneratorTest, [], "Compiler-Tests");
  50056. $core.addMethod(
  50057. $core.method({
  50058. selector: "codeGeneratorClass",
  50059. protocol: "accessing",
  50060. fn: function (){
  50061. var self=this,$self=this;
  50062. return $globals.InliningCodeGenerator;
  50063. },
  50064. args: [],
  50065. source: "codeGeneratorClass\x0a\x09^ InliningCodeGenerator",
  50066. referencedClasses: ["InliningCodeGenerator"],
  50067. messageSends: []
  50068. }),
  50069. $globals.InliningCodeGeneratorTest);
  50070. $core.addClass("ScopeVarTest", $globals.TestCase, [], "Compiler-Tests");
  50071. $core.addMethod(
  50072. $core.method({
  50073. selector: "testClassRefVar",
  50074. protocol: "tests",
  50075. fn: function (){
  50076. var self=this,$self=this;
  50077. var node;
  50078. return $core.withContext(function($ctx1) {
  50079. var $1,$2;
  50080. $1=$recv($globals.VariableNode)._new();
  50081. $ctx1.sendIdx["new"]=1;
  50082. $recv($1)._value_("Object");
  50083. node=$recv($1)._yourself();
  50084. $2=$recv($globals.SemanticAnalyzer)._new();
  50085. $ctx1.sendIdx["new"]=2;
  50086. $recv($2)._pushScope_($recv($globals.MethodLexicalScope)._new());
  50087. $recv($2)._visit_(node);
  50088. $self._assert_($recv($recv(node)._binding())._isClassRefVar());
  50089. return self;
  50090. }, function($ctx1) {$ctx1.fill(self,"testClassRefVar",{node:node},$globals.ScopeVarTest)});
  50091. },
  50092. args: [],
  50093. 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",
  50094. referencedClasses: ["VariableNode", "SemanticAnalyzer", "MethodLexicalScope"],
  50095. messageSends: ["value:", "new", "yourself", "pushScope:", "visit:", "assert:", "isClassRefVar", "binding"]
  50096. }),
  50097. $globals.ScopeVarTest);
  50098. $core.addMethod(
  50099. $core.method({
  50100. selector: "testInstanceVar",
  50101. protocol: "tests",
  50102. fn: function (){
  50103. var self=this,$self=this;
  50104. var node,scope;
  50105. return $core.withContext(function($ctx1) {
  50106. var $1;
  50107. $1=$recv($globals.VariableNode)._new();
  50108. $ctx1.sendIdx["new"]=1;
  50109. $recv($1)._value_("bzzz");
  50110. node=$recv($1)._yourself();
  50111. scope=$recv($globals.MethodLexicalScope)._new();
  50112. $recv(scope)._addIVar_("bzzz");
  50113. $self._assert_($recv($recv(scope)._bindingFor_(node))._isInstanceVar());
  50114. return self;
  50115. }, function($ctx1) {$ctx1.fill(self,"testInstanceVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50116. },
  50117. args: [],
  50118. 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",
  50119. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50120. messageSends: ["value:", "new", "yourself", "addIVar:", "assert:", "isInstanceVar", "bindingFor:"]
  50121. }),
  50122. $globals.ScopeVarTest);
  50123. $core.addMethod(
  50124. $core.method({
  50125. selector: "testPseudoVar",
  50126. protocol: "tests",
  50127. fn: function (){
  50128. var self=this,$self=this;
  50129. var node,pseudoVars;
  50130. return $core.withContext(function($ctx1) {
  50131. var $1;
  50132. pseudoVars=["self", "super", "true", "false", "nil"];
  50133. $recv(pseudoVars)._do_((function(each){
  50134. return $core.withContext(function($ctx2) {
  50135. $1=$recv($globals.VariableNode)._new();
  50136. $ctx2.sendIdx["new"]=1;
  50137. $recv($1)._value_(each);
  50138. node=$recv($1)._yourself();
  50139. return $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isPseudoVar());
  50140. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  50141. }));
  50142. return self;
  50143. }, function($ctx1) {$ctx1.fill(self,"testPseudoVar",{node:node,pseudoVars:pseudoVars},$globals.ScopeVarTest)});
  50144. },
  50145. args: [],
  50146. 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]",
  50147. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50148. messageSends: ["do:", "value:", "new", "yourself", "assert:", "isPseudoVar", "bindingFor:"]
  50149. }),
  50150. $globals.ScopeVarTest);
  50151. $core.addMethod(
  50152. $core.method({
  50153. selector: "testTempVar",
  50154. protocol: "tests",
  50155. fn: function (){
  50156. var self=this,$self=this;
  50157. var node,scope;
  50158. return $core.withContext(function($ctx1) {
  50159. var $1;
  50160. $1=$recv($globals.VariableNode)._new();
  50161. $ctx1.sendIdx["new"]=1;
  50162. $recv($1)._value_("bzzz");
  50163. node=$recv($1)._yourself();
  50164. scope=$recv($globals.MethodLexicalScope)._new();
  50165. $recv(scope)._addTemp_("bzzz");
  50166. $self._assert_($recv($recv(scope)._bindingFor_(node))._isTempVar());
  50167. return self;
  50168. }, function($ctx1) {$ctx1.fill(self,"testTempVar",{node:node,scope:scope},$globals.ScopeVarTest)});
  50169. },
  50170. args: [],
  50171. 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",
  50172. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50173. messageSends: ["value:", "new", "yourself", "addTemp:", "assert:", "isTempVar", "bindingFor:"]
  50174. }),
  50175. $globals.ScopeVarTest);
  50176. $core.addMethod(
  50177. $core.method({
  50178. selector: "testUnknownVar",
  50179. protocol: "tests",
  50180. fn: function (){
  50181. var self=this,$self=this;
  50182. var node;
  50183. return $core.withContext(function($ctx1) {
  50184. var $1;
  50185. $1=$recv($globals.VariableNode)._new();
  50186. $ctx1.sendIdx["new"]=1;
  50187. $recv($1)._value_("bzzz");
  50188. node=$recv($1)._yourself();
  50189. $self._assert_($recv($recv($recv($globals.MethodLexicalScope)._new())._bindingFor_(node))._isNil());
  50190. return self;
  50191. }, function($ctx1) {$ctx1.fill(self,"testUnknownVar",{node:node},$globals.ScopeVarTest)});
  50192. },
  50193. args: [],
  50194. source: "testUnknownVar\x0a\x09| node |\x0a\x09node := VariableNode new\x0a\x09\x09value: 'bzzz';\x0a\x09\x09yourself.\x0a\x09self assert: (MethodLexicalScope new bindingFor: node) isNil",
  50195. referencedClasses: ["VariableNode", "MethodLexicalScope"],
  50196. messageSends: ["value:", "new", "yourself", "assert:", "isNil", "bindingFor:"]
  50197. }),
  50198. $globals.ScopeVarTest);
  50199. $core.addClass("SemanticAnalyzerTest", $globals.TestCase, ["analyzer"], "Compiler-Tests");
  50200. $core.addMethod(
  50201. $core.method({
  50202. selector: "setUp",
  50203. protocol: "running",
  50204. fn: function (){
  50205. var self=this,$self=this;
  50206. return $core.withContext(function($ctx1) {
  50207. $self["@analyzer"]=$recv($globals.SemanticAnalyzer)._on_($globals.Object);
  50208. return self;
  50209. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.SemanticAnalyzerTest)});
  50210. },
  50211. args: [],
  50212. source: "setUp\x0a\x09analyzer := SemanticAnalyzer on: Object",
  50213. referencedClasses: ["SemanticAnalyzer", "Object"],
  50214. messageSends: ["on:"]
  50215. }),
  50216. $globals.SemanticAnalyzerTest);
  50217. $core.addMethod(
  50218. $core.method({
  50219. selector: "testAssignment",
  50220. protocol: "tests",
  50221. fn: function (){
  50222. var self=this,$self=this;
  50223. var src,ast;
  50224. return $core.withContext(function($ctx1) {
  50225. src="foo self := 1";
  50226. ast=$recv($globals.Smalltalk)._parse_(src);
  50227. $self._should_raise_((function(){
  50228. return $core.withContext(function($ctx2) {
  50229. return $recv($self["@analyzer"])._visit_(ast);
  50230. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50231. }),$globals.InvalidAssignmentError);
  50232. return self;
  50233. }, function($ctx1) {$ctx1.fill(self,"testAssignment",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50234. },
  50235. args: [],
  50236. 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",
  50237. referencedClasses: ["Smalltalk", "InvalidAssignmentError"],
  50238. messageSends: ["parse:", "should:raise:", "visit:"]
  50239. }),
  50240. $globals.SemanticAnalyzerTest);
  50241. $core.addMethod(
  50242. $core.method({
  50243. selector: "testNonLocalReturn",
  50244. protocol: "tests",
  50245. fn: function (){
  50246. var self=this,$self=this;
  50247. var src,ast;
  50248. return $core.withContext(function($ctx1) {
  50249. src="foo | a | a + 1. ^ a";
  50250. ast=$recv($globals.Smalltalk)._parse_(src);
  50251. $recv($self["@analyzer"])._visit_(ast);
  50252. $self._deny_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50253. return self;
  50254. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50255. },
  50256. args: [],
  50257. 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",
  50258. referencedClasses: ["Smalltalk"],
  50259. messageSends: ["parse:", "visit:", "deny:", "hasNonLocalReturn", "scope"]
  50260. }),
  50261. $globals.SemanticAnalyzerTest);
  50262. $core.addMethod(
  50263. $core.method({
  50264. selector: "testNonLocalReturn2",
  50265. protocol: "tests",
  50266. fn: function (){
  50267. var self=this,$self=this;
  50268. var src,ast;
  50269. return $core.withContext(function($ctx1) {
  50270. src="foo | a | a + 1. [ [ ^ a] ]";
  50271. ast=$recv($globals.Smalltalk)._parse_(src);
  50272. $recv($self["@analyzer"])._visit_(ast);
  50273. $self._assert_($recv($recv(ast)._scope())._hasNonLocalReturn());
  50274. return self;
  50275. }, function($ctx1) {$ctx1.fill(self,"testNonLocalReturn2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50276. },
  50277. args: [],
  50278. 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",
  50279. referencedClasses: ["Smalltalk"],
  50280. messageSends: ["parse:", "visit:", "assert:", "hasNonLocalReturn", "scope"]
  50281. }),
  50282. $globals.SemanticAnalyzerTest);
  50283. $core.addMethod(
  50284. $core.method({
  50285. selector: "testScope",
  50286. protocol: "tests",
  50287. fn: function (){
  50288. var self=this,$self=this;
  50289. var src,ast;
  50290. return $core.withContext(function($ctx1) {
  50291. var $4,$3,$2,$1;
  50292. src="foo | a | a + 1. [ | b | b := a ]";
  50293. ast=$recv($globals.Smalltalk)._parse_(src);
  50294. $recv($self["@analyzer"])._visit_(ast);
  50295. $4=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50296. $ctx1.sendIdx["dagChildren"]=1;
  50297. $3=$recv($4)._last();
  50298. $2=$recv($3)._scope();
  50299. $ctx1.sendIdx["scope"]=1;
  50300. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50301. $self._deny_($1);
  50302. return self;
  50303. }, function($ctx1) {$ctx1.fill(self,"testScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50304. },
  50305. args: [],
  50306. 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.",
  50307. referencedClasses: ["Smalltalk"],
  50308. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "last", "dagChildren", "first"]
  50309. }),
  50310. $globals.SemanticAnalyzerTest);
  50311. $core.addMethod(
  50312. $core.method({
  50313. selector: "testScope2",
  50314. protocol: "tests",
  50315. fn: function (){
  50316. var self=this,$self=this;
  50317. var src,ast;
  50318. return $core.withContext(function($ctx1) {
  50319. var $8,$7,$6,$5,$4,$3,$2,$1;
  50320. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50321. ast=$recv($globals.Smalltalk)._parse_(src);
  50322. $recv($self["@analyzer"])._visit_(ast);
  50323. $8=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50324. $ctx1.sendIdx["dagChildren"]=3;
  50325. $7=$recv($8)._last();
  50326. $6=$recv($7)._dagChildren();
  50327. $ctx1.sendIdx["dagChildren"]=2;
  50328. $5=$recv($6)._first();
  50329. $ctx1.sendIdx["first"]=2;
  50330. $4=$recv($5)._dagChildren();
  50331. $ctx1.sendIdx["dagChildren"]=1;
  50332. $3=$recv($4)._first();
  50333. $ctx1.sendIdx["first"]=1;
  50334. $2=$recv($3)._scope();
  50335. $ctx1.sendIdx["scope"]=1;
  50336. $1=$recv($2).__eq_eq($recv(ast)._scope());
  50337. $self._deny_($1);
  50338. return self;
  50339. }, function($ctx1) {$ctx1.fill(self,"testScope2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50340. },
  50341. args: [],
  50342. 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.",
  50343. referencedClasses: ["Smalltalk"],
  50344. messageSends: ["parse:", "visit:", "deny:", "==", "scope", "first", "dagChildren", "last"]
  50345. }),
  50346. $globals.SemanticAnalyzerTest);
  50347. $core.addMethod(
  50348. $core.method({
  50349. selector: "testScopeLevel",
  50350. protocol: "tests",
  50351. fn: function (){
  50352. var self=this,$self=this;
  50353. var src,ast;
  50354. return $core.withContext(function($ctx1) {
  50355. var $2,$1,$10,$9,$8,$7,$6,$5,$4,$3;
  50356. src="foo | a | a + 1. [ [ | b | b := a ] ]";
  50357. ast=$recv($globals.Smalltalk)._parse_(src);
  50358. $recv($self["@analyzer"])._visit_(ast);
  50359. $2=$recv(ast)._scope();
  50360. $ctx1.sendIdx["scope"]=1;
  50361. $1=$recv($2)._scopeLevel();
  50362. $ctx1.sendIdx["scopeLevel"]=1;
  50363. $self._assert_equals_($1,(1));
  50364. $ctx1.sendIdx["assert:equals:"]=1;
  50365. $10=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50366. $ctx1.sendIdx["dagChildren"]=3;
  50367. $9=$recv($10)._last();
  50368. $8=$recv($9)._dagChildren();
  50369. $ctx1.sendIdx["dagChildren"]=2;
  50370. $7=$recv($8)._first();
  50371. $ctx1.sendIdx["first"]=2;
  50372. $6=$recv($7)._dagChildren();
  50373. $ctx1.sendIdx["dagChildren"]=1;
  50374. $5=$recv($6)._first();
  50375. $ctx1.sendIdx["first"]=1;
  50376. $4=$recv($5)._scope();
  50377. $3=$recv($4)._scopeLevel();
  50378. $self._assert_equals_($3,(3));
  50379. return self;
  50380. }, function($ctx1) {$ctx1.fill(self,"testScopeLevel",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50381. },
  50382. args: [],
  50383. 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",
  50384. referencedClasses: ["Smalltalk"],
  50385. messageSends: ["parse:", "visit:", "assert:equals:", "scopeLevel", "scope", "first", "dagChildren", "last"]
  50386. }),
  50387. $globals.SemanticAnalyzerTest);
  50388. $core.addMethod(
  50389. $core.method({
  50390. selector: "testUnknownVariables",
  50391. protocol: "tests",
  50392. fn: function (){
  50393. var self=this,$self=this;
  50394. var src,ast;
  50395. return $core.withContext(function($ctx1) {
  50396. src="foo | a | b + a";
  50397. ast=$recv($globals.Smalltalk)._parse_(src);
  50398. $self._should_raise_((function(){
  50399. return $core.withContext(function($ctx2) {
  50400. return $recv($self["@analyzer"])._visit_(ast);
  50401. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50402. }),$globals.UnknownVariableError);
  50403. return self;
  50404. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariables",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50405. },
  50406. args: [],
  50407. 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",
  50408. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50409. messageSends: ["parse:", "should:raise:", "visit:"]
  50410. }),
  50411. $globals.SemanticAnalyzerTest);
  50412. $core.addMethod(
  50413. $core.method({
  50414. selector: "testUnknownVariablesWithScope",
  50415. protocol: "tests",
  50416. fn: function (){
  50417. var self=this,$self=this;
  50418. var src,ast;
  50419. return $core.withContext(function($ctx1) {
  50420. src="foo | a b | [ c + 1. [ a + 1. d + 1 ]]";
  50421. ast=$recv($globals.Smalltalk)._parse_(src);
  50422. $self._should_raise_((function(){
  50423. return $core.withContext(function($ctx2) {
  50424. return $recv($self["@analyzer"])._visit_(ast);
  50425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50426. }),$globals.UnknownVariableError);
  50427. return self;
  50428. }, function($ctx1) {$ctx1.fill(self,"testUnknownVariablesWithScope",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50429. },
  50430. args: [],
  50431. 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",
  50432. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50433. messageSends: ["parse:", "should:raise:", "visit:"]
  50434. }),
  50435. $globals.SemanticAnalyzerTest);
  50436. $core.addMethod(
  50437. $core.method({
  50438. selector: "testVariableShadowing",
  50439. protocol: "tests",
  50440. fn: function (){
  50441. var self=this,$self=this;
  50442. var src,ast;
  50443. return $core.withContext(function($ctx1) {
  50444. src="foo | a | a + 1";
  50445. ast=$recv($globals.Smalltalk)._parse_(src);
  50446. $recv($self["@analyzer"])._visit_(ast);
  50447. return self;
  50448. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50449. },
  50450. args: [],
  50451. source: "testVariableShadowing\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50452. referencedClasses: ["Smalltalk"],
  50453. messageSends: ["parse:", "visit:"]
  50454. }),
  50455. $globals.SemanticAnalyzerTest);
  50456. $core.addMethod(
  50457. $core.method({
  50458. selector: "testVariableShadowing2",
  50459. protocol: "tests",
  50460. fn: function (){
  50461. var self=this,$self=this;
  50462. var src,ast;
  50463. return $core.withContext(function($ctx1) {
  50464. src="foo | a | a + 1. [ | a | a := 2 ]";
  50465. ast=$recv($globals.Smalltalk)._parse_(src);
  50466. $self._should_raise_((function(){
  50467. return $core.withContext(function($ctx2) {
  50468. return $recv($self["@analyzer"])._visit_(ast);
  50469. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50470. }),$globals.ShadowingVariableError);
  50471. return self;
  50472. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing2",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50473. },
  50474. args: [],
  50475. 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",
  50476. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50477. messageSends: ["parse:", "should:raise:", "visit:"]
  50478. }),
  50479. $globals.SemanticAnalyzerTest);
  50480. $core.addMethod(
  50481. $core.method({
  50482. selector: "testVariableShadowing3",
  50483. protocol: "tests",
  50484. fn: function (){
  50485. var self=this,$self=this;
  50486. var src,ast;
  50487. return $core.withContext(function($ctx1) {
  50488. src="foo | a | a + 1. [ | b | b := 2 ]";
  50489. ast=$recv($globals.Smalltalk)._parse_(src);
  50490. $recv($self["@analyzer"])._visit_(ast);
  50491. return self;
  50492. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing3",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50493. },
  50494. args: [],
  50495. source: "testVariableShadowing3\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ | b | b := 2 ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50496. referencedClasses: ["Smalltalk"],
  50497. messageSends: ["parse:", "visit:"]
  50498. }),
  50499. $globals.SemanticAnalyzerTest);
  50500. $core.addMethod(
  50501. $core.method({
  50502. selector: "testVariableShadowing4",
  50503. protocol: "tests",
  50504. fn: function (){
  50505. var self=this,$self=this;
  50506. var src,ast;
  50507. return $core.withContext(function($ctx1) {
  50508. src="foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]";
  50509. ast=$recv($globals.Smalltalk)._parse_(src);
  50510. $recv($self["@analyzer"])._visit_(ast);
  50511. return self;
  50512. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing4",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50513. },
  50514. args: [],
  50515. source: "testVariableShadowing4\x0a\x09| src ast |\x0a\x09src := 'foo | a | a + 1. [ [ [ | b | b := 2 ] ] ]'.\x0a\x09ast := Smalltalk parse: src.\x0a\x09analyzer visit: ast",
  50516. referencedClasses: ["Smalltalk"],
  50517. messageSends: ["parse:", "visit:"]
  50518. }),
  50519. $globals.SemanticAnalyzerTest);
  50520. $core.addMethod(
  50521. $core.method({
  50522. selector: "testVariableShadowing5",
  50523. protocol: "tests",
  50524. fn: function (){
  50525. var self=this,$self=this;
  50526. var src,ast;
  50527. return $core.withContext(function($ctx1) {
  50528. src="foo | a | a + 1. [ [ [ | a | a := 2 ] ] ]";
  50529. ast=$recv($globals.Smalltalk)._parse_(src);
  50530. $self._should_raise_((function(){
  50531. return $core.withContext(function($ctx2) {
  50532. return $recv($self["@analyzer"])._visit_(ast);
  50533. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50534. }),$globals.ShadowingVariableError);
  50535. return self;
  50536. }, function($ctx1) {$ctx1.fill(self,"testVariableShadowing5",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50537. },
  50538. args: [],
  50539. 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",
  50540. referencedClasses: ["Smalltalk", "ShadowingVariableError"],
  50541. messageSends: ["parse:", "should:raise:", "visit:"]
  50542. }),
  50543. $globals.SemanticAnalyzerTest);
  50544. $core.addMethod(
  50545. $core.method({
  50546. selector: "testVariablesLookup",
  50547. protocol: "tests",
  50548. fn: function (){
  50549. var self=this,$self=this;
  50550. var src,ast;
  50551. return $core.withContext(function($ctx1) {
  50552. 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;
  50553. src="foo | a | a + 1. [ | b | b := a ]";
  50554. ast=$recv($globals.Smalltalk)._parse_(src);
  50555. $recv($self["@analyzer"])._visit_(ast);
  50556. $7=$recv(ast)._dagChildren();
  50557. $ctx1.sendIdx["dagChildren"]=2;
  50558. $6=$recv($7)._first();
  50559. $ctx1.sendIdx["first"]=2;
  50560. $5=$recv($6)._dagChildren();
  50561. $ctx1.sendIdx["dagChildren"]=1;
  50562. $4=$recv($5)._first();
  50563. $ctx1.sendIdx["first"]=1;
  50564. $3=$recv($4)._receiver();
  50565. $ctx1.sendIdx["receiver"]=1;
  50566. $2=$recv($3)._binding();
  50567. $ctx1.sendIdx["binding"]=1;
  50568. $1=$recv($2)._isTempVar();
  50569. $ctx1.sendIdx["isTempVar"]=1;
  50570. $self._assert_($1);
  50571. $ctx1.sendIdx["assert:"]=1;
  50572. $15=$recv(ast)._dagChildren();
  50573. $ctx1.sendIdx["dagChildren"]=4;
  50574. $14=$recv($15)._first();
  50575. $ctx1.sendIdx["first"]=4;
  50576. $13=$recv($14)._dagChildren();
  50577. $ctx1.sendIdx["dagChildren"]=3;
  50578. $12=$recv($13)._first();
  50579. $ctx1.sendIdx["first"]=3;
  50580. $11=$recv($12)._receiver();
  50581. $10=$recv($11)._binding();
  50582. $ctx1.sendIdx["binding"]=2;
  50583. $9=$recv($10)._scope();
  50584. $ctx1.sendIdx["scope"]=1;
  50585. $16=$recv(ast)._scope();
  50586. $ctx1.sendIdx["scope"]=2;
  50587. $8=$recv($9).__eq_eq($16);
  50588. $ctx1.sendIdx["=="]=1;
  50589. $self._assert_($8);
  50590. $ctx1.sendIdx["assert:"]=2;
  50591. $27=$recv(ast)._dagChildren();
  50592. $ctx1.sendIdx["dagChildren"]=8;
  50593. $26=$recv($27)._first();
  50594. $ctx1.sendIdx["first"]=7;
  50595. $25=$recv($26)._dagChildren();
  50596. $ctx1.sendIdx["dagChildren"]=7;
  50597. $24=$recv($25)._last();
  50598. $ctx1.sendIdx["last"]=1;
  50599. $23=$recv($24)._dagChildren();
  50600. $ctx1.sendIdx["dagChildren"]=6;
  50601. $22=$recv($23)._first();
  50602. $ctx1.sendIdx["first"]=6;
  50603. $21=$recv($22)._dagChildren();
  50604. $ctx1.sendIdx["dagChildren"]=5;
  50605. $20=$recv($21)._first();
  50606. $ctx1.sendIdx["first"]=5;
  50607. $19=$recv($20)._left();
  50608. $ctx1.sendIdx["left"]=1;
  50609. $18=$recv($19)._binding();
  50610. $ctx1.sendIdx["binding"]=3;
  50611. $17=$recv($18)._isTempVar();
  50612. $self._assert_($17);
  50613. $ctx1.sendIdx["assert:"]=3;
  50614. $39=$recv(ast)._dagChildren();
  50615. $ctx1.sendIdx["dagChildren"]=12;
  50616. $38=$recv($39)._first();
  50617. $ctx1.sendIdx["first"]=10;
  50618. $37=$recv($38)._dagChildren();
  50619. $ctx1.sendIdx["dagChildren"]=11;
  50620. $36=$recv($37)._last();
  50621. $ctx1.sendIdx["last"]=2;
  50622. $35=$recv($36)._dagChildren();
  50623. $ctx1.sendIdx["dagChildren"]=10;
  50624. $34=$recv($35)._first();
  50625. $ctx1.sendIdx["first"]=9;
  50626. $33=$recv($34)._dagChildren();
  50627. $ctx1.sendIdx["dagChildren"]=9;
  50628. $32=$recv($33)._first();
  50629. $ctx1.sendIdx["first"]=8;
  50630. $31=$recv($32)._left();
  50631. $30=$recv($31)._binding();
  50632. $29=$recv($30)._scope();
  50633. $ctx1.sendIdx["scope"]=3;
  50634. $42=$recv($recv($recv(ast)._dagChildren())._first())._dagChildren();
  50635. $ctx1.sendIdx["dagChildren"]=13;
  50636. $41=$recv($42)._last();
  50637. $40=$recv($41)._scope();
  50638. $28=$recv($29).__eq_eq($40);
  50639. $self._assert_($28);
  50640. return self;
  50641. }, function($ctx1) {$ctx1.fill(self,"testVariablesLookup",{src:src,ast:ast},$globals.SemanticAnalyzerTest)});
  50642. },
  50643. args: [],
  50644. 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.",
  50645. referencedClasses: ["Smalltalk"],
  50646. messageSends: ["parse:", "visit:", "assert:", "isTempVar", "binding", "receiver", "first", "dagChildren", "==", "scope", "left", "last"]
  50647. }),
  50648. $globals.SemanticAnalyzerTest);
  50649. $core.addClass("AISemanticAnalyzerTest", $globals.SemanticAnalyzerTest, [], "Compiler-Tests");
  50650. $core.addMethod(
  50651. $core.method({
  50652. selector: "setUp",
  50653. protocol: "running",
  50654. fn: function (){
  50655. var self=this,$self=this;
  50656. return $core.withContext(function($ctx1) {
  50657. var $1,$3,$4,$2;
  50658. $1=$recv($globals.AISemanticAnalyzer)._on_($globals.Object);
  50659. $3=$recv($globals.AIContext)._new();
  50660. $recv($3)._defineLocal_("local");
  50661. $recv($3)._localAt_put_("local",(3));
  50662. $4=$recv($3)._yourself();
  50663. $ctx1.sendIdx["yourself"]=1;
  50664. $2=$4;
  50665. $recv($1)._context_($2);
  50666. $self["@analyzer"]=$recv($1)._yourself();
  50667. return self;
  50668. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.AISemanticAnalyzerTest)});
  50669. },
  50670. args: [],
  50671. 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",
  50672. referencedClasses: ["AISemanticAnalyzer", "Object", "AIContext"],
  50673. messageSends: ["context:", "on:", "defineLocal:", "new", "localAt:put:", "yourself"]
  50674. }),
  50675. $globals.AISemanticAnalyzerTest);
  50676. $core.addMethod(
  50677. $core.method({
  50678. selector: "testContextVariables",
  50679. protocol: "tests",
  50680. fn: function (){
  50681. var self=this,$self=this;
  50682. var src,ast;
  50683. return $core.withContext(function($ctx1) {
  50684. src="foo | a | local + a";
  50685. ast=$recv($globals.Smalltalk)._parse_(src);
  50686. $self._shouldnt_raise_((function(){
  50687. return $core.withContext(function($ctx2) {
  50688. return $recv($self["@analyzer"])._visit_(ast);
  50689. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50690. }),$globals.UnknownVariableError);
  50691. return self;
  50692. }, function($ctx1) {$ctx1.fill(self,"testContextVariables",{src:src,ast:ast},$globals.AISemanticAnalyzerTest)});
  50693. },
  50694. args: [],
  50695. 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",
  50696. referencedClasses: ["Smalltalk", "UnknownVariableError"],
  50697. messageSends: ["parse:", "shouldnt:raise:", "visit:"]
  50698. }),
  50699. $globals.AISemanticAnalyzerTest);
  50700. });
  50701. define('amber_core/Kernel-Tests',["amber/boot", "amber_core/Kernel-Objects", "amber_core/SUnit"], function($boot){"use strict";
  50702. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  50703. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  50704. $core.addPackage("Kernel-Tests");
  50705. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].innerEval = function (expr) { return eval(expr); };
  50706. ($core.packageDescriptors||$core.packages)["Kernel-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  50707. $core.addClass("AnnouncementSubscriptionTest", $globals.TestCase, [], "Kernel-Tests");
  50708. $core.addMethod(
  50709. $core.method({
  50710. selector: "testAddExtensionMethod",
  50711. protocol: "tests",
  50712. fn: function (){
  50713. var self=this,$self=this;
  50714. var method,dirty;
  50715. return $core.withContext(function($ctx1) {
  50716. var $2,$1,$4,$3,$5,$8,$7,$6,$9,$10;
  50717. $2=$self._class();
  50718. $ctx1.sendIdx["class"]=1;
  50719. $1=$recv($2)._package();
  50720. $ctx1.sendIdx["package"]=1;
  50721. dirty=$recv($1)._isDirty();
  50722. $ctx1.sendIdx["isDirty"]=1;
  50723. $4=$self._class();
  50724. $ctx1.sendIdx["class"]=2;
  50725. $3=$recv($4)._package();
  50726. $ctx1.sendIdx["package"]=2;
  50727. $recv($3)._beClean();
  50728. $5=$self._class();
  50729. $ctx1.sendIdx["class"]=3;
  50730. method=$recv($5)._compile_protocol_("doNothing","**not-a-package");
  50731. $8=$self._class();
  50732. $ctx1.sendIdx["class"]=4;
  50733. $7=$recv($8)._package();
  50734. $ctx1.sendIdx["package"]=3;
  50735. $6=$recv($7)._isDirty();
  50736. $self._deny_($6);
  50737. $9=$self._class();
  50738. $ctx1.sendIdx["class"]=5;
  50739. $recv($9)._removeCompiledMethod_(method);
  50740. $10=dirty;
  50741. if($core.assert($10)){
  50742. $recv($recv($self._class())._package())._beDirty();
  50743. }
  50744. return self;
  50745. }, function($ctx1) {$ctx1.fill(self,"testAddExtensionMethod",{method:method,dirty:dirty},$globals.AnnouncementSubscriptionTest)});
  50746. },
  50747. args: [],
  50748. 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 ]",
  50749. referencedClasses: [],
  50750. messageSends: ["isDirty", "package", "class", "beClean", "compile:protocol:", "deny:", "removeCompiledMethod:", "ifTrue:", "beDirty"]
  50751. }),
  50752. $globals.AnnouncementSubscriptionTest);
  50753. $core.addMethod(
  50754. $core.method({
  50755. selector: "testHandlesAnnouncement",
  50756. protocol: "tests",
  50757. fn: function (){
  50758. var self=this,$self=this;
  50759. var subscription,announcementClass1,announcementClass2,classBuilder;
  50760. return $core.withContext(function($ctx1) {
  50761. var $1,$2;
  50762. classBuilder=$recv($globals.ClassBuilder)._new();
  50763. $ctx1.sendIdx["new"]=1;
  50764. announcementClass1=$recv(classBuilder)._basicAddSubclassOf_named_instanceVariableNames_package_($globals.SystemAnnouncement,"TestAnnouncement1",[],"Kernel-Tests");
  50765. subscription=$recv($recv($globals.AnnouncementSubscription)._new())._announcementClass_($globals.SystemAnnouncement);
  50766. $1=$recv(subscription)._handlesAnnouncement_($globals.SystemAnnouncement);
  50767. $ctx1.sendIdx["handlesAnnouncement:"]=1;
  50768. $self._assert_equals_($1,true);
  50769. $ctx1.sendIdx["assert:equals:"]=1;
  50770. $2=$recv(subscription)._handlesAnnouncement_(announcementClass1);
  50771. $ctx1.sendIdx["handlesAnnouncement:"]=2;
  50772. $self._assert_equals_($2,true);
  50773. $ctx1.sendIdx["assert:equals:"]=2;
  50774. $self._assert_equals_($recv(subscription)._handlesAnnouncement_($globals.Object),false);
  50775. $recv(classBuilder)._basicRemoveClass_(announcementClass1);
  50776. return self;
  50777. }, function($ctx1) {$ctx1.fill(self,"testHandlesAnnouncement",{subscription:subscription,announcementClass1:announcementClass1,announcementClass2:announcementClass2,classBuilder:classBuilder},$globals.AnnouncementSubscriptionTest)});
  50778. },
  50779. args: [],
  50780. 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.",
  50781. referencedClasses: ["ClassBuilder", "SystemAnnouncement", "AnnouncementSubscription", "Object"],
  50782. messageSends: ["new", "basicAddSubclassOf:named:instanceVariableNames:package:", "announcementClass:", "assert:equals:", "handlesAnnouncement:", "basicRemoveClass:"]
  50783. }),
  50784. $globals.AnnouncementSubscriptionTest);
  50785. $core.addClass("AnnouncerTest", $globals.TestCase, [], "Kernel-Tests");
  50786. $core.addMethod(
  50787. $core.method({
  50788. selector: "testOnDo",
  50789. protocol: "tests",
  50790. fn: function (){
  50791. var self=this,$self=this;
  50792. var counter,announcer;
  50793. return $core.withContext(function($ctx1) {
  50794. var $1,$2;
  50795. counter=(0);
  50796. announcer=$recv($globals.Announcer)._new();
  50797. $ctx1.sendIdx["new"]=1;
  50798. $recv(announcer)._on_do_($globals.SystemAnnouncement,(function(){
  50799. return $core.withContext(function($ctx2) {
  50800. counter=$recv(counter).__plus((1));
  50801. return counter;
  50802. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50803. }));
  50804. $1=announcer;
  50805. $2=$recv($globals.SystemAnnouncement)._new();
  50806. $ctx1.sendIdx["new"]=2;
  50807. $recv($1)._announce_($2);
  50808. $ctx1.sendIdx["announce:"]=1;
  50809. $self._assert_equals_(counter,(1));
  50810. $ctx1.sendIdx["assert:equals:"]=1;
  50811. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50812. $self._assert_equals_(counter,(2));
  50813. return self;
  50814. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50815. },
  50816. args: [],
  50817. 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.",
  50818. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50819. messageSends: ["new", "on:do:", "+", "announce:", "assert:equals:"]
  50820. }),
  50821. $globals.AnnouncerTest);
  50822. $core.addMethod(
  50823. $core.method({
  50824. selector: "testOnDoFor",
  50825. protocol: "tests",
  50826. fn: function (){
  50827. var self=this,$self=this;
  50828. var counter,announcer;
  50829. return $core.withContext(function($ctx1) {
  50830. var $1,$2,$3,$4;
  50831. counter=(0);
  50832. announcer=$recv($globals.Announcer)._new();
  50833. $ctx1.sendIdx["new"]=1;
  50834. $recv(announcer)._on_do_for_($globals.SystemAnnouncement,(function(){
  50835. return $core.withContext(function($ctx2) {
  50836. counter=$recv(counter).__plus((1));
  50837. return counter;
  50838. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50839. }),self);
  50840. $1=announcer;
  50841. $2=$recv($globals.SystemAnnouncement)._new();
  50842. $ctx1.sendIdx["new"]=2;
  50843. $recv($1)._announce_($2);
  50844. $ctx1.sendIdx["announce:"]=1;
  50845. $self._assert_equals_(counter,(1));
  50846. $ctx1.sendIdx["assert:equals:"]=1;
  50847. $3=announcer;
  50848. $4=$recv($globals.SystemAnnouncement)._new();
  50849. $ctx1.sendIdx["new"]=3;
  50850. $recv($3)._announce_($4);
  50851. $ctx1.sendIdx["announce:"]=2;
  50852. $self._assert_equals_(counter,(2));
  50853. $ctx1.sendIdx["assert:equals:"]=2;
  50854. $recv(announcer)._unsubscribe_(self);
  50855. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50856. $self._assert_equals_(counter,(2));
  50857. return self;
  50858. }, function($ctx1) {$ctx1.fill(self,"testOnDoFor",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50859. },
  50860. args: [],
  50861. 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.",
  50862. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50863. messageSends: ["new", "on:do:for:", "+", "announce:", "assert:equals:", "unsubscribe:"]
  50864. }),
  50865. $globals.AnnouncerTest);
  50866. $core.addMethod(
  50867. $core.method({
  50868. selector: "testOnDoOnce",
  50869. protocol: "tests",
  50870. fn: function (){
  50871. var self=this,$self=this;
  50872. var counter,announcer;
  50873. return $core.withContext(function($ctx1) {
  50874. var $1,$2;
  50875. counter=(0);
  50876. announcer=$recv($globals.Announcer)._new();
  50877. $ctx1.sendIdx["new"]=1;
  50878. $recv(announcer)._on_doOnce_($globals.SystemAnnouncement,(function(){
  50879. return $core.withContext(function($ctx2) {
  50880. counter=$recv(counter).__plus((1));
  50881. return counter;
  50882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50883. }));
  50884. $1=announcer;
  50885. $2=$recv($globals.SystemAnnouncement)._new();
  50886. $ctx1.sendIdx["new"]=2;
  50887. $recv($1)._announce_($2);
  50888. $ctx1.sendIdx["announce:"]=1;
  50889. $self._assert_equals_(counter,(1));
  50890. $ctx1.sendIdx["assert:equals:"]=1;
  50891. $recv(announcer)._announce_($recv($globals.SystemAnnouncement)._new());
  50892. $self._assert_equals_(counter,(1));
  50893. return self;
  50894. }, function($ctx1) {$ctx1.fill(self,"testOnDoOnce",{counter:counter,announcer:announcer},$globals.AnnouncerTest)});
  50895. },
  50896. args: [],
  50897. 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.",
  50898. referencedClasses: ["Announcer", "SystemAnnouncement"],
  50899. messageSends: ["new", "on:doOnce:", "+", "announce:", "assert:equals:"]
  50900. }),
  50901. $globals.AnnouncerTest);
  50902. $core.addClass("BlockClosureTest", $globals.TestCase, [], "Kernel-Tests");
  50903. $core.addMethod(
  50904. $core.method({
  50905. selector: "localReturnOnDoCatch",
  50906. protocol: "fixture",
  50907. fn: function (){
  50908. var self=this,$self=this;
  50909. return $core.withContext(function($ctx1) {
  50910. var $early={};
  50911. try {
  50912. $recv((function(){
  50913. throw $early=[(2)];
  50914. }))._on_do_($globals.Error,(function(){
  50915. }));
  50916. return (3);
  50917. }
  50918. catch(e) {if(e===$early)return e[0]; throw e}
  50919. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoCatch",{},$globals.BlockClosureTest)});
  50920. },
  50921. args: [],
  50922. source: "localReturnOnDoCatch\x0a [ ^ 2 ] on: Error do: [].\x0a ^ 3",
  50923. referencedClasses: ["Error"],
  50924. messageSends: ["on:do:"]
  50925. }),
  50926. $globals.BlockClosureTest);
  50927. $core.addMethod(
  50928. $core.method({
  50929. selector: "localReturnOnDoMiss",
  50930. protocol: "fixture",
  50931. fn: function (){
  50932. var self=this,$self=this;
  50933. return $core.withContext(function($ctx1) {
  50934. var $early={};
  50935. try {
  50936. $recv((function(){
  50937. throw $early=[(2)];
  50938. }))._on_do_($globals.Class,(function(){
  50939. }));
  50940. return (3);
  50941. }
  50942. catch(e) {if(e===$early)return e[0]; throw e}
  50943. }, function($ctx1) {$ctx1.fill(self,"localReturnOnDoMiss",{},$globals.BlockClosureTest)});
  50944. },
  50945. args: [],
  50946. source: "localReturnOnDoMiss\x0a [ ^ 2 ] on: Class do: [].\x0a ^ 3",
  50947. referencedClasses: ["Class"],
  50948. messageSends: ["on:do:"]
  50949. }),
  50950. $globals.BlockClosureTest);
  50951. $core.addMethod(
  50952. $core.method({
  50953. selector: "testCanClearInterval",
  50954. protocol: "tests",
  50955. fn: function (){
  50956. var self=this,$self=this;
  50957. return $core.withContext(function($ctx1) {
  50958. $self._shouldnt_raise_((function(){
  50959. return $core.withContext(function($ctx2) {
  50960. return $recv($recv((function(){
  50961. return $core.withContext(function($ctx3) {
  50962. return $recv($recv($globals.Error)._new())._signal();
  50963. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50964. }))._valueWithInterval_((0)))._clearInterval();
  50965. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50966. }),$globals.Error);
  50967. return self;
  50968. }, function($ctx1) {$ctx1.fill(self,"testCanClearInterval",{},$globals.BlockClosureTest)});
  50969. },
  50970. args: [],
  50971. source: "testCanClearInterval\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithInterval: 0) clearInterval ] raise: Error",
  50972. referencedClasses: ["Error"],
  50973. messageSends: ["shouldnt:raise:", "clearInterval", "valueWithInterval:", "signal", "new"]
  50974. }),
  50975. $globals.BlockClosureTest);
  50976. $core.addMethod(
  50977. $core.method({
  50978. selector: "testCanClearTimeout",
  50979. protocol: "tests",
  50980. fn: function (){
  50981. var self=this,$self=this;
  50982. return $core.withContext(function($ctx1) {
  50983. $self._shouldnt_raise_((function(){
  50984. return $core.withContext(function($ctx2) {
  50985. return $recv($recv((function(){
  50986. return $core.withContext(function($ctx3) {
  50987. return $recv($recv($globals.Error)._new())._signal();
  50988. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  50989. }))._valueWithTimeout_((0)))._clearTimeout();
  50990. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  50991. }),$globals.Error);
  50992. return self;
  50993. }, function($ctx1) {$ctx1.fill(self,"testCanClearTimeout",{},$globals.BlockClosureTest)});
  50994. },
  50995. args: [],
  50996. source: "testCanClearTimeout\x0a\x09self shouldnt: [ ([ Error new signal ] valueWithTimeout: 0) clearTimeout ] raise: Error",
  50997. referencedClasses: ["Error"],
  50998. messageSends: ["shouldnt:raise:", "clearTimeout", "valueWithTimeout:", "signal", "new"]
  50999. }),
  51000. $globals.BlockClosureTest);
  51001. $core.addMethod(
  51002. $core.method({
  51003. selector: "testCompiledSource",
  51004. protocol: "tests",
  51005. fn: function (){
  51006. var self=this,$self=this;
  51007. return $core.withContext(function($ctx1) {
  51008. $self._assert_($recv($recv((function(){
  51009. return $core.withContext(function($ctx2) {
  51010. return (1).__plus((1));
  51011. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51012. }))._compiledSource())._includesSubString_("function"));
  51013. return self;
  51014. }, function($ctx1) {$ctx1.fill(self,"testCompiledSource",{},$globals.BlockClosureTest)});
  51015. },
  51016. args: [],
  51017. source: "testCompiledSource\x0a\x09self assert: ([ 1+1 ] compiledSource includesSubString: 'function')",
  51018. referencedClasses: [],
  51019. messageSends: ["assert:", "includesSubString:", "compiledSource", "+"]
  51020. }),
  51021. $globals.BlockClosureTest);
  51022. $core.addMethod(
  51023. $core.method({
  51024. selector: "testCurrySelf",
  51025. protocol: "tests",
  51026. fn: function (){
  51027. var self=this,$self=this;
  51028. var curriedMethod,array;
  51029. return $core.withContext(function($ctx1) {
  51030. curriedMethod=$recv($recv((function(selfarg,x){
  51031. return $core.withContext(function($ctx2) {
  51032. return $recv(selfarg)._at_(x);
  51033. }, function($ctx2) {$ctx2.fillBlock({selfarg:selfarg,x:x},$ctx1,1)});
  51034. }))._currySelf())._asCompiledMethod_("foo:");
  51035. array=[(3), (1), (4)];
  51036. $recv($recv($globals.ClassBuilder)._new())._installMethod_forClass_protocol_(curriedMethod,$globals.Array,"**test helper");
  51037. $recv((function(){
  51038. return $core.withContext(function($ctx2) {
  51039. return $self._assert_equals_($recv(array)._foo_((2)),(1));
  51040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51041. }))._ensure_((function(){
  51042. return $core.withContext(function($ctx2) {
  51043. return $recv($globals.Array)._removeCompiledMethod_(curriedMethod);
  51044. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51045. }));
  51046. return self;
  51047. }, function($ctx1) {$ctx1.fill(self,"testCurrySelf",{curriedMethod:curriedMethod,array:array},$globals.BlockClosureTest)});
  51048. },
  51049. args: [],
  51050. 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 ]",
  51051. referencedClasses: ["ClassBuilder", "Array"],
  51052. messageSends: ["asCompiledMethod:", "currySelf", "at:", "installMethod:forClass:protocol:", "new", "ensure:", "assert:equals:", "foo:", "removeCompiledMethod:"]
  51053. }),
  51054. $globals.BlockClosureTest);
  51055. $core.addMethod(
  51056. $core.method({
  51057. selector: "testEnsure",
  51058. protocol: "tests",
  51059. fn: function (){
  51060. var self=this,$self=this;
  51061. return $core.withContext(function($ctx1) {
  51062. $self._assert_equals_($recv((function(){
  51063. return (3);
  51064. }))._ensure_((function(){
  51065. return (4);
  51066. })),(3));
  51067. return self;
  51068. }, function($ctx1) {$ctx1.fill(self,"testEnsure",{},$globals.BlockClosureTest)});
  51069. },
  51070. args: [],
  51071. source: "testEnsure\x0a\x09self assert: ([ 3 ] ensure: [ 4 ]) equals: 3",
  51072. referencedClasses: [],
  51073. messageSends: ["assert:equals:", "ensure:"]
  51074. }),
  51075. $globals.BlockClosureTest);
  51076. $core.addMethod(
  51077. $core.method({
  51078. selector: "testEnsureRaises",
  51079. protocol: "tests",
  51080. fn: function (){
  51081. var self=this,$self=this;
  51082. return $core.withContext(function($ctx1) {
  51083. $self._should_raise_((function(){
  51084. return $core.withContext(function($ctx2) {
  51085. return $recv((function(){
  51086. return $core.withContext(function($ctx3) {
  51087. return $recv($recv($globals.Error)._new())._signal();
  51088. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51089. }))._ensure_((function(){
  51090. return true;
  51091. }));
  51092. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51093. }),$globals.Error);
  51094. return self;
  51095. }, function($ctx1) {$ctx1.fill(self,"testEnsureRaises",{},$globals.BlockClosureTest)});
  51096. },
  51097. args: [],
  51098. source: "testEnsureRaises\x0a\x09self should: [ [Error new signal ] ensure: [ true ]] raise: Error",
  51099. referencedClasses: ["Error"],
  51100. messageSends: ["should:raise:", "ensure:", "signal", "new"]
  51101. }),
  51102. $globals.BlockClosureTest);
  51103. $core.addMethod(
  51104. $core.method({
  51105. selector: "testExceptionSemantics",
  51106. protocol: "tests",
  51107. fn: function (){
  51108. var self=this,$self=this;
  51109. return $core.withContext(function($ctx1) {
  51110. $self._timeout_((100));
  51111. $recv($self._async_((function(){
  51112. return $core.withContext(function($ctx2) {
  51113. return $recv((function(){
  51114. return $core.withContext(function($ctx3) {
  51115. $self._assert_(true);
  51116. $recv($globals.Error)._signal();
  51117. $self._deny_(true);
  51118. return $self._finished();
  51119. $ctx3.sendIdx["finished"]=1;
  51120. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  51121. }))._on_do_($globals.Error,(function(ex){
  51122. return $core.withContext(function($ctx3) {
  51123. return $self._finished();
  51124. }, function($ctx3) {$ctx3.fillBlock({ex:ex},$ctx2,3)});
  51125. }));
  51126. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51127. })))._valueWithTimeout_((0));
  51128. return self;
  51129. }, function($ctx1) {$ctx1.fill(self,"testExceptionSemantics",{},$globals.BlockClosureTest)});
  51130. },
  51131. args: [],
  51132. 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",
  51133. referencedClasses: ["Error"],
  51134. messageSends: ["timeout:", "valueWithTimeout:", "async:", "on:do:", "assert:", "signal", "deny:", "finished"]
  51135. }),
  51136. $globals.BlockClosureTest);
  51137. $core.addMethod(
  51138. $core.method({
  51139. selector: "testLocalReturnOnDoCatch",
  51140. protocol: "tests",
  51141. fn: function (){
  51142. var self=this,$self=this;
  51143. return $core.withContext(function($ctx1) {
  51144. $self._assert_equals_($self._localReturnOnDoCatch(),(2));
  51145. return self;
  51146. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoCatch",{},$globals.BlockClosureTest)});
  51147. },
  51148. args: [],
  51149. source: "testLocalReturnOnDoCatch\x0a\x09self assert: self localReturnOnDoCatch equals: 2",
  51150. referencedClasses: [],
  51151. messageSends: ["assert:equals:", "localReturnOnDoCatch"]
  51152. }),
  51153. $globals.BlockClosureTest);
  51154. $core.addMethod(
  51155. $core.method({
  51156. selector: "testLocalReturnOnDoMiss",
  51157. protocol: "tests",
  51158. fn: function (){
  51159. var self=this,$self=this;
  51160. return $core.withContext(function($ctx1) {
  51161. $self._assert_equals_($self._localReturnOnDoMiss(),(2));
  51162. return self;
  51163. }, function($ctx1) {$ctx1.fill(self,"testLocalReturnOnDoMiss",{},$globals.BlockClosureTest)});
  51164. },
  51165. args: [],
  51166. source: "testLocalReturnOnDoMiss\x0a\x09self assert: self localReturnOnDoMiss equals: 2",
  51167. referencedClasses: [],
  51168. messageSends: ["assert:equals:", "localReturnOnDoMiss"]
  51169. }),
  51170. $globals.BlockClosureTest);
  51171. $core.addMethod(
  51172. $core.method({
  51173. selector: "testNewWithValues",
  51174. protocol: "tests",
  51175. fn: function (){
  51176. var self=this,$self=this;
  51177. return $core.withContext(function($ctx1) {
  51178. function TestConstructor(arg1, arg2, arg3) {}
  51179. TestConstructor.prototype.name = "theTestPrototype";
  51180. var wrappedConstructor = $recv(TestConstructor);
  51181. var result = wrappedConstructor._newWithValues_([1, 2, 3]);
  51182. $self._assert_(result instanceof TestConstructor);
  51183. $self._assert_equals_(result.name, "theTestPrototype");
  51184. /* newWithValues: cannot help if the argument list is wrong, and should warn that a mistake was made. */
  51185. $self._should_raise_(function () {wrappedConstructor._newWithValues_("single argument");}, $globals.Error);;
  51186. return self;
  51187. }, function($ctx1) {$ctx1.fill(self,"testNewWithValues",{},$globals.BlockClosureTest)});
  51188. },
  51189. args: [],
  51190. 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'>",
  51191. referencedClasses: [],
  51192. messageSends: []
  51193. }),
  51194. $globals.BlockClosureTest);
  51195. $core.addMethod(
  51196. $core.method({
  51197. selector: "testNumArgs",
  51198. protocol: "tests",
  51199. fn: function (){
  51200. var self=this,$self=this;
  51201. return $core.withContext(function($ctx1) {
  51202. var $1;
  51203. $1=$recv((function(){
  51204. }))._numArgs();
  51205. $ctx1.sendIdx["numArgs"]=1;
  51206. $self._assert_equals_($1,(0));
  51207. $ctx1.sendIdx["assert:equals:"]=1;
  51208. $self._assert_equals_($recv((function(a,b){
  51209. }))._numArgs(),(2));
  51210. return self;
  51211. }, function($ctx1) {$ctx1.fill(self,"testNumArgs",{},$globals.BlockClosureTest)});
  51212. },
  51213. args: [],
  51214. source: "testNumArgs\x0a\x09self assert: [] numArgs equals: 0.\x0a\x09self assert: [ :a :b | ] numArgs equals: 2",
  51215. referencedClasses: [],
  51216. messageSends: ["assert:equals:", "numArgs"]
  51217. }),
  51218. $globals.BlockClosureTest);
  51219. $core.addMethod(
  51220. $core.method({
  51221. selector: "testOnDo",
  51222. protocol: "tests",
  51223. fn: function (){
  51224. var self=this,$self=this;
  51225. return $core.withContext(function($ctx1) {
  51226. $self._assert_($recv((function(){
  51227. return $core.withContext(function($ctx2) {
  51228. return $recv($recv($globals.Error)._new())._signal();
  51229. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51230. }))._on_do_($globals.Error,(function(ex){
  51231. return true;
  51232. })));
  51233. return self;
  51234. }, function($ctx1) {$ctx1.fill(self,"testOnDo",{},$globals.BlockClosureTest)});
  51235. },
  51236. args: [],
  51237. source: "testOnDo\x0a\x09self assert: ([ Error new signal ] on: Error do: [ :ex | true ])",
  51238. referencedClasses: ["Error"],
  51239. messageSends: ["assert:", "on:do:", "signal", "new"]
  51240. }),
  51241. $globals.BlockClosureTest);
  51242. $core.addMethod(
  51243. $core.method({
  51244. selector: "testValue",
  51245. protocol: "tests",
  51246. fn: function (){
  51247. var self=this,$self=this;
  51248. return $core.withContext(function($ctx1) {
  51249. var $1;
  51250. $1=$recv((function(){
  51251. return $core.withContext(function($ctx2) {
  51252. return (1).__plus((1));
  51253. $ctx2.sendIdx["+"]=1;
  51254. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51255. }))._value();
  51256. $ctx1.sendIdx["value"]=1;
  51257. $self._assert_equals_($1,(2));
  51258. $ctx1.sendIdx["assert:equals:"]=1;
  51259. $self._assert_equals_($recv((function(x){
  51260. return $core.withContext(function($ctx2) {
  51261. return $recv(x).__plus((1));
  51262. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  51263. }))._value_((2)),(3));
  51264. $ctx1.sendIdx["assert:equals:"]=2;
  51265. $self._assert_equals_($recv((function(x,y){
  51266. return $core.withContext(function($ctx2) {
  51267. return $recv(x).__star(y);
  51268. }, function($ctx2) {$ctx2.fillBlock({x:x,y:y},$ctx1,3)});
  51269. }))._value_value_((2),(4)),(8));
  51270. $ctx1.sendIdx["assert:equals:"]=3;
  51271. $self._assert_equals_($recv((function(a,b,c){
  51272. return (1);
  51273. }))._value(),(1));
  51274. return self;
  51275. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.BlockClosureTest)});
  51276. },
  51277. args: [],
  51278. 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",
  51279. referencedClasses: [],
  51280. messageSends: ["assert:equals:", "value", "+", "value:", "value:value:", "*"]
  51281. }),
  51282. $globals.BlockClosureTest);
  51283. $core.addMethod(
  51284. $core.method({
  51285. selector: "testValueWithPossibleArguments",
  51286. protocol: "tests",
  51287. fn: function (){
  51288. var self=this,$self=this;
  51289. return $core.withContext(function($ctx1) {
  51290. var $1,$2;
  51291. $1=$recv((function(){
  51292. return (1);
  51293. }))._valueWithPossibleArguments_([(3), (4)]);
  51294. $ctx1.sendIdx["valueWithPossibleArguments:"]=1;
  51295. $self._assert_equals_($1,(1));
  51296. $ctx1.sendIdx["assert:equals:"]=1;
  51297. $2=$recv((function(a){
  51298. return $core.withContext(function($ctx2) {
  51299. return $recv(a).__plus((4));
  51300. $ctx2.sendIdx["+"]=1;
  51301. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  51302. }))._valueWithPossibleArguments_([(3), (4)]);
  51303. $ctx1.sendIdx["valueWithPossibleArguments:"]=2;
  51304. $self._assert_equals_($2,(7));
  51305. $ctx1.sendIdx["assert:equals:"]=2;
  51306. $self._assert_equals_($recv((function(a,b){
  51307. return $core.withContext(function($ctx2) {
  51308. return $recv(a).__plus(b);
  51309. }, function($ctx2) {$ctx2.fillBlock({a:a,b:b},$ctx1,3)});
  51310. }))._valueWithPossibleArguments_([(3), (4), (5)]),(7));
  51311. return self;
  51312. }, function($ctx1) {$ctx1.fill(self,"testValueWithPossibleArguments",{},$globals.BlockClosureTest)});
  51313. },
  51314. args: [],
  51315. 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.",
  51316. referencedClasses: [],
  51317. messageSends: ["assert:equals:", "valueWithPossibleArguments:", "+"]
  51318. }),
  51319. $globals.BlockClosureTest);
  51320. $core.addMethod(
  51321. $core.method({
  51322. selector: "testWhileFalse",
  51323. protocol: "tests",
  51324. fn: function (){
  51325. var self=this,$self=this;
  51326. var i;
  51327. return $core.withContext(function($ctx1) {
  51328. i=(0);
  51329. $recv((function(){
  51330. return $core.withContext(function($ctx2) {
  51331. return $recv(i).__gt((5));
  51332. $ctx2.sendIdx[">"]=1;
  51333. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51334. }))._whileFalse_((function(){
  51335. return $core.withContext(function($ctx2) {
  51336. i=$recv(i).__plus((1));
  51337. $ctx2.sendIdx["+"]=1;
  51338. return i;
  51339. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51340. }));
  51341. $self._assert_equals_(i,(6));
  51342. $ctx1.sendIdx["assert:equals:"]=1;
  51343. i=(0);
  51344. $recv((function(){
  51345. return $core.withContext(function($ctx2) {
  51346. i=$recv(i).__plus((1));
  51347. return $recv(i).__gt((5));
  51348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51349. }))._whileFalse();
  51350. $self._assert_equals_(i,(6));
  51351. return self;
  51352. }, function($ctx1) {$ctx1.fill(self,"testWhileFalse",{i:i},$globals.BlockClosureTest)});
  51353. },
  51354. args: [],
  51355. 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",
  51356. referencedClasses: [],
  51357. messageSends: ["whileFalse:", ">", "+", "assert:equals:", "whileFalse"]
  51358. }),
  51359. $globals.BlockClosureTest);
  51360. $core.addMethod(
  51361. $core.method({
  51362. selector: "testWhileTrue",
  51363. protocol: "tests",
  51364. fn: function (){
  51365. var self=this,$self=this;
  51366. var i;
  51367. return $core.withContext(function($ctx1) {
  51368. i=(0);
  51369. $recv((function(){
  51370. return $core.withContext(function($ctx2) {
  51371. return $recv(i).__lt((5));
  51372. $ctx2.sendIdx["<"]=1;
  51373. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51374. }))._whileTrue_((function(){
  51375. return $core.withContext(function($ctx2) {
  51376. i=$recv(i).__plus((1));
  51377. $ctx2.sendIdx["+"]=1;
  51378. return i;
  51379. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  51380. }));
  51381. $self._assert_equals_(i,(5));
  51382. $ctx1.sendIdx["assert:equals:"]=1;
  51383. i=(0);
  51384. $recv((function(){
  51385. return $core.withContext(function($ctx2) {
  51386. i=$recv(i).__plus((1));
  51387. return $recv(i).__lt((5));
  51388. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  51389. }))._whileTrue();
  51390. $self._assert_equals_(i,(5));
  51391. return self;
  51392. }, function($ctx1) {$ctx1.fill(self,"testWhileTrue",{i:i},$globals.BlockClosureTest)});
  51393. },
  51394. args: [],
  51395. 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",
  51396. referencedClasses: [],
  51397. messageSends: ["whileTrue:", "<", "+", "assert:equals:", "whileTrue"]
  51398. }),
  51399. $globals.BlockClosureTest);
  51400. $core.addClass("BooleanTest", $globals.TestCase, [], "Kernel-Tests");
  51401. $core.addMethod(
  51402. $core.method({
  51403. selector: "testEquality",
  51404. protocol: "tests",
  51405. fn: function (){
  51406. var self=this,$self=this;
  51407. return $core.withContext(function($ctx1) {
  51408. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51409. $1=(0).__eq(false);
  51410. $ctx1.sendIdx["="]=1;
  51411. $self._deny_($1);
  51412. $ctx1.sendIdx["deny:"]=1;
  51413. $2=false.__eq((0));
  51414. $ctx1.sendIdx["="]=2;
  51415. $self._deny_($2);
  51416. $ctx1.sendIdx["deny:"]=2;
  51417. $3="".__eq(false);
  51418. $ctx1.sendIdx["="]=3;
  51419. $self._deny_($3);
  51420. $ctx1.sendIdx["deny:"]=3;
  51421. $4=false.__eq("");
  51422. $ctx1.sendIdx["="]=4;
  51423. $self._deny_($4);
  51424. $ctx1.sendIdx["deny:"]=4;
  51425. $5=true.__eq(true);
  51426. $ctx1.sendIdx["="]=5;
  51427. $self._assert_($5);
  51428. $ctx1.sendIdx["assert:"]=1;
  51429. $6=false.__eq(true);
  51430. $ctx1.sendIdx["="]=6;
  51431. $self._deny_($6);
  51432. $ctx1.sendIdx["deny:"]=5;
  51433. $7=true.__eq(false);
  51434. $ctx1.sendIdx["="]=7;
  51435. $self._deny_($7);
  51436. $8=false.__eq(false);
  51437. $ctx1.sendIdx["="]=8;
  51438. $self._assert_($8);
  51439. $ctx1.sendIdx["assert:"]=2;
  51440. $10=true._yourself();
  51441. $ctx1.sendIdx["yourself"]=1;
  51442. $9=$recv($10).__eq(true);
  51443. $ctx1.sendIdx["="]=9;
  51444. $self._assert_($9);
  51445. $ctx1.sendIdx["assert:"]=3;
  51446. $12=true._yourself();
  51447. $ctx1.sendIdx["yourself"]=2;
  51448. $11=$recv($12).__eq(true._yourself());
  51449. $self._assert_($11);
  51450. return self;
  51451. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.BooleanTest)});
  51452. },
  51453. args: [],
  51454. 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)",
  51455. referencedClasses: [],
  51456. messageSends: ["deny:", "=", "assert:", "yourself"]
  51457. }),
  51458. $globals.BooleanTest);
  51459. $core.addMethod(
  51460. $core.method({
  51461. selector: "testIdentity",
  51462. protocol: "tests",
  51463. fn: function (){
  51464. var self=this,$self=this;
  51465. return $core.withContext(function($ctx1) {
  51466. var $1,$2,$3,$4,$5,$6,$7,$8,$10,$9,$12,$11;
  51467. $1=(0).__eq_eq(false);
  51468. $ctx1.sendIdx["=="]=1;
  51469. $self._deny_($1);
  51470. $ctx1.sendIdx["deny:"]=1;
  51471. $2=false.__eq_eq((0));
  51472. $ctx1.sendIdx["=="]=2;
  51473. $self._deny_($2);
  51474. $ctx1.sendIdx["deny:"]=2;
  51475. $3="".__eq_eq(false);
  51476. $ctx1.sendIdx["=="]=3;
  51477. $self._deny_($3);
  51478. $ctx1.sendIdx["deny:"]=3;
  51479. $4=false.__eq_eq("");
  51480. $ctx1.sendIdx["=="]=4;
  51481. $self._deny_($4);
  51482. $ctx1.sendIdx["deny:"]=4;
  51483. $5=true.__eq_eq(true);
  51484. $ctx1.sendIdx["=="]=5;
  51485. $self._assert_($5);
  51486. $ctx1.sendIdx["assert:"]=1;
  51487. $6=false.__eq_eq(true);
  51488. $ctx1.sendIdx["=="]=6;
  51489. $self._deny_($6);
  51490. $ctx1.sendIdx["deny:"]=5;
  51491. $7=true.__eq_eq(false);
  51492. $ctx1.sendIdx["=="]=7;
  51493. $self._deny_($7);
  51494. $8=false.__eq_eq(false);
  51495. $ctx1.sendIdx["=="]=8;
  51496. $self._assert_($8);
  51497. $ctx1.sendIdx["assert:"]=2;
  51498. $10=true._yourself();
  51499. $ctx1.sendIdx["yourself"]=1;
  51500. $9=$recv($10).__eq_eq(true);
  51501. $ctx1.sendIdx["=="]=9;
  51502. $self._assert_($9);
  51503. $ctx1.sendIdx["assert:"]=3;
  51504. $12=true._yourself();
  51505. $ctx1.sendIdx["yourself"]=2;
  51506. $11=$recv($12).__eq_eq(true._yourself());
  51507. $self._assert_($11);
  51508. return self;
  51509. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.BooleanTest)});
  51510. },
  51511. args: [],
  51512. 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",
  51513. referencedClasses: [],
  51514. messageSends: ["deny:", "==", "assert:", "yourself"]
  51515. }),
  51516. $globals.BooleanTest);
  51517. $core.addMethod(
  51518. $core.method({
  51519. selector: "testIfTrueIfFalse",
  51520. protocol: "tests",
  51521. fn: function (){
  51522. var self=this,$self=this;
  51523. return $core.withContext(function($ctx1) {
  51524. var $1,$2,$3,$4,$5,$6,$7,$8;
  51525. if($core.assert(true)){
  51526. $1="alternative block";
  51527. }
  51528. $self._assert_equals_($1,"alternative block");
  51529. $ctx1.sendIdx["assert:equals:"]=1;
  51530. if(!$core.assert(true)){
  51531. $2="alternative block";
  51532. }
  51533. $self._assert_equals_($2,nil);
  51534. $ctx1.sendIdx["assert:equals:"]=2;
  51535. if($core.assert(false)){
  51536. $3="alternative block";
  51537. }
  51538. $self._assert_equals_($3,nil);
  51539. $ctx1.sendIdx["assert:equals:"]=3;
  51540. if(!$core.assert(false)){
  51541. $4="alternative block";
  51542. }
  51543. $self._assert_equals_($4,"alternative block");
  51544. $ctx1.sendIdx["assert:equals:"]=4;
  51545. if($core.assert(false)){
  51546. $5="alternative block";
  51547. } else {
  51548. $5="alternative block2";
  51549. }
  51550. $self._assert_equals_($5,"alternative block2");
  51551. $ctx1.sendIdx["assert:equals:"]=5;
  51552. if($core.assert(false)){
  51553. $6="alternative block2";
  51554. } else {
  51555. $6="alternative block";
  51556. }
  51557. $self._assert_equals_($6,"alternative block");
  51558. $ctx1.sendIdx["assert:equals:"]=6;
  51559. if($core.assert(true)){
  51560. $7="alternative block";
  51561. } else {
  51562. $7="alternative block2";
  51563. }
  51564. $self._assert_equals_($7,"alternative block");
  51565. $ctx1.sendIdx["assert:equals:"]=7;
  51566. if($core.assert(true)){
  51567. $8="alternative block2";
  51568. } else {
  51569. $8="alternative block";
  51570. }
  51571. $self._assert_equals_($8,"alternative block2");
  51572. return self;
  51573. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalse",{},$globals.BooleanTest)});
  51574. },
  51575. args: [],
  51576. 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'.",
  51577. referencedClasses: [],
  51578. messageSends: ["assert:equals:", "ifTrue:", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51579. }),
  51580. $globals.BooleanTest);
  51581. $core.addMethod(
  51582. $core.method({
  51583. selector: "testIfTrueIfFalseWithBoxing",
  51584. protocol: "tests",
  51585. fn: function (){
  51586. var self=this,$self=this;
  51587. return $core.withContext(function($ctx1) {
  51588. var $2,$1,$4,$3,$6,$5,$8,$7,$10,$9,$12,$11,$14,$13,$16,$15;
  51589. $2=true._yourself();
  51590. $ctx1.sendIdx["yourself"]=1;
  51591. if($core.assert($2)){
  51592. $1="alternative block";
  51593. }
  51594. $self._assert_equals_($1,"alternative block");
  51595. $ctx1.sendIdx["assert:equals:"]=1;
  51596. $4=true._yourself();
  51597. $ctx1.sendIdx["yourself"]=2;
  51598. if(!$core.assert($4)){
  51599. $3="alternative block";
  51600. }
  51601. $self._assert_equals_($3,nil);
  51602. $ctx1.sendIdx["assert:equals:"]=2;
  51603. $6=false._yourself();
  51604. $ctx1.sendIdx["yourself"]=3;
  51605. if($core.assert($6)){
  51606. $5="alternative block";
  51607. }
  51608. $self._assert_equals_($5,nil);
  51609. $ctx1.sendIdx["assert:equals:"]=3;
  51610. $8=false._yourself();
  51611. $ctx1.sendIdx["yourself"]=4;
  51612. if(!$core.assert($8)){
  51613. $7="alternative block";
  51614. }
  51615. $self._assert_equals_($7,"alternative block");
  51616. $ctx1.sendIdx["assert:equals:"]=4;
  51617. $10=false._yourself();
  51618. $ctx1.sendIdx["yourself"]=5;
  51619. if($core.assert($10)){
  51620. $9="alternative block";
  51621. } else {
  51622. $9="alternative block2";
  51623. }
  51624. $self._assert_equals_($9,"alternative block2");
  51625. $ctx1.sendIdx["assert:equals:"]=5;
  51626. $12=false._yourself();
  51627. $ctx1.sendIdx["yourself"]=6;
  51628. if($core.assert($12)){
  51629. $11="alternative block2";
  51630. } else {
  51631. $11="alternative block";
  51632. }
  51633. $self._assert_equals_($11,"alternative block");
  51634. $ctx1.sendIdx["assert:equals:"]=6;
  51635. $14=true._yourself();
  51636. $ctx1.sendIdx["yourself"]=7;
  51637. if($core.assert($14)){
  51638. $13="alternative block";
  51639. } else {
  51640. $13="alternative block2";
  51641. }
  51642. $self._assert_equals_($13,"alternative block");
  51643. $ctx1.sendIdx["assert:equals:"]=7;
  51644. $16=true._yourself();
  51645. if($core.assert($16)){
  51646. $15="alternative block2";
  51647. } else {
  51648. $15="alternative block";
  51649. }
  51650. $self._assert_equals_($15,"alternative block2");
  51651. return self;
  51652. }, function($ctx1) {$ctx1.fill(self,"testIfTrueIfFalseWithBoxing",{},$globals.BooleanTest)});
  51653. },
  51654. args: [],
  51655. 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'.",
  51656. referencedClasses: [],
  51657. messageSends: ["assert:equals:", "ifTrue:", "yourself", "ifFalse:", "ifTrue:ifFalse:", "ifFalse:ifTrue:"]
  51658. }),
  51659. $globals.BooleanTest);
  51660. $core.addMethod(
  51661. $core.method({
  51662. selector: "testLogic",
  51663. protocol: "tests",
  51664. fn: function (){
  51665. var self=this,$self=this;
  51666. return $core.withContext(function($ctx1) {
  51667. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$12,$11,$14,$13,$16,$17,$15,$19,$18,$21,$20,$23,$22;
  51668. $1=true.__and(true);
  51669. $ctx1.sendIdx["&"]=1;
  51670. $self._assert_($1);
  51671. $ctx1.sendIdx["assert:"]=1;
  51672. $2=true.__and(false);
  51673. $ctx1.sendIdx["&"]=2;
  51674. $self._deny_($2);
  51675. $ctx1.sendIdx["deny:"]=1;
  51676. $3=false.__and(true);
  51677. $ctx1.sendIdx["&"]=3;
  51678. $self._deny_($3);
  51679. $ctx1.sendIdx["deny:"]=2;
  51680. $5=false.__and(false);
  51681. $ctx1.sendIdx["&"]=4;
  51682. $4=$self._deny_($5);
  51683. $ctx1.sendIdx["deny:"]=3;
  51684. $6=true.__or(true);
  51685. $ctx1.sendIdx["|"]=1;
  51686. $self._assert_($6);
  51687. $ctx1.sendIdx["assert:"]=2;
  51688. $7=true.__or(false);
  51689. $ctx1.sendIdx["|"]=2;
  51690. $self._assert_($7);
  51691. $ctx1.sendIdx["assert:"]=3;
  51692. $8=false.__or(true);
  51693. $ctx1.sendIdx["|"]=3;
  51694. $self._assert_($8);
  51695. $ctx1.sendIdx["assert:"]=4;
  51696. $10=false.__or(false);
  51697. $ctx1.sendIdx["|"]=4;
  51698. $9=$self._deny_($10);
  51699. $ctx1.sendIdx["deny:"]=4;
  51700. $12=(1).__gt((0));
  51701. $ctx1.sendIdx[">"]=1;
  51702. $11=true.__and($12);
  51703. $ctx1.sendIdx["&"]=5;
  51704. $self._assert_($11);
  51705. $ctx1.sendIdx["assert:"]=5;
  51706. $14=(1).__gt((0));
  51707. $ctx1.sendIdx[">"]=2;
  51708. $13=$recv($14).__and(false);
  51709. $ctx1.sendIdx["&"]=6;
  51710. $self._deny_($13);
  51711. $ctx1.sendIdx["deny:"]=5;
  51712. $16=(1).__gt((0));
  51713. $ctx1.sendIdx[">"]=3;
  51714. $17=(1).__gt((2));
  51715. $ctx1.sendIdx[">"]=4;
  51716. $15=$recv($16).__and($17);
  51717. $self._deny_($15);
  51718. $19=(1).__gt((0));
  51719. $ctx1.sendIdx[">"]=5;
  51720. $18=false.__or($19);
  51721. $ctx1.sendIdx["|"]=5;
  51722. $self._assert_($18);
  51723. $ctx1.sendIdx["assert:"]=6;
  51724. $21=(1).__gt((0));
  51725. $ctx1.sendIdx[">"]=6;
  51726. $20=$recv($21).__or(false);
  51727. $ctx1.sendIdx["|"]=6;
  51728. $self._assert_($20);
  51729. $ctx1.sendIdx["assert:"]=7;
  51730. $23=(1).__gt((0));
  51731. $ctx1.sendIdx[">"]=7;
  51732. $22=$recv($23).__or((1).__gt((2)));
  51733. $self._assert_($22);
  51734. return self;
  51735. }, function($ctx1) {$ctx1.fill(self,"testLogic",{},$globals.BooleanTest)});
  51736. },
  51737. args: [],
  51738. 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))",
  51739. referencedClasses: [],
  51740. messageSends: ["assert:", "&", "deny:", "|", ">"]
  51741. }),
  51742. $globals.BooleanTest);
  51743. $core.addMethod(
  51744. $core.method({
  51745. selector: "testLogicKeywords",
  51746. protocol: "tests",
  51747. fn: function (){
  51748. var self=this,$self=this;
  51749. return $core.withContext(function($ctx1) {
  51750. var $1,$2,$3,$5,$4,$6,$7,$8,$10,$9,$11,$13,$12,$15,$14,$16,$18,$17,$20,$19;
  51751. $1=true._and_((function(){
  51752. return true;
  51753. }));
  51754. $ctx1.sendIdx["and:"]=1;
  51755. $self._assert_($1);
  51756. $ctx1.sendIdx["assert:"]=1;
  51757. $2=true._and_((function(){
  51758. return false;
  51759. }));
  51760. $ctx1.sendIdx["and:"]=2;
  51761. $self._deny_($2);
  51762. $ctx1.sendIdx["deny:"]=1;
  51763. $3=false._and_((function(){
  51764. return true;
  51765. }));
  51766. $ctx1.sendIdx["and:"]=3;
  51767. $self._deny_($3);
  51768. $ctx1.sendIdx["deny:"]=2;
  51769. $5=false._and_((function(){
  51770. return false;
  51771. }));
  51772. $ctx1.sendIdx["and:"]=4;
  51773. $4=$self._deny_($5);
  51774. $ctx1.sendIdx["deny:"]=3;
  51775. $6=true._or_((function(){
  51776. return true;
  51777. }));
  51778. $ctx1.sendIdx["or:"]=1;
  51779. $self._assert_($6);
  51780. $ctx1.sendIdx["assert:"]=2;
  51781. $7=true._or_((function(){
  51782. return false;
  51783. }));
  51784. $ctx1.sendIdx["or:"]=2;
  51785. $self._assert_($7);
  51786. $ctx1.sendIdx["assert:"]=3;
  51787. $8=false._or_((function(){
  51788. return true;
  51789. }));
  51790. $ctx1.sendIdx["or:"]=3;
  51791. $self._assert_($8);
  51792. $ctx1.sendIdx["assert:"]=4;
  51793. $10=false._or_((function(){
  51794. return false;
  51795. }));
  51796. $ctx1.sendIdx["or:"]=4;
  51797. $9=$self._deny_($10);
  51798. $ctx1.sendIdx["deny:"]=4;
  51799. $11=true._and_((function(){
  51800. return $core.withContext(function($ctx2) {
  51801. return (1).__gt((0));
  51802. $ctx2.sendIdx[">"]=1;
  51803. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  51804. }));
  51805. $ctx1.sendIdx["and:"]=5;
  51806. $self._assert_($11);
  51807. $ctx1.sendIdx["assert:"]=5;
  51808. $13=(1).__gt((0));
  51809. $ctx1.sendIdx[">"]=2;
  51810. $12=$recv($13)._and_((function(){
  51811. return false;
  51812. }));
  51813. $ctx1.sendIdx["and:"]=6;
  51814. $self._deny_($12);
  51815. $ctx1.sendIdx["deny:"]=5;
  51816. $15=(1).__gt((0));
  51817. $ctx1.sendIdx[">"]=3;
  51818. $14=$recv($15)._and_((function(){
  51819. return $core.withContext(function($ctx2) {
  51820. return (1).__gt((2));
  51821. $ctx2.sendIdx[">"]=4;
  51822. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  51823. }));
  51824. $self._deny_($14);
  51825. $16=false._or_((function(){
  51826. return $core.withContext(function($ctx2) {
  51827. return (1).__gt((0));
  51828. $ctx2.sendIdx[">"]=5;
  51829. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  51830. }));
  51831. $ctx1.sendIdx["or:"]=5;
  51832. $self._assert_($16);
  51833. $ctx1.sendIdx["assert:"]=6;
  51834. $18=(1).__gt((0));
  51835. $ctx1.sendIdx[">"]=6;
  51836. $17=$recv($18)._or_((function(){
  51837. return false;
  51838. }));
  51839. $ctx1.sendIdx["or:"]=6;
  51840. $self._assert_($17);
  51841. $ctx1.sendIdx["assert:"]=7;
  51842. $20=(1).__gt((0));
  51843. $ctx1.sendIdx[">"]=7;
  51844. $19=$recv($20)._or_((function(){
  51845. return $core.withContext(function($ctx2) {
  51846. return (1).__gt((2));
  51847. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  51848. }));
  51849. $self._assert_($19);
  51850. return self;
  51851. }, function($ctx1) {$ctx1.fill(self,"testLogicKeywords",{},$globals.BooleanTest)});
  51852. },
  51853. args: [],
  51854. 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 ])",
  51855. referencedClasses: [],
  51856. messageSends: ["assert:", "and:", "deny:", "or:", ">"]
  51857. }),
  51858. $globals.BooleanTest);
  51859. $core.addMethod(
  51860. $core.method({
  51861. selector: "testNonBooleanError",
  51862. protocol: "tests",
  51863. fn: function (){
  51864. var self=this,$self=this;
  51865. return $core.withContext(function($ctx1) {
  51866. $self._should_raise_((function(){
  51867. return $core.withContext(function($ctx2) {
  51868. if($core.assert("")){
  51869. } else {
  51870. }
  51871. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  51872. }),$globals.NonBooleanReceiver);
  51873. return self;
  51874. }, function($ctx1) {$ctx1.fill(self,"testNonBooleanError",{},$globals.BooleanTest)});
  51875. },
  51876. args: [],
  51877. source: "testNonBooleanError\x0a\x09self should: [ '' ifTrue: [] ifFalse: [] ] raise: NonBooleanReceiver",
  51878. referencedClasses: ["NonBooleanReceiver"],
  51879. messageSends: ["should:raise:", "ifTrue:ifFalse:"]
  51880. }),
  51881. $globals.BooleanTest);
  51882. $core.addClass("ClassBuilderTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  51883. $core.addMethod(
  51884. $core.method({
  51885. selector: "setUp",
  51886. protocol: "running",
  51887. fn: function (){
  51888. var self=this,$self=this;
  51889. return $core.withContext(function($ctx1) {
  51890. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  51891. return self;
  51892. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassBuilderTest)});
  51893. },
  51894. args: [],
  51895. source: "setUp\x0a\x09builder := ClassBuilder new",
  51896. referencedClasses: ["ClassBuilder"],
  51897. messageSends: ["new"]
  51898. }),
  51899. $globals.ClassBuilderTest);
  51900. $core.addMethod(
  51901. $core.method({
  51902. selector: "tearDown",
  51903. protocol: "running",
  51904. fn: function (){
  51905. var self=this,$self=this;
  51906. return $core.withContext(function($ctx1) {
  51907. var $1,$receiver;
  51908. $1=$self["@theClass"];
  51909. if(($receiver = $1) == null || $receiver.a$nil){
  51910. $1;
  51911. } else {
  51912. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  51913. $self._deny_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51914. $self["@theClass"]=nil;
  51915. $self["@theClass"];
  51916. }
  51917. return self;
  51918. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassBuilderTest)});
  51919. },
  51920. args: [],
  51921. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09self deny: (theClass package classes includes: theClass).\x0a\x09\x09theClass := nil ]",
  51922. referencedClasses: ["Smalltalk"],
  51923. messageSends: ["ifNotNil:", "removeClass:", "deny:", "includes:", "classes", "package"]
  51924. }),
  51925. $globals.ClassBuilderTest);
  51926. $core.addMethod(
  51927. $core.method({
  51928. selector: "testAddTrait",
  51929. protocol: "tests",
  51930. fn: function (){
  51931. var self=this,$self=this;
  51932. return $core.withContext(function($ctx1) {
  51933. var $3,$2,$1,$4;
  51934. $self["@theClass"]=$recv($self["@builder"])._addTraitNamed_package_("ObjectMock2","Kernel-Tests");
  51935. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51936. $ctx1.sendIdx["assert:equals:"]=1;
  51937. $3=$recv($self["@theClass"])._package();
  51938. $ctx1.sendIdx["package"]=1;
  51939. $2=$recv($3)._classes();
  51940. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  51941. $self._assert_equals_($1,(1));
  51942. $ctx1.sendIdx["assert:equals:"]=2;
  51943. $4=$recv($self["@theClass"])._package();
  51944. $ctx1.sendIdx["package"]=2;
  51945. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  51946. return self;
  51947. }, function($ctx1) {$ctx1.fill(self,"testAddTrait",{},$globals.ClassBuilderTest)});
  51948. },
  51949. args: [],
  51950. 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",
  51951. referencedClasses: ["ObjectMock"],
  51952. messageSends: ["addTraitNamed:package:", "assert:equals:", "name", "occurrencesOf:", "classes", "package"]
  51953. }),
  51954. $globals.ClassBuilderTest);
  51955. $core.addMethod(
  51956. $core.method({
  51957. selector: "testClassCopy",
  51958. protocol: "tests",
  51959. fn: function (){
  51960. var self=this,$self=this;
  51961. return $core.withContext(function($ctx1) {
  51962. var $2,$1,$4,$3,$6,$7,$5,$9,$8;
  51963. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  51964. $2=$recv($self["@theClass"])._superclass();
  51965. $ctx1.sendIdx["superclass"]=1;
  51966. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  51967. $ctx1.sendIdx["=="]=1;
  51968. $self._assert_($1);
  51969. $ctx1.sendIdx["assert:"]=1;
  51970. $4=$recv($self["@theClass"])._instanceVariableNames();
  51971. $ctx1.sendIdx["instanceVariableNames"]=1;
  51972. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  51973. $ctx1.sendIdx["=="]=2;
  51974. $self._assert_($3);
  51975. $ctx1.sendIdx["assert:"]=2;
  51976. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  51977. $ctx1.sendIdx["assert:equals:"]=1;
  51978. $6=$recv($self["@theClass"])._package();
  51979. $ctx1.sendIdx["package"]=1;
  51980. $7=$recv($globals.ObjectMock)._package();
  51981. $ctx1.sendIdx["package"]=2;
  51982. $5=$recv($6).__eq_eq($7);
  51983. $self._assert_($5);
  51984. $ctx1.sendIdx["assert:"]=3;
  51985. $self._assert_($recv($recv($recv($self["@theClass"])._package())._classes())._includes_($self["@theClass"]));
  51986. $9=$recv($self["@theClass"])._methodDictionary();
  51987. $ctx1.sendIdx["methodDictionary"]=1;
  51988. $8=$recv($9)._keys();
  51989. $ctx1.sendIdx["keys"]=1;
  51990. $self._assert_equals_($8,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  51991. return self;
  51992. }, function($ctx1) {$ctx1.fill(self,"testClassCopy",{},$globals.ClassBuilderTest)});
  51993. },
  51994. args: [],
  51995. 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",
  51996. referencedClasses: ["ObjectMock"],
  51997. messageSends: ["copyClass:named:", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "includes:", "classes", "keys", "methodDictionary"]
  51998. }),
  51999. $globals.ClassBuilderTest);
  52000. $core.addMethod(
  52001. $core.method({
  52002. selector: "testClassMigration",
  52003. protocol: "tests",
  52004. fn: function (){
  52005. var self=this,$self=this;
  52006. var instance,oldClass;
  52007. return $core.withContext(function($ctx1) {
  52008. var $2,$1,$4,$3,$5,$6,$7,$8,$10,$9,$12,$11;
  52009. oldClass=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52010. $2=$recv($globals.Smalltalk)._globals();
  52011. $ctx1.sendIdx["globals"]=1;
  52012. $1=$recv($2)._at_("ObjectMock2");
  52013. $ctx1.sendIdx["at:"]=1;
  52014. instance=$recv($1)._new();
  52015. $4=$recv($globals.Smalltalk)._globals();
  52016. $ctx1.sendIdx["globals"]=2;
  52017. $3=$recv($4)._at_("ObjectMock2");
  52018. $ctx1.sendIdx["at:"]=2;
  52019. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($3,"","Kernel-Tests");
  52020. $5=$recv(oldClass).__eq_eq($globals.ObjectMock2);
  52021. $ctx1.sendIdx["=="]=1;
  52022. $self._deny_($5);
  52023. $ctx1.sendIdx["deny:"]=1;
  52024. $6=$recv($recv($globals.ObjectMock2)._superclass()).__eq_eq($globals.ObjectMock);
  52025. $ctx1.sendIdx["=="]=2;
  52026. $self._assert_($6);
  52027. $ctx1.sendIdx["assert:"]=1;
  52028. $self._assert_($recv($recv($globals.ObjectMock2)._instanceVariableNames())._isEmpty());
  52029. $ctx1.sendIdx["assert:"]=2;
  52030. $7=$recv($globals.ObjectMock2)._selectors();
  52031. $ctx1.sendIdx["selectors"]=1;
  52032. $self._assert_equals_($7,$recv(oldClass)._selectors());
  52033. $ctx1.sendIdx["assert:equals:"]=1;
  52034. $8=$recv($globals.ObjectMock2)._comment();
  52035. $ctx1.sendIdx["comment"]=1;
  52036. $self._assert_equals_($8,$recv(oldClass)._comment());
  52037. $ctx1.sendIdx["assert:equals:"]=2;
  52038. $10=$recv($globals.ObjectMock2)._package();
  52039. $ctx1.sendIdx["package"]=1;
  52040. $9=$recv($10)._name();
  52041. $ctx1.sendIdx["name"]=1;
  52042. $self._assert_equals_($9,"Kernel-Tests");
  52043. $self._assert_($recv($recv($recv($globals.ObjectMock2)._package())._classes())._includes_($globals.ObjectMock2));
  52044. $ctx1.sendIdx["assert:"]=3;
  52045. $12=$recv(instance)._class();
  52046. $ctx1.sendIdx["class"]=1;
  52047. $11=$recv($12).__eq_eq($globals.ObjectMock2);
  52048. $self._deny_($11);
  52049. $self._assert_($recv($recv($recv($globals.Smalltalk)._globals())._at_($recv($recv(instance)._class())._name()))._isNil());
  52050. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  52051. return self;
  52052. }, function($ctx1) {$ctx1.fill(self,"testClassMigration",{instance:instance,oldClass:oldClass},$globals.ClassBuilderTest)});
  52053. },
  52054. args: [],
  52055. 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",
  52056. referencedClasses: ["ObjectMock", "Smalltalk", "ObjectMock2"],
  52057. 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:"]
  52058. }),
  52059. $globals.ClassBuilderTest);
  52060. $core.addMethod(
  52061. $core.method({
  52062. selector: "testClassMigrationWithClassInstanceVariables",
  52063. protocol: "tests",
  52064. fn: function (){
  52065. var self=this,$self=this;
  52066. return $core.withContext(function($ctx1) {
  52067. var $1;
  52068. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52069. $1=$recv($globals.ObjectMock2)._class();
  52070. $ctx1.sendIdx["class"]=1;
  52071. $recv($1)._instanceVariableNames_("foo bar");
  52072. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  52073. $self._assert_equals_($recv($recv($globals.ObjectMock2)._class())._instanceVariableNames(),["foo", "bar"]);
  52074. $recv($globals.Smalltalk)._removeClass_($globals.ObjectMock2);
  52075. return self;
  52076. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithClassInstanceVariables",{},$globals.ClassBuilderTest)});
  52077. },
  52078. args: [],
  52079. 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",
  52080. referencedClasses: ["ObjectMock", "ObjectMock2", "Smalltalk"],
  52081. messageSends: ["copyClass:named:", "instanceVariableNames:", "class", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:equals:", "instanceVariableNames", "removeClass:"]
  52082. }),
  52083. $globals.ClassBuilderTest);
  52084. $core.addMethod(
  52085. $core.method({
  52086. selector: "testClassMigrationWithSubclasses",
  52087. protocol: "tests",
  52088. fn: function (){
  52089. var self=this,$self=this;
  52090. return $core.withContext(function($ctx1) {
  52091. var $2,$1,$4,$3;
  52092. $recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52093. $recv($globals.ObjectMock2)._subclass_instanceVariableNames_package_("ObjectMock3","","Kernel-Tests");
  52094. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=1;
  52095. $recv($globals.ObjectMock3)._subclass_instanceVariableNames_package_("ObjectMock4","","Kernel-Tests");
  52096. $ctx1.sendIdx["subclass:instanceVariableNames:package:"]=2;
  52097. $recv($globals.ObjectMock)._subclass_instanceVariableNames_package_($recv($recv($globals.Smalltalk)._globals())._at_("ObjectMock2"),"","Kernel-Tests");
  52098. $2=$recv($globals.ObjectMock)._subclasses();
  52099. $ctx1.sendIdx["subclasses"]=1;
  52100. $1=$recv($2)._includes_($globals.ObjectMock2);
  52101. $ctx1.sendIdx["includes:"]=1;
  52102. $self._assert_($1);
  52103. $ctx1.sendIdx["assert:"]=1;
  52104. $4=$recv($globals.ObjectMock2)._subclasses();
  52105. $ctx1.sendIdx["subclasses"]=2;
  52106. $3=$recv($4)._includes_($globals.ObjectMock3);
  52107. $ctx1.sendIdx["includes:"]=2;
  52108. $self._assert_($3);
  52109. $ctx1.sendIdx["assert:"]=2;
  52110. $self._assert_($recv($recv($globals.ObjectMock3)._subclasses())._includes_($globals.ObjectMock4));
  52111. $recv($recv($globals.ObjectMock)._allSubclasses())._reverseDo_((function(each){
  52112. return $core.withContext(function($ctx2) {
  52113. return $recv($globals.Smalltalk)._removeClass_(each);
  52114. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52115. }));
  52116. return self;
  52117. }, function($ctx1) {$ctx1.fill(self,"testClassMigrationWithSubclasses",{},$globals.ClassBuilderTest)});
  52118. },
  52119. args: [],
  52120. 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 ]",
  52121. referencedClasses: ["ObjectMock", "ObjectMock2", "ObjectMock3", "Smalltalk", "ObjectMock4"],
  52122. messageSends: ["copyClass:named:", "subclass:instanceVariableNames:package:", "at:", "globals", "assert:", "includes:", "subclasses", "reverseDo:", "allSubclasses", "removeClass:"]
  52123. }),
  52124. $globals.ClassBuilderTest);
  52125. $core.addMethod(
  52126. $core.method({
  52127. selector: "testInstanceVariableNames",
  52128. protocol: "tests",
  52129. fn: function (){
  52130. var self=this,$self=this;
  52131. return $core.withContext(function($ctx1) {
  52132. $self._assert_equals_($recv($self["@builder"])._instanceVariableNamesFor_(" hello world "),["hello", "world"]);
  52133. return self;
  52134. }, function($ctx1) {$ctx1.fill(self,"testInstanceVariableNames",{},$globals.ClassBuilderTest)});
  52135. },
  52136. args: [],
  52137. source: "testInstanceVariableNames\x0a\x09self assert: (builder instanceVariableNamesFor: ' hello world ') equals: #('hello' 'world')",
  52138. referencedClasses: [],
  52139. messageSends: ["assert:equals:", "instanceVariableNamesFor:"]
  52140. }),
  52141. $globals.ClassBuilderTest);
  52142. $core.addMethod(
  52143. $core.method({
  52144. selector: "testSubclass",
  52145. protocol: "tests",
  52146. fn: function (){
  52147. var self=this,$self=this;
  52148. return $core.withContext(function($ctx1) {
  52149. var $3,$2,$1,$4;
  52150. $self["@theClass"]=$recv($self["@builder"])._addSubclassOf_named_instanceVariableNames_package_($globals.ObjectMock,"ObjectMock2","foo bar","Kernel-Tests");
  52151. $self._assert_equals_($recv($self["@theClass"])._superclass(),$globals.ObjectMock);
  52152. $ctx1.sendIdx["assert:equals:"]=1;
  52153. $self._assert_equals_($recv($self["@theClass"])._instanceVariableNames(),"foo bar");
  52154. $ctx1.sendIdx["assert:equals:"]=2;
  52155. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52156. $ctx1.sendIdx["assert:equals:"]=3;
  52157. $3=$recv($self["@theClass"])._package();
  52158. $ctx1.sendIdx["package"]=1;
  52159. $2=$recv($3)._classes();
  52160. $1=$recv($2)._occurrencesOf_($self["@theClass"]);
  52161. $self._assert_equals_($1,(1));
  52162. $ctx1.sendIdx["assert:equals:"]=4;
  52163. $4=$recv($self["@theClass"])._package();
  52164. $ctx1.sendIdx["package"]=2;
  52165. $self._assert_equals_($4,$recv($globals.ObjectMock)._package());
  52166. $ctx1.sendIdx["assert:equals:"]=5;
  52167. $self._assert_equals_($recv($recv($recv($self["@theClass"])._methodDictionary())._keys())._size(),(0));
  52168. return self;
  52169. }, function($ctx1) {$ctx1.fill(self,"testSubclass",{},$globals.ClassBuilderTest)});
  52170. },
  52171. args: [],
  52172. 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",
  52173. referencedClasses: ["ObjectMock"],
  52174. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "assert:equals:", "superclass", "instanceVariableNames", "name", "occurrencesOf:", "classes", "package", "size", "keys", "methodDictionary"]
  52175. }),
  52176. $globals.ClassBuilderTest);
  52177. $core.addClass("ClassTest", $globals.TestCase, ["builder", "theClass"], "Kernel-Tests");
  52178. $core.addMethod(
  52179. $core.method({
  52180. selector: "jsConstructor",
  52181. protocol: "running",
  52182. fn: function (){
  52183. var self=this,$self=this;
  52184. return $core.withContext(function($ctx1) {
  52185. function Foo(){}
  52186. Foo.prototype.valueOf = function () {return 4;};
  52187. return Foo;
  52188. ;
  52189. return self;
  52190. }, function($ctx1) {$ctx1.fill(self,"jsConstructor",{},$globals.ClassTest)});
  52191. },
  52192. args: [],
  52193. source: "jsConstructor\x0a\x09<inlineJS: '\x0a\x09\x09function Foo(){}\x0a\x09\x09Foo.prototype.valueOf = function () {return 4;};\x0a\x09\x09return Foo;\x0a\x09'>",
  52194. referencedClasses: [],
  52195. messageSends: []
  52196. }),
  52197. $globals.ClassTest);
  52198. $core.addMethod(
  52199. $core.method({
  52200. selector: "setUp",
  52201. protocol: "running",
  52202. fn: function (){
  52203. var self=this,$self=this;
  52204. return $core.withContext(function($ctx1) {
  52205. $self["@builder"]=$recv($globals.ClassBuilder)._new();
  52206. return self;
  52207. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ClassTest)});
  52208. },
  52209. args: [],
  52210. source: "setUp\x0a\x09builder := ClassBuilder new",
  52211. referencedClasses: ["ClassBuilder"],
  52212. messageSends: ["new"]
  52213. }),
  52214. $globals.ClassTest);
  52215. $core.addMethod(
  52216. $core.method({
  52217. selector: "tearDown",
  52218. protocol: "running",
  52219. fn: function (){
  52220. var self=this,$self=this;
  52221. return $core.withContext(function($ctx1) {
  52222. var $1,$receiver;
  52223. $1=$self["@theClass"];
  52224. if(($receiver = $1) == null || $receiver.a$nil){
  52225. $1;
  52226. } else {
  52227. $recv($recv($self["@theClass"])._allSubclasses())._reverseDo_((function(each){
  52228. return $core.withContext(function($ctx2) {
  52229. return $recv($globals.Smalltalk)._removeClass_(each);
  52230. $ctx2.sendIdx["removeClass:"]=1;
  52231. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52232. }));
  52233. $recv($globals.Smalltalk)._removeClass_($self["@theClass"]);
  52234. $self["@theClass"]=nil;
  52235. $self["@theClass"];
  52236. }
  52237. return self;
  52238. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.ClassTest)});
  52239. },
  52240. args: [],
  52241. source: "tearDown\x0a\x09theClass ifNotNil: [\x0a\x09\x09theClass allSubclasses reverseDo: [ :each | Smalltalk removeClass: each ].\x0a\x09\x09Smalltalk removeClass: theClass.\x0a\x09\x09theClass := nil ]",
  52242. referencedClasses: ["Smalltalk"],
  52243. messageSends: ["ifNotNil:", "reverseDo:", "allSubclasses", "removeClass:"]
  52244. }),
  52245. $globals.ClassTest);
  52246. $core.addMethod(
  52247. $core.method({
  52248. selector: "testAllSubclasses",
  52249. protocol: "tests",
  52250. fn: function (){
  52251. var self=this,$self=this;
  52252. var subclasses,index;
  52253. return $core.withContext(function($ctx1) {
  52254. subclasses=$recv($globals.Object)._subclasses();
  52255. $ctx1.sendIdx["subclasses"]=1;
  52256. index=(1);
  52257. $recv((function(){
  52258. return $core.withContext(function($ctx2) {
  52259. return $recv(index).__gt($recv(subclasses)._size());
  52260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52261. }))._whileFalse_((function(){
  52262. return $core.withContext(function($ctx2) {
  52263. $recv(subclasses)._addAll_($recv($recv(subclasses)._at_(index))._subclasses());
  52264. index=$recv(index).__plus((1));
  52265. return index;
  52266. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  52267. }));
  52268. $self._assert_equals_($recv($globals.Object)._allSubclasses(),subclasses);
  52269. return self;
  52270. }, function($ctx1) {$ctx1.fill(self,"testAllSubclasses",{subclasses:subclasses,index:index},$globals.ClassTest)});
  52271. },
  52272. args: [],
  52273. 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",
  52274. referencedClasses: ["Object"],
  52275. messageSends: ["subclasses", "whileFalse:", ">", "size", "addAll:", "at:", "+", "assert:equals:", "allSubclasses"]
  52276. }),
  52277. $globals.ClassTest);
  52278. $core.addMethod(
  52279. $core.method({
  52280. selector: "testMetaclassSubclasses",
  52281. protocol: "tests",
  52282. fn: function (){
  52283. var self=this,$self=this;
  52284. var subclasses;
  52285. return $core.withContext(function($ctx1) {
  52286. var $4,$3,$2,$1;
  52287. $4=$recv($globals.Object)._class();
  52288. $ctx1.sendIdx["class"]=1;
  52289. $3=$recv($4)._instanceClass();
  52290. $2=$recv($3)._subclasses();
  52291. $ctx1.sendIdx["subclasses"]=1;
  52292. $1=$recv($2)._select_((function(each){
  52293. return $core.withContext(function($ctx2) {
  52294. return $recv($recv(each)._isMetaclass())._not();
  52295. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52296. }));
  52297. subclasses=$recv($1)._collect_((function(each){
  52298. return $core.withContext(function($ctx2) {
  52299. return $recv(each)._theMetaClass();
  52300. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52301. }));
  52302. $self._assert_equals_($recv($recv($globals.Object)._class())._subclasses(),subclasses);
  52303. return self;
  52304. }, function($ctx1) {$ctx1.fill(self,"testMetaclassSubclasses",{subclasses:subclasses},$globals.ClassTest)});
  52305. },
  52306. args: [],
  52307. 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",
  52308. referencedClasses: ["Object"],
  52309. messageSends: ["collect:", "select:", "subclasses", "instanceClass", "class", "not", "isMetaclass", "theMetaClass", "assert:equals:"]
  52310. }),
  52311. $globals.ClassTest);
  52312. $core.addMethod(
  52313. $core.method({
  52314. selector: "testSetJavaScriptConstructor",
  52315. protocol: "tests",
  52316. fn: function (){
  52317. var self=this,$self=this;
  52318. var instance;
  52319. return $core.withContext(function($ctx1) {
  52320. var $2,$1,$4,$3,$6,$5,$8,$7;
  52321. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52322. $recv($self["@theClass"])._javascriptConstructor_($self._jsConstructor());
  52323. $2=$recv($self["@theClass"])._superclass();
  52324. $ctx1.sendIdx["superclass"]=1;
  52325. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52326. $ctx1.sendIdx["=="]=1;
  52327. $self._assert_($1);
  52328. $ctx1.sendIdx["assert:"]=1;
  52329. $4=$recv($self["@theClass"])._instanceVariableNames();
  52330. $ctx1.sendIdx["instanceVariableNames"]=1;
  52331. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52332. $ctx1.sendIdx["=="]=2;
  52333. $self._assert_($3);
  52334. $ctx1.sendIdx["assert:"]=2;
  52335. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52336. $ctx1.sendIdx["assert:equals:"]=1;
  52337. $6=$recv($self["@theClass"])._package();
  52338. $ctx1.sendIdx["package"]=1;
  52339. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52340. $ctx1.sendIdx["=="]=3;
  52341. $self._assert_($5);
  52342. $ctx1.sendIdx["assert:"]=3;
  52343. $8=$recv($self["@theClass"])._methodDictionary();
  52344. $ctx1.sendIdx["methodDictionary"]=1;
  52345. $7=$recv($8)._keys();
  52346. $ctx1.sendIdx["keys"]=1;
  52347. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52348. $ctx1.sendIdx["assert:equals:"]=2;
  52349. instance=$recv($self["@theClass"])._new();
  52350. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52351. $self._assert_equals_($recv(instance)._value(),(4));
  52352. $ctx1.sendIdx["assert:equals:"]=3;
  52353. $self._shouldnt_raise_((function(){
  52354. return $core.withContext(function($ctx2) {
  52355. return $recv(instance)._foo_((9));
  52356. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52357. }),$globals.Error);
  52358. $self._assert_equals_($recv(instance)._foo(),(9));
  52359. return self;
  52360. }, function($ctx1) {$ctx1.fill(self,"testSetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52361. },
  52362. args: [],
  52363. 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",
  52364. referencedClasses: ["ObjectMock", "Error"],
  52365. messageSends: ["copyClass:named:", "javascriptConstructor:", "jsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52366. }),
  52367. $globals.ClassTest);
  52368. $core.addMethod(
  52369. $core.method({
  52370. selector: "testTrickySetJavaScriptConstructor",
  52371. protocol: "tests",
  52372. fn: function (){
  52373. var self=this,$self=this;
  52374. var instance;
  52375. return $core.withContext(function($ctx1) {
  52376. var $2,$1,$4,$3,$6,$5,$8,$7;
  52377. $self["@theClass"]=$recv($self["@builder"])._copyClass_named_($globals.ObjectMock,"ObjectMock2");
  52378. $recv($self["@theClass"])._javascriptConstructor_($self._trickyJsConstructor());
  52379. $2=$recv($self["@theClass"])._superclass();
  52380. $ctx1.sendIdx["superclass"]=1;
  52381. $1=$recv($2).__eq_eq($recv($globals.ObjectMock)._superclass());
  52382. $ctx1.sendIdx["=="]=1;
  52383. $self._assert_($1);
  52384. $ctx1.sendIdx["assert:"]=1;
  52385. $4=$recv($self["@theClass"])._instanceVariableNames();
  52386. $ctx1.sendIdx["instanceVariableNames"]=1;
  52387. $3=$recv($4).__eq_eq($recv($globals.ObjectMock)._instanceVariableNames());
  52388. $ctx1.sendIdx["=="]=2;
  52389. $self._assert_($3);
  52390. $ctx1.sendIdx["assert:"]=2;
  52391. $self._assert_equals_($recv($self["@theClass"])._name(),"ObjectMock2");
  52392. $ctx1.sendIdx["assert:equals:"]=1;
  52393. $6=$recv($self["@theClass"])._package();
  52394. $ctx1.sendIdx["package"]=1;
  52395. $5=$recv($6).__eq_eq($recv($globals.ObjectMock)._package());
  52396. $ctx1.sendIdx["=="]=3;
  52397. $self._assert_($5);
  52398. $ctx1.sendIdx["assert:"]=3;
  52399. $8=$recv($self["@theClass"])._methodDictionary();
  52400. $ctx1.sendIdx["methodDictionary"]=1;
  52401. $7=$recv($8)._keys();
  52402. $ctx1.sendIdx["keys"]=1;
  52403. $self._assert_equals_($7,$recv($recv($globals.ObjectMock)._methodDictionary())._keys());
  52404. $ctx1.sendIdx["assert:equals:"]=2;
  52405. instance=$recv($self["@theClass"])._new();
  52406. $self._assert_($recv($recv(instance)._class()).__eq_eq($self["@theClass"]));
  52407. $self._assert_equals_($recv(instance)._value(),(4));
  52408. $ctx1.sendIdx["assert:equals:"]=3;
  52409. $self._shouldnt_raise_((function(){
  52410. return $core.withContext(function($ctx2) {
  52411. return $recv(instance)._foo_((9));
  52412. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52413. }),$globals.Error);
  52414. $self._assert_equals_($recv(instance)._foo(),(9));
  52415. return self;
  52416. }, function($ctx1) {$ctx1.fill(self,"testTrickySetJavaScriptConstructor",{instance:instance},$globals.ClassTest)});
  52417. },
  52418. args: [],
  52419. 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",
  52420. referencedClasses: ["ObjectMock", "Error"],
  52421. messageSends: ["copyClass:named:", "javascriptConstructor:", "trickyJsConstructor", "assert:", "==", "superclass", "instanceVariableNames", "assert:equals:", "name", "package", "keys", "methodDictionary", "new", "class", "value", "shouldnt:raise:", "foo:", "foo"]
  52422. }),
  52423. $globals.ClassTest);
  52424. $core.addMethod(
  52425. $core.method({
  52426. selector: "trickyJsConstructor",
  52427. protocol: "running",
  52428. fn: function (){
  52429. var self=this,$self=this;
  52430. return $core.withContext(function($ctx1) {
  52431. function Foo(){}
  52432. Foo.prototype.valueOf = function () {return 4;};
  52433. Foo.prototype._foo = function () {return "bar";};
  52434. return Foo;
  52435. ;
  52436. return self;
  52437. }, function($ctx1) {$ctx1.fill(self,"trickyJsConstructor",{},$globals.ClassTest)});
  52438. },
  52439. args: [],
  52440. 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'>",
  52441. referencedClasses: [],
  52442. messageSends: []
  52443. }),
  52444. $globals.ClassTest);
  52445. $core.addClass("CollectionTest", $globals.TestCase, ["sampleBlock"], "Kernel-Tests");
  52446. $core.addMethod(
  52447. $core.method({
  52448. selector: "assertSameContents:as:",
  52449. protocol: "convenience",
  52450. fn: function (aCollection,anotherCollection){
  52451. var self=this,$self=this;
  52452. return $core.withContext(function($ctx1) {
  52453. var $2,$1,$4,$3;
  52454. $2=$recv(aCollection)._size();
  52455. $ctx1.sendIdx["size"]=1;
  52456. $1=$recv($2).__eq($recv(anotherCollection)._size());
  52457. $ctx1.sendIdx["="]=1;
  52458. $self._assert_($1);
  52459. $ctx1.sendIdx["assert:"]=1;
  52460. $recv(aCollection)._do_((function(each){
  52461. return $core.withContext(function($ctx2) {
  52462. $4=$recv(aCollection)._occurrencesOf_(each);
  52463. $ctx2.sendIdx["occurrencesOf:"]=1;
  52464. $3=$recv($4).__eq($recv(anotherCollection)._occurrencesOf_(each));
  52465. return $self._assert_($3);
  52466. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52467. }));
  52468. return self;
  52469. }, function($ctx1) {$ctx1.fill(self,"assertSameContents:as:",{aCollection:aCollection,anotherCollection:anotherCollection},$globals.CollectionTest)});
  52470. },
  52471. args: ["aCollection", "anotherCollection"],
  52472. 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)) ]",
  52473. referencedClasses: [],
  52474. messageSends: ["assert:", "=", "size", "do:", "occurrencesOf:"]
  52475. }),
  52476. $globals.CollectionTest);
  52477. $core.addMethod(
  52478. $core.method({
  52479. selector: "collection",
  52480. protocol: "fixture",
  52481. fn: function (){
  52482. var self=this,$self=this;
  52483. return $core.withContext(function($ctx1) {
  52484. $self._subclassResponsibility();
  52485. return self;
  52486. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.CollectionTest)});
  52487. },
  52488. args: [],
  52489. source: "collection\x0a\x09\x22Answers pre-filled collection of type tested.\x22\x0a\x0a\x09self subclassResponsibility",
  52490. referencedClasses: [],
  52491. messageSends: ["subclassResponsibility"]
  52492. }),
  52493. $globals.CollectionTest);
  52494. $core.addMethod(
  52495. $core.method({
  52496. selector: "collectionClass",
  52497. protocol: "fixture",
  52498. fn: function (){
  52499. var self=this,$self=this;
  52500. return $core.withContext(function($ctx1) {
  52501. return $recv($self._class())._collectionClass();
  52502. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.CollectionTest)});
  52503. },
  52504. args: [],
  52505. source: "collectionClass\x0a\x09\x22Answers class of collection type tested\x22\x0a\x0a\x09^ self class collectionClass",
  52506. referencedClasses: [],
  52507. messageSends: ["collectionClass", "class"]
  52508. }),
  52509. $globals.CollectionTest);
  52510. $core.addMethod(
  52511. $core.method({
  52512. selector: "collectionOfPrintStrings",
  52513. protocol: "fixture",
  52514. fn: function (){
  52515. var self=this,$self=this;
  52516. return $core.withContext(function($ctx1) {
  52517. $self._subclassResponsibility();
  52518. return self;
  52519. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.CollectionTest)});
  52520. },
  52521. args: [],
  52522. source: "collectionOfPrintStrings\x0a\x09\x22Answers self collection but with values\x0a\x09changed to their printStrings\x22\x0a\x0a\x09self subclassResponsibility",
  52523. referencedClasses: [],
  52524. messageSends: ["subclassResponsibility"]
  52525. }),
  52526. $globals.CollectionTest);
  52527. $core.addMethod(
  52528. $core.method({
  52529. selector: "collectionSize",
  52530. protocol: "fixture",
  52531. fn: function (){
  52532. var self=this,$self=this;
  52533. return $core.withContext(function($ctx1) {
  52534. $self._subclassResponsibility();
  52535. return self;
  52536. }, function($ctx1) {$ctx1.fill(self,"collectionSize",{},$globals.CollectionTest)});
  52537. },
  52538. args: [],
  52539. source: "collectionSize\x0a\x09\x22Answers size of self collection.\x22\x0a\x0a\x09self subclassResponsibility",
  52540. referencedClasses: [],
  52541. messageSends: ["subclassResponsibility"]
  52542. }),
  52543. $globals.CollectionTest);
  52544. $core.addMethod(
  52545. $core.method({
  52546. selector: "collectionWithDuplicates",
  52547. protocol: "fixture",
  52548. fn: function (){
  52549. var self=this,$self=this;
  52550. return $core.withContext(function($ctx1) {
  52551. $self._subclassResponsibility();
  52552. return self;
  52553. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.CollectionTest)});
  52554. },
  52555. args: [],
  52556. 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",
  52557. referencedClasses: [],
  52558. messageSends: ["subclassResponsibility"]
  52559. }),
  52560. $globals.CollectionTest);
  52561. $core.addMethod(
  52562. $core.method({
  52563. selector: "collectionWithNewValue",
  52564. protocol: "fixture",
  52565. fn: function (){
  52566. var self=this,$self=this;
  52567. return $core.withContext(function($ctx1) {
  52568. $self._subclassResponsibility();
  52569. return self;
  52570. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.CollectionTest)});
  52571. },
  52572. args: [],
  52573. 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",
  52574. referencedClasses: [],
  52575. messageSends: ["subclassResponsibility"]
  52576. }),
  52577. $globals.CollectionTest);
  52578. $core.addMethod(
  52579. $core.method({
  52580. selector: "initialize",
  52581. protocol: "initialization",
  52582. fn: function (){
  52583. var self=this,$self=this;
  52584. return $core.withContext(function($ctx1) {
  52585. (
  52586. $ctx1.supercall = true,
  52587. ($globals.CollectionTest.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  52588. $ctx1.supercall = false;
  52589. $self["@sampleBlock"]=(function(){
  52590. });
  52591. return self;
  52592. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.CollectionTest)});
  52593. },
  52594. args: [],
  52595. source: "initialize\x0a\x09super initialize.\x0a\x0a\x09sampleBlock := []",
  52596. referencedClasses: [],
  52597. messageSends: ["initialize"]
  52598. }),
  52599. $globals.CollectionTest);
  52600. $core.addMethod(
  52601. $core.method({
  52602. selector: "sampleNewValue",
  52603. protocol: "fixture",
  52604. fn: function (){
  52605. var self=this,$self=this;
  52606. return "N";
  52607. },
  52608. args: [],
  52609. 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'",
  52610. referencedClasses: [],
  52611. messageSends: []
  52612. }),
  52613. $globals.CollectionTest);
  52614. $core.addMethod(
  52615. $core.method({
  52616. selector: "sampleNewValueAsCollection",
  52617. protocol: "fixture",
  52618. fn: function (){
  52619. var self=this,$self=this;
  52620. return $core.withContext(function($ctx1) {
  52621. return $recv($self._collectionClass())._with_($self._sampleNewValue());
  52622. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.CollectionTest)});
  52623. },
  52624. args: [],
  52625. 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",
  52626. referencedClasses: [],
  52627. messageSends: ["with:", "collectionClass", "sampleNewValue"]
  52628. }),
  52629. $globals.CollectionTest);
  52630. $core.addMethod(
  52631. $core.method({
  52632. selector: "testAddAll",
  52633. protocol: "tests",
  52634. fn: function (){
  52635. var self=this,$self=this;
  52636. return $core.withContext(function($ctx1) {
  52637. 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;
  52638. $2=$self._collection();
  52639. $ctx1.sendIdx["collection"]=1;
  52640. $4=$self._collectionClass();
  52641. $ctx1.sendIdx["collectionClass"]=1;
  52642. $3=$recv($4)._new();
  52643. $ctx1.sendIdx["new"]=1;
  52644. $recv($2)._addAll_($3);
  52645. $ctx1.sendIdx["addAll:"]=1;
  52646. $5=$recv($2)._yourself();
  52647. $ctx1.sendIdx["yourself"]=1;
  52648. $1=$5;
  52649. $6=$self._collection();
  52650. $ctx1.sendIdx["collection"]=2;
  52651. $self._assert_equals_($1,$6);
  52652. $ctx1.sendIdx["assert:equals:"]=1;
  52653. $9=$self._collectionClass();
  52654. $ctx1.sendIdx["collectionClass"]=2;
  52655. $8=$recv($9)._new();
  52656. $ctx1.sendIdx["new"]=2;
  52657. $10=$self._collection();
  52658. $ctx1.sendIdx["collection"]=3;
  52659. $recv($8)._addAll_($10);
  52660. $ctx1.sendIdx["addAll:"]=2;
  52661. $11=$recv($8)._yourself();
  52662. $ctx1.sendIdx["yourself"]=2;
  52663. $7=$11;
  52664. $12=$self._collection();
  52665. $ctx1.sendIdx["collection"]=4;
  52666. $self._assert_equals_($7,$12);
  52667. $ctx1.sendIdx["assert:equals:"]=2;
  52668. $15=$self._collectionClass();
  52669. $ctx1.sendIdx["collectionClass"]=3;
  52670. $14=$recv($15)._new();
  52671. $ctx1.sendIdx["new"]=3;
  52672. $17=$self._collectionClass();
  52673. $ctx1.sendIdx["collectionClass"]=4;
  52674. $16=$recv($17)._new();
  52675. $ctx1.sendIdx["new"]=4;
  52676. $recv($14)._addAll_($16);
  52677. $ctx1.sendIdx["addAll:"]=3;
  52678. $18=$recv($14)._yourself();
  52679. $ctx1.sendIdx["yourself"]=3;
  52680. $13=$18;
  52681. $self._assert_equals_($13,$recv($self._collectionClass())._new());
  52682. $ctx1.sendIdx["assert:equals:"]=3;
  52683. $20=$self._collection();
  52684. $ctx1.sendIdx["collection"]=5;
  52685. $21=$self._sampleNewValueAsCollection();
  52686. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52687. $recv($20)._addAll_($21);
  52688. $ctx1.sendIdx["addAll:"]=4;
  52689. $22=$recv($20)._yourself();
  52690. $ctx1.sendIdx["yourself"]=4;
  52691. $19=$22;
  52692. $23=$self._collectionWithNewValue();
  52693. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52694. $self._assert_equals_($19,$23);
  52695. $25=$self._sampleNewValueAsCollection();
  52696. $recv($25)._addAll_($self._collection());
  52697. $24=$recv($25)._yourself();
  52698. $self._assertSameContents_as_($24,$self._collectionWithNewValue());
  52699. return self;
  52700. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.CollectionTest)});
  52701. },
  52702. args: [],
  52703. 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",
  52704. referencedClasses: [],
  52705. messageSends: ["assert:equals:", "addAll:", "collection", "new", "collectionClass", "yourself", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52706. }),
  52707. $globals.CollectionTest);
  52708. $core.addMethod(
  52709. $core.method({
  52710. selector: "testAllSatisfy",
  52711. protocol: "tests",
  52712. fn: function (){
  52713. var self=this,$self=this;
  52714. var collection,anyOne;
  52715. return $core.withContext(function($ctx1) {
  52716. var $1;
  52717. collection=$self._collection();
  52718. anyOne=$recv(collection)._anyOne();
  52719. $1=$recv(collection)._allSatisfy_((function(each){
  52720. return $core.withContext(function($ctx2) {
  52721. return $recv(collection)._includes_(each);
  52722. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52723. }));
  52724. $ctx1.sendIdx["allSatisfy:"]=1;
  52725. $self._assert_($1);
  52726. $self._deny_($recv(collection)._allSatisfy_((function(each){
  52727. return $core.withContext(function($ctx2) {
  52728. return $recv(each).__tild_eq(anyOne);
  52729. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52730. })));
  52731. return self;
  52732. }, function($ctx1) {$ctx1.fill(self,"testAllSatisfy",{collection:collection,anyOne:anyOne},$globals.CollectionTest)});
  52733. },
  52734. args: [],
  52735. 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 ])",
  52736. referencedClasses: [],
  52737. messageSends: ["collection", "anyOne", "assert:", "allSatisfy:", "includes:", "deny:", "~="]
  52738. }),
  52739. $globals.CollectionTest);
  52740. $core.addMethod(
  52741. $core.method({
  52742. selector: "testAnyOne",
  52743. protocol: "tests",
  52744. fn: function (){
  52745. var self=this,$self=this;
  52746. return $core.withContext(function($ctx1) {
  52747. var $2,$1;
  52748. $self._should_raise_((function(){
  52749. return $core.withContext(function($ctx2) {
  52750. return $recv($recv($self._collectionClass())._new())._anyOne();
  52751. $ctx2.sendIdx["anyOne"]=1;
  52752. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  52753. }),$globals.Error);
  52754. $2=$self._collection();
  52755. $ctx1.sendIdx["collection"]=1;
  52756. $1=$recv($2)._includes_($recv($self._collection())._anyOne());
  52757. $self._assert_($1);
  52758. return self;
  52759. }, function($ctx1) {$ctx1.fill(self,"testAnyOne",{},$globals.CollectionTest)});
  52760. },
  52761. args: [],
  52762. source: "testAnyOne\x0a\x09self should: [ self collectionClass new anyOne ] raise: Error.\x0a\x09self assert: (self collection includes: self collection anyOne)",
  52763. referencedClasses: ["Error"],
  52764. messageSends: ["should:raise:", "anyOne", "new", "collectionClass", "assert:", "includes:", "collection"]
  52765. }),
  52766. $globals.CollectionTest);
  52767. $core.addMethod(
  52768. $core.method({
  52769. selector: "testAnySatisfy",
  52770. protocol: "tests",
  52771. fn: function (){
  52772. var self=this,$self=this;
  52773. var anyOne;
  52774. return $core.withContext(function($ctx1) {
  52775. var $1,$3,$2;
  52776. $1=$self._collection();
  52777. $ctx1.sendIdx["collection"]=1;
  52778. anyOne=$recv($1)._anyOne();
  52779. $3=$self._collection();
  52780. $ctx1.sendIdx["collection"]=2;
  52781. $2=$recv($3)._anySatisfy_((function(each){
  52782. return $core.withContext(function($ctx2) {
  52783. return $recv(each).__eq(anyOne);
  52784. $ctx2.sendIdx["="]=1;
  52785. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52786. }));
  52787. $ctx1.sendIdx["anySatisfy:"]=1;
  52788. $self._assert_($2);
  52789. $self._deny_($recv($self._collection())._anySatisfy_((function(each){
  52790. return $core.withContext(function($ctx2) {
  52791. return $recv(each).__eq($recv($globals.Object)._new());
  52792. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  52793. })));
  52794. return self;
  52795. }, function($ctx1) {$ctx1.fill(self,"testAnySatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  52796. },
  52797. args: [],
  52798. 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 ])",
  52799. referencedClasses: ["Object"],
  52800. messageSends: ["anyOne", "collection", "assert:", "anySatisfy:", "=", "deny:", "new"]
  52801. }),
  52802. $globals.CollectionTest);
  52803. $core.addMethod(
  52804. $core.method({
  52805. selector: "testAsArray",
  52806. protocol: "tests",
  52807. fn: function (){
  52808. var self=this,$self=this;
  52809. return $core.withContext(function($ctx1) {
  52810. var $1;
  52811. $1=$self._collection();
  52812. $ctx1.sendIdx["collection"]=1;
  52813. $self._assertSameContents_as_($1,$recv($self._collection())._asArray());
  52814. return self;
  52815. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.CollectionTest)});
  52816. },
  52817. args: [],
  52818. source: "testAsArray\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asArray",
  52819. referencedClasses: [],
  52820. messageSends: ["assertSameContents:as:", "collection", "asArray"]
  52821. }),
  52822. $globals.CollectionTest);
  52823. $core.addMethod(
  52824. $core.method({
  52825. selector: "testAsOrderedCollection",
  52826. protocol: "tests",
  52827. fn: function (){
  52828. var self=this,$self=this;
  52829. return $core.withContext(function($ctx1) {
  52830. var $1;
  52831. $1=$self._collection();
  52832. $ctx1.sendIdx["collection"]=1;
  52833. $self._assertSameContents_as_($1,$recv($self._collection())._asOrderedCollection());
  52834. return self;
  52835. }, function($ctx1) {$ctx1.fill(self,"testAsOrderedCollection",{},$globals.CollectionTest)});
  52836. },
  52837. args: [],
  52838. source: "testAsOrderedCollection\x0a\x09self\x0a\x09\x09assertSameContents: self collection\x0a\x09\x09as: self collection asOrderedCollection",
  52839. referencedClasses: [],
  52840. messageSends: ["assertSameContents:as:", "collection", "asOrderedCollection"]
  52841. }),
  52842. $globals.CollectionTest);
  52843. $core.addMethod(
  52844. $core.method({
  52845. selector: "testAsSet",
  52846. protocol: "tests",
  52847. fn: function (){
  52848. var self=this,$self=this;
  52849. var c,set;
  52850. return $core.withContext(function($ctx1) {
  52851. c=$self._collectionWithDuplicates();
  52852. set=$recv(c)._asSet();
  52853. $self._assert_equals_($recv(set)._size(),(6));
  52854. $recv(c)._do_((function(each){
  52855. return $core.withContext(function($ctx2) {
  52856. return $self._assert_($recv(set)._includes_(each));
  52857. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  52858. }));
  52859. return self;
  52860. }, function($ctx1) {$ctx1.fill(self,"testAsSet",{c:c,set:set},$globals.CollectionTest)});
  52861. },
  52862. args: [],
  52863. 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) ]",
  52864. referencedClasses: [],
  52865. messageSends: ["collectionWithDuplicates", "asSet", "assert:equals:", "size", "do:", "assert:", "includes:"]
  52866. }),
  52867. $globals.CollectionTest);
  52868. $core.addMethod(
  52869. $core.method({
  52870. selector: "testCollect",
  52871. protocol: "tests",
  52872. fn: function (){
  52873. var self=this,$self=this;
  52874. return $core.withContext(function($ctx1) {
  52875. var $2,$1,$3,$5,$4,$8,$7,$6,$11,$10,$9;
  52876. $2=$self._collection();
  52877. $ctx1.sendIdx["collection"]=1;
  52878. $1=$recv($2)._collect_((function(each){
  52879. return each;
  52880. }));
  52881. $ctx1.sendIdx["collect:"]=1;
  52882. $3=$self._collection();
  52883. $ctx1.sendIdx["collection"]=2;
  52884. $self._assert_equals_($1,$3);
  52885. $ctx1.sendIdx["assert:equals:"]=1;
  52886. $5=$self._collectionWithNewValue();
  52887. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52888. $4=$recv($5)._collect_((function(each){
  52889. return each;
  52890. }));
  52891. $ctx1.sendIdx["collect:"]=2;
  52892. $self._assert_equals_($4,$self._collectionWithNewValue());
  52893. $ctx1.sendIdx["assert:equals:"]=2;
  52894. $8=$self._collectionClass();
  52895. $ctx1.sendIdx["collectionClass"]=1;
  52896. $7=$recv($8)._new();
  52897. $ctx1.sendIdx["new"]=1;
  52898. $6=$recv($7)._collect_((function(each){
  52899. return $core.withContext(function($ctx2) {
  52900. return $recv(each)._printString();
  52901. $ctx2.sendIdx["printString"]=1;
  52902. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  52903. }));
  52904. $ctx1.sendIdx["collect:"]=3;
  52905. $self._assert_equals_($6,$recv($self._collectionClass())._new());
  52906. $ctx1.sendIdx["assert:equals:"]=3;
  52907. $11=$self._collection();
  52908. $ctx1.sendIdx["collection"]=3;
  52909. $10=$recv($11)._collect_((function(){
  52910. return $core.withContext(function($ctx2) {
  52911. return $self._sampleNewValue();
  52912. $ctx2.sendIdx["sampleNewValue"]=1;
  52913. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  52914. }));
  52915. $ctx1.sendIdx["collect:"]=4;
  52916. $9=$recv($10)._detect_((function(){
  52917. return true;
  52918. }));
  52919. $self._assert_equals_($9,$self._sampleNewValue());
  52920. $ctx1.sendIdx["assert:equals:"]=4;
  52921. $self._assert_equals_($recv($self._collection())._collect_((function(each){
  52922. return $core.withContext(function($ctx2) {
  52923. return $recv(each)._printString();
  52924. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  52925. })),$self._collectionOfPrintStrings());
  52926. return self;
  52927. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.CollectionTest)});
  52928. },
  52929. args: [],
  52930. 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",
  52931. referencedClasses: [],
  52932. messageSends: ["assert:equals:", "collect:", "collection", "collectionWithNewValue", "new", "collectionClass", "printString", "detect:", "sampleNewValue", "collectionOfPrintStrings"]
  52933. }),
  52934. $globals.CollectionTest);
  52935. $core.addMethod(
  52936. $core.method({
  52937. selector: "testComma",
  52938. protocol: "tests",
  52939. fn: function (){
  52940. var self=this,$self=this;
  52941. return $core.withContext(function($ctx1) {
  52942. var $2,$4,$3,$1,$5,$8,$7,$9,$6,$10,$13,$12,$15,$14,$11,$17,$18,$16,$19;
  52943. $2=$self._collection();
  52944. $ctx1.sendIdx["collection"]=1;
  52945. $4=$self._collectionClass();
  52946. $ctx1.sendIdx["collectionClass"]=1;
  52947. $3=$recv($4)._new();
  52948. $ctx1.sendIdx["new"]=1;
  52949. $1=$recv($2).__comma($3);
  52950. $ctx1.sendIdx[","]=1;
  52951. $5=$self._collection();
  52952. $ctx1.sendIdx["collection"]=2;
  52953. $self._assert_equals_($1,$5);
  52954. $ctx1.sendIdx["assert:equals:"]=1;
  52955. $8=$self._collectionClass();
  52956. $ctx1.sendIdx["collectionClass"]=2;
  52957. $7=$recv($8)._new();
  52958. $ctx1.sendIdx["new"]=2;
  52959. $9=$self._collection();
  52960. $ctx1.sendIdx["collection"]=3;
  52961. $6=$recv($7).__comma($9);
  52962. $ctx1.sendIdx[","]=2;
  52963. $10=$self._collection();
  52964. $ctx1.sendIdx["collection"]=4;
  52965. $self._assert_equals_($6,$10);
  52966. $ctx1.sendIdx["assert:equals:"]=2;
  52967. $13=$self._collectionClass();
  52968. $ctx1.sendIdx["collectionClass"]=3;
  52969. $12=$recv($13)._new();
  52970. $ctx1.sendIdx["new"]=3;
  52971. $15=$self._collectionClass();
  52972. $ctx1.sendIdx["collectionClass"]=4;
  52973. $14=$recv($15)._new();
  52974. $ctx1.sendIdx["new"]=4;
  52975. $11=$recv($12).__comma($14);
  52976. $ctx1.sendIdx[","]=3;
  52977. $self._assert_equals_($11,$recv($self._collectionClass())._new());
  52978. $ctx1.sendIdx["assert:equals:"]=3;
  52979. $17=$self._collection();
  52980. $ctx1.sendIdx["collection"]=5;
  52981. $18=$self._sampleNewValueAsCollection();
  52982. $ctx1.sendIdx["sampleNewValueAsCollection"]=1;
  52983. $16=$recv($17).__comma($18);
  52984. $ctx1.sendIdx[","]=4;
  52985. $19=$self._collectionWithNewValue();
  52986. $ctx1.sendIdx["collectionWithNewValue"]=1;
  52987. $self._assert_equals_($16,$19);
  52988. $self._assertSameContents_as_($recv($self._sampleNewValueAsCollection()).__comma($self._collection()),$self._collectionWithNewValue());
  52989. return self;
  52990. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.CollectionTest)});
  52991. },
  52992. args: [],
  52993. 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",
  52994. referencedClasses: [],
  52995. messageSends: ["assert:equals:", ",", "collection", "new", "collectionClass", "sampleNewValueAsCollection", "collectionWithNewValue", "assertSameContents:as:"]
  52996. }),
  52997. $globals.CollectionTest);
  52998. $core.addMethod(
  52999. $core.method({
  53000. selector: "testCopy",
  53001. protocol: "tests",
  53002. fn: function (){
  53003. var self=this,$self=this;
  53004. return $core.withContext(function($ctx1) {
  53005. var $3,$2,$1,$5,$4,$7,$6,$8,$10,$9,$11,$15,$14,$13,$16,$12,$19,$18,$17;
  53006. $3=$self._collectionClass();
  53007. $ctx1.sendIdx["collectionClass"]=1;
  53008. $2=$recv($3)._new();
  53009. $ctx1.sendIdx["new"]=1;
  53010. $1=$recv($2)._copy();
  53011. $ctx1.sendIdx["copy"]=1;
  53012. $5=$self._collectionClass();
  53013. $ctx1.sendIdx["collectionClass"]=2;
  53014. $4=$recv($5)._new();
  53015. $ctx1.sendIdx["new"]=2;
  53016. $self._assert_equals_($1,$4);
  53017. $ctx1.sendIdx["assert:equals:"]=1;
  53018. $7=$self._collection();
  53019. $ctx1.sendIdx["collection"]=1;
  53020. $6=$recv($7)._copy();
  53021. $ctx1.sendIdx["copy"]=2;
  53022. $8=$self._collection();
  53023. $ctx1.sendIdx["collection"]=2;
  53024. $self._assert_equals_($6,$8);
  53025. $ctx1.sendIdx["assert:equals:"]=2;
  53026. $10=$self._collectionWithNewValue();
  53027. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53028. $9=$recv($10)._copy();
  53029. $ctx1.sendIdx["copy"]=3;
  53030. $11=$self._collectionWithNewValue();
  53031. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53032. $self._assert_equals_($9,$11);
  53033. $15=$self._collectionClass();
  53034. $ctx1.sendIdx["collectionClass"]=3;
  53035. $14=$recv($15)._new();
  53036. $ctx1.sendIdx["new"]=3;
  53037. $13=$recv($14)._copy();
  53038. $ctx1.sendIdx["copy"]=4;
  53039. $16=$self._collection();
  53040. $ctx1.sendIdx["collection"]=3;
  53041. $12=$recv($13).__eq($16);
  53042. $ctx1.sendIdx["="]=1;
  53043. $self._deny_($12);
  53044. $ctx1.sendIdx["deny:"]=1;
  53045. $19=$self._collection();
  53046. $ctx1.sendIdx["collection"]=4;
  53047. $18=$recv($19)._copy();
  53048. $ctx1.sendIdx["copy"]=5;
  53049. $17=$recv($18).__eq($recv($self._collectionClass())._new());
  53050. $ctx1.sendIdx["="]=2;
  53051. $self._deny_($17);
  53052. $ctx1.sendIdx["deny:"]=2;
  53053. $self._deny_($recv($recv($self._collection())._copy()).__eq($self._collectionWithNewValue()));
  53054. return self;
  53055. }, function($ctx1) {$ctx1.fill(self,"testCopy",{},$globals.CollectionTest)});
  53056. },
  53057. args: [],
  53058. 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",
  53059. referencedClasses: [],
  53060. messageSends: ["assert:equals:", "copy", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53061. }),
  53062. $globals.CollectionTest);
  53063. $core.addMethod(
  53064. $core.method({
  53065. selector: "testCopySeparates",
  53066. protocol: "tests",
  53067. fn: function (){
  53068. var self=this,$self=this;
  53069. var original,copy;
  53070. return $core.withContext(function($ctx1) {
  53071. original=$self._collection();
  53072. $ctx1.sendIdx["collection"]=1;
  53073. copy=$recv(original)._copy();
  53074. $recv(copy)._addAll_($self._sampleNewValueAsCollection());
  53075. $self._assert_($recv(original).__eq($self._collection()));
  53076. return self;
  53077. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{original:original,copy:copy},$globals.CollectionTest)});
  53078. },
  53079. args: [],
  53080. 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",
  53081. referencedClasses: [],
  53082. messageSends: ["collection", "copy", "addAll:", "sampleNewValueAsCollection", "assert:", "="]
  53083. }),
  53084. $globals.CollectionTest);
  53085. $core.addMethod(
  53086. $core.method({
  53087. selector: "testDetect",
  53088. protocol: "tests",
  53089. fn: function (){
  53090. var self=this,$self=this;
  53091. return $core.withContext(function($ctx1) {
  53092. var $1,$2,$3,$4,$6,$5,$7;
  53093. $self._shouldnt_raise_((function(){
  53094. return $core.withContext(function($ctx2) {
  53095. $1=$self._collection();
  53096. $ctx2.sendIdx["collection"]=1;
  53097. return $recv($1)._detect_((function(){
  53098. return true;
  53099. }));
  53100. $ctx2.sendIdx["detect:"]=1;
  53101. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53102. }),$globals.Error);
  53103. $self._should_raise_((function(){
  53104. return $core.withContext(function($ctx2) {
  53105. $2=$self._collection();
  53106. $ctx2.sendIdx["collection"]=2;
  53107. return $recv($2)._detect_((function(){
  53108. return false;
  53109. }));
  53110. $ctx2.sendIdx["detect:"]=2;
  53111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53112. }),$globals.Error);
  53113. $ctx1.sendIdx["should:raise:"]=1;
  53114. $3=$recv($self._sampleNewValueAsCollection())._detect_((function(){
  53115. return true;
  53116. }));
  53117. $ctx1.sendIdx["detect:"]=3;
  53118. $4=$self._sampleNewValue();
  53119. $ctx1.sendIdx["sampleNewValue"]=1;
  53120. $self._assert_equals_($3,$4);
  53121. $ctx1.sendIdx["assert:equals:"]=1;
  53122. $5=$recv($self._collectionWithNewValue())._detect_((function(each){
  53123. return $core.withContext(function($ctx2) {
  53124. $6=$self._sampleNewValue();
  53125. $ctx2.sendIdx["sampleNewValue"]=2;
  53126. return $recv(each).__eq($6);
  53127. $ctx2.sendIdx["="]=1;
  53128. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53129. }));
  53130. $ctx1.sendIdx["detect:"]=4;
  53131. $7=$self._sampleNewValue();
  53132. $ctx1.sendIdx["sampleNewValue"]=3;
  53133. $self._assert_equals_($5,$7);
  53134. $self._should_raise_((function(){
  53135. return $core.withContext(function($ctx2) {
  53136. return $recv($self._collection())._detect_((function(each){
  53137. return $core.withContext(function($ctx3) {
  53138. return $recv(each).__eq($self._sampleNewValue());
  53139. }, function($ctx3) {$ctx3.fillBlock({each:each},$ctx2,8)});
  53140. }));
  53141. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  53142. }),$globals.Error);
  53143. return self;
  53144. }, function($ctx1) {$ctx1.fill(self,"testDetect",{},$globals.CollectionTest)});
  53145. },
  53146. args: [],
  53147. 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",
  53148. referencedClasses: ["Error"],
  53149. messageSends: ["shouldnt:raise:", "detect:", "collection", "should:raise:", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53150. }),
  53151. $globals.CollectionTest);
  53152. $core.addMethod(
  53153. $core.method({
  53154. selector: "testDetectIfNone",
  53155. protocol: "tests",
  53156. fn: function (){
  53157. var self=this,$self=this;
  53158. var sentinel;
  53159. return $core.withContext(function($ctx1) {
  53160. var $3,$2,$1,$5,$4,$6,$7,$9,$8,$10;
  53161. sentinel=$recv($globals.Object)._new();
  53162. $3=$self._collection();
  53163. $ctx1.sendIdx["collection"]=1;
  53164. $2=$recv($3)._detect_ifNone_((function(){
  53165. return true;
  53166. }),(function(){
  53167. return sentinel;
  53168. }));
  53169. $ctx1.sendIdx["detect:ifNone:"]=1;
  53170. $1=$recv($2).__tild_eq(sentinel);
  53171. $self._assert_($1);
  53172. $5=$self._collection();
  53173. $ctx1.sendIdx["collection"]=2;
  53174. $4=$recv($5)._detect_ifNone_((function(){
  53175. return false;
  53176. }),(function(){
  53177. return sentinel;
  53178. }));
  53179. $ctx1.sendIdx["detect:ifNone:"]=2;
  53180. $self._assert_equals_($4,sentinel);
  53181. $ctx1.sendIdx["assert:equals:"]=1;
  53182. $6=$recv($self._sampleNewValueAsCollection())._detect_ifNone_((function(){
  53183. return true;
  53184. }),(function(){
  53185. return sentinel;
  53186. }));
  53187. $ctx1.sendIdx["detect:ifNone:"]=3;
  53188. $7=$self._sampleNewValue();
  53189. $ctx1.sendIdx["sampleNewValue"]=1;
  53190. $self._assert_equals_($6,$7);
  53191. $ctx1.sendIdx["assert:equals:"]=2;
  53192. $8=$recv($self._collectionWithNewValue())._detect_ifNone_((function(each){
  53193. return $core.withContext(function($ctx2) {
  53194. $9=$self._sampleNewValue();
  53195. $ctx2.sendIdx["sampleNewValue"]=2;
  53196. return $recv(each).__eq($9);
  53197. $ctx2.sendIdx["="]=1;
  53198. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,7)});
  53199. }),(function(){
  53200. return sentinel;
  53201. }));
  53202. $ctx1.sendIdx["detect:ifNone:"]=4;
  53203. $10=$self._sampleNewValue();
  53204. $ctx1.sendIdx["sampleNewValue"]=3;
  53205. $self._assert_equals_($8,$10);
  53206. $ctx1.sendIdx["assert:equals:"]=3;
  53207. $self._assert_equals_($recv($self._collection())._detect_ifNone_((function(each){
  53208. return $core.withContext(function($ctx2) {
  53209. return $recv(each).__eq($self._sampleNewValue());
  53210. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,9)});
  53211. }),(function(){
  53212. return sentinel;
  53213. })),sentinel);
  53214. return self;
  53215. }, function($ctx1) {$ctx1.fill(self,"testDetectIfNone",{sentinel:sentinel},$globals.CollectionTest)});
  53216. },
  53217. args: [],
  53218. 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",
  53219. referencedClasses: ["Object"],
  53220. messageSends: ["new", "assert:", "~=", "detect:ifNone:", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue", "collectionWithNewValue", "="]
  53221. }),
  53222. $globals.CollectionTest);
  53223. $core.addMethod(
  53224. $core.method({
  53225. selector: "testDo",
  53226. protocol: "tests",
  53227. fn: function (){
  53228. var self=this,$self=this;
  53229. var newCollection;
  53230. return $core.withContext(function($ctx1) {
  53231. var $1,$2;
  53232. newCollection=$recv($globals.OrderedCollection)._new();
  53233. $ctx1.sendIdx["new"]=1;
  53234. $1=$self._collection();
  53235. $ctx1.sendIdx["collection"]=1;
  53236. $recv($1)._do_((function(each){
  53237. return $core.withContext(function($ctx2) {
  53238. return $recv(newCollection)._add_(each);
  53239. $ctx2.sendIdx["add:"]=1;
  53240. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53241. }));
  53242. $ctx1.sendIdx["do:"]=1;
  53243. $self._assertSameContents_as_($self._collection(),newCollection);
  53244. $ctx1.sendIdx["assertSameContents:as:"]=1;
  53245. newCollection=$recv($globals.OrderedCollection)._new();
  53246. $2=$self._collectionWithDuplicates();
  53247. $ctx1.sendIdx["collectionWithDuplicates"]=1;
  53248. $recv($2)._do_((function(each){
  53249. return $core.withContext(function($ctx2) {
  53250. return $recv(newCollection)._add_(each);
  53251. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53252. }));
  53253. $self._assertSameContents_as_($self._collectionWithDuplicates(),newCollection);
  53254. return self;
  53255. }, function($ctx1) {$ctx1.fill(self,"testDo",{newCollection:newCollection},$globals.CollectionTest)});
  53256. },
  53257. args: [],
  53258. 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",
  53259. referencedClasses: ["OrderedCollection"],
  53260. messageSends: ["new", "do:", "collection", "add:", "assertSameContents:as:", "collectionWithDuplicates"]
  53261. }),
  53262. $globals.CollectionTest);
  53263. $core.addMethod(
  53264. $core.method({
  53265. selector: "testEquality",
  53266. protocol: "tests",
  53267. fn: function (){
  53268. var self=this,$self=this;
  53269. return $core.withContext(function($ctx1) {
  53270. var $2,$1,$4,$3,$5,$6,$7,$8,$11,$10,$12,$9,$14,$13;
  53271. $2=$self._collectionClass();
  53272. $ctx1.sendIdx["collectionClass"]=1;
  53273. $1=$recv($2)._new();
  53274. $ctx1.sendIdx["new"]=1;
  53275. $4=$self._collectionClass();
  53276. $ctx1.sendIdx["collectionClass"]=2;
  53277. $3=$recv($4)._new();
  53278. $ctx1.sendIdx["new"]=2;
  53279. $self._assert_equals_($1,$3);
  53280. $ctx1.sendIdx["assert:equals:"]=1;
  53281. $5=$self._collection();
  53282. $ctx1.sendIdx["collection"]=1;
  53283. $6=$self._collection();
  53284. $ctx1.sendIdx["collection"]=2;
  53285. $self._assert_equals_($5,$6);
  53286. $ctx1.sendIdx["assert:equals:"]=2;
  53287. $7=$self._collectionWithNewValue();
  53288. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53289. $8=$self._collectionWithNewValue();
  53290. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53291. $self._assert_equals_($7,$8);
  53292. $11=$self._collectionClass();
  53293. $ctx1.sendIdx["collectionClass"]=3;
  53294. $10=$recv($11)._new();
  53295. $ctx1.sendIdx["new"]=3;
  53296. $12=$self._collection();
  53297. $ctx1.sendIdx["collection"]=3;
  53298. $9=$recv($10).__eq($12);
  53299. $ctx1.sendIdx["="]=1;
  53300. $self._deny_($9);
  53301. $ctx1.sendIdx["deny:"]=1;
  53302. $14=$self._collection();
  53303. $ctx1.sendIdx["collection"]=4;
  53304. $13=$recv($14).__eq($recv($self._collectionClass())._new());
  53305. $ctx1.sendIdx["="]=2;
  53306. $self._deny_($13);
  53307. $ctx1.sendIdx["deny:"]=2;
  53308. $self._deny_($recv($self._collection()).__eq($self._collectionWithNewValue()));
  53309. return self;
  53310. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.CollectionTest)});
  53311. },
  53312. args: [],
  53313. 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",
  53314. referencedClasses: [],
  53315. messageSends: ["assert:equals:", "new", "collectionClass", "collection", "collectionWithNewValue", "deny:", "="]
  53316. }),
  53317. $globals.CollectionTest);
  53318. $core.addMethod(
  53319. $core.method({
  53320. selector: "testIfEmptyFamily",
  53321. protocol: "tests",
  53322. fn: function (){
  53323. var self=this,$self=this;
  53324. return $core.withContext(function($ctx1) {
  53325. 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;
  53326. $3=$self._collectionClass();
  53327. $ctx1.sendIdx["collectionClass"]=1;
  53328. $2=$recv($3)._new();
  53329. $ctx1.sendIdx["new"]=1;
  53330. $1=$recv($2)._ifEmpty_((function(){
  53331. return (42);
  53332. }));
  53333. $ctx1.sendIdx["ifEmpty:"]=1;
  53334. $self._assert_equals_($1,(42));
  53335. $ctx1.sendIdx["assert:equals:"]=1;
  53336. $5=$self._collection();
  53337. $ctx1.sendIdx["collection"]=1;
  53338. $4=$recv($5)._ifEmpty_((function(){
  53339. return (42);
  53340. }));
  53341. $6=$self._collection();
  53342. $ctx1.sendIdx["collection"]=2;
  53343. $self._assert_equals_($4,$6);
  53344. $ctx1.sendIdx["assert:equals:"]=2;
  53345. $9=$self._collectionClass();
  53346. $ctx1.sendIdx["collectionClass"]=2;
  53347. $8=$recv($9)._new();
  53348. $ctx1.sendIdx["new"]=2;
  53349. $7=$recv($8)._ifNotEmpty_((function(){
  53350. return (42);
  53351. }));
  53352. $ctx1.sendIdx["ifNotEmpty:"]=1;
  53353. $11=$self._collectionClass();
  53354. $ctx1.sendIdx["collectionClass"]=3;
  53355. $10=$recv($11)._new();
  53356. $ctx1.sendIdx["new"]=3;
  53357. $self._assert_equals_($7,$10);
  53358. $ctx1.sendIdx["assert:equals:"]=3;
  53359. $13=$self._collection();
  53360. $ctx1.sendIdx["collection"]=3;
  53361. $12=$recv($13)._ifNotEmpty_((function(){
  53362. return (42);
  53363. }));
  53364. $ctx1.sendIdx["ifNotEmpty:"]=2;
  53365. $self._assert_equals_($12,(42));
  53366. $ctx1.sendIdx["assert:equals:"]=4;
  53367. $15=$self._collection();
  53368. $ctx1.sendIdx["collection"]=4;
  53369. $14=$recv($15)._ifNotEmpty_((function(col){
  53370. return col;
  53371. }));
  53372. $16=$self._collection();
  53373. $ctx1.sendIdx["collection"]=5;
  53374. $self._assert_equals_($14,$16);
  53375. $ctx1.sendIdx["assert:equals:"]=5;
  53376. $19=$self._collectionClass();
  53377. $ctx1.sendIdx["collectionClass"]=4;
  53378. $18=$recv($19)._new();
  53379. $ctx1.sendIdx["new"]=4;
  53380. $17=$recv($18)._ifEmpty_ifNotEmpty_((function(){
  53381. return (42);
  53382. }),(function(){
  53383. return (999);
  53384. }));
  53385. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=1;
  53386. $self._assert_equals_($17,(42));
  53387. $ctx1.sendIdx["assert:equals:"]=6;
  53388. $21=$self._collection();
  53389. $ctx1.sendIdx["collection"]=6;
  53390. $20=$recv($21)._ifEmpty_ifNotEmpty_((function(){
  53391. return (42);
  53392. }),(function(){
  53393. return (999);
  53394. }));
  53395. $ctx1.sendIdx["ifEmpty:ifNotEmpty:"]=2;
  53396. $self._assert_equals_($20,(999));
  53397. $ctx1.sendIdx["assert:equals:"]=7;
  53398. $23=$self._collection();
  53399. $ctx1.sendIdx["collection"]=7;
  53400. $22=$recv($23)._ifEmpty_ifNotEmpty_((function(){
  53401. return (42);
  53402. }),(function(col){
  53403. return col;
  53404. }));
  53405. $24=$self._collection();
  53406. $ctx1.sendIdx["collection"]=8;
  53407. $self._assert_equals_($22,$24);
  53408. $ctx1.sendIdx["assert:equals:"]=8;
  53409. $25=$recv($recv($self._collectionClass())._new())._ifNotEmpty_ifEmpty_((function(){
  53410. return (42);
  53411. }),(function(){
  53412. return (999);
  53413. }));
  53414. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=1;
  53415. $self._assert_equals_($25,(999));
  53416. $ctx1.sendIdx["assert:equals:"]=9;
  53417. $27=$self._collection();
  53418. $ctx1.sendIdx["collection"]=9;
  53419. $26=$recv($27)._ifNotEmpty_ifEmpty_((function(){
  53420. return (42);
  53421. }),(function(){
  53422. return (999);
  53423. }));
  53424. $ctx1.sendIdx["ifNotEmpty:ifEmpty:"]=2;
  53425. $self._assert_equals_($26,(42));
  53426. $ctx1.sendIdx["assert:equals:"]=10;
  53427. $29=$self._collection();
  53428. $ctx1.sendIdx["collection"]=10;
  53429. $28=$recv($29)._ifNotEmpty_ifEmpty_((function(col){
  53430. return col;
  53431. }),(function(){
  53432. return (999);
  53433. }));
  53434. $self._assert_equals_($28,$self._collection());
  53435. return self;
  53436. }, function($ctx1) {$ctx1.fill(self,"testIfEmptyFamily",{},$globals.CollectionTest)});
  53437. },
  53438. args: [],
  53439. 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.",
  53440. referencedClasses: [],
  53441. messageSends: ["assert:equals:", "ifEmpty:", "new", "collectionClass", "collection", "ifNotEmpty:", "ifEmpty:ifNotEmpty:", "ifNotEmpty:ifEmpty:"]
  53442. }),
  53443. $globals.CollectionTest);
  53444. $core.addMethod(
  53445. $core.method({
  53446. selector: "testIsEmpty",
  53447. protocol: "tests",
  53448. fn: function (){
  53449. var self=this,$self=this;
  53450. return $core.withContext(function($ctx1) {
  53451. var $1;
  53452. $1=$recv($recv($self._collectionClass())._new())._isEmpty();
  53453. $ctx1.sendIdx["isEmpty"]=1;
  53454. $self._assert_($1);
  53455. $self._deny_($recv($self._collection())._isEmpty());
  53456. return self;
  53457. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{},$globals.CollectionTest)});
  53458. },
  53459. args: [],
  53460. source: "testIsEmpty\x0a\x09self assert: self collectionClass new isEmpty.\x0a\x09self deny: self collection isEmpty",
  53461. referencedClasses: [],
  53462. messageSends: ["assert:", "isEmpty", "new", "collectionClass", "deny:", "collection"]
  53463. }),
  53464. $globals.CollectionTest);
  53465. $core.addMethod(
  53466. $core.method({
  53467. selector: "testNoneSatisfy",
  53468. protocol: "tests",
  53469. fn: function (){
  53470. var self=this,$self=this;
  53471. var anyOne;
  53472. return $core.withContext(function($ctx1) {
  53473. var $1,$3,$2;
  53474. $1=$self._collection();
  53475. $ctx1.sendIdx["collection"]=1;
  53476. anyOne=$recv($1)._anyOne();
  53477. $3=$self._collection();
  53478. $ctx1.sendIdx["collection"]=2;
  53479. $2=$recv($3)._noneSatisfy_((function(each){
  53480. return $core.withContext(function($ctx2) {
  53481. return $recv(each).__eq(anyOne);
  53482. $ctx2.sendIdx["="]=1;
  53483. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53484. }));
  53485. $ctx1.sendIdx["noneSatisfy:"]=1;
  53486. $self._deny_($2);
  53487. $self._assert_($recv($self._collection())._noneSatisfy_((function(each){
  53488. return $core.withContext(function($ctx2) {
  53489. return $recv(each).__eq($recv($globals.Object)._new());
  53490. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  53491. })));
  53492. return self;
  53493. }, function($ctx1) {$ctx1.fill(self,"testNoneSatisfy",{anyOne:anyOne},$globals.CollectionTest)});
  53494. },
  53495. args: [],
  53496. 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 ])",
  53497. referencedClasses: ["Object"],
  53498. messageSends: ["anyOne", "collection", "deny:", "noneSatisfy:", "=", "assert:", "new"]
  53499. }),
  53500. $globals.CollectionTest);
  53501. $core.addMethod(
  53502. $core.method({
  53503. selector: "testRegression1224",
  53504. protocol: "tests",
  53505. fn: function (){
  53506. var self=this,$self=this;
  53507. return $core.withContext(function($ctx1) {
  53508. var $3,$2,$1;
  53509. $3=$recv($self._collectionClass())._new();
  53510. $recv($3)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  53511. }));
  53512. $2=$recv($3)._yourself();
  53513. $1=$recv($2)._size();
  53514. $self._assert_equals_($1,(0));
  53515. return self;
  53516. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.CollectionTest)});
  53517. },
  53518. args: [],
  53519. source: "testRegression1224\x0a\x09self assert: (self collectionClass new\x0a\x09\x09remove: self sampleNewValue ifAbsent: [];\x0a\x09\x09yourself) size equals: 0",
  53520. referencedClasses: [],
  53521. messageSends: ["assert:equals:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  53522. }),
  53523. $globals.CollectionTest);
  53524. $core.addMethod(
  53525. $core.method({
  53526. selector: "testRemoveAll",
  53527. protocol: "tests",
  53528. fn: function (){
  53529. var self=this,$self=this;
  53530. return $core.withContext(function($ctx1) {
  53531. var $2,$1;
  53532. $2=$self._collection();
  53533. $recv($2)._removeAll();
  53534. $1=$recv($2)._yourself();
  53535. $self._assert_equals_($1,$recv($self._collectionClass())._new());
  53536. return self;
  53537. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.CollectionTest)});
  53538. },
  53539. args: [],
  53540. source: "testRemoveAll\x0a\x09self assert: (self collection removeAll; yourself) equals: self collectionClass new",
  53541. referencedClasses: [],
  53542. messageSends: ["assert:equals:", "removeAll", "collection", "yourself", "new", "collectionClass"]
  53543. }),
  53544. $globals.CollectionTest);
  53545. $core.addMethod(
  53546. $core.method({
  53547. selector: "testSelect",
  53548. protocol: "tests",
  53549. fn: function (){
  53550. var self=this,$self=this;
  53551. return $core.withContext(function($ctx1) {
  53552. var $2,$1,$4,$3,$6,$5,$7,$9,$10,$8,$12,$13,$11,$14,$16,$17,$15;
  53553. $2=$self._collection();
  53554. $ctx1.sendIdx["collection"]=1;
  53555. $1=$recv($2)._select_((function(){
  53556. return false;
  53557. }));
  53558. $ctx1.sendIdx["select:"]=1;
  53559. $4=$self._collectionClass();
  53560. $ctx1.sendIdx["collectionClass"]=1;
  53561. $3=$recv($4)._new();
  53562. $ctx1.sendIdx["new"]=1;
  53563. $self._assert_equals_($1,$3);
  53564. $ctx1.sendIdx["assert:equals:"]=1;
  53565. $6=$self._collection();
  53566. $ctx1.sendIdx["collection"]=2;
  53567. $5=$recv($6)._select_((function(){
  53568. return true;
  53569. }));
  53570. $ctx1.sendIdx["select:"]=2;
  53571. $7=$self._collection();
  53572. $ctx1.sendIdx["collection"]=3;
  53573. $self._assert_equals_($5,$7);
  53574. $ctx1.sendIdx["assert:equals:"]=2;
  53575. $9=$self._collectionWithNewValue();
  53576. $ctx1.sendIdx["collectionWithNewValue"]=1;
  53577. $8=$recv($9)._select_((function(each){
  53578. return $core.withContext(function($ctx2) {
  53579. $10=$self._sampleNewValue();
  53580. $ctx2.sendIdx["sampleNewValue"]=1;
  53581. return $recv(each).__eq($10);
  53582. $ctx2.sendIdx["="]=1;
  53583. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  53584. }));
  53585. $ctx1.sendIdx["select:"]=3;
  53586. $self._assert_equals_($8,$self._sampleNewValueAsCollection());
  53587. $ctx1.sendIdx["assert:equals:"]=3;
  53588. $12=$self._collectionWithNewValue();
  53589. $ctx1.sendIdx["collectionWithNewValue"]=2;
  53590. $11=$recv($12)._select_((function(each){
  53591. return $core.withContext(function($ctx2) {
  53592. $13=$self._sampleNewValue();
  53593. $ctx2.sendIdx["sampleNewValue"]=2;
  53594. return $recv(each).__tild_eq($13);
  53595. $ctx2.sendIdx["~="]=1;
  53596. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53597. }));
  53598. $ctx1.sendIdx["select:"]=4;
  53599. $14=$self._collection();
  53600. $ctx1.sendIdx["collection"]=4;
  53601. $self._assert_equals_($11,$14);
  53602. $ctx1.sendIdx["assert:equals:"]=4;
  53603. $16=$self._collection();
  53604. $ctx1.sendIdx["collection"]=5;
  53605. $15=$recv($16)._select_((function(each){
  53606. return $core.withContext(function($ctx2) {
  53607. $17=$self._sampleNewValue();
  53608. $ctx2.sendIdx["sampleNewValue"]=3;
  53609. return $recv(each).__eq($17);
  53610. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,5)});
  53611. }));
  53612. $ctx1.sendIdx["select:"]=5;
  53613. $self._assert_equals_($15,$recv($self._collectionClass())._new());
  53614. $ctx1.sendIdx["assert:equals:"]=5;
  53615. $self._assert_equals_($recv($self._collectionWithNewValue())._select_((function(each){
  53616. return $core.withContext(function($ctx2) {
  53617. return $recv(each).__tild_eq($self._sampleNewValue());
  53618. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53619. })),$self._collection());
  53620. return self;
  53621. }, function($ctx1) {$ctx1.fill(self,"testSelect",{},$globals.CollectionTest)});
  53622. },
  53623. args: [],
  53624. 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",
  53625. referencedClasses: [],
  53626. messageSends: ["assert:equals:", "select:", "collection", "new", "collectionClass", "collectionWithNewValue", "=", "sampleNewValue", "sampleNewValueAsCollection", "~="]
  53627. }),
  53628. $globals.CollectionTest);
  53629. $core.addMethod(
  53630. $core.method({
  53631. selector: "testSelectThenCollect",
  53632. protocol: "tests",
  53633. fn: function (){
  53634. var self=this,$self=this;
  53635. return $core.withContext(function($ctx1) {
  53636. var $2,$1,$4,$3,$6,$5,$7,$9,$8;
  53637. $2=$self._collection();
  53638. $ctx1.sendIdx["collection"]=1;
  53639. $1=$recv($2)._select_thenCollect_((function(){
  53640. return false;
  53641. }),"isString");
  53642. $ctx1.sendIdx["select:thenCollect:"]=1;
  53643. $4=$self._collectionClass();
  53644. $ctx1.sendIdx["collectionClass"]=1;
  53645. $3=$recv($4)._new();
  53646. $ctx1.sendIdx["new"]=1;
  53647. $self._assert_equals_($1,$3);
  53648. $ctx1.sendIdx["assert:equals:"]=1;
  53649. $6=$self._collection();
  53650. $ctx1.sendIdx["collection"]=2;
  53651. $5=$recv($6)._select_thenCollect_((function(){
  53652. return true;
  53653. }),(function(x){
  53654. return x;
  53655. }));
  53656. $ctx1.sendIdx["select:thenCollect:"]=2;
  53657. $7=$self._collection();
  53658. $ctx1.sendIdx["collection"]=3;
  53659. $self._assert_equals_($5,$7);
  53660. $ctx1.sendIdx["assert:equals:"]=2;
  53661. $8=$recv($self._collection())._select_thenCollect_((function(each){
  53662. return $core.withContext(function($ctx2) {
  53663. $9=$self._sampleNewValue();
  53664. $ctx2.sendIdx["sampleNewValue"]=1;
  53665. return $recv(each).__eq($9);
  53666. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,4)});
  53667. }),(function(x){
  53668. return x;
  53669. }));
  53670. $ctx1.sendIdx["select:thenCollect:"]=3;
  53671. $self._assert_equals_($8,$recv($self._collectionClass())._new());
  53672. $ctx1.sendIdx["assert:equals:"]=3;
  53673. $self._assert_equals_($recv($self._collectionWithNewValue())._select_thenCollect_((function(each){
  53674. return $core.withContext(function($ctx2) {
  53675. return $recv(each).__tild_eq($self._sampleNewValue());
  53676. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,6)});
  53677. }),"printString"),$self._collectionOfPrintStrings());
  53678. return self;
  53679. }, function($ctx1) {$ctx1.fill(self,"testSelectThenCollect",{},$globals.CollectionTest)});
  53680. },
  53681. args: [],
  53682. 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",
  53683. referencedClasses: [],
  53684. messageSends: ["assert:equals:", "select:thenCollect:", "collection", "new", "collectionClass", "=", "sampleNewValue", "collectionWithNewValue", "~=", "collectionOfPrintStrings"]
  53685. }),
  53686. $globals.CollectionTest);
  53687. $core.addMethod(
  53688. $core.method({
  53689. selector: "testSingle",
  53690. protocol: "tests",
  53691. fn: function (){
  53692. var self=this,$self=this;
  53693. return $core.withContext(function($ctx1) {
  53694. $self._should_raise_((function(){
  53695. return $core.withContext(function($ctx2) {
  53696. return $recv($recv($self._collectionClass())._new())._single();
  53697. $ctx2.sendIdx["single"]=1;
  53698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  53699. }),$globals.Error);
  53700. $ctx1.sendIdx["should:raise:"]=1;
  53701. $self._should_raise_((function(){
  53702. return $core.withContext(function($ctx2) {
  53703. return $recv($self._collection())._single();
  53704. $ctx2.sendIdx["single"]=2;
  53705. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  53706. }),$globals.Error);
  53707. $self._assert_equals_($recv($self._sampleNewValueAsCollection())._single(),$self._sampleNewValue());
  53708. return self;
  53709. }, function($ctx1) {$ctx1.fill(self,"testSingle",{},$globals.CollectionTest)});
  53710. },
  53711. args: [],
  53712. 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",
  53713. referencedClasses: ["Error"],
  53714. messageSends: ["should:raise:", "single", "new", "collectionClass", "collection", "assert:equals:", "sampleNewValueAsCollection", "sampleNewValue"]
  53715. }),
  53716. $globals.CollectionTest);
  53717. $core.addMethod(
  53718. $core.method({
  53719. selector: "testSize",
  53720. protocol: "tests",
  53721. fn: function (){
  53722. var self=this,$self=this;
  53723. return $core.withContext(function($ctx1) {
  53724. var $1,$2;
  53725. $1=$recv($recv($self._collectionClass())._new())._size();
  53726. $ctx1.sendIdx["size"]=1;
  53727. $self._assert_equals_($1,(0));
  53728. $ctx1.sendIdx["assert:equals:"]=1;
  53729. $2=$recv($self._sampleNewValueAsCollection())._size();
  53730. $ctx1.sendIdx["size"]=2;
  53731. $self._assert_equals_($2,(1));
  53732. $ctx1.sendIdx["assert:equals:"]=2;
  53733. $self._assert_equals_($recv($self._collection())._size(),$self._collectionSize());
  53734. return self;
  53735. }, function($ctx1) {$ctx1.fill(self,"testSize",{},$globals.CollectionTest)});
  53736. },
  53737. args: [],
  53738. 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",
  53739. referencedClasses: [],
  53740. messageSends: ["assert:equals:", "size", "new", "collectionClass", "sampleNewValueAsCollection", "collection", "collectionSize"]
  53741. }),
  53742. $globals.CollectionTest);
  53743. $core.addMethod(
  53744. $core.method({
  53745. selector: "collectionClass",
  53746. protocol: "fixture",
  53747. fn: function (){
  53748. var self=this,$self=this;
  53749. return nil;
  53750. },
  53751. args: [],
  53752. source: "collectionClass\x0a\x09\x22Answers class of collection type tested,\x0a\x09or nil if test is abstract\x22\x0a\x0a\x09^ nil",
  53753. referencedClasses: [],
  53754. messageSends: []
  53755. }),
  53756. $globals.CollectionTest.a$cls);
  53757. $core.addMethod(
  53758. $core.method({
  53759. selector: "isAbstract",
  53760. protocol: "testing",
  53761. fn: function (){
  53762. var self=this,$self=this;
  53763. return $core.withContext(function($ctx1) {
  53764. return $recv($self._collectionClass())._isNil();
  53765. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.CollectionTest.a$cls)});
  53766. },
  53767. args: [],
  53768. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  53769. referencedClasses: [],
  53770. messageSends: ["isNil", "collectionClass"]
  53771. }),
  53772. $globals.CollectionTest.a$cls);
  53773. $core.addClass("IndexableCollectionTest", $globals.CollectionTest, [], "Kernel-Tests");
  53774. $core.addMethod(
  53775. $core.method({
  53776. selector: "collectionWithNewValue",
  53777. protocol: "fixture",
  53778. fn: function (){
  53779. var self=this,$self=this;
  53780. return $core.withContext(function($ctx1) {
  53781. $self._subclassResponsibility();
  53782. return self;
  53783. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.IndexableCollectionTest)});
  53784. },
  53785. args: [],
  53786. 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",
  53787. referencedClasses: [],
  53788. messageSends: ["subclassResponsibility"]
  53789. }),
  53790. $globals.IndexableCollectionTest);
  53791. $core.addMethod(
  53792. $core.method({
  53793. selector: "nonIndexesDo:",
  53794. protocol: "fixture",
  53795. fn: function (aBlock){
  53796. var self=this,$self=this;
  53797. return $core.withContext(function($ctx1) {
  53798. $self._subclassResponsibility();
  53799. return self;
  53800. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53801. },
  53802. args: ["aBlock"],
  53803. 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",
  53804. referencedClasses: [],
  53805. messageSends: ["subclassResponsibility"]
  53806. }),
  53807. $globals.IndexableCollectionTest);
  53808. $core.addMethod(
  53809. $core.method({
  53810. selector: "sampleNewIndex",
  53811. protocol: "fixture",
  53812. fn: function (){
  53813. var self=this,$self=this;
  53814. return $core.withContext(function($ctx1) {
  53815. $self._subclassResponsibility();
  53816. return self;
  53817. }, function($ctx1) {$ctx1.fill(self,"sampleNewIndex",{},$globals.IndexableCollectionTest)});
  53818. },
  53819. args: [],
  53820. 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",
  53821. referencedClasses: [],
  53822. messageSends: ["subclassResponsibility"]
  53823. }),
  53824. $globals.IndexableCollectionTest);
  53825. $core.addMethod(
  53826. $core.method({
  53827. selector: "samplesDo:",
  53828. protocol: "fixture",
  53829. fn: function (aBlock){
  53830. var self=this,$self=this;
  53831. return $core.withContext(function($ctx1) {
  53832. $self._subclassResponsibility();
  53833. return self;
  53834. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.IndexableCollectionTest)});
  53835. },
  53836. args: ["aBlock"],
  53837. 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",
  53838. referencedClasses: [],
  53839. messageSends: ["subclassResponsibility"]
  53840. }),
  53841. $globals.IndexableCollectionTest);
  53842. $core.addMethod(
  53843. $core.method({
  53844. selector: "testAt",
  53845. protocol: "tests",
  53846. fn: function (){
  53847. var self=this,$self=this;
  53848. return $core.withContext(function($ctx1) {
  53849. var $1;
  53850. $self._nonIndexesDo_((function(each){
  53851. return $core.withContext(function($ctx2) {
  53852. return $self._should_raise_((function(){
  53853. return $core.withContext(function($ctx3) {
  53854. $1=$self._collection();
  53855. $ctx3.sendIdx["collection"]=1;
  53856. return $recv($1)._at_(each);
  53857. $ctx3.sendIdx["at:"]=1;
  53858. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53859. }),$globals.Error);
  53860. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53861. }));
  53862. $self._samplesDo_((function(index,value){
  53863. return $core.withContext(function($ctx2) {
  53864. return $self._assert_equals_($recv($self._collection())._at_(index),value);
  53865. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53866. }));
  53867. return self;
  53868. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.IndexableCollectionTest)});
  53869. },
  53870. args: [],
  53871. 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 ]",
  53872. referencedClasses: ["Error"],
  53873. messageSends: ["nonIndexesDo:", "should:raise:", "at:", "collection", "samplesDo:", "assert:equals:"]
  53874. }),
  53875. $globals.IndexableCollectionTest);
  53876. $core.addMethod(
  53877. $core.method({
  53878. selector: "testAtIfAbsent",
  53879. protocol: "tests",
  53880. fn: function (){
  53881. var self=this,$self=this;
  53882. return $core.withContext(function($ctx1) {
  53883. var $2,$1,$3;
  53884. $self._nonIndexesDo_((function(each){
  53885. return $core.withContext(function($ctx2) {
  53886. $2=$self._collection();
  53887. $ctx2.sendIdx["collection"]=1;
  53888. $1=$recv($2)._at_ifAbsent_(each,(function(){
  53889. return $core.withContext(function($ctx3) {
  53890. return $self._sampleNewValue();
  53891. $ctx3.sendIdx["sampleNewValue"]=1;
  53892. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53893. }));
  53894. $ctx2.sendIdx["at:ifAbsent:"]=1;
  53895. $3=$self._sampleNewValue();
  53896. $ctx2.sendIdx["sampleNewValue"]=2;
  53897. return $self._assert_equals_($1,$3);
  53898. $ctx2.sendIdx["assert:equals:"]=1;
  53899. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53900. }));
  53901. $self._samplesDo_((function(index,value){
  53902. return $core.withContext(function($ctx2) {
  53903. return $self._assert_equals_($recv($self._collection())._at_ifAbsent_(index,(function(){
  53904. return $core.withContext(function($ctx3) {
  53905. return $self._sampleNewValue();
  53906. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  53907. })),value);
  53908. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  53909. }));
  53910. return self;
  53911. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{},$globals.IndexableCollectionTest)});
  53912. },
  53913. args: [],
  53914. 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 ].",
  53915. referencedClasses: [],
  53916. messageSends: ["nonIndexesDo:", "assert:equals:", "at:ifAbsent:", "collection", "sampleNewValue", "samplesDo:"]
  53917. }),
  53918. $globals.IndexableCollectionTest);
  53919. $core.addMethod(
  53920. $core.method({
  53921. selector: "testAtIfAbsentPut",
  53922. protocol: "tests",
  53923. fn: function (){
  53924. var self=this,$self=this;
  53925. var newCollection;
  53926. return $core.withContext(function($ctx1) {
  53927. var $1;
  53928. newCollection=$self._collection();
  53929. $ctx1.sendIdx["collection"]=1;
  53930. $self._samplesDo_((function(index,value){
  53931. return $core.withContext(function($ctx2) {
  53932. $1=$recv(newCollection)._at_ifAbsentPut_(index,(function(){
  53933. return $core.withContext(function($ctx3) {
  53934. return $self._sampleNewValue();
  53935. $ctx3.sendIdx["sampleNewValue"]=1;
  53936. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  53937. }));
  53938. $ctx2.sendIdx["at:ifAbsentPut:"]=1;
  53939. return $self._assert_equals_($1,value);
  53940. $ctx2.sendIdx["assert:equals:"]=1;
  53941. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  53942. }));
  53943. $self._assert_equals_(newCollection,$self._collection());
  53944. $ctx1.sendIdx["assert:equals:"]=2;
  53945. $self._assert_equals_($recv(newCollection)._at_ifAbsentPut_($self._sampleNewIndex(),(function(){
  53946. return $core.withContext(function($ctx2) {
  53947. return $self._sampleNewValue();
  53948. $ctx2.sendIdx["sampleNewValue"]=2;
  53949. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  53950. })),$self._sampleNewValue());
  53951. $ctx1.sendIdx["assert:equals:"]=3;
  53952. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  53953. return self;
  53954. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  53955. },
  53956. args: [],
  53957. 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",
  53958. referencedClasses: [],
  53959. messageSends: ["collection", "samplesDo:", "assert:equals:", "at:ifAbsentPut:", "sampleNewValue", "sampleNewIndex", "collectionWithNewValue"]
  53960. }),
  53961. $globals.IndexableCollectionTest);
  53962. $core.addMethod(
  53963. $core.method({
  53964. selector: "testAtIfPresent",
  53965. protocol: "tests",
  53966. fn: function (){
  53967. var self=this,$self=this;
  53968. var visited,sentinel;
  53969. return $core.withContext(function($ctx1) {
  53970. var $2,$1,$4,$3;
  53971. sentinel=$recv($globals.Object)._new();
  53972. $self._nonIndexesDo_((function(each){
  53973. return $core.withContext(function($ctx2) {
  53974. visited=nil;
  53975. $2=$self._collection();
  53976. $ctx2.sendIdx["collection"]=1;
  53977. $1=$recv($2)._at_ifPresent_(each,(function(value1){
  53978. visited=value1;
  53979. return sentinel;
  53980. }));
  53981. $ctx2.sendIdx["at:ifPresent:"]=1;
  53982. $self._assert_equals_($1,nil);
  53983. $ctx2.sendIdx["assert:equals:"]=1;
  53984. return $self._assert_($recv(visited)._isNil());
  53985. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  53986. }));
  53987. $self._samplesDo_((function(index,value){
  53988. return $core.withContext(function($ctx2) {
  53989. visited=nil;
  53990. $4=$self._collection();
  53991. $ctx2.sendIdx["collection"]=2;
  53992. $3=$recv($4)._at_ifPresent_(index,(function(value2){
  53993. visited=value2;
  53994. return sentinel;
  53995. }));
  53996. $self._assert_equals_($3,sentinel);
  53997. $ctx2.sendIdx["assert:equals:"]=2;
  53998. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  53999. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,3)});
  54000. }));
  54001. return self;
  54002. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  54003. },
  54004. args: [],
  54005. 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) ]",
  54006. referencedClasses: ["Object"],
  54007. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:", "collection", "assert:", "isNil", "samplesDo:", "at:"]
  54008. }),
  54009. $globals.IndexableCollectionTest);
  54010. $core.addMethod(
  54011. $core.method({
  54012. selector: "testAtIfPresentIfAbsent",
  54013. protocol: "tests",
  54014. fn: function (){
  54015. var self=this,$self=this;
  54016. var visited,sentinel;
  54017. return $core.withContext(function($ctx1) {
  54018. var $2,$1,$3,$5,$4;
  54019. sentinel=$recv($globals.Object)._new();
  54020. $self._nonIndexesDo_((function(each){
  54021. return $core.withContext(function($ctx2) {
  54022. visited=nil;
  54023. $2=$self._collection();
  54024. $ctx2.sendIdx["collection"]=1;
  54025. $1=$recv($2)._at_ifPresent_ifAbsent_(each,(function(value1){
  54026. visited=value1;
  54027. return sentinel;
  54028. }),(function(){
  54029. return $core.withContext(function($ctx3) {
  54030. return $self._sampleNewValue();
  54031. $ctx3.sendIdx["sampleNewValue"]=1;
  54032. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  54033. }));
  54034. $ctx2.sendIdx["at:ifPresent:ifAbsent:"]=1;
  54035. $3=$self._sampleNewValue();
  54036. $ctx2.sendIdx["sampleNewValue"]=2;
  54037. $self._assert_equals_($1,$3);
  54038. $ctx2.sendIdx["assert:equals:"]=1;
  54039. return $self._assert_($recv(visited)._isNil());
  54040. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  54041. }));
  54042. $self._samplesDo_((function(index,value){
  54043. return $core.withContext(function($ctx2) {
  54044. visited=nil;
  54045. $5=$self._collection();
  54046. $ctx2.sendIdx["collection"]=2;
  54047. $4=$recv($5)._at_ifPresent_ifAbsent_(index,(function(value2){
  54048. visited=value2;
  54049. return sentinel;
  54050. }),(function(){
  54051. return $core.withContext(function($ctx3) {
  54052. return $self._sampleNewValue();
  54053. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,6)});
  54054. }));
  54055. $self._assert_equals_($4,sentinel);
  54056. $ctx2.sendIdx["assert:equals:"]=2;
  54057. return $self._assert_equals_(visited,$recv($self._collection())._at_(index));
  54058. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,4)});
  54059. }));
  54060. return self;
  54061. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{visited:visited,sentinel:sentinel},$globals.IndexableCollectionTest)});
  54062. },
  54063. args: [],
  54064. 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) ]",
  54065. referencedClasses: ["Object"],
  54066. messageSends: ["new", "nonIndexesDo:", "assert:equals:", "at:ifPresent:ifAbsent:", "collection", "sampleNewValue", "assert:", "isNil", "samplesDo:", "at:"]
  54067. }),
  54068. $globals.IndexableCollectionTest);
  54069. $core.addMethod(
  54070. $core.method({
  54071. selector: "testAtPut",
  54072. protocol: "tests",
  54073. fn: function (){
  54074. var self=this,$self=this;
  54075. var newCollection;
  54076. return $core.withContext(function($ctx1) {
  54077. newCollection=$self._collection();
  54078. $ctx1.sendIdx["collection"]=1;
  54079. $self._samplesDo_((function(index,value){
  54080. return $core.withContext(function($ctx2) {
  54081. return $recv(newCollection)._at_put_(index,value);
  54082. $ctx2.sendIdx["at:put:"]=1;
  54083. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54084. }));
  54085. $self._assert_equals_(newCollection,$self._collection());
  54086. $ctx1.sendIdx["assert:equals:"]=1;
  54087. $recv(newCollection)._at_put_($self._sampleNewIndex(),$self._sampleNewValue());
  54088. $self._assert_equals_(newCollection,$self._collectionWithNewValue());
  54089. return self;
  54090. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{newCollection:newCollection},$globals.IndexableCollectionTest)});
  54091. },
  54092. args: [],
  54093. 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",
  54094. referencedClasses: [],
  54095. messageSends: ["collection", "samplesDo:", "at:put:", "assert:equals:", "sampleNewIndex", "sampleNewValue", "collectionWithNewValue"]
  54096. }),
  54097. $globals.IndexableCollectionTest);
  54098. $core.addMethod(
  54099. $core.method({
  54100. selector: "testIndexOf",
  54101. protocol: "tests",
  54102. fn: function (){
  54103. var self=this,$self=this;
  54104. return $core.withContext(function($ctx1) {
  54105. var $1;
  54106. $self._should_raise_((function(){
  54107. return $core.withContext(function($ctx2) {
  54108. $1=$self._collection();
  54109. $ctx2.sendIdx["collection"]=1;
  54110. return $recv($1)._indexOf_($self._sampleNewValue());
  54111. $ctx2.sendIdx["indexOf:"]=1;
  54112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  54113. }),$globals.Error);
  54114. $self._samplesDo_((function(index,value){
  54115. return $core.withContext(function($ctx2) {
  54116. return $self._assert_equals_($recv($self._collection())._indexOf_(value),index);
  54117. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,2)});
  54118. }));
  54119. return self;
  54120. }, function($ctx1) {$ctx1.fill(self,"testIndexOf",{},$globals.IndexableCollectionTest)});
  54121. },
  54122. args: [],
  54123. 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 ]",
  54124. referencedClasses: ["Error"],
  54125. messageSends: ["should:raise:", "indexOf:", "collection", "sampleNewValue", "samplesDo:", "assert:equals:"]
  54126. }),
  54127. $globals.IndexableCollectionTest);
  54128. $core.addMethod(
  54129. $core.method({
  54130. selector: "testIndexOfWithNull",
  54131. protocol: "tests",
  54132. fn: function (){
  54133. var self=this,$self=this;
  54134. var jsNull;
  54135. return $core.withContext(function($ctx1) {
  54136. var $2,$1;
  54137. jsNull=$recv($globals.JSON)._parse_("null");
  54138. $self._samplesDo_((function(index,value){
  54139. return $core.withContext(function($ctx2) {
  54140. $2=$self._collection();
  54141. $recv($2)._at_put_(index,jsNull);
  54142. $1=$recv($2)._indexOf_(jsNull);
  54143. return $self._assert_equals_($1,index);
  54144. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  54145. }));
  54146. return self;
  54147. }, function($ctx1) {$ctx1.fill(self,"testIndexOfWithNull",{jsNull:jsNull},$globals.IndexableCollectionTest)});
  54148. },
  54149. args: [],
  54150. 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 ]",
  54151. referencedClasses: ["JSON"],
  54152. messageSends: ["parse:", "samplesDo:", "assert:equals:", "at:put:", "collection", "indexOf:"]
  54153. }),
  54154. $globals.IndexableCollectionTest);
  54155. $core.addMethod(
  54156. $core.method({
  54157. selector: "testWithIndexDo",
  54158. protocol: "tests",
  54159. fn: function (){
  54160. var self=this,$self=this;
  54161. var collection;
  54162. return $core.withContext(function($ctx1) {
  54163. collection=$self._collection();
  54164. $ctx1.sendIdx["collection"]=1;
  54165. $recv($self._collection())._withIndexDo_((function(each,index){
  54166. return $core.withContext(function($ctx2) {
  54167. return $self._assert_equals_($recv(collection)._at_(index),each);
  54168. }, function($ctx2) {$ctx2.fillBlock({each:each,index:index},$ctx1,1)});
  54169. }));
  54170. return self;
  54171. }, function($ctx1) {$ctx1.fill(self,"testWithIndexDo",{collection:collection},$globals.IndexableCollectionTest)});
  54172. },
  54173. args: [],
  54174. 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 ]",
  54175. referencedClasses: [],
  54176. messageSends: ["collection", "withIndexDo:", "assert:equals:", "at:"]
  54177. }),
  54178. $globals.IndexableCollectionTest);
  54179. $core.addClass("AssociativeCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  54180. $core.addMethod(
  54181. $core.method({
  54182. selector: "collectionKeys",
  54183. protocol: "fixture",
  54184. fn: function (){
  54185. var self=this,$self=this;
  54186. return $core.withContext(function($ctx1) {
  54187. $self._subclassResponsibility();
  54188. return self;
  54189. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.AssociativeCollectionTest)});
  54190. },
  54191. args: [],
  54192. source: "collectionKeys\x0a\x09self subclassResponsibility",
  54193. referencedClasses: [],
  54194. messageSends: ["subclassResponsibility"]
  54195. }),
  54196. $globals.AssociativeCollectionTest);
  54197. $core.addMethod(
  54198. $core.method({
  54199. selector: "collectionValues",
  54200. protocol: "fixture",
  54201. fn: function (){
  54202. var self=this,$self=this;
  54203. return $core.withContext(function($ctx1) {
  54204. $self._subclassResponsibility();
  54205. return self;
  54206. }, function($ctx1) {$ctx1.fill(self,"collectionValues",{},$globals.AssociativeCollectionTest)});
  54207. },
  54208. args: [],
  54209. source: "collectionValues\x0a\x09self subclassResponsibility",
  54210. referencedClasses: [],
  54211. messageSends: ["subclassResponsibility"]
  54212. }),
  54213. $globals.AssociativeCollectionTest);
  54214. $core.addMethod(
  54215. $core.method({
  54216. selector: "nonIndexesDo:",
  54217. protocol: "fixture",
  54218. fn: function (aBlock){
  54219. var self=this,$self=this;
  54220. return $core.withContext(function($ctx1) {
  54221. $recv(aBlock)._value_((5));
  54222. $ctx1.sendIdx["value:"]=1;
  54223. $recv(aBlock)._value_((function(){
  54224. }));
  54225. $ctx1.sendIdx["value:"]=2;
  54226. $recv(aBlock)._value_($recv($globals.Object)._new());
  54227. $ctx1.sendIdx["value:"]=3;
  54228. $recv(aBlock)._value_("z");
  54229. return self;
  54230. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54231. },
  54232. args: ["aBlock"],
  54233. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 5.\x0a\x09aBlock value: [].\x0a\x09aBlock value: Object new.\x0a\x09aBlock value: 'z'",
  54234. referencedClasses: ["Object"],
  54235. messageSends: ["value:", "new"]
  54236. }),
  54237. $globals.AssociativeCollectionTest);
  54238. $core.addMethod(
  54239. $core.method({
  54240. selector: "sampleNewIndex",
  54241. protocol: "fixture",
  54242. fn: function (){
  54243. var self=this,$self=this;
  54244. return "new";
  54245. },
  54246. args: [],
  54247. source: "sampleNewIndex\x0a\x09^ 'new'",
  54248. referencedClasses: [],
  54249. messageSends: []
  54250. }),
  54251. $globals.AssociativeCollectionTest);
  54252. $core.addMethod(
  54253. $core.method({
  54254. selector: "samplesDo:",
  54255. protocol: "fixture",
  54256. fn: function (aBlock){
  54257. var self=this,$self=this;
  54258. return $core.withContext(function($ctx1) {
  54259. $recv(aBlock)._value_value_("a",(2));
  54260. return self;
  54261. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.AssociativeCollectionTest)});
  54262. },
  54263. args: ["aBlock"],
  54264. source: "samplesDo: aBlock\x0a\x09aBlock value: 'a' value: 2",
  54265. referencedClasses: [],
  54266. messageSends: ["value:value:"]
  54267. }),
  54268. $globals.AssociativeCollectionTest);
  54269. $core.addMethod(
  54270. $core.method({
  54271. selector: "testAddAll",
  54272. protocol: "tests",
  54273. fn: function (){
  54274. var self=this,$self=this;
  54275. return $core.withContext(function($ctx1) {
  54276. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  54277. (
  54278. $ctx1.supercall = true,
  54279. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  54280. $ctx1.supercall = false;
  54281. $2=$self._collection();
  54282. $ctx1.sendIdx["collection"]=1;
  54283. $3=$self._collection();
  54284. $ctx1.sendIdx["collection"]=2;
  54285. $recv($2)._addAll_($3);
  54286. $ctx1.sendIdx["addAll:"]=1;
  54287. $4=$recv($2)._yourself();
  54288. $ctx1.sendIdx["yourself"]=1;
  54289. $1=$4;
  54290. $5=$self._collection();
  54291. $ctx1.sendIdx["collection"]=3;
  54292. $self._assert_equals_($1,$5);
  54293. $ctx1.sendIdx["assert:equals:"]=1;
  54294. $7=$self._collection();
  54295. $ctx1.sendIdx["collection"]=4;
  54296. $8=$self._collectionWithNewValue();
  54297. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54298. $recv($7)._addAll_($8);
  54299. $ctx1.sendIdx["addAll:"]=2;
  54300. $9=$recv($7)._yourself();
  54301. $ctx1.sendIdx["yourself"]=2;
  54302. $6=$9;
  54303. $10=$self._collectionWithNewValue();
  54304. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54305. $self._assert_equals_($6,$10);
  54306. $ctx1.sendIdx["assert:equals:"]=2;
  54307. $12=$self._collectionWithNewValue();
  54308. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54309. $recv($12)._addAll_($self._collection());
  54310. $11=$recv($12)._yourself();
  54311. $self._assert_equals_($11,$self._collectionWithNewValue());
  54312. return self;
  54313. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.AssociativeCollectionTest)});
  54314. },
  54315. args: [],
  54316. 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",
  54317. referencedClasses: [],
  54318. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  54319. }),
  54320. $globals.AssociativeCollectionTest);
  54321. $core.addMethod(
  54322. $core.method({
  54323. selector: "testAsDictionary",
  54324. protocol: "tests",
  54325. fn: function (){
  54326. var self=this,$self=this;
  54327. return $core.withContext(function($ctx1) {
  54328. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asDictionary())._isMemberOf_($globals.Dictionary));
  54329. return self;
  54330. }, function($ctx1) {$ctx1.fill(self,"testAsDictionary",{},$globals.AssociativeCollectionTest)});
  54331. },
  54332. args: [],
  54333. source: "testAsDictionary\x0aself assert: ( self collectionClass new asDictionary isMemberOf: Dictionary ).",
  54334. referencedClasses: ["Dictionary"],
  54335. messageSends: ["assert:", "isMemberOf:", "asDictionary", "new", "collectionClass"]
  54336. }),
  54337. $globals.AssociativeCollectionTest);
  54338. $core.addMethod(
  54339. $core.method({
  54340. selector: "testAsHashedCollection",
  54341. protocol: "tests",
  54342. fn: function (){
  54343. var self=this,$self=this;
  54344. return $core.withContext(function($ctx1) {
  54345. $self._assert_($recv($recv($recv($self._collectionClass())._new())._asHashedCollection())._isMemberOf_($globals.HashedCollection));
  54346. return self;
  54347. }, function($ctx1) {$ctx1.fill(self,"testAsHashedCollection",{},$globals.AssociativeCollectionTest)});
  54348. },
  54349. args: [],
  54350. source: "testAsHashedCollection\x0aself assert: ( self collectionClass new asHashedCollection isMemberOf: HashedCollection ).",
  54351. referencedClasses: ["HashedCollection"],
  54352. messageSends: ["assert:", "isMemberOf:", "asHashedCollection", "new", "collectionClass"]
  54353. }),
  54354. $globals.AssociativeCollectionTest);
  54355. $core.addMethod(
  54356. $core.method({
  54357. selector: "testComma",
  54358. protocol: "tests",
  54359. fn: function (){
  54360. var self=this,$self=this;
  54361. return $core.withContext(function($ctx1) {
  54362. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  54363. (
  54364. $ctx1.supercall = true,
  54365. ($globals.AssociativeCollectionTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  54366. $ctx1.supercall = false;
  54367. $2=$self._collection();
  54368. $ctx1.sendIdx["collection"]=1;
  54369. $3=$self._collection();
  54370. $ctx1.sendIdx["collection"]=2;
  54371. $1=$recv($2).__comma($3);
  54372. $ctx1.sendIdx[","]=1;
  54373. $4=$self._collection();
  54374. $ctx1.sendIdx["collection"]=3;
  54375. $self._assert_equals_($1,$4);
  54376. $ctx1.sendIdx["assert:equals:"]=1;
  54377. $6=$self._collection();
  54378. $ctx1.sendIdx["collection"]=4;
  54379. $7=$self._collectionWithNewValue();
  54380. $ctx1.sendIdx["collectionWithNewValue"]=1;
  54381. $5=$recv($6).__comma($7);
  54382. $ctx1.sendIdx[","]=2;
  54383. $8=$self._collectionWithNewValue();
  54384. $ctx1.sendIdx["collectionWithNewValue"]=2;
  54385. $self._assert_equals_($5,$8);
  54386. $ctx1.sendIdx["assert:equals:"]=2;
  54387. $10=$self._collectionWithNewValue();
  54388. $ctx1.sendIdx["collectionWithNewValue"]=3;
  54389. $9=$recv($10).__comma($self._collection());
  54390. $self._assert_equals_($9,$self._collectionWithNewValue());
  54391. return self;
  54392. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.AssociativeCollectionTest)});
  54393. },
  54394. args: [],
  54395. 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",
  54396. referencedClasses: [],
  54397. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  54398. }),
  54399. $globals.AssociativeCollectionTest);
  54400. $core.addMethod(
  54401. $core.method({
  54402. selector: "testFrom",
  54403. protocol: "tests",
  54404. fn: function (){
  54405. var self=this,$self=this;
  54406. var associations;
  54407. return $core.withContext(function($ctx1) {
  54408. var $1;
  54409. $1="a".__minus_gt((1));
  54410. $ctx1.sendIdx["->"]=1;
  54411. associations=[$1,"b".__minus_gt((2))];
  54412. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._from_(associations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54413. return self;
  54414. }, function($ctx1) {$ctx1.fill(self,"testFrom",{associations:associations},$globals.AssociativeCollectionTest)});
  54415. },
  54416. args: [],
  54417. 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 }.",
  54418. referencedClasses: [],
  54419. messageSends: ["->", "assertSameContents:as:", "from:", "collectionClass", "class"]
  54420. }),
  54421. $globals.AssociativeCollectionTest);
  54422. $core.addMethod(
  54423. $core.method({
  54424. selector: "testKeys",
  54425. protocol: "tests",
  54426. fn: function (){
  54427. var self=this,$self=this;
  54428. return $core.withContext(function($ctx1) {
  54429. var $2,$1,$3,$4;
  54430. $2=$recv($recv($self._collectionClass())._new())._keys();
  54431. $ctx1.sendIdx["keys"]=1;
  54432. $1=$recv($2)._isEmpty();
  54433. $self._assert_($1);
  54434. $3=$recv($self._collection())._keys();
  54435. $ctx1.sendIdx["keys"]=2;
  54436. $4=$self._collectionKeys();
  54437. $ctx1.sendIdx["collectionKeys"]=1;
  54438. $self._assertSameContents_as_($3,$4);
  54439. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54440. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._keys(),$recv($self._collectionKeys()).__comma([$self._sampleNewIndex()]));
  54441. return self;
  54442. }, function($ctx1) {$ctx1.fill(self,"testKeys",{},$globals.AssociativeCollectionTest)});
  54443. },
  54444. args: [],
  54445. 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 }",
  54446. referencedClasses: [],
  54447. messageSends: ["assert:", "isEmpty", "keys", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionKeys", "collectionWithNewValue", ",", "sampleNewIndex"]
  54448. }),
  54449. $globals.AssociativeCollectionTest);
  54450. $core.addMethod(
  54451. $core.method({
  54452. selector: "testNewFromPairs",
  54453. protocol: "tests",
  54454. fn: function (){
  54455. var self=this,$self=this;
  54456. var flattenedAssociations;
  54457. return $core.withContext(function($ctx1) {
  54458. flattenedAssociations=["a",(1),"b",(2)];
  54459. $self._assertSameContents_as_($recv($recv($self._class())._collectionClass())._newFromPairs_(flattenedAssociations),$globals.HashedCollection._newFromPairs_(["a",(1),"b",(2)]));
  54460. return self;
  54461. }, function($ctx1) {$ctx1.fill(self,"testNewFromPairs",{flattenedAssociations:flattenedAssociations},$globals.AssociativeCollectionTest)});
  54462. },
  54463. args: [],
  54464. 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 }.",
  54465. referencedClasses: [],
  54466. messageSends: ["assertSameContents:as:", "newFromPairs:", "collectionClass", "class"]
  54467. }),
  54468. $globals.AssociativeCollectionTest);
  54469. $core.addMethod(
  54470. $core.method({
  54471. selector: "testPrintString",
  54472. protocol: "tests",
  54473. fn: function (){
  54474. var self=this,$self=this;
  54475. return $core.withContext(function($ctx1) {
  54476. var $3,$2,$1,$4;
  54477. $3=$self._collectionClass();
  54478. $ctx1.sendIdx["collectionClass"]=1;
  54479. $2=$recv($3)._new();
  54480. $recv($2)._at_put_("firstname","James");
  54481. $ctx1.sendIdx["at:put:"]=1;
  54482. $recv($2)._at_put_("lastname","Bond");
  54483. $1=$recv($2)._printString();
  54484. $4=$recv("a ".__comma($recv($self._collectionClass())._name())).__comma(" ('firstname' -> 'James' , 'lastname' -> 'Bond')");
  54485. $ctx1.sendIdx[","]=1;
  54486. $self._assert_equals_($1,$4);
  54487. return self;
  54488. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{},$globals.AssociativeCollectionTest)});
  54489. },
  54490. args: [],
  54491. 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'')'",
  54492. referencedClasses: [],
  54493. messageSends: ["assert:equals:", "at:put:", "new", "collectionClass", "printString", ",", "name"]
  54494. }),
  54495. $globals.AssociativeCollectionTest);
  54496. $core.addMethod(
  54497. $core.method({
  54498. selector: "testRemoveKey",
  54499. protocol: "tests",
  54500. fn: function (){
  54501. var self=this,$self=this;
  54502. return $core.withContext(function($ctx1) {
  54503. var $1,$2,$3,$5,$6,$4,$8,$7;
  54504. $self._nonIndexesDo_((function(each){
  54505. var collection;
  54506. return $core.withContext(function($ctx2) {
  54507. collection=$self._collection();
  54508. $ctx2.sendIdx["collection"]=1;
  54509. $self._should_raise_((function(){
  54510. return $core.withContext(function($ctx3) {
  54511. return $recv(collection)._removeKey_(each);
  54512. $ctx3.sendIdx["removeKey:"]=1;
  54513. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54514. }),$globals.Error);
  54515. $1=collection;
  54516. $2=$self._collection();
  54517. $ctx2.sendIdx["collection"]=2;
  54518. return $self._assert_equals_($1,$2);
  54519. $ctx2.sendIdx["assert:equals:"]=1;
  54520. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54521. }));
  54522. $self._samplesDo_((function(index,value){
  54523. var collection;
  54524. return $core.withContext(function($ctx2) {
  54525. collection=$self._collection();
  54526. $ctx2.sendIdx["collection"]=3;
  54527. $3=$recv(collection)._removeKey_(index);
  54528. $ctx2.sendIdx["removeKey:"]=2;
  54529. $self._assert_equals_($3,value);
  54530. $ctx2.sendIdx["assert:equals:"]=2;
  54531. $5=collection;
  54532. $6=$self._collection();
  54533. $ctx2.sendIdx["collection"]=4;
  54534. $4=$recv($5).__eq($6);
  54535. return $self._deny_($4);
  54536. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54537. }));
  54538. $8=$self._collectionWithNewValue();
  54539. $recv($8)._removeKey_($self._sampleNewIndex());
  54540. $7=$recv($8)._yourself();
  54541. $self._assert_equals_($7,$self._collection());
  54542. return self;
  54543. }, function($ctx1) {$ctx1.fill(self,"testRemoveKey",{},$globals.AssociativeCollectionTest)});
  54544. },
  54545. args: [],
  54546. 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",
  54547. referencedClasses: ["Error"],
  54548. messageSends: ["nonIndexesDo:", "collection", "should:raise:", "removeKey:", "assert:equals:", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "yourself"]
  54549. }),
  54550. $globals.AssociativeCollectionTest);
  54551. $core.addMethod(
  54552. $core.method({
  54553. selector: "testRemoveKeyIfAbsent",
  54554. protocol: "tests",
  54555. fn: function (){
  54556. var self=this,$self=this;
  54557. return $core.withContext(function($ctx1) {
  54558. var $1,$2,$3,$4,$5,$7,$8,$6,$10,$9;
  54559. $self._nonIndexesDo_((function(each){
  54560. var collection;
  54561. return $core.withContext(function($ctx2) {
  54562. collection=$self._collection();
  54563. $ctx2.sendIdx["collection"]=1;
  54564. $1=$recv(collection)._removeKey_ifAbsent_(each,(function(){
  54565. return $core.withContext(function($ctx3) {
  54566. return $self._sampleNewValue();
  54567. $ctx3.sendIdx["sampleNewValue"]=1;
  54568. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  54569. }));
  54570. $ctx2.sendIdx["removeKey:ifAbsent:"]=1;
  54571. $2=$self._sampleNewValue();
  54572. $ctx2.sendIdx["sampleNewValue"]=2;
  54573. $self._assert_equals_($1,$2);
  54574. $ctx2.sendIdx["assert:equals:"]=1;
  54575. $3=collection;
  54576. $4=$self._collection();
  54577. $ctx2.sendIdx["collection"]=2;
  54578. return $self._assert_equals_($3,$4);
  54579. $ctx2.sendIdx["assert:equals:"]=2;
  54580. }, function($ctx2) {$ctx2.fillBlock({each:each,collection:collection},$ctx1,1)});
  54581. }));
  54582. $self._samplesDo_((function(index,value){
  54583. var collection;
  54584. return $core.withContext(function($ctx2) {
  54585. collection=$self._collection();
  54586. $ctx2.sendIdx["collection"]=3;
  54587. $5=$recv(collection)._removeKey_ifAbsent_(index,(function(){
  54588. return $core.withContext(function($ctx3) {
  54589. return $self._sampleNewValue();
  54590. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,4)});
  54591. }));
  54592. $ctx2.sendIdx["removeKey:ifAbsent:"]=2;
  54593. $self._assert_equals_($5,value);
  54594. $ctx2.sendIdx["assert:equals:"]=3;
  54595. $7=collection;
  54596. $8=$self._collection();
  54597. $ctx2.sendIdx["collection"]=4;
  54598. $6=$recv($7).__eq($8);
  54599. return $self._deny_($6);
  54600. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,3)});
  54601. }));
  54602. $10=$self._collectionWithNewValue();
  54603. $recv($10)._removeKey_ifAbsent_($self._sampleNewIndex(),(function(){
  54604. return $core.withContext(function($ctx2) {
  54605. return $self._assert_(false);
  54606. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  54607. }));
  54608. $9=$recv($10)._yourself();
  54609. $self._assert_equals_($9,$self._collection());
  54610. return self;
  54611. }, function($ctx1) {$ctx1.fill(self,"testRemoveKeyIfAbsent",{},$globals.AssociativeCollectionTest)});
  54612. },
  54613. args: [],
  54614. 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",
  54615. referencedClasses: [],
  54616. messageSends: ["nonIndexesDo:", "collection", "assert:equals:", "removeKey:ifAbsent:", "sampleNewValue", "samplesDo:", "deny:", "=", "collectionWithNewValue", "sampleNewIndex", "assert:", "yourself"]
  54617. }),
  54618. $globals.AssociativeCollectionTest);
  54619. $core.addMethod(
  54620. $core.method({
  54621. selector: "testValues",
  54622. protocol: "tests",
  54623. fn: function (){
  54624. var self=this,$self=this;
  54625. return $core.withContext(function($ctx1) {
  54626. var $2,$1,$3,$4;
  54627. $2=$recv($recv($self._collectionClass())._new())._values();
  54628. $ctx1.sendIdx["values"]=1;
  54629. $1=$recv($2)._isEmpty();
  54630. $self._assert_($1);
  54631. $3=$recv($self._collection())._values();
  54632. $ctx1.sendIdx["values"]=2;
  54633. $4=$self._collectionValues();
  54634. $ctx1.sendIdx["collectionValues"]=1;
  54635. $self._assertSameContents_as_($3,$4);
  54636. $ctx1.sendIdx["assertSameContents:as:"]=1;
  54637. $self._assertSameContents_as_($recv($self._collectionWithNewValue())._values(),$recv($self._collectionValues()).__comma([$self._sampleNewValue()]));
  54638. return self;
  54639. }, function($ctx1) {$ctx1.fill(self,"testValues",{},$globals.AssociativeCollectionTest)});
  54640. },
  54641. args: [],
  54642. 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 }",
  54643. referencedClasses: [],
  54644. messageSends: ["assert:", "isEmpty", "values", "new", "collectionClass", "assertSameContents:as:", "collection", "collectionValues", "collectionWithNewValue", ",", "sampleNewValue"]
  54645. }),
  54646. $globals.AssociativeCollectionTest);
  54647. $core.addClass("DictionaryTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54648. $core.addMethod(
  54649. $core.method({
  54650. selector: "collection",
  54651. protocol: "fixture",
  54652. fn: function (){
  54653. var self=this,$self=this;
  54654. return $core.withContext(function($ctx1) {
  54655. var $1;
  54656. $1=$recv($globals.Dictionary)._new();
  54657. $recv($1)._at_put_((1),(1));
  54658. $ctx1.sendIdx["at:put:"]=1;
  54659. $recv($1)._at_put_("a",(2));
  54660. $ctx1.sendIdx["at:put:"]=2;
  54661. $recv($1)._at_put_(true,(3));
  54662. $ctx1.sendIdx["at:put:"]=3;
  54663. $recv($1)._at_put_((1).__at((3)),(-4));
  54664. $ctx1.sendIdx["at:put:"]=4;
  54665. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54666. return $recv($1)._yourself();
  54667. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.DictionaryTest)});
  54668. },
  54669. args: [],
  54670. 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",
  54671. referencedClasses: ["Dictionary"],
  54672. messageSends: ["at:put:", "new", "@", "yourself"]
  54673. }),
  54674. $globals.DictionaryTest);
  54675. $core.addMethod(
  54676. $core.method({
  54677. selector: "collectionKeys",
  54678. protocol: "fixture",
  54679. fn: function (){
  54680. var self=this,$self=this;
  54681. return $core.withContext(function($ctx1) {
  54682. return [(1),"a",true,(1).__at((3)),$self["@sampleBlock"]];
  54683. }, function($ctx1) {$ctx1.fill(self,"collectionKeys",{},$globals.DictionaryTest)});
  54684. },
  54685. args: [],
  54686. source: "collectionKeys\x0a\x09^ {1. 'a'. true. 1@3. sampleBlock}",
  54687. referencedClasses: [],
  54688. messageSends: ["@"]
  54689. }),
  54690. $globals.DictionaryTest);
  54691. $core.addMethod(
  54692. $core.method({
  54693. selector: "collectionOfPrintStrings",
  54694. protocol: "fixture",
  54695. fn: function (){
  54696. var self=this,$self=this;
  54697. return $core.withContext(function($ctx1) {
  54698. var $1;
  54699. $1=$recv($globals.Dictionary)._new();
  54700. $recv($1)._at_put_((1),"1");
  54701. $ctx1.sendIdx["at:put:"]=1;
  54702. $recv($1)._at_put_("a","2");
  54703. $ctx1.sendIdx["at:put:"]=2;
  54704. $recv($1)._at_put_(true,"3");
  54705. $ctx1.sendIdx["at:put:"]=3;
  54706. $recv($1)._at_put_((1).__at((3)),"-4");
  54707. $ctx1.sendIdx["at:put:"]=4;
  54708. $recv($1)._at_put_($self["@sampleBlock"],"9");
  54709. return $recv($1)._yourself();
  54710. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.DictionaryTest)});
  54711. },
  54712. args: [],
  54713. 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",
  54714. referencedClasses: ["Dictionary"],
  54715. messageSends: ["at:put:", "new", "@", "yourself"]
  54716. }),
  54717. $globals.DictionaryTest);
  54718. $core.addMethod(
  54719. $core.method({
  54720. selector: "collectionSize",
  54721. protocol: "fixture",
  54722. fn: function (){
  54723. var self=this,$self=this;
  54724. return (5);
  54725. },
  54726. args: [],
  54727. source: "collectionSize\x0a\x09^ 5",
  54728. referencedClasses: [],
  54729. messageSends: []
  54730. }),
  54731. $globals.DictionaryTest);
  54732. $core.addMethod(
  54733. $core.method({
  54734. selector: "collectionValues",
  54735. protocol: "fixture",
  54736. fn: function (){
  54737. var self=this,$self=this;
  54738. return [(1),(2),(3),(-4),(9)];
  54739. },
  54740. args: [],
  54741. source: "collectionValues\x0a\x09^ {1. 2. 3. -4. 9}",
  54742. referencedClasses: [],
  54743. messageSends: []
  54744. }),
  54745. $globals.DictionaryTest);
  54746. $core.addMethod(
  54747. $core.method({
  54748. selector: "collectionWithDuplicates",
  54749. protocol: "fixture",
  54750. fn: function (){
  54751. var self=this,$self=this;
  54752. return $core.withContext(function($ctx1) {
  54753. var $1;
  54754. $1=$recv($globals.Dictionary)._new();
  54755. $recv($1)._at_put_((1),(1));
  54756. $ctx1.sendIdx["at:put:"]=1;
  54757. $recv($1)._at_put_("a",(2));
  54758. $ctx1.sendIdx["at:put:"]=2;
  54759. $recv($1)._at_put_(true,(3));
  54760. $ctx1.sendIdx["at:put:"]=3;
  54761. $recv($1)._at_put_((4),(-4));
  54762. $ctx1.sendIdx["at:put:"]=4;
  54763. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54764. $ctx1.sendIdx["at:put:"]=5;
  54765. $recv($1)._at_put_("b",(1));
  54766. $ctx1.sendIdx["at:put:"]=6;
  54767. $recv($1)._at_put_((3),(3));
  54768. $ctx1.sendIdx["at:put:"]=7;
  54769. $recv($1)._at_put_(false,(12));
  54770. return $recv($1)._yourself();
  54771. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.DictionaryTest)});
  54772. },
  54773. args: [],
  54774. 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",
  54775. referencedClasses: ["Dictionary"],
  54776. messageSends: ["at:put:", "new", "yourself"]
  54777. }),
  54778. $globals.DictionaryTest);
  54779. $core.addMethod(
  54780. $core.method({
  54781. selector: "collectionWithNewValue",
  54782. protocol: "fixture",
  54783. fn: function (){
  54784. var self=this,$self=this;
  54785. return $core.withContext(function($ctx1) {
  54786. var $1;
  54787. $1=$recv($globals.Dictionary)._new();
  54788. $recv($1)._at_put_((1),(1));
  54789. $ctx1.sendIdx["at:put:"]=1;
  54790. $recv($1)._at_put_("a",(2));
  54791. $ctx1.sendIdx["at:put:"]=2;
  54792. $recv($1)._at_put_(true,(3));
  54793. $ctx1.sendIdx["at:put:"]=3;
  54794. $recv($1)._at_put_((1).__at((3)),(-4));
  54795. $ctx1.sendIdx["at:put:"]=4;
  54796. $recv($1)._at_put_($self["@sampleBlock"],(9));
  54797. $ctx1.sendIdx["at:put:"]=5;
  54798. $recv($1)._at_put_("new","N");
  54799. return $recv($1)._yourself();
  54800. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.DictionaryTest)});
  54801. },
  54802. args: [],
  54803. 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",
  54804. referencedClasses: ["Dictionary"],
  54805. messageSends: ["at:put:", "new", "@", "yourself"]
  54806. }),
  54807. $globals.DictionaryTest);
  54808. $core.addMethod(
  54809. $core.method({
  54810. selector: "sampleNewValueAsCollection",
  54811. protocol: "fixture",
  54812. fn: function (){
  54813. var self=this,$self=this;
  54814. return $core.withContext(function($ctx1) {
  54815. var $1;
  54816. $1=$recv($globals.Dictionary)._new();
  54817. $recv($1)._at_put_("new","N");
  54818. return $recv($1)._yourself();
  54819. }, function($ctx1) {$ctx1.fill(self,"sampleNewValueAsCollection",{},$globals.DictionaryTest)});
  54820. },
  54821. args: [],
  54822. source: "sampleNewValueAsCollection\x0a\x09^ Dictionary new\x0a\x09\x09at: 'new' put: 'N';\x0a\x09\x09yourself",
  54823. referencedClasses: ["Dictionary"],
  54824. messageSends: ["at:put:", "new", "yourself"]
  54825. }),
  54826. $globals.DictionaryTest);
  54827. $core.addMethod(
  54828. $core.method({
  54829. selector: "samplesDo:",
  54830. protocol: "fixture",
  54831. fn: function (aBlock){
  54832. var self=this,$self=this;
  54833. return $core.withContext(function($ctx1) {
  54834. (
  54835. $ctx1.supercall = true,
  54836. ($globals.DictionaryTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  54837. $ctx1.supercall = false;
  54838. $recv(aBlock)._value_value_(true,(3));
  54839. $ctx1.sendIdx["value:value:"]=1;
  54840. $recv(aBlock)._value_value_((1).__at((3)),(-4));
  54841. $ctx1.sendIdx["value:value:"]=2;
  54842. $recv(aBlock)._value_value_($self["@sampleBlock"],(9));
  54843. return self;
  54844. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.DictionaryTest)});
  54845. },
  54846. args: ["aBlock"],
  54847. 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",
  54848. referencedClasses: [],
  54849. messageSends: ["samplesDo:", "value:value:", "@"]
  54850. }),
  54851. $globals.DictionaryTest);
  54852. $core.addMethod(
  54853. $core.method({
  54854. selector: "testAccessing",
  54855. protocol: "tests",
  54856. fn: function (){
  54857. var self=this,$self=this;
  54858. var d;
  54859. return $core.withContext(function($ctx1) {
  54860. var $1,$2,$3,$4,$5,$6,$7,$9,$10,$8,$12,$13,$11;
  54861. d=$recv($globals.Dictionary)._new();
  54862. $recv(d)._at_put_("hello","world");
  54863. $ctx1.sendIdx["at:put:"]=1;
  54864. $1=$recv(d)._at_("hello");
  54865. $ctx1.sendIdx["at:"]=1;
  54866. $self._assert_equals_($1,"world");
  54867. $ctx1.sendIdx["assert:equals:"]=1;
  54868. $2=$recv(d)._at_ifAbsent_("hello",(function(){
  54869. return nil;
  54870. }));
  54871. $ctx1.sendIdx["at:ifAbsent:"]=1;
  54872. $self._assert_equals_($2,"world");
  54873. $ctx1.sendIdx["assert:equals:"]=2;
  54874. $self._deny_($recv($recv(d)._at_ifAbsent_("foo",(function(){
  54875. return nil;
  54876. }))).__eq("world"));
  54877. $ctx1.sendIdx["deny:"]=1;
  54878. $3=$recv(d)._includesKey_("hello");
  54879. $ctx1.sendIdx["includesKey:"]=1;
  54880. $self._assert_($3);
  54881. $ctx1.sendIdx["assert:"]=1;
  54882. $4=$recv(d)._includesKey_("foo");
  54883. $ctx1.sendIdx["includesKey:"]=2;
  54884. $self._deny_($4);
  54885. $ctx1.sendIdx["deny:"]=2;
  54886. $recv(d)._at_put_((1),(2));
  54887. $ctx1.sendIdx["at:put:"]=2;
  54888. $5=$recv(d)._at_((1));
  54889. $ctx1.sendIdx["at:"]=2;
  54890. $self._assert_equals_($5,(2));
  54891. $ctx1.sendIdx["assert:equals:"]=3;
  54892. $6=d;
  54893. $7=(1).__at((3));
  54894. $ctx1.sendIdx["@"]=1;
  54895. $recv($6)._at_put_($7,(3));
  54896. $9=d;
  54897. $10=(1).__at((3));
  54898. $ctx1.sendIdx["@"]=2;
  54899. $8=$recv($9)._at_($10);
  54900. $self._assert_equals_($8,(3));
  54901. $12=d;
  54902. $13=(1).__at((3));
  54903. $ctx1.sendIdx["@"]=3;
  54904. $11=$recv($12)._includesKey_($13);
  54905. $ctx1.sendIdx["includesKey:"]=3;
  54906. $self._assert_($11);
  54907. $self._deny_($recv(d)._includesKey_((3).__at((1))));
  54908. return self;
  54909. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{d:d},$globals.DictionaryTest)});
  54910. },
  54911. args: [],
  54912. 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)",
  54913. referencedClasses: ["Dictionary"],
  54914. messageSends: ["new", "at:put:", "assert:equals:", "at:", "at:ifAbsent:", "deny:", "=", "assert:", "includesKey:", "@"]
  54915. }),
  54916. $globals.DictionaryTest);
  54917. $core.addMethod(
  54918. $core.method({
  54919. selector: "testDynamicDictionaries",
  54920. protocol: "tests",
  54921. fn: function (){
  54922. var self=this,$self=this;
  54923. return $core.withContext(function($ctx1) {
  54924. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asDictionary(),$recv($globals.Dictionary)._with_("hello".__minus_gt((1))));
  54925. return self;
  54926. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.DictionaryTest)});
  54927. },
  54928. args: [],
  54929. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asDictionary equals: (Dictionary with: 'hello' -> 1)",
  54930. referencedClasses: ["Dictionary"],
  54931. messageSends: ["assert:equals:", "asDictionary", "with:", "->"]
  54932. }),
  54933. $globals.DictionaryTest);
  54934. $core.addMethod(
  54935. $core.method({
  54936. selector: "collectionClass",
  54937. protocol: "fixture",
  54938. fn: function (){
  54939. var self=this,$self=this;
  54940. return $globals.Dictionary;
  54941. },
  54942. args: [],
  54943. source: "collectionClass\x0a\x09^ Dictionary",
  54944. referencedClasses: ["Dictionary"],
  54945. messageSends: []
  54946. }),
  54947. $globals.DictionaryTest.a$cls);
  54948. $core.addClass("HashedCollectionTest", $globals.AssociativeCollectionTest, [], "Kernel-Tests");
  54949. $core.addMethod(
  54950. $core.method({
  54951. selector: "collection",
  54952. protocol: "fixture",
  54953. fn: function (){
  54954. var self=this,$self=this;
  54955. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4)]);
  54956. },
  54957. args: [],
  54958. source: "collection\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4 }",
  54959. referencedClasses: [],
  54960. messageSends: []
  54961. }),
  54962. $globals.HashedCollectionTest);
  54963. $core.addMethod(
  54964. $core.method({
  54965. selector: "collectionKeys",
  54966. protocol: "fixture",
  54967. fn: function (){
  54968. var self=this,$self=this;
  54969. return ["b","a","c","d"];
  54970. },
  54971. args: [],
  54972. source: "collectionKeys\x0a\x09^ { 'b'. 'a'. 'c'. 'd' }",
  54973. referencedClasses: [],
  54974. messageSends: []
  54975. }),
  54976. $globals.HashedCollectionTest);
  54977. $core.addMethod(
  54978. $core.method({
  54979. selector: "collectionOfPrintStrings",
  54980. protocol: "fixture",
  54981. fn: function (){
  54982. var self=this,$self=this;
  54983. return $globals.HashedCollection._newFromPairs_(["b","1","a","2","c","3","d","-4"]);
  54984. },
  54985. args: [],
  54986. source: "collectionOfPrintStrings\x0a\x09^ #{ 'b' -> '1'. 'a' -> '2'. 'c' -> '3'. 'd' -> '-4' }",
  54987. referencedClasses: [],
  54988. messageSends: []
  54989. }),
  54990. $globals.HashedCollectionTest);
  54991. $core.addMethod(
  54992. $core.method({
  54993. selector: "collectionSize",
  54994. protocol: "fixture",
  54995. fn: function (){
  54996. var self=this,$self=this;
  54997. return (4);
  54998. },
  54999. args: [],
  55000. source: "collectionSize\x0a\x09^ 4",
  55001. referencedClasses: [],
  55002. messageSends: []
  55003. }),
  55004. $globals.HashedCollectionTest);
  55005. $core.addMethod(
  55006. $core.method({
  55007. selector: "collectionValues",
  55008. protocol: "fixture",
  55009. fn: function (){
  55010. var self=this,$self=this;
  55011. return [(1),(2),(3),(-4)];
  55012. },
  55013. args: [],
  55014. source: "collectionValues\x0a\x09^ { 1. 2. 3. -4 }",
  55015. referencedClasses: [],
  55016. messageSends: []
  55017. }),
  55018. $globals.HashedCollectionTest);
  55019. $core.addMethod(
  55020. $core.method({
  55021. selector: "collectionWithDuplicates",
  55022. protocol: "fixture",
  55023. fn: function (){
  55024. var self=this,$self=this;
  55025. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"e",(1),"f",(2),"g",(10),"h",(0)]);
  55026. },
  55027. args: [],
  55028. source: "collectionWithDuplicates\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'e' -> 1. 'f' -> 2. 'g' -> 10. 'h' -> 0 }",
  55029. referencedClasses: [],
  55030. messageSends: []
  55031. }),
  55032. $globals.HashedCollectionTest);
  55033. $core.addMethod(
  55034. $core.method({
  55035. selector: "collectionWithNewValue",
  55036. protocol: "fixture",
  55037. fn: function (){
  55038. var self=this,$self=this;
  55039. return $globals.HashedCollection._newFromPairs_(["b",(1),"a",(2),"c",(3),"d",(-4),"new","N"]);
  55040. },
  55041. args: [],
  55042. source: "collectionWithNewValue\x0a\x09^ #{ 'b' -> 1. 'a' -> 2. 'c' -> 3. 'd' -> -4. 'new' -> 'N' }",
  55043. referencedClasses: [],
  55044. messageSends: []
  55045. }),
  55046. $globals.HashedCollectionTest);
  55047. $core.addMethod(
  55048. $core.method({
  55049. selector: "sampleNewValueAsCollection",
  55050. protocol: "fixture",
  55051. fn: function (){
  55052. var self=this,$self=this;
  55053. return $globals.HashedCollection._newFromPairs_(["new","N"]);
  55054. },
  55055. args: [],
  55056. source: "sampleNewValueAsCollection\x0a\x09^ #{ 'new' -> 'N' }",
  55057. referencedClasses: [],
  55058. messageSends: []
  55059. }),
  55060. $globals.HashedCollectionTest);
  55061. $core.addMethod(
  55062. $core.method({
  55063. selector: "testDynamicDictionaries",
  55064. protocol: "tests",
  55065. fn: function (){
  55066. var self=this,$self=this;
  55067. return $core.withContext(function($ctx1) {
  55068. $self._assert_equals_($recv($globals.HashedCollection._newFromPairs_(["hello",(1)]))._asHashedCollection(),$recv($globals.HashedCollection)._with_("hello".__minus_gt((1))));
  55069. return self;
  55070. }, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaries",{},$globals.HashedCollectionTest)});
  55071. },
  55072. args: [],
  55073. source: "testDynamicDictionaries\x0a\x09self assert: #{'hello' -> 1} asHashedCollection equals: (HashedCollection with: 'hello' -> 1)",
  55074. referencedClasses: ["HashedCollection"],
  55075. messageSends: ["assert:equals:", "asHashedCollection", "with:", "->"]
  55076. }),
  55077. $globals.HashedCollectionTest);
  55078. $core.addMethod(
  55079. $core.method({
  55080. selector: "collectionClass",
  55081. protocol: "fixture",
  55082. fn: function (){
  55083. var self=this,$self=this;
  55084. return $globals.HashedCollection;
  55085. },
  55086. args: [],
  55087. source: "collectionClass\x0a\x09^ HashedCollection",
  55088. referencedClasses: ["HashedCollection"],
  55089. messageSends: []
  55090. }),
  55091. $globals.HashedCollectionTest.a$cls);
  55092. $core.addClass("SequenceableCollectionTest", $globals.IndexableCollectionTest, [], "Kernel-Tests");
  55093. $core.addMethod(
  55094. $core.method({
  55095. selector: "collectionFirst",
  55096. protocol: "fixture",
  55097. fn: function (){
  55098. var self=this,$self=this;
  55099. return $core.withContext(function($ctx1) {
  55100. $self._subclassResponsibility();
  55101. return self;
  55102. }, function($ctx1) {$ctx1.fill(self,"collectionFirst",{},$globals.SequenceableCollectionTest)});
  55103. },
  55104. args: [],
  55105. source: "collectionFirst\x0a\x09self subclassResponsibility",
  55106. referencedClasses: [],
  55107. messageSends: ["subclassResponsibility"]
  55108. }),
  55109. $globals.SequenceableCollectionTest);
  55110. $core.addMethod(
  55111. $core.method({
  55112. selector: "collectionFirstTwo",
  55113. protocol: "fixture",
  55114. fn: function (){
  55115. var self=this,$self=this;
  55116. return $core.withContext(function($ctx1) {
  55117. $self._subclassResponsibility();
  55118. return self;
  55119. }, function($ctx1) {$ctx1.fill(self,"collectionFirstTwo",{},$globals.SequenceableCollectionTest)});
  55120. },
  55121. args: [],
  55122. source: "collectionFirstTwo\x0a\x09self subclassResponsibility",
  55123. referencedClasses: [],
  55124. messageSends: ["subclassResponsibility"]
  55125. }),
  55126. $globals.SequenceableCollectionTest);
  55127. $core.addMethod(
  55128. $core.method({
  55129. selector: "collectionLast",
  55130. protocol: "fixture",
  55131. fn: function (){
  55132. var self=this,$self=this;
  55133. return $core.withContext(function($ctx1) {
  55134. $self._subclassResponsibility();
  55135. return self;
  55136. }, function($ctx1) {$ctx1.fill(self,"collectionLast",{},$globals.SequenceableCollectionTest)});
  55137. },
  55138. args: [],
  55139. source: "collectionLast\x0a\x09self subclassResponsibility",
  55140. referencedClasses: [],
  55141. messageSends: ["subclassResponsibility"]
  55142. }),
  55143. $globals.SequenceableCollectionTest);
  55144. $core.addMethod(
  55145. $core.method({
  55146. selector: "collectionLastTwo",
  55147. protocol: "fixture",
  55148. fn: function (){
  55149. var self=this,$self=this;
  55150. return $core.withContext(function($ctx1) {
  55151. $self._subclassResponsibility();
  55152. return self;
  55153. }, function($ctx1) {$ctx1.fill(self,"collectionLastTwo",{},$globals.SequenceableCollectionTest)});
  55154. },
  55155. args: [],
  55156. source: "collectionLastTwo\x0a\x09self subclassResponsibility",
  55157. referencedClasses: [],
  55158. messageSends: ["subclassResponsibility"]
  55159. }),
  55160. $globals.SequenceableCollectionTest);
  55161. $core.addMethod(
  55162. $core.method({
  55163. selector: "nonIndexesDo:",
  55164. protocol: "fixture",
  55165. fn: function (aBlock){
  55166. var self=this,$self=this;
  55167. return $core.withContext(function($ctx1) {
  55168. $recv(aBlock)._value_((0));
  55169. $ctx1.sendIdx["value:"]=1;
  55170. $recv(aBlock)._value_($recv($self._collectionSize()).__plus((1)));
  55171. $ctx1.sendIdx["value:"]=2;
  55172. $recv(aBlock)._value_("z");
  55173. return self;
  55174. }, function($ctx1) {$ctx1.fill(self,"nonIndexesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55175. },
  55176. args: ["aBlock"],
  55177. source: "nonIndexesDo: aBlock\x0a\x09aBlock value: 0.\x0a\x09aBlock value: self collectionSize + 1.\x0a\x09aBlock value: 'z'",
  55178. referencedClasses: [],
  55179. messageSends: ["value:", "+", "collectionSize"]
  55180. }),
  55181. $globals.SequenceableCollectionTest);
  55182. $core.addMethod(
  55183. $core.method({
  55184. selector: "samplesDo:",
  55185. protocol: "fixture",
  55186. fn: function (aBlock){
  55187. var self=this,$self=this;
  55188. return $core.withContext(function($ctx1) {
  55189. $recv(aBlock)._value_value_((1),$self._collectionFirst());
  55190. $ctx1.sendIdx["value:value:"]=1;
  55191. $recv(aBlock)._value_value_($self._collectionSize(),$self._collectionLast());
  55192. return self;
  55193. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.SequenceableCollectionTest)});
  55194. },
  55195. args: ["aBlock"],
  55196. source: "samplesDo: aBlock\x0a\x09aBlock value: 1 value: self collectionFirst.\x0a\x09aBlock value: self collectionSize value: self collectionLast",
  55197. referencedClasses: [],
  55198. messageSends: ["value:value:", "collectionFirst", "collectionSize", "collectionLast"]
  55199. }),
  55200. $globals.SequenceableCollectionTest);
  55201. $core.addMethod(
  55202. $core.method({
  55203. selector: "testBeginsWith",
  55204. protocol: "tests",
  55205. fn: function (){
  55206. var self=this,$self=this;
  55207. return $core.withContext(function($ctx1) {
  55208. var $2,$1,$4,$5,$3,$7,$6;
  55209. $2=$self._collection();
  55210. $ctx1.sendIdx["collection"]=1;
  55211. $1=$recv($2)._beginsWith_($recv($self._collectionClass())._new());
  55212. $ctx1.sendIdx["beginsWith:"]=1;
  55213. $self._assert_($1);
  55214. $ctx1.sendIdx["assert:"]=1;
  55215. $4=$self._collection();
  55216. $ctx1.sendIdx["collection"]=2;
  55217. $5=$self._collection();
  55218. $ctx1.sendIdx["collection"]=3;
  55219. $3=$recv($4)._beginsWith_($5);
  55220. $ctx1.sendIdx["beginsWith:"]=2;
  55221. $self._assert_($3);
  55222. $ctx1.sendIdx["assert:"]=2;
  55223. $7=$self._collection();
  55224. $ctx1.sendIdx["collection"]=4;
  55225. $6=$recv($7)._beginsWith_($self._collectionFirstTwo());
  55226. $ctx1.sendIdx["beginsWith:"]=3;
  55227. $self._assert_($6);
  55228. $self._deny_($recv($self._collection())._beginsWith_($self._collectionLastTwo()));
  55229. return self;
  55230. }, function($ctx1) {$ctx1.fill(self,"testBeginsWith",{},$globals.SequenceableCollectionTest)});
  55231. },
  55232. args: [],
  55233. 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)",
  55234. referencedClasses: [],
  55235. messageSends: ["assert:", "beginsWith:", "collection", "new", "collectionClass", "collectionFirstTwo", "deny:", "collectionLastTwo"]
  55236. }),
  55237. $globals.SequenceableCollectionTest);
  55238. $core.addMethod(
  55239. $core.method({
  55240. selector: "testEndsWith",
  55241. protocol: "tests",
  55242. fn: function (){
  55243. var self=this,$self=this;
  55244. return $core.withContext(function($ctx1) {
  55245. var $2,$1,$4,$5,$3,$7,$6;
  55246. $2=$self._collection();
  55247. $ctx1.sendIdx["collection"]=1;
  55248. $1=$recv($2)._endsWith_($recv($self._collectionClass())._new());
  55249. $ctx1.sendIdx["endsWith:"]=1;
  55250. $self._assert_($1);
  55251. $ctx1.sendIdx["assert:"]=1;
  55252. $4=$self._collection();
  55253. $ctx1.sendIdx["collection"]=2;
  55254. $5=$self._collection();
  55255. $ctx1.sendIdx["collection"]=3;
  55256. $3=$recv($4)._endsWith_($5);
  55257. $ctx1.sendIdx["endsWith:"]=2;
  55258. $self._assert_($3);
  55259. $ctx1.sendIdx["assert:"]=2;
  55260. $7=$self._collection();
  55261. $ctx1.sendIdx["collection"]=4;
  55262. $6=$recv($7)._endsWith_($self._collectionLastTwo());
  55263. $ctx1.sendIdx["endsWith:"]=3;
  55264. $self._assert_($6);
  55265. $self._deny_($recv($self._collection())._endsWith_($self._collectionFirstTwo()));
  55266. return self;
  55267. }, function($ctx1) {$ctx1.fill(self,"testEndsWith",{},$globals.SequenceableCollectionTest)});
  55268. },
  55269. args: [],
  55270. 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)",
  55271. referencedClasses: [],
  55272. messageSends: ["assert:", "endsWith:", "collection", "new", "collectionClass", "collectionLastTwo", "deny:", "collectionFirstTwo"]
  55273. }),
  55274. $globals.SequenceableCollectionTest);
  55275. $core.addMethod(
  55276. $core.method({
  55277. selector: "testFirst",
  55278. protocol: "tests",
  55279. fn: function (){
  55280. var self=this,$self=this;
  55281. return $core.withContext(function($ctx1) {
  55282. $self._assert_equals_($recv($self._collection())._first(),$self._collectionFirst());
  55283. return self;
  55284. }, function($ctx1) {$ctx1.fill(self,"testFirst",{},$globals.SequenceableCollectionTest)});
  55285. },
  55286. args: [],
  55287. source: "testFirst\x0a\x09self assert: self collection first equals: self collectionFirst",
  55288. referencedClasses: [],
  55289. messageSends: ["assert:equals:", "first", "collection", "collectionFirst"]
  55290. }),
  55291. $globals.SequenceableCollectionTest);
  55292. $core.addMethod(
  55293. $core.method({
  55294. selector: "testFirstN",
  55295. protocol: "tests",
  55296. fn: function (){
  55297. var self=this,$self=this;
  55298. return $core.withContext(function($ctx1) {
  55299. var $2,$1,$4,$3,$6,$5,$7;
  55300. $2=$self._collection();
  55301. $ctx1.sendIdx["collection"]=1;
  55302. $1=$recv($2)._first_((2));
  55303. $ctx1.sendIdx["first:"]=1;
  55304. $self._assert_equals_($1,$self._collectionFirstTwo());
  55305. $ctx1.sendIdx["assert:equals:"]=1;
  55306. $4=$self._collection();
  55307. $ctx1.sendIdx["collection"]=2;
  55308. $3=$recv($4)._first_((0));
  55309. $ctx1.sendIdx["first:"]=2;
  55310. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55311. $ctx1.sendIdx["assert:equals:"]=2;
  55312. $6=$self._collection();
  55313. $ctx1.sendIdx["collection"]=3;
  55314. $5=$recv($6)._first_($self._collectionSize());
  55315. $ctx1.sendIdx["first:"]=3;
  55316. $7=$self._collection();
  55317. $ctx1.sendIdx["collection"]=4;
  55318. $self._assert_equals_($5,$7);
  55319. $self._should_raise_((function(){
  55320. return $core.withContext(function($ctx2) {
  55321. return $recv($self._collection())._first_((33));
  55322. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55323. }),$globals.Error);
  55324. return self;
  55325. }, function($ctx1) {$ctx1.fill(self,"testFirstN",{},$globals.SequenceableCollectionTest)});
  55326. },
  55327. args: [],
  55328. 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",
  55329. referencedClasses: ["Error"],
  55330. messageSends: ["assert:equals:", "first:", "collection", "collectionFirstTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55331. }),
  55332. $globals.SequenceableCollectionTest);
  55333. $core.addMethod(
  55334. $core.method({
  55335. selector: "testFourth",
  55336. protocol: "tests",
  55337. fn: function (){
  55338. var self=this,$self=this;
  55339. return $core.withContext(function($ctx1) {
  55340. var $2,$1;
  55341. $2=$self._collection();
  55342. $ctx1.sendIdx["collection"]=1;
  55343. $1=$recv($2)._fourth();
  55344. $self._assert_equals_($1,$recv($self._collection())._at_((4)));
  55345. return self;
  55346. }, function($ctx1) {$ctx1.fill(self,"testFourth",{},$globals.SequenceableCollectionTest)});
  55347. },
  55348. args: [],
  55349. source: "testFourth\x0a\x09self assert: (self collection fourth) equals: (self collection at: 4)",
  55350. referencedClasses: [],
  55351. messageSends: ["assert:equals:", "fourth", "collection", "at:"]
  55352. }),
  55353. $globals.SequenceableCollectionTest);
  55354. $core.addMethod(
  55355. $core.method({
  55356. selector: "testIndexOfStartingAt",
  55357. protocol: "tests",
  55358. fn: function (){
  55359. var self=this,$self=this;
  55360. var jsNull;
  55361. return $core.withContext(function($ctx1) {
  55362. var $2,$1,$4,$3;
  55363. jsNull=$recv($globals.JSON)._parse_("null");
  55364. $self._samplesDo_((function(index,value){
  55365. return $core.withContext(function($ctx2) {
  55366. $2=$self._collection();
  55367. $ctx2.sendIdx["collection"]=1;
  55368. $1=$recv($2)._indexOf_startingAt_(value,(1));
  55369. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55370. $self._assert_equals_($1,index);
  55371. $ctx2.sendIdx["assert:equals:"]=1;
  55372. $4=$self._collection();
  55373. $ctx2.sendIdx["collection"]=2;
  55374. $3=$recv($4)._indexOf_startingAt_(value,index);
  55375. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55376. $self._assert_equals_($3,index);
  55377. $ctx2.sendIdx["assert:equals:"]=2;
  55378. return $self._assert_equals_($recv($self._collection())._indexOf_startingAt_(value,$recv(index).__plus((1))),(0));
  55379. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value},$ctx1,1)});
  55380. }));
  55381. return self;
  55382. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAt",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55383. },
  55384. args: [],
  55385. 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 ]",
  55386. referencedClasses: ["JSON"],
  55387. messageSends: ["parse:", "samplesDo:", "assert:equals:", "indexOf:startingAt:", "collection", "+"]
  55388. }),
  55389. $globals.SequenceableCollectionTest);
  55390. $core.addMethod(
  55391. $core.method({
  55392. selector: "testIndexOfStartingAtWithNull",
  55393. protocol: "tests",
  55394. fn: function (){
  55395. var self=this,$self=this;
  55396. var jsNull;
  55397. return $core.withContext(function($ctx1) {
  55398. var $1,$2;
  55399. jsNull=$recv($globals.JSON)._parse_("null");
  55400. $self._samplesDo_((function(index,value){
  55401. var collection;
  55402. return $core.withContext(function($ctx2) {
  55403. collection=$self._collection();
  55404. $recv(collection)._at_put_(index,jsNull);
  55405. $1=$recv(collection)._indexOf_startingAt_(jsNull,(1));
  55406. $ctx2.sendIdx["indexOf:startingAt:"]=1;
  55407. $self._assert_equals_($1,index);
  55408. $ctx2.sendIdx["assert:equals:"]=1;
  55409. $2=$recv(collection)._indexOf_startingAt_(jsNull,index);
  55410. $ctx2.sendIdx["indexOf:startingAt:"]=2;
  55411. $self._assert_equals_($2,index);
  55412. $ctx2.sendIdx["assert:equals:"]=2;
  55413. return $self._assert_equals_($recv(collection)._indexOf_startingAt_(jsNull,$recv(index).__plus((1))),(0));
  55414. }, function($ctx2) {$ctx2.fillBlock({index:index,value:value,collection:collection},$ctx1,1)});
  55415. }));
  55416. return self;
  55417. }, function($ctx1) {$ctx1.fill(self,"testIndexOfStartingAtWithNull",{jsNull:jsNull},$globals.SequenceableCollectionTest)});
  55418. },
  55419. args: [],
  55420. 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 ]",
  55421. referencedClasses: ["JSON"],
  55422. messageSends: ["parse:", "samplesDo:", "collection", "at:put:", "assert:equals:", "indexOf:startingAt:", "+"]
  55423. }),
  55424. $globals.SequenceableCollectionTest);
  55425. $core.addMethod(
  55426. $core.method({
  55427. selector: "testLast",
  55428. protocol: "tests",
  55429. fn: function (){
  55430. var self=this,$self=this;
  55431. return $core.withContext(function($ctx1) {
  55432. $self._assert_equals_($recv($self._collection())._last(),$self._collectionLast());
  55433. return self;
  55434. }, function($ctx1) {$ctx1.fill(self,"testLast",{},$globals.SequenceableCollectionTest)});
  55435. },
  55436. args: [],
  55437. source: "testLast\x0a\x09self assert: self collection last equals: self collectionLast",
  55438. referencedClasses: [],
  55439. messageSends: ["assert:equals:", "last", "collection", "collectionLast"]
  55440. }),
  55441. $globals.SequenceableCollectionTest);
  55442. $core.addMethod(
  55443. $core.method({
  55444. selector: "testLastN",
  55445. protocol: "tests",
  55446. fn: function (){
  55447. var self=this,$self=this;
  55448. return $core.withContext(function($ctx1) {
  55449. var $2,$1,$4,$3,$6,$5,$7;
  55450. $2=$self._collection();
  55451. $ctx1.sendIdx["collection"]=1;
  55452. $1=$recv($2)._last_((2));
  55453. $ctx1.sendIdx["last:"]=1;
  55454. $self._assert_equals_($1,$self._collectionLastTwo());
  55455. $ctx1.sendIdx["assert:equals:"]=1;
  55456. $4=$self._collection();
  55457. $ctx1.sendIdx["collection"]=2;
  55458. $3=$recv($4)._last_((0));
  55459. $ctx1.sendIdx["last:"]=2;
  55460. $self._assert_equals_($3,$recv($self._collectionClass())._new());
  55461. $ctx1.sendIdx["assert:equals:"]=2;
  55462. $6=$self._collection();
  55463. $ctx1.sendIdx["collection"]=3;
  55464. $5=$recv($6)._last_($self._collectionSize());
  55465. $ctx1.sendIdx["last:"]=3;
  55466. $7=$self._collection();
  55467. $ctx1.sendIdx["collection"]=4;
  55468. $self._assert_equals_($5,$7);
  55469. $self._should_raise_((function(){
  55470. return $core.withContext(function($ctx2) {
  55471. return $recv($self._collection())._last_((33));
  55472. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55473. }),$globals.Error);
  55474. return self;
  55475. }, function($ctx1) {$ctx1.fill(self,"testLastN",{},$globals.SequenceableCollectionTest)});
  55476. },
  55477. args: [],
  55478. 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",
  55479. referencedClasses: ["Error"],
  55480. messageSends: ["assert:equals:", "last:", "collection", "collectionLastTwo", "new", "collectionClass", "collectionSize", "should:raise:"]
  55481. }),
  55482. $globals.SequenceableCollectionTest);
  55483. $core.addMethod(
  55484. $core.method({
  55485. selector: "testSecond",
  55486. protocol: "tests",
  55487. fn: function (){
  55488. var self=this,$self=this;
  55489. return $core.withContext(function($ctx1) {
  55490. var $2,$1;
  55491. $2=$self._collection();
  55492. $ctx1.sendIdx["collection"]=1;
  55493. $1=$recv($2)._second();
  55494. $self._assert_equals_($1,$recv($self._collection())._at_((2)));
  55495. return self;
  55496. }, function($ctx1) {$ctx1.fill(self,"testSecond",{},$globals.SequenceableCollectionTest)});
  55497. },
  55498. args: [],
  55499. source: "testSecond\x0a\x09self assert: (self collection second) equals: (self collection at: 2)",
  55500. referencedClasses: [],
  55501. messageSends: ["assert:equals:", "second", "collection", "at:"]
  55502. }),
  55503. $globals.SequenceableCollectionTest);
  55504. $core.addMethod(
  55505. $core.method({
  55506. selector: "testThird",
  55507. protocol: "tests",
  55508. fn: function (){
  55509. var self=this,$self=this;
  55510. return $core.withContext(function($ctx1) {
  55511. var $2,$1;
  55512. $2=$self._collection();
  55513. $ctx1.sendIdx["collection"]=1;
  55514. $1=$recv($2)._third();
  55515. $self._assert_equals_($1,$recv($self._collection())._at_((3)));
  55516. return self;
  55517. }, function($ctx1) {$ctx1.fill(self,"testThird",{},$globals.SequenceableCollectionTest)});
  55518. },
  55519. args: [],
  55520. source: "testThird\x0a\x09self assert: (self collection third) equals: (self collection at: 3)",
  55521. referencedClasses: [],
  55522. messageSends: ["assert:equals:", "third", "collection", "at:"]
  55523. }),
  55524. $globals.SequenceableCollectionTest);
  55525. $core.addClass("ArrayTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55526. $core.addMethod(
  55527. $core.method({
  55528. selector: "collection",
  55529. protocol: "fixture",
  55530. fn: function (){
  55531. var self=this,$self=this;
  55532. return [(1), (2), (3), (-4)];
  55533. },
  55534. args: [],
  55535. source: "collection\x0a\x09^ #(1 2 3 -4)",
  55536. referencedClasses: [],
  55537. messageSends: []
  55538. }),
  55539. $globals.ArrayTest);
  55540. $core.addMethod(
  55541. $core.method({
  55542. selector: "collectionFirst",
  55543. protocol: "fixture",
  55544. fn: function (){
  55545. var self=this,$self=this;
  55546. return (1);
  55547. },
  55548. args: [],
  55549. source: "collectionFirst\x0a\x09^ 1",
  55550. referencedClasses: [],
  55551. messageSends: []
  55552. }),
  55553. $globals.ArrayTest);
  55554. $core.addMethod(
  55555. $core.method({
  55556. selector: "collectionFirstTwo",
  55557. protocol: "fixture",
  55558. fn: function (){
  55559. var self=this,$self=this;
  55560. return [(1), (2)];
  55561. },
  55562. args: [],
  55563. source: "collectionFirstTwo\x0a\x09^ #(1 2)",
  55564. referencedClasses: [],
  55565. messageSends: []
  55566. }),
  55567. $globals.ArrayTest);
  55568. $core.addMethod(
  55569. $core.method({
  55570. selector: "collectionLast",
  55571. protocol: "fixture",
  55572. fn: function (){
  55573. var self=this,$self=this;
  55574. return (-4);
  55575. },
  55576. args: [],
  55577. source: "collectionLast\x0a\x09^ -4",
  55578. referencedClasses: [],
  55579. messageSends: []
  55580. }),
  55581. $globals.ArrayTest);
  55582. $core.addMethod(
  55583. $core.method({
  55584. selector: "collectionLastTwo",
  55585. protocol: "fixture",
  55586. fn: function (){
  55587. var self=this,$self=this;
  55588. return [(3), (-4)];
  55589. },
  55590. args: [],
  55591. source: "collectionLastTwo\x0a\x09^ #(3 -4)",
  55592. referencedClasses: [],
  55593. messageSends: []
  55594. }),
  55595. $globals.ArrayTest);
  55596. $core.addMethod(
  55597. $core.method({
  55598. selector: "collectionOfPrintStrings",
  55599. protocol: "fixture",
  55600. fn: function (){
  55601. var self=this,$self=this;
  55602. return ["1", "2", "3", "-4"];
  55603. },
  55604. args: [],
  55605. source: "collectionOfPrintStrings\x0a\x09^ #('1' '2' '3' '-4')",
  55606. referencedClasses: [],
  55607. messageSends: []
  55608. }),
  55609. $globals.ArrayTest);
  55610. $core.addMethod(
  55611. $core.method({
  55612. selector: "collectionSize",
  55613. protocol: "fixture",
  55614. fn: function (){
  55615. var self=this,$self=this;
  55616. return (4);
  55617. },
  55618. args: [],
  55619. source: "collectionSize\x0a\x09^ 4",
  55620. referencedClasses: [],
  55621. messageSends: []
  55622. }),
  55623. $globals.ArrayTest);
  55624. $core.addMethod(
  55625. $core.method({
  55626. selector: "collectionWithDuplicates",
  55627. protocol: "fixture",
  55628. fn: function (){
  55629. var self=this,$self=this;
  55630. return ["a", "b", "c", (1), (2), (1), "a", []];
  55631. },
  55632. args: [],
  55633. source: "collectionWithDuplicates\x0a\x09^ #('a' 'b' 'c' 1 2 1 'a' ())",
  55634. referencedClasses: [],
  55635. messageSends: []
  55636. }),
  55637. $globals.ArrayTest);
  55638. $core.addMethod(
  55639. $core.method({
  55640. selector: "collectionWithNewValue",
  55641. protocol: "fixture",
  55642. fn: function (){
  55643. var self=this,$self=this;
  55644. return [(1), (2), (3), (-4), "N"];
  55645. },
  55646. args: [],
  55647. source: "collectionWithNewValue\x0a\x09^ #(1 2 3 -4 'N')",
  55648. referencedClasses: [],
  55649. messageSends: []
  55650. }),
  55651. $globals.ArrayTest);
  55652. $core.addMethod(
  55653. $core.method({
  55654. selector: "sampleNewIndex",
  55655. protocol: "fixture",
  55656. fn: function (){
  55657. var self=this,$self=this;
  55658. return (5);
  55659. },
  55660. args: [],
  55661. source: "sampleNewIndex\x0a\x09^ 5",
  55662. referencedClasses: [],
  55663. messageSends: []
  55664. }),
  55665. $globals.ArrayTest);
  55666. $core.addMethod(
  55667. $core.method({
  55668. selector: "samplesDo:",
  55669. protocol: "fixture",
  55670. fn: function (aBlock){
  55671. var self=this,$self=this;
  55672. return $core.withContext(function($ctx1) {
  55673. (
  55674. $ctx1.supercall = true,
  55675. ($globals.ArrayTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  55676. $ctx1.supercall = false;
  55677. $recv(aBlock)._value_value_((3),(3));
  55678. return self;
  55679. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.ArrayTest)});
  55680. },
  55681. args: ["aBlock"],
  55682. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 3.",
  55683. referencedClasses: [],
  55684. messageSends: ["samplesDo:", "value:value:"]
  55685. }),
  55686. $globals.ArrayTest);
  55687. $core.addMethod(
  55688. $core.method({
  55689. selector: "testAdd",
  55690. protocol: "tests",
  55691. fn: function (){
  55692. var self=this,$self=this;
  55693. var array;
  55694. return $core.withContext(function($ctx1) {
  55695. array=$self._collection();
  55696. $recv(array)._add_((6));
  55697. $self._assert_equals_($recv(array)._last(),(6));
  55698. return self;
  55699. }, function($ctx1) {$ctx1.fill(self,"testAdd",{array:array},$globals.ArrayTest)});
  55700. },
  55701. args: [],
  55702. source: "testAdd \x0a\x09| array | \x0a\x09array := self collection. \x0a\x09array add: 6.\x0a\x09\x0a\x09self assert: array last equals: 6",
  55703. referencedClasses: [],
  55704. messageSends: ["collection", "add:", "assert:equals:", "last"]
  55705. }),
  55706. $globals.ArrayTest);
  55707. $core.addMethod(
  55708. $core.method({
  55709. selector: "testAddFirst",
  55710. protocol: "tests",
  55711. fn: function (){
  55712. var self=this,$self=this;
  55713. return $core.withContext(function($ctx1) {
  55714. var $3,$2,$1;
  55715. $3=$self._collection();
  55716. $recv($3)._addFirst_((0));
  55717. $2=$recv($3)._yourself();
  55718. $1=$recv($2)._first();
  55719. $self._assert_equals_($1,(0));
  55720. return self;
  55721. }, function($ctx1) {$ctx1.fill(self,"testAddFirst",{},$globals.ArrayTest)});
  55722. },
  55723. args: [],
  55724. source: "testAddFirst\x0a\x09self assert: (self collection addFirst: 0; yourself) first equals: 0",
  55725. referencedClasses: [],
  55726. messageSends: ["assert:equals:", "first", "addFirst:", "collection", "yourself"]
  55727. }),
  55728. $globals.ArrayTest);
  55729. $core.addMethod(
  55730. $core.method({
  55731. selector: "testPrintString",
  55732. protocol: "tests",
  55733. fn: function (){
  55734. var self=this,$self=this;
  55735. var array;
  55736. return $core.withContext(function($ctx1) {
  55737. var $1,$2,$3,$4,$5,$6,$7,$8;
  55738. array=$recv($globals.Array)._new();
  55739. $1=$recv(array)._printString();
  55740. $ctx1.sendIdx["printString"]=1;
  55741. $self._assert_equals_($1,"an Array ()");
  55742. $ctx1.sendIdx["assert:equals:"]=1;
  55743. $2=array;
  55744. $recv($2)._add_((1));
  55745. $ctx1.sendIdx["add:"]=1;
  55746. $3=$recv($2)._add_((3));
  55747. $ctx1.sendIdx["add:"]=2;
  55748. $4=$recv(array)._printString();
  55749. $ctx1.sendIdx["printString"]=2;
  55750. $self._assert_equals_($4,"an Array (1 3)");
  55751. $ctx1.sendIdx["assert:equals:"]=2;
  55752. $recv(array)._add_("foo");
  55753. $5=$recv(array)._printString();
  55754. $ctx1.sendIdx["printString"]=3;
  55755. $self._assert_equals_($5,"an Array (1 3 'foo')");
  55756. $ctx1.sendIdx["assert:equals:"]=3;
  55757. $6=array;
  55758. $recv($6)._remove_((1));
  55759. $ctx1.sendIdx["remove:"]=1;
  55760. $recv($6)._remove_((3));
  55761. $7=$recv(array)._printString();
  55762. $ctx1.sendIdx["printString"]=4;
  55763. $self._assert_equals_($7,"an Array ('foo')");
  55764. $ctx1.sendIdx["assert:equals:"]=4;
  55765. $recv(array)._addLast_((3));
  55766. $ctx1.sendIdx["addLast:"]=1;
  55767. $8=$recv(array)._printString();
  55768. $ctx1.sendIdx["printString"]=5;
  55769. $self._assert_equals_($8,"an Array ('foo' 3)");
  55770. $ctx1.sendIdx["assert:equals:"]=5;
  55771. $recv(array)._addLast_((3));
  55772. $self._assert_equals_($recv(array)._printString(),"an Array ('foo' 3 3)");
  55773. return self;
  55774. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{array:array},$globals.ArrayTest)});
  55775. },
  55776. args: [],
  55777. 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)'.",
  55778. referencedClasses: ["Array"],
  55779. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:", "addLast:"]
  55780. }),
  55781. $globals.ArrayTest);
  55782. $core.addMethod(
  55783. $core.method({
  55784. selector: "testRemove",
  55785. protocol: "tests",
  55786. fn: function (){
  55787. var self=this,$self=this;
  55788. var array;
  55789. return $core.withContext(function($ctx1) {
  55790. array=[(1), (2), (3), (4), (5)];
  55791. $recv(array)._remove_((3));
  55792. $ctx1.sendIdx["remove:"]=1;
  55793. $self._assert_equals_(array,[(1), (2), (4), (5)]);
  55794. $self._should_raise_((function(){
  55795. return $core.withContext(function($ctx2) {
  55796. return $recv(array)._remove_((3));
  55797. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  55798. }),$globals.Error);
  55799. return self;
  55800. }, function($ctx1) {$ctx1.fill(self,"testRemove",{array:array},$globals.ArrayTest)});
  55801. },
  55802. args: [],
  55803. 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",
  55804. referencedClasses: ["Error"],
  55805. messageSends: ["remove:", "assert:equals:", "should:raise:"]
  55806. }),
  55807. $globals.ArrayTest);
  55808. $core.addMethod(
  55809. $core.method({
  55810. selector: "testRemoveFromTo",
  55811. protocol: "tests",
  55812. fn: function (){
  55813. var self=this,$self=this;
  55814. return $core.withContext(function($ctx1) {
  55815. var $1,$2;
  55816. $1=[(1), (2), (3), (4)]._removeFrom_to_((1),(3));
  55817. $ctx1.sendIdx["removeFrom:to:"]=1;
  55818. $self._assert_equals_($1,[(4)]);
  55819. $ctx1.sendIdx["assert:equals:"]=1;
  55820. $2=[(1), (2), (3), (4)]._removeFrom_to_((2),(3));
  55821. $ctx1.sendIdx["removeFrom:to:"]=2;
  55822. $self._assert_equals_($2,[(1), (4)]);
  55823. $ctx1.sendIdx["assert:equals:"]=2;
  55824. $self._assert_equals_([(1), (2), (3), (4)]._removeFrom_to_((2),(4)),[(1)]);
  55825. return self;
  55826. }, function($ctx1) {$ctx1.fill(self,"testRemoveFromTo",{},$globals.ArrayTest)});
  55827. },
  55828. args: [],
  55829. 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)",
  55830. referencedClasses: [],
  55831. messageSends: ["assert:equals:", "removeFrom:to:"]
  55832. }),
  55833. $globals.ArrayTest);
  55834. $core.addMethod(
  55835. $core.method({
  55836. selector: "testRemoveIndex",
  55837. protocol: "tests",
  55838. fn: function (){
  55839. var self=this,$self=this;
  55840. return $core.withContext(function($ctx1) {
  55841. var $1,$2;
  55842. $1=[(1), (2), (3), (4)]._removeIndex_((2));
  55843. $ctx1.sendIdx["removeIndex:"]=1;
  55844. $self._assert_equals_($1,[(1), (3), (4)]);
  55845. $ctx1.sendIdx["assert:equals:"]=1;
  55846. $2=[(1), (2), (3), (4)]._removeIndex_((1));
  55847. $ctx1.sendIdx["removeIndex:"]=2;
  55848. $self._assert_equals_($2,[(2), (3), (4)]);
  55849. $ctx1.sendIdx["assert:equals:"]=2;
  55850. $self._assert_equals_(["hello"]._removeIndex_((1)),[]);
  55851. return self;
  55852. }, function($ctx1) {$ctx1.fill(self,"testRemoveIndex",{},$globals.ArrayTest)});
  55853. },
  55854. args: [],
  55855. 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: #()",
  55856. referencedClasses: [],
  55857. messageSends: ["assert:equals:", "removeIndex:"]
  55858. }),
  55859. $globals.ArrayTest);
  55860. $core.addMethod(
  55861. $core.method({
  55862. selector: "testRemoveLast",
  55863. protocol: "tests",
  55864. fn: function (){
  55865. var self=this,$self=this;
  55866. var array;
  55867. return $core.withContext(function($ctx1) {
  55868. array=[(1), (2)];
  55869. $recv(array)._removeLast();
  55870. $self._assert_equals_($recv(array)._last(),(1));
  55871. return self;
  55872. }, function($ctx1) {$ctx1.fill(self,"testRemoveLast",{array:array},$globals.ArrayTest)});
  55873. },
  55874. args: [],
  55875. source: "testRemoveLast \x0a\x09| array |\x0a\x09array := #(1 2). \x0a\x09array removeLast.\x0a\x09\x0a\x09self assert: array last equals: 1",
  55876. referencedClasses: [],
  55877. messageSends: ["removeLast", "assert:equals:", "last"]
  55878. }),
  55879. $globals.ArrayTest);
  55880. $core.addMethod(
  55881. $core.method({
  55882. selector: "testReversed",
  55883. protocol: "tests",
  55884. fn: function (){
  55885. var self=this,$self=this;
  55886. var array;
  55887. return $core.withContext(function($ctx1) {
  55888. array=[(5), (4), (3), (2), (1)];
  55889. $self._assert_equals_($recv(array)._reversed(),[(1), (2), (3), (4), (5)]);
  55890. return self;
  55891. }, function($ctx1) {$ctx1.fill(self,"testReversed",{array:array},$globals.ArrayTest)});
  55892. },
  55893. args: [],
  55894. source: "testReversed\x0a\x09|array|\x0a\x09array := #(5 4 3 2 1). \x0a\x09self assert: (array reversed) equals: #(1 2 3 4 5)",
  55895. referencedClasses: [],
  55896. messageSends: ["assert:equals:", "reversed"]
  55897. }),
  55898. $globals.ArrayTest);
  55899. $core.addMethod(
  55900. $core.method({
  55901. selector: "testSort",
  55902. protocol: "tests",
  55903. fn: function (){
  55904. var self=this,$self=this;
  55905. var array;
  55906. return $core.withContext(function($ctx1) {
  55907. array=[(10), (1), (5)];
  55908. $recv(array)._sort();
  55909. $self._assert_equals_(array,[(1), (5), (10)]);
  55910. return self;
  55911. }, function($ctx1) {$ctx1.fill(self,"testSort",{array:array},$globals.ArrayTest)});
  55912. },
  55913. args: [],
  55914. source: "testSort\x0a\x09| array |\x0a\x09array := #(10 1 5). \x0a\x09array sort.\x0a\x09self assert: array equals: #(1 5 10)",
  55915. referencedClasses: [],
  55916. messageSends: ["sort", "assert:equals:"]
  55917. }),
  55918. $globals.ArrayTest);
  55919. $core.addMethod(
  55920. $core.method({
  55921. selector: "collectionClass",
  55922. protocol: "fixture",
  55923. fn: function (){
  55924. var self=this,$self=this;
  55925. return $globals.Array;
  55926. },
  55927. args: [],
  55928. source: "collectionClass\x0a\x09^ Array",
  55929. referencedClasses: ["Array"],
  55930. messageSends: []
  55931. }),
  55932. $globals.ArrayTest.a$cls);
  55933. $core.addClass("StringTest", $globals.SequenceableCollectionTest, [], "Kernel-Tests");
  55934. $core.addMethod(
  55935. $core.method({
  55936. selector: "collection",
  55937. protocol: "fixture",
  55938. fn: function (){
  55939. var self=this,$self=this;
  55940. return "helLo";
  55941. },
  55942. args: [],
  55943. source: "collection\x0a\x09^ 'helLo'",
  55944. referencedClasses: [],
  55945. messageSends: []
  55946. }),
  55947. $globals.StringTest);
  55948. $core.addMethod(
  55949. $core.method({
  55950. selector: "collectionFirst",
  55951. protocol: "fixture",
  55952. fn: function (){
  55953. var self=this,$self=this;
  55954. return "h";
  55955. },
  55956. args: [],
  55957. source: "collectionFirst\x0a\x09^ 'h'",
  55958. referencedClasses: [],
  55959. messageSends: []
  55960. }),
  55961. $globals.StringTest);
  55962. $core.addMethod(
  55963. $core.method({
  55964. selector: "collectionFirstTwo",
  55965. protocol: "fixture",
  55966. fn: function (){
  55967. var self=this,$self=this;
  55968. return "he";
  55969. },
  55970. args: [],
  55971. source: "collectionFirstTwo\x0a\x09^ 'he'",
  55972. referencedClasses: [],
  55973. messageSends: []
  55974. }),
  55975. $globals.StringTest);
  55976. $core.addMethod(
  55977. $core.method({
  55978. selector: "collectionLast",
  55979. protocol: "fixture",
  55980. fn: function (){
  55981. var self=this,$self=this;
  55982. return "o";
  55983. },
  55984. args: [],
  55985. source: "collectionLast\x0a\x09^ 'o'",
  55986. referencedClasses: [],
  55987. messageSends: []
  55988. }),
  55989. $globals.StringTest);
  55990. $core.addMethod(
  55991. $core.method({
  55992. selector: "collectionLastTwo",
  55993. protocol: "fixture",
  55994. fn: function (){
  55995. var self=this,$self=this;
  55996. return "Lo";
  55997. },
  55998. args: [],
  55999. source: "collectionLastTwo\x0a\x09^ 'Lo'",
  56000. referencedClasses: [],
  56001. messageSends: []
  56002. }),
  56003. $globals.StringTest);
  56004. $core.addMethod(
  56005. $core.method({
  56006. selector: "collectionOfPrintStrings",
  56007. protocol: "fixture",
  56008. fn: function (){
  56009. var self=this,$self=this;
  56010. return "'h''e''l''L''o'";
  56011. },
  56012. args: [],
  56013. source: "collectionOfPrintStrings\x0a\x09^ '''h''''e''''l''''L''''o'''",
  56014. referencedClasses: [],
  56015. messageSends: []
  56016. }),
  56017. $globals.StringTest);
  56018. $core.addMethod(
  56019. $core.method({
  56020. selector: "collectionSize",
  56021. protocol: "fixture",
  56022. fn: function (){
  56023. var self=this,$self=this;
  56024. return (5);
  56025. },
  56026. args: [],
  56027. source: "collectionSize\x0a\x09^ 5",
  56028. referencedClasses: [],
  56029. messageSends: []
  56030. }),
  56031. $globals.StringTest);
  56032. $core.addMethod(
  56033. $core.method({
  56034. selector: "collectionWithDuplicates",
  56035. protocol: "fixture",
  56036. fn: function (){
  56037. var self=this,$self=this;
  56038. return "abbaerten";
  56039. },
  56040. args: [],
  56041. source: "collectionWithDuplicates\x0a\x09^ 'abbaerten'",
  56042. referencedClasses: [],
  56043. messageSends: []
  56044. }),
  56045. $globals.StringTest);
  56046. $core.addMethod(
  56047. $core.method({
  56048. selector: "collectionWithNewValue",
  56049. protocol: "fixture",
  56050. fn: function (){
  56051. var self=this,$self=this;
  56052. return "helLoN";
  56053. },
  56054. args: [],
  56055. source: "collectionWithNewValue\x0a\x09^ 'helLoN'",
  56056. referencedClasses: [],
  56057. messageSends: []
  56058. }),
  56059. $globals.StringTest);
  56060. $core.addMethod(
  56061. $core.method({
  56062. selector: "sampleNewValueAsCollection",
  56063. protocol: "fixture",
  56064. fn: function (){
  56065. var self=this,$self=this;
  56066. return "N";
  56067. },
  56068. args: [],
  56069. source: "sampleNewValueAsCollection\x0a\x09^ 'N'",
  56070. referencedClasses: [],
  56071. messageSends: []
  56072. }),
  56073. $globals.StringTest);
  56074. $core.addMethod(
  56075. $core.method({
  56076. selector: "samplesDo:",
  56077. protocol: "fixture",
  56078. fn: function (aBlock){
  56079. var self=this,$self=this;
  56080. return $core.withContext(function($ctx1) {
  56081. (
  56082. $ctx1.supercall = true,
  56083. ($globals.StringTest.superclass||$boot.nilAsClass).fn.prototype._samplesDo_.apply($self, [aBlock]));
  56084. $ctx1.supercall = false;
  56085. $recv(aBlock)._value_value_((3),"l");
  56086. return self;
  56087. }, function($ctx1) {$ctx1.fill(self,"samplesDo:",{aBlock:aBlock},$globals.StringTest)});
  56088. },
  56089. args: ["aBlock"],
  56090. source: "samplesDo: aBlock\x0a\x09super samplesDo: aBlock.\x0a\x09aBlock value: 3 value: 'l'",
  56091. referencedClasses: [],
  56092. messageSends: ["samplesDo:", "value:value:"]
  56093. }),
  56094. $globals.StringTest);
  56095. $core.addMethod(
  56096. $core.method({
  56097. selector: "testAddAll",
  56098. protocol: "tests",
  56099. fn: function (){
  56100. var self=this,$self=this;
  56101. return $core.withContext(function($ctx1) {
  56102. var $1;
  56103. $self._should_raise_((function(){
  56104. return $core.withContext(function($ctx2) {
  56105. $1=$self._collection();
  56106. $ctx2.sendIdx["collection"]=1;
  56107. return $recv($1)._addAll_($self._collection());
  56108. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56109. }),$globals.Error);
  56110. return self;
  56111. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.StringTest)});
  56112. },
  56113. args: [],
  56114. source: "testAddAll\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ self collection addAll: self collection ] raise: Error",
  56115. referencedClasses: ["Error"],
  56116. messageSends: ["should:raise:", "addAll:", "collection"]
  56117. }),
  56118. $globals.StringTest);
  56119. $core.addMethod(
  56120. $core.method({
  56121. selector: "testAddRemove",
  56122. protocol: "tests",
  56123. fn: function (){
  56124. var self=this,$self=this;
  56125. return $core.withContext(function($ctx1) {
  56126. $self._should_raise_((function(){
  56127. return $core.withContext(function($ctx2) {
  56128. return "hello"._add_("a");
  56129. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56130. }),$globals.Error);
  56131. $ctx1.sendIdx["should:raise:"]=1;
  56132. $self._should_raise_((function(){
  56133. return $core.withContext(function($ctx2) {
  56134. return "hello"._remove_("h");
  56135. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  56136. }),$globals.Error);
  56137. return self;
  56138. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{},$globals.StringTest)});
  56139. },
  56140. args: [],
  56141. source: "testAddRemove\x0a\x09self should: [ 'hello' add: 'a' ] raise: Error.\x0a\x09self should: [ 'hello' remove: 'h' ] raise: Error",
  56142. referencedClasses: ["Error"],
  56143. messageSends: ["should:raise:", "add:", "remove:"]
  56144. }),
  56145. $globals.StringTest);
  56146. $core.addMethod(
  56147. $core.method({
  56148. selector: "testAsArray",
  56149. protocol: "tests",
  56150. fn: function (){
  56151. var self=this,$self=this;
  56152. return $core.withContext(function($ctx1) {
  56153. $self._assert_equals_("hello"._asArray(),["h", "e", "l", "l", "o"]);
  56154. return self;
  56155. }, function($ctx1) {$ctx1.fill(self,"testAsArray",{},$globals.StringTest)});
  56156. },
  56157. args: [],
  56158. source: "testAsArray\x0a\x09self assert: 'hello' asArray equals: #('h' 'e' 'l' 'l' 'o').",
  56159. referencedClasses: [],
  56160. messageSends: ["assert:equals:", "asArray"]
  56161. }),
  56162. $globals.StringTest);
  56163. $core.addMethod(
  56164. $core.method({
  56165. selector: "testAsLowerCase",
  56166. protocol: "tests",
  56167. fn: function (){
  56168. var self=this,$self=this;
  56169. return $core.withContext(function($ctx1) {
  56170. $self._assert_equals_("JACKIE"._asLowercase(),"jackie");
  56171. return self;
  56172. }, function($ctx1) {$ctx1.fill(self,"testAsLowerCase",{},$globals.StringTest)});
  56173. },
  56174. args: [],
  56175. source: "testAsLowerCase\x0a\x09self assert: 'JACKIE' asLowercase equals: 'jackie'.",
  56176. referencedClasses: [],
  56177. messageSends: ["assert:equals:", "asLowercase"]
  56178. }),
  56179. $globals.StringTest);
  56180. $core.addMethod(
  56181. $core.method({
  56182. selector: "testAsNumber",
  56183. protocol: "tests",
  56184. fn: function (){
  56185. var self=this,$self=this;
  56186. return $core.withContext(function($ctx1) {
  56187. var $1,$2;
  56188. $1="3"._asNumber();
  56189. $ctx1.sendIdx["asNumber"]=1;
  56190. $self._assert_equals_($1,(3));
  56191. $ctx1.sendIdx["assert:equals:"]=1;
  56192. $2="-3"._asNumber();
  56193. $ctx1.sendIdx["asNumber"]=2;
  56194. $self._assert_equals_($2,(-3));
  56195. $ctx1.sendIdx["assert:equals:"]=2;
  56196. $self._assert_equals_("-1.5"._asNumber(),(-1.5));
  56197. return self;
  56198. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.StringTest)});
  56199. },
  56200. args: [],
  56201. 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.",
  56202. referencedClasses: [],
  56203. messageSends: ["assert:equals:", "asNumber"]
  56204. }),
  56205. $globals.StringTest);
  56206. $core.addMethod(
  56207. $core.method({
  56208. selector: "testAsUpperCase",
  56209. protocol: "tests",
  56210. fn: function (){
  56211. var self=this,$self=this;
  56212. return $core.withContext(function($ctx1) {
  56213. $self._assert_equals_("jackie"._asUppercase(),"JACKIE");
  56214. return self;
  56215. }, function($ctx1) {$ctx1.fill(self,"testAsUpperCase",{},$globals.StringTest)});
  56216. },
  56217. args: [],
  56218. source: "testAsUpperCase\x0a\x09self assert: 'jackie' asUppercase equals: 'JACKIE'.",
  56219. referencedClasses: [],
  56220. messageSends: ["assert:equals:", "asUppercase"]
  56221. }),
  56222. $globals.StringTest);
  56223. $core.addMethod(
  56224. $core.method({
  56225. selector: "testAsciiValue",
  56226. protocol: "tests",
  56227. fn: function (){
  56228. var self=this,$self=this;
  56229. var characterA,characterU;
  56230. return $core.withContext(function($ctx1) {
  56231. var $1;
  56232. characterA="A";
  56233. characterU="U";
  56234. $1=$recv(characterA)._asciiValue();
  56235. $ctx1.sendIdx["asciiValue"]=1;
  56236. $self._assert_equals_($1,(65));
  56237. $ctx1.sendIdx["assert:equals:"]=1;
  56238. $self._assert_equals_($recv(characterU)._asciiValue(),(85));
  56239. return self;
  56240. }, function($ctx1) {$ctx1.fill(self,"testAsciiValue",{characterA:characterA,characterU:characterU},$globals.StringTest)});
  56241. },
  56242. args: [],
  56243. 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",
  56244. referencedClasses: [],
  56245. messageSends: ["assert:equals:", "asciiValue"]
  56246. }),
  56247. $globals.StringTest);
  56248. $core.addMethod(
  56249. $core.method({
  56250. selector: "testAtIfAbsentPut",
  56251. protocol: "tests",
  56252. fn: function (){
  56253. var self=this,$self=this;
  56254. return $core.withContext(function($ctx1) {
  56255. $self._should_raise_((function(){
  56256. return $core.withContext(function($ctx2) {
  56257. return "hello"._at_ifAbsentPut_((6),(function(){
  56258. return "a";
  56259. }));
  56260. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56261. }),$globals.Error);
  56262. return self;
  56263. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsentPut",{},$globals.StringTest)});
  56264. },
  56265. args: [],
  56266. source: "testAtIfAbsentPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 6 ifAbsentPut: [ 'a' ] ] raise: Error",
  56267. referencedClasses: ["Error"],
  56268. messageSends: ["should:raise:", "at:ifAbsentPut:"]
  56269. }),
  56270. $globals.StringTest);
  56271. $core.addMethod(
  56272. $core.method({
  56273. selector: "testAtPut",
  56274. protocol: "tests",
  56275. fn: function (){
  56276. var self=this,$self=this;
  56277. return $core.withContext(function($ctx1) {
  56278. $self._should_raise_((function(){
  56279. return $core.withContext(function($ctx2) {
  56280. return "hello"._at_put_((1),"a");
  56281. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56282. }),$globals.Error);
  56283. return self;
  56284. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{},$globals.StringTest)});
  56285. },
  56286. args: [],
  56287. source: "testAtPut\x0a\x09\x22String instances are read-only\x22\x0a\x09self should: [ 'hello' at: 1 put: 'a' ] raise: Error",
  56288. referencedClasses: ["Error"],
  56289. messageSends: ["should:raise:", "at:put:"]
  56290. }),
  56291. $globals.StringTest);
  56292. $core.addMethod(
  56293. $core.method({
  56294. selector: "testCapitalized",
  56295. protocol: "tests",
  56296. fn: function (){
  56297. var self=this,$self=this;
  56298. return $core.withContext(function($ctx1) {
  56299. var $1,$2,$3;
  56300. $1="test"._capitalized();
  56301. $ctx1.sendIdx["capitalized"]=1;
  56302. $self._assert_equals_($1,"Test");
  56303. $ctx1.sendIdx["assert:equals:"]=1;
  56304. $2="Test"._capitalized();
  56305. $ctx1.sendIdx["capitalized"]=2;
  56306. $self._assert_equals_($2,"Test");
  56307. $ctx1.sendIdx["assert:equals:"]=2;
  56308. $self._assert_equals_(""._capitalized(),"");
  56309. $ctx1.sendIdx["assert:equals:"]=3;
  56310. $3="Test"._isCapitalized();
  56311. $ctx1.sendIdx["isCapitalized"]=1;
  56312. $self._assert_equals_($3,true);
  56313. $ctx1.sendIdx["assert:equals:"]=4;
  56314. $self._assert_equals_("test"._isCapitalized(),false);
  56315. return self;
  56316. }, function($ctx1) {$ctx1.fill(self,"testCapitalized",{},$globals.StringTest)});
  56317. },
  56318. args: [],
  56319. 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.",
  56320. referencedClasses: [],
  56321. messageSends: ["assert:equals:", "capitalized", "isCapitalized"]
  56322. }),
  56323. $globals.StringTest);
  56324. $core.addMethod(
  56325. $core.method({
  56326. selector: "testCharCodeAt",
  56327. protocol: "tests",
  56328. fn: function (){
  56329. var self=this,$self=this;
  56330. return $core.withContext(function($ctx1) {
  56331. var $1,$2,$3,$4,$5;
  56332. $1="jackie"._charCodeAt_((1));
  56333. $ctx1.sendIdx["charCodeAt:"]=1;
  56334. $self._assert_equals_($1,(106));
  56335. $ctx1.sendIdx["assert:equals:"]=1;
  56336. $2="jackie"._charCodeAt_((2));
  56337. $ctx1.sendIdx["charCodeAt:"]=2;
  56338. $self._assert_equals_($2,(97));
  56339. $ctx1.sendIdx["assert:equals:"]=2;
  56340. $3="jackie"._charCodeAt_((3));
  56341. $ctx1.sendIdx["charCodeAt:"]=3;
  56342. $self._assert_equals_($3,(99));
  56343. $ctx1.sendIdx["assert:equals:"]=3;
  56344. $4="jackie"._charCodeAt_((4));
  56345. $ctx1.sendIdx["charCodeAt:"]=4;
  56346. $self._assert_equals_($4,(107));
  56347. $ctx1.sendIdx["assert:equals:"]=4;
  56348. $5="jackie"._charCodeAt_((5));
  56349. $ctx1.sendIdx["charCodeAt:"]=5;
  56350. $self._assert_equals_($5,(105));
  56351. $ctx1.sendIdx["assert:equals:"]=5;
  56352. $self._assert_equals_("jackie"._charCodeAt_((6)),(101));
  56353. return self;
  56354. }, function($ctx1) {$ctx1.fill(self,"testCharCodeAt",{},$globals.StringTest)});
  56355. },
  56356. args: [],
  56357. 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",
  56358. referencedClasses: [],
  56359. messageSends: ["assert:equals:", "charCodeAt:"]
  56360. }),
  56361. $globals.StringTest);
  56362. $core.addMethod(
  56363. $core.method({
  56364. selector: "testCopyFromTo",
  56365. protocol: "tests",
  56366. fn: function (){
  56367. var self=this,$self=this;
  56368. return $core.withContext(function($ctx1) {
  56369. var $1;
  56370. $1="jackie"._copyFrom_to_((1),(3));
  56371. $ctx1.sendIdx["copyFrom:to:"]=1;
  56372. $self._assert_equals_($1,"jac");
  56373. $ctx1.sendIdx["assert:equals:"]=1;
  56374. $self._assert_equals_("jackie"._copyFrom_to_((4),(6)),"kie");
  56375. return self;
  56376. }, function($ctx1) {$ctx1.fill(self,"testCopyFromTo",{},$globals.StringTest)});
  56377. },
  56378. args: [],
  56379. source: "testCopyFromTo\x0a\x09self assert: ('jackie' copyFrom: 1 to: 3) equals: 'jac'.\x0a\x09self assert: ('jackie' copyFrom: 4 to: 6) equals: 'kie'.",
  56380. referencedClasses: [],
  56381. messageSends: ["assert:equals:", "copyFrom:to:"]
  56382. }),
  56383. $globals.StringTest);
  56384. $core.addMethod(
  56385. $core.method({
  56386. selector: "testCopySeparates",
  56387. protocol: "tests",
  56388. fn: function (){
  56389. var self=this,$self=this;
  56390. return $core.withContext(function($ctx1) {
  56391. var $3,$2,$1;
  56392. $3=$self._collection();
  56393. $ctx1.sendIdx["collection"]=1;
  56394. $2=$recv($3)._copy();
  56395. $1=$recv($2).__eq_eq($self._collection());
  56396. $self._assert_($1);
  56397. return self;
  56398. }, function($ctx1) {$ctx1.fill(self,"testCopySeparates",{},$globals.StringTest)});
  56399. },
  56400. args: [],
  56401. source: "testCopySeparates\x0a\x09\x22String instances are immutable\x22\x0a\x09self assert: self collection copy == self collection",
  56402. referencedClasses: [],
  56403. messageSends: ["assert:", "==", "copy", "collection"]
  56404. }),
  56405. $globals.StringTest);
  56406. $core.addMethod(
  56407. $core.method({
  56408. selector: "testCopyWithoutAll",
  56409. protocol: "tests",
  56410. fn: function (){
  56411. var self=this,$self=this;
  56412. return $core.withContext(function($ctx1) {
  56413. $self._assert_equals_("*hello* *world*"._copyWithoutAll_("*"),"hello world");
  56414. return self;
  56415. }, function($ctx1) {$ctx1.fill(self,"testCopyWithoutAll",{},$globals.StringTest)});
  56416. },
  56417. args: [],
  56418. source: "testCopyWithoutAll\x0a\x09self\x0a\x09\x09assert: ('*hello* *world*' copyWithoutAll: '*')\x0a\x09\x09equals: 'hello world'",
  56419. referencedClasses: [],
  56420. messageSends: ["assert:equals:", "copyWithoutAll:"]
  56421. }),
  56422. $globals.StringTest);
  56423. $core.addMethod(
  56424. $core.method({
  56425. selector: "testEquality",
  56426. protocol: "tests",
  56427. fn: function (){
  56428. var self=this,$self=this;
  56429. return $core.withContext(function($ctx1) {
  56430. var $1,$2,$3;
  56431. $self._assert_equals_("hello","hello");
  56432. $ctx1.sendIdx["assert:equals:"]=1;
  56433. $1="hello".__eq("world");
  56434. $ctx1.sendIdx["="]=1;
  56435. $self._deny_($1);
  56436. $ctx1.sendIdx["deny:"]=1;
  56437. $2="hello".__eq([]._at_ifAbsent_((1),(function(){
  56438. })));
  56439. $ctx1.sendIdx["="]=2;
  56440. $self._deny_($2);
  56441. $ctx1.sendIdx["deny:"]=2;
  56442. $3="hello"._yourself();
  56443. $ctx1.sendIdx["yourself"]=1;
  56444. $self._assert_equals_("hello",$3);
  56445. $ctx1.sendIdx["assert:equals:"]=2;
  56446. $self._assert_equals_("hello"._yourself(),"hello");
  56447. $self._deny_("".__eq((0)));
  56448. return self;
  56449. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.StringTest)});
  56450. },
  56451. args: [],
  56452. 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",
  56453. referencedClasses: [],
  56454. messageSends: ["assert:equals:", "deny:", "=", "at:ifAbsent:", "yourself"]
  56455. }),
  56456. $globals.StringTest);
  56457. $core.addMethod(
  56458. $core.method({
  56459. selector: "testIdentity",
  56460. protocol: "tests",
  56461. fn: function (){
  56462. var self=this,$self=this;
  56463. return $core.withContext(function($ctx1) {
  56464. var $1,$2,$4,$3,$5;
  56465. $1="hello".__eq_eq("hello");
  56466. $ctx1.sendIdx["=="]=1;
  56467. $self._assert_($1);
  56468. $ctx1.sendIdx["assert:"]=1;
  56469. $2="hello".__eq_eq("world");
  56470. $ctx1.sendIdx["=="]=2;
  56471. $self._deny_($2);
  56472. $ctx1.sendIdx["deny:"]=1;
  56473. $4="hello"._yourself();
  56474. $ctx1.sendIdx["yourself"]=1;
  56475. $3="hello".__eq_eq($4);
  56476. $ctx1.sendIdx["=="]=3;
  56477. $self._assert_($3);
  56478. $ctx1.sendIdx["assert:"]=2;
  56479. $5=$recv("hello"._yourself()).__eq_eq("hello");
  56480. $ctx1.sendIdx["=="]=4;
  56481. $self._assert_($5);
  56482. $self._deny_("".__eq_eq((0)));
  56483. return self;
  56484. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.StringTest)});
  56485. },
  56486. args: [],
  56487. 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",
  56488. referencedClasses: [],
  56489. messageSends: ["assert:", "==", "deny:", "yourself"]
  56490. }),
  56491. $globals.StringTest);
  56492. $core.addMethod(
  56493. $core.method({
  56494. selector: "testIncludesSubString",
  56495. protocol: "tests",
  56496. fn: function (){
  56497. var self=this,$self=this;
  56498. return $core.withContext(function($ctx1) {
  56499. var $1;
  56500. $1="amber"._includesSubString_("ber");
  56501. $ctx1.sendIdx["includesSubString:"]=1;
  56502. $self._assert_($1);
  56503. $self._deny_("amber"._includesSubString_("zork"));
  56504. return self;
  56505. }, function($ctx1) {$ctx1.fill(self,"testIncludesSubString",{},$globals.StringTest)});
  56506. },
  56507. args: [],
  56508. source: "testIncludesSubString\x0a\x09self assert: ('amber' includesSubString: 'ber').\x0a\x09self deny: ('amber' includesSubString: 'zork').",
  56509. referencedClasses: [],
  56510. messageSends: ["assert:", "includesSubString:", "deny:"]
  56511. }),
  56512. $globals.StringTest);
  56513. $core.addMethod(
  56514. $core.method({
  56515. selector: "testIndexOfStartingAtWithNull",
  56516. protocol: "tests",
  56517. fn: function (){
  56518. var self=this,$self=this;
  56519. return self;
  56520. },
  56521. args: [],
  56522. source: "testIndexOfStartingAtWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56523. referencedClasses: [],
  56524. messageSends: []
  56525. }),
  56526. $globals.StringTest);
  56527. $core.addMethod(
  56528. $core.method({
  56529. selector: "testIndexOfWithNull",
  56530. protocol: "tests",
  56531. fn: function (){
  56532. var self=this,$self=this;
  56533. return self;
  56534. },
  56535. args: [],
  56536. source: "testIndexOfWithNull\x0a\x09\x22String cannot hold JS null\x22",
  56537. referencedClasses: [],
  56538. messageSends: []
  56539. }),
  56540. $globals.StringTest);
  56541. $core.addMethod(
  56542. $core.method({
  56543. selector: "testIsVowel",
  56544. protocol: "tests",
  56545. fn: function (){
  56546. var self=this,$self=this;
  56547. var vowel,consonant;
  56548. return $core.withContext(function($ctx1) {
  56549. var $1;
  56550. vowel="u";
  56551. consonant="z";
  56552. $1=$recv(vowel)._isVowel();
  56553. $ctx1.sendIdx["isVowel"]=1;
  56554. $self._assert_equals_($1,true);
  56555. $ctx1.sendIdx["assert:equals:"]=1;
  56556. $self._assert_equals_($recv(consonant)._isVowel(),false);
  56557. return self;
  56558. }, function($ctx1) {$ctx1.fill(self,"testIsVowel",{vowel:vowel,consonant:consonant},$globals.StringTest)});
  56559. },
  56560. args: [],
  56561. 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",
  56562. referencedClasses: [],
  56563. messageSends: ["assert:equals:", "isVowel"]
  56564. }),
  56565. $globals.StringTest);
  56566. $core.addMethod(
  56567. $core.method({
  56568. selector: "testJoin",
  56569. protocol: "tests",
  56570. fn: function (){
  56571. var self=this,$self=this;
  56572. return $core.withContext(function($ctx1) {
  56573. $self._assert_equals_(","._join_(["hello", "world"]),"hello,world");
  56574. return self;
  56575. }, function($ctx1) {$ctx1.fill(self,"testJoin",{},$globals.StringTest)});
  56576. },
  56577. args: [],
  56578. source: "testJoin\x0a\x09self assert: (',' join: #('hello' 'world')) equals: 'hello,world'",
  56579. referencedClasses: [],
  56580. messageSends: ["assert:equals:", "join:"]
  56581. }),
  56582. $globals.StringTest);
  56583. $core.addMethod(
  56584. $core.method({
  56585. selector: "testRegression1224",
  56586. protocol: "tests",
  56587. fn: function (){
  56588. var self=this,$self=this;
  56589. return $core.withContext(function($ctx1) {
  56590. var $2,$1;
  56591. $self._should_raise_((function(){
  56592. return $core.withContext(function($ctx2) {
  56593. $2=$recv($self._collectionClass())._new();
  56594. $recv($2)._remove_ifAbsent_($self._sampleNewValue(),(function(){
  56595. }));
  56596. $1=$recv($2)._yourself();
  56597. return $recv($1)._size();
  56598. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56599. }),$globals.Error);
  56600. return self;
  56601. }, function($ctx1) {$ctx1.fill(self,"testRegression1224",{},$globals.StringTest)});
  56602. },
  56603. args: [],
  56604. 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",
  56605. referencedClasses: ["Error"],
  56606. messageSends: ["should:raise:", "size", "remove:ifAbsent:", "new", "collectionClass", "sampleNewValue", "yourself"]
  56607. }),
  56608. $globals.StringTest);
  56609. $core.addMethod(
  56610. $core.method({
  56611. selector: "testRemoveAll",
  56612. protocol: "tests",
  56613. fn: function (){
  56614. var self=this,$self=this;
  56615. return $core.withContext(function($ctx1) {
  56616. $self._should_raise_((function(){
  56617. return $core.withContext(function($ctx2) {
  56618. return $recv($self._collection())._removeAll();
  56619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56620. }),$globals.Error);
  56621. return self;
  56622. }, function($ctx1) {$ctx1.fill(self,"testRemoveAll",{},$globals.StringTest)});
  56623. },
  56624. args: [],
  56625. source: "testRemoveAll\x0a\x09self should: [ self collection removeAll ] raise: Error",
  56626. referencedClasses: ["Error"],
  56627. messageSends: ["should:raise:", "removeAll", "collection"]
  56628. }),
  56629. $globals.StringTest);
  56630. $core.addMethod(
  56631. $core.method({
  56632. selector: "testReversed",
  56633. protocol: "tests",
  56634. fn: function (){
  56635. var self=this,$self=this;
  56636. return $core.withContext(function($ctx1) {
  56637. $self._assert_equals_("jackiechan"._reversed(),"nahceikcaj");
  56638. return self;
  56639. }, function($ctx1) {$ctx1.fill(self,"testReversed",{},$globals.StringTest)});
  56640. },
  56641. args: [],
  56642. source: "testReversed\x0a\x09self assert: 'jackiechan' reversed equals: 'nahceikcaj'.",
  56643. referencedClasses: [],
  56644. messageSends: ["assert:equals:", "reversed"]
  56645. }),
  56646. $globals.StringTest);
  56647. $core.addMethod(
  56648. $core.method({
  56649. selector: "testStreamContents",
  56650. protocol: "tests",
  56651. fn: function (){
  56652. var self=this,$self=this;
  56653. return $core.withContext(function($ctx1) {
  56654. $self._assert_equals_($recv($globals.String)._streamContents_((function(aStream){
  56655. return $core.withContext(function($ctx2) {
  56656. $recv(aStream)._nextPutAll_("hello");
  56657. $ctx2.sendIdx["nextPutAll:"]=1;
  56658. $recv(aStream)._space();
  56659. return $recv(aStream)._nextPutAll_("world");
  56660. }, function($ctx2) {$ctx2.fillBlock({aStream:aStream},$ctx1,1)});
  56661. })),"hello world");
  56662. return self;
  56663. }, function($ctx1) {$ctx1.fill(self,"testStreamContents",{},$globals.StringTest)});
  56664. },
  56665. args: [],
  56666. 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'",
  56667. referencedClasses: ["String"],
  56668. messageSends: ["assert:equals:", "streamContents:", "nextPutAll:", "space"]
  56669. }),
  56670. $globals.StringTest);
  56671. $core.addMethod(
  56672. $core.method({
  56673. selector: "testSubStrings",
  56674. protocol: "tests",
  56675. fn: function (){
  56676. var self=this,$self=this;
  56677. return $core.withContext(function($ctx1) {
  56678. $self._assert_equals_("jackiechan"._subStrings_("ie"),["jack", "chan"]);
  56679. return self;
  56680. }, function($ctx1) {$ctx1.fill(self,"testSubStrings",{},$globals.StringTest)});
  56681. },
  56682. args: [],
  56683. source: "testSubStrings\x0a\x09self assert: ('jackiechan' subStrings: 'ie') equals: #( 'jack' 'chan' ).",
  56684. referencedClasses: [],
  56685. messageSends: ["assert:equals:", "subStrings:"]
  56686. }),
  56687. $globals.StringTest);
  56688. $core.addMethod(
  56689. $core.method({
  56690. selector: "testTrim",
  56691. protocol: "tests",
  56692. fn: function (){
  56693. var self=this,$self=this;
  56694. return $core.withContext(function($ctx1) {
  56695. $self._assert_equals_(" jackie"._trimLeft(),"jackie");
  56696. $ctx1.sendIdx["assert:equals:"]=1;
  56697. $self._assert_equals_("jackie "._trimRight(),"jackie");
  56698. return self;
  56699. }, function($ctx1) {$ctx1.fill(self,"testTrim",{},$globals.StringTest)});
  56700. },
  56701. args: [],
  56702. source: "testTrim\x0a\x09self assert: ' jackie' trimLeft equals: 'jackie'.\x0a\x09self assert: 'jackie ' trimRight equals: 'jackie'.",
  56703. referencedClasses: [],
  56704. messageSends: ["assert:equals:", "trimLeft", "trimRight"]
  56705. }),
  56706. $globals.StringTest);
  56707. $core.addMethod(
  56708. $core.method({
  56709. selector: "testValue",
  56710. protocol: "tests",
  56711. fn: function (){
  56712. var self=this,$self=this;
  56713. return $core.withContext(function($ctx1) {
  56714. $self._assert_equals_("asString"._value_((1)),"1");
  56715. $ctx1.sendIdx["assert:equals:"]=1;
  56716. $self._assert_equals_([(1), (2), (3)]._collect_("asString"),["1", "2", "3"]);
  56717. return self;
  56718. }, function($ctx1) {$ctx1.fill(self,"testValue",{},$globals.StringTest)});
  56719. },
  56720. args: [],
  56721. 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')",
  56722. referencedClasses: [],
  56723. messageSends: ["assert:equals:", "value:", "collect:"]
  56724. }),
  56725. $globals.StringTest);
  56726. $core.addMethod(
  56727. $core.method({
  56728. selector: "collectionClass",
  56729. protocol: "fixture",
  56730. fn: function (){
  56731. var self=this,$self=this;
  56732. return $globals.String;
  56733. },
  56734. args: [],
  56735. source: "collectionClass\x0a\x09^ String",
  56736. referencedClasses: ["String"],
  56737. messageSends: []
  56738. }),
  56739. $globals.StringTest.a$cls);
  56740. $core.addClass("SetTest", $globals.CollectionTest, [], "Kernel-Tests");
  56741. $core.addMethod(
  56742. $core.method({
  56743. selector: "collection",
  56744. protocol: "fixture",
  56745. fn: function (){
  56746. var self=this,$self=this;
  56747. return $core.withContext(function($ctx1) {
  56748. var $1;
  56749. $1=$recv($globals.Set)._new();
  56750. $recv($1)._add_($globals.Smalltalk);
  56751. $ctx1.sendIdx["add:"]=1;
  56752. $recv($1)._add_(nil);
  56753. $ctx1.sendIdx["add:"]=2;
  56754. $recv($1)._add_((3).__at((3)));
  56755. $ctx1.sendIdx["add:"]=3;
  56756. $recv($1)._add_(false);
  56757. $ctx1.sendIdx["add:"]=4;
  56758. $recv($1)._add_($self["@sampleBlock"]);
  56759. return $recv($1)._yourself();
  56760. }, function($ctx1) {$ctx1.fill(self,"collection",{},$globals.SetTest)});
  56761. },
  56762. args: [],
  56763. 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",
  56764. referencedClasses: ["Set", "Smalltalk"],
  56765. messageSends: ["add:", "new", "@", "yourself"]
  56766. }),
  56767. $globals.SetTest);
  56768. $core.addMethod(
  56769. $core.method({
  56770. selector: "collectionOfPrintStrings",
  56771. protocol: "fixture",
  56772. fn: function (){
  56773. var self=this,$self=this;
  56774. return $core.withContext(function($ctx1) {
  56775. var $1;
  56776. $1=$recv($globals.Set)._new();
  56777. $recv($1)._add_("a SmalltalkImage");
  56778. $ctx1.sendIdx["add:"]=1;
  56779. $recv($1)._add_("nil");
  56780. $ctx1.sendIdx["add:"]=2;
  56781. $recv($1)._add_("3@3");
  56782. $ctx1.sendIdx["add:"]=3;
  56783. $recv($1)._add_("false");
  56784. $ctx1.sendIdx["add:"]=4;
  56785. $recv($1)._add_("a BlockClosure");
  56786. return $recv($1)._yourself();
  56787. }, function($ctx1) {$ctx1.fill(self,"collectionOfPrintStrings",{},$globals.SetTest)});
  56788. },
  56789. args: [],
  56790. 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",
  56791. referencedClasses: ["Set"],
  56792. messageSends: ["add:", "new", "yourself"]
  56793. }),
  56794. $globals.SetTest);
  56795. $core.addMethod(
  56796. $core.method({
  56797. selector: "collectionSize",
  56798. protocol: "fixture",
  56799. fn: function (){
  56800. var self=this,$self=this;
  56801. return (5);
  56802. },
  56803. args: [],
  56804. source: "collectionSize\x0a\x09^ 5",
  56805. referencedClasses: [],
  56806. messageSends: []
  56807. }),
  56808. $globals.SetTest);
  56809. $core.addMethod(
  56810. $core.method({
  56811. selector: "collectionWithDuplicates",
  56812. protocol: "fixture",
  56813. fn: function (){
  56814. var self=this,$self=this;
  56815. return $core.withContext(function($ctx1) {
  56816. var $1;
  56817. $1=$self._collection();
  56818. $recv($1)._add_((0));
  56819. return $recv($1)._yourself();
  56820. }, function($ctx1) {$ctx1.fill(self,"collectionWithDuplicates",{},$globals.SetTest)});
  56821. },
  56822. args: [],
  56823. source: "collectionWithDuplicates\x0a\x09\x22Set has no duplicates\x22\x0a\x09^ self collection add: 0; yourself",
  56824. referencedClasses: [],
  56825. messageSends: ["add:", "collection", "yourself"]
  56826. }),
  56827. $globals.SetTest);
  56828. $core.addMethod(
  56829. $core.method({
  56830. selector: "collectionWithNewValue",
  56831. protocol: "fixture",
  56832. fn: function (){
  56833. var self=this,$self=this;
  56834. return $core.withContext(function($ctx1) {
  56835. var $1;
  56836. $1=$recv($globals.Set)._new();
  56837. $recv($1)._add_($globals.Smalltalk);
  56838. $ctx1.sendIdx["add:"]=1;
  56839. $recv($1)._add_(nil);
  56840. $ctx1.sendIdx["add:"]=2;
  56841. $recv($1)._add_((3).__at((3)));
  56842. $ctx1.sendIdx["add:"]=3;
  56843. $recv($1)._add_("N");
  56844. $ctx1.sendIdx["add:"]=4;
  56845. $recv($1)._add_(false);
  56846. $ctx1.sendIdx["add:"]=5;
  56847. $recv($1)._add_($self["@sampleBlock"]);
  56848. return $recv($1)._yourself();
  56849. }, function($ctx1) {$ctx1.fill(self,"collectionWithNewValue",{},$globals.SetTest)});
  56850. },
  56851. args: [],
  56852. 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",
  56853. referencedClasses: ["Set", "Smalltalk"],
  56854. messageSends: ["add:", "new", "@", "yourself"]
  56855. }),
  56856. $globals.SetTest);
  56857. $core.addMethod(
  56858. $core.method({
  56859. selector: "testAddAll",
  56860. protocol: "tests",
  56861. fn: function (){
  56862. var self=this,$self=this;
  56863. return $core.withContext(function($ctx1) {
  56864. var $2,$3,$4,$1,$5,$7,$8,$9,$6,$10,$12,$11;
  56865. (
  56866. $ctx1.supercall = true,
  56867. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testAddAll.apply($self, []));
  56868. $ctx1.supercall = false;
  56869. $2=$self._collection();
  56870. $ctx1.sendIdx["collection"]=1;
  56871. $3=$self._collection();
  56872. $ctx1.sendIdx["collection"]=2;
  56873. $recv($2)._addAll_($3);
  56874. $ctx1.sendIdx["addAll:"]=1;
  56875. $4=$recv($2)._yourself();
  56876. $ctx1.sendIdx["yourself"]=1;
  56877. $1=$4;
  56878. $5=$self._collection();
  56879. $ctx1.sendIdx["collection"]=3;
  56880. $self._assert_equals_($1,$5);
  56881. $ctx1.sendIdx["assert:equals:"]=1;
  56882. $7=$self._collection();
  56883. $ctx1.sendIdx["collection"]=4;
  56884. $8=$self._collectionWithNewValue();
  56885. $ctx1.sendIdx["collectionWithNewValue"]=1;
  56886. $recv($7)._addAll_($8);
  56887. $ctx1.sendIdx["addAll:"]=2;
  56888. $9=$recv($7)._yourself();
  56889. $ctx1.sendIdx["yourself"]=2;
  56890. $6=$9;
  56891. $10=$self._collectionWithNewValue();
  56892. $ctx1.sendIdx["collectionWithNewValue"]=2;
  56893. $self._assert_equals_($6,$10);
  56894. $ctx1.sendIdx["assert:equals:"]=2;
  56895. $12=$self._collectionWithNewValue();
  56896. $ctx1.sendIdx["collectionWithNewValue"]=3;
  56897. $recv($12)._addAll_($self._collection());
  56898. $11=$recv($12)._yourself();
  56899. $self._assert_equals_($11,$self._collectionWithNewValue());
  56900. return self;
  56901. }, function($ctx1) {$ctx1.fill(self,"testAddAll",{},$globals.SetTest)});
  56902. },
  56903. args: [],
  56904. 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",
  56905. referencedClasses: [],
  56906. messageSends: ["testAddAll", "assert:equals:", "addAll:", "collection", "yourself", "collectionWithNewValue"]
  56907. }),
  56908. $globals.SetTest);
  56909. $core.addMethod(
  56910. $core.method({
  56911. selector: "testAddRemove",
  56912. protocol: "tests",
  56913. fn: function (){
  56914. var self=this,$self=this;
  56915. var set;
  56916. return $core.withContext(function($ctx1) {
  56917. var $1,$2;
  56918. set=$recv($globals.Set)._new();
  56919. $self._assert_($recv(set)._isEmpty());
  56920. $ctx1.sendIdx["assert:"]=1;
  56921. $recv(set)._add_((3));
  56922. $ctx1.sendIdx["add:"]=1;
  56923. $1=$recv(set)._includes_((3));
  56924. $ctx1.sendIdx["includes:"]=1;
  56925. $self._assert_($1);
  56926. $ctx1.sendIdx["assert:"]=2;
  56927. $recv(set)._add_((5));
  56928. $2=$recv(set)._includes_((5));
  56929. $ctx1.sendIdx["includes:"]=2;
  56930. $self._assert_($2);
  56931. $recv(set)._remove_((3));
  56932. $self._deny_($recv(set)._includes_((3)));
  56933. return self;
  56934. }, function($ctx1) {$ctx1.fill(self,"testAddRemove",{set:set},$globals.SetTest)});
  56935. },
  56936. args: [],
  56937. 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)",
  56938. referencedClasses: ["Set"],
  56939. messageSends: ["new", "assert:", "isEmpty", "add:", "includes:", "remove:", "deny:"]
  56940. }),
  56941. $globals.SetTest);
  56942. $core.addMethod(
  56943. $core.method({
  56944. selector: "testAt",
  56945. protocol: "tests",
  56946. fn: function (){
  56947. var self=this,$self=this;
  56948. return $core.withContext(function($ctx1) {
  56949. $self._should_raise_((function(){
  56950. return $core.withContext(function($ctx2) {
  56951. return $recv($recv($globals.Set)._new())._at_put_((1),(2));
  56952. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  56953. }),$globals.Error);
  56954. return self;
  56955. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.SetTest)});
  56956. },
  56957. args: [],
  56958. source: "testAt\x0a\x09self should: [ Set new at: 1 put: 2 ] raise: Error",
  56959. referencedClasses: ["Set", "Error"],
  56960. messageSends: ["should:raise:", "at:put:", "new"]
  56961. }),
  56962. $globals.SetTest);
  56963. $core.addMethod(
  56964. $core.method({
  56965. selector: "testCollect",
  56966. protocol: "tests",
  56967. fn: function (){
  56968. var self=this,$self=this;
  56969. return $core.withContext(function($ctx1) {
  56970. var $2,$1;
  56971. (
  56972. $ctx1.supercall = true,
  56973. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testCollect.apply($self, []));
  56974. $ctx1.supercall = false;
  56975. $2=[(5), (6), (8)]._asSet();
  56976. $ctx1.sendIdx["asSet"]=1;
  56977. $1=$recv($2)._collect_((function(x){
  56978. return $core.withContext(function($ctx2) {
  56979. return $recv(x).__backslash_backslash((3));
  56980. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  56981. }));
  56982. $self._assert_equals_($1,[(0), (2)]._asSet());
  56983. return self;
  56984. }, function($ctx1) {$ctx1.fill(self,"testCollect",{},$globals.SetTest)});
  56985. },
  56986. args: [],
  56987. source: "testCollect\x0a\x09super testCollect.\x0a\x09self assert: (#(5 6 8) asSet collect: [ :x | x \x5c\x5c 3 ]) equals: #(0 2) asSet",
  56988. referencedClasses: [],
  56989. messageSends: ["testCollect", "assert:equals:", "collect:", "asSet", "\x5c\x5c"]
  56990. }),
  56991. $globals.SetTest);
  56992. $core.addMethod(
  56993. $core.method({
  56994. selector: "testComma",
  56995. protocol: "tests",
  56996. fn: function (){
  56997. var self=this,$self=this;
  56998. return $core.withContext(function($ctx1) {
  56999. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$9;
  57000. (
  57001. $ctx1.supercall = true,
  57002. ($globals.SetTest.superclass||$boot.nilAsClass).fn.prototype._testComma.apply($self, []));
  57003. $ctx1.supercall = false;
  57004. $2=$self._collection();
  57005. $ctx1.sendIdx["collection"]=1;
  57006. $3=$self._collection();
  57007. $ctx1.sendIdx["collection"]=2;
  57008. $1=$recv($2).__comma($3);
  57009. $ctx1.sendIdx[","]=1;
  57010. $4=$self._collection();
  57011. $ctx1.sendIdx["collection"]=3;
  57012. $self._assert_equals_($1,$4);
  57013. $ctx1.sendIdx["assert:equals:"]=1;
  57014. $6=$self._collection();
  57015. $ctx1.sendIdx["collection"]=4;
  57016. $7=$self._collectionWithNewValue();
  57017. $ctx1.sendIdx["collectionWithNewValue"]=1;
  57018. $5=$recv($6).__comma($7);
  57019. $ctx1.sendIdx[","]=2;
  57020. $8=$self._collectionWithNewValue();
  57021. $ctx1.sendIdx["collectionWithNewValue"]=2;
  57022. $self._assert_equals_($5,$8);
  57023. $ctx1.sendIdx["assert:equals:"]=2;
  57024. $10=$self._collectionWithNewValue();
  57025. $ctx1.sendIdx["collectionWithNewValue"]=3;
  57026. $9=$recv($10).__comma($self._collection());
  57027. $self._assert_equals_($9,$self._collectionWithNewValue());
  57028. return self;
  57029. }, function($ctx1) {$ctx1.fill(self,"testComma",{},$globals.SetTest)});
  57030. },
  57031. args: [],
  57032. 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",
  57033. referencedClasses: [],
  57034. messageSends: ["testComma", "assert:equals:", ",", "collection", "collectionWithNewValue"]
  57035. }),
  57036. $globals.SetTest);
  57037. $core.addMethod(
  57038. $core.method({
  57039. selector: "testComparing",
  57040. protocol: "tests",
  57041. fn: function (){
  57042. var self=this,$self=this;
  57043. return $core.withContext(function($ctx1) {
  57044. var $1,$2,$3,$4,$6,$7,$5,$9,$8;
  57045. $1=[(0), (2)]._asSet();
  57046. $ctx1.sendIdx["asSet"]=1;
  57047. $2=[(0), (2)]._asSet();
  57048. $ctx1.sendIdx["asSet"]=2;
  57049. $self._assert_equals_($1,$2);
  57050. $ctx1.sendIdx["assert:equals:"]=1;
  57051. $3=[(2), (0)]._asSet();
  57052. $ctx1.sendIdx["asSet"]=3;
  57053. $4=[(0), (2)]._asSet();
  57054. $ctx1.sendIdx["asSet"]=4;
  57055. $self._assert_equals_($3,$4);
  57056. $6=[(0), (2), (3)]._asSet();
  57057. $ctx1.sendIdx["asSet"]=5;
  57058. $7=[(0), (2)]._asSet();
  57059. $ctx1.sendIdx["asSet"]=6;
  57060. $5=$recv($6).__eq($7);
  57061. $ctx1.sendIdx["="]=1;
  57062. $self._deny_($5);
  57063. $ctx1.sendIdx["deny:"]=1;
  57064. $9=[(1), (2)]._asSet();
  57065. $ctx1.sendIdx["asSet"]=7;
  57066. $8=$recv($9).__eq([(0), (2)]._asSet());
  57067. $self._deny_($8);
  57068. return self;
  57069. }, function($ctx1) {$ctx1.fill(self,"testComparing",{},$globals.SetTest)});
  57070. },
  57071. args: [],
  57072. 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",
  57073. referencedClasses: [],
  57074. messageSends: ["assert:equals:", "asSet", "deny:", "="]
  57075. }),
  57076. $globals.SetTest);
  57077. $core.addMethod(
  57078. $core.method({
  57079. selector: "testPrintString",
  57080. protocol: "tests",
  57081. fn: function (){
  57082. var self=this,$self=this;
  57083. var set;
  57084. return $core.withContext(function($ctx1) {
  57085. var $1,$2,$3,$4,$5,$6,$7,$8;
  57086. set=$recv($globals.Set)._new();
  57087. $1=$recv(set)._printString();
  57088. $ctx1.sendIdx["printString"]=1;
  57089. $self._assert_equals_($1,"a Set ()");
  57090. $ctx1.sendIdx["assert:equals:"]=1;
  57091. $2=set;
  57092. $recv($2)._add_((1));
  57093. $ctx1.sendIdx["add:"]=1;
  57094. $3=$recv($2)._add_((3));
  57095. $ctx1.sendIdx["add:"]=2;
  57096. $4=$recv(set)._printString();
  57097. $ctx1.sendIdx["printString"]=2;
  57098. $self._assert_equals_($4,"a Set (1 3)");
  57099. $ctx1.sendIdx["assert:equals:"]=2;
  57100. $recv(set)._add_("foo");
  57101. $ctx1.sendIdx["add:"]=3;
  57102. $5=$recv(set)._printString();
  57103. $ctx1.sendIdx["printString"]=3;
  57104. $self._assert_equals_($5,"a Set (1 3 'foo')");
  57105. $ctx1.sendIdx["assert:equals:"]=3;
  57106. $6=set;
  57107. $recv($6)._remove_((1));
  57108. $ctx1.sendIdx["remove:"]=1;
  57109. $recv($6)._remove_((3));
  57110. $7=$recv(set)._printString();
  57111. $ctx1.sendIdx["printString"]=4;
  57112. $self._assert_equals_($7,"a Set ('foo')");
  57113. $ctx1.sendIdx["assert:equals:"]=4;
  57114. $recv(set)._add_((3));
  57115. $ctx1.sendIdx["add:"]=4;
  57116. $8=$recv(set)._printString();
  57117. $ctx1.sendIdx["printString"]=5;
  57118. $self._assert_equals_($8,"a Set (3 'foo')");
  57119. $ctx1.sendIdx["assert:equals:"]=5;
  57120. $recv(set)._add_((3));
  57121. $self._assert_equals_($recv(set)._printString(),"a Set (3 'foo')");
  57122. return self;
  57123. }, function($ctx1) {$ctx1.fill(self,"testPrintString",{set:set},$globals.SetTest)});
  57124. },
  57125. args: [],
  57126. 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'')'",
  57127. referencedClasses: ["Set"],
  57128. messageSends: ["new", "assert:equals:", "printString", "add:", "remove:"]
  57129. }),
  57130. $globals.SetTest);
  57131. $core.addMethod(
  57132. $core.method({
  57133. selector: "testUnboxedObjects",
  57134. protocol: "tests",
  57135. fn: function (){
  57136. var self=this,$self=this;
  57137. return $core.withContext(function($ctx1) {
  57138. var $4,$3,$2,$1;
  57139. $4="foo"._yourself();
  57140. $ctx1.sendIdx["yourself"]=1;
  57141. $3=[$4,"foo"._yourself()];
  57142. $2=$recv($3)._asSet();
  57143. $1=$recv($2)._asArray();
  57144. $self._assert_equals_($1,["foo"]);
  57145. return self;
  57146. }, function($ctx1) {$ctx1.fill(self,"testUnboxedObjects",{},$globals.SetTest)});
  57147. },
  57148. args: [],
  57149. source: "testUnboxedObjects\x0a\x09self assert: {'foo' yourself. 'foo' yourself} asSet asArray equals: #('foo')",
  57150. referencedClasses: [],
  57151. messageSends: ["assert:equals:", "asArray", "asSet", "yourself"]
  57152. }),
  57153. $globals.SetTest);
  57154. $core.addMethod(
  57155. $core.method({
  57156. selector: "testUnicity",
  57157. protocol: "tests",
  57158. fn: function (){
  57159. var self=this,$self=this;
  57160. var set;
  57161. return $core.withContext(function($ctx1) {
  57162. var $1;
  57163. set=$recv($globals.Set)._new();
  57164. $recv(set)._add_((21));
  57165. $ctx1.sendIdx["add:"]=1;
  57166. $recv(set)._add_("hello");
  57167. $ctx1.sendIdx["add:"]=2;
  57168. $recv(set)._add_((21));
  57169. $ctx1.sendIdx["add:"]=3;
  57170. $1=$recv(set)._size();
  57171. $ctx1.sendIdx["size"]=1;
  57172. $self._assert_equals_($1,(2));
  57173. $ctx1.sendIdx["assert:equals:"]=1;
  57174. $recv(set)._add_("hello");
  57175. $self._assert_equals_($recv(set)._size(),(2));
  57176. $ctx1.sendIdx["assert:equals:"]=2;
  57177. $self._assert_equals_($recv(set)._asArray(),[(21), "hello"]);
  57178. return self;
  57179. }, function($ctx1) {$ctx1.fill(self,"testUnicity",{set:set},$globals.SetTest)});
  57180. },
  57181. args: [],
  57182. 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')",
  57183. referencedClasses: ["Set"],
  57184. messageSends: ["new", "add:", "assert:equals:", "size", "asArray"]
  57185. }),
  57186. $globals.SetTest);
  57187. $core.addMethod(
  57188. $core.method({
  57189. selector: "collectionClass",
  57190. protocol: "fixture",
  57191. fn: function (){
  57192. var self=this,$self=this;
  57193. return $globals.Set;
  57194. },
  57195. args: [],
  57196. source: "collectionClass\x0a\x09^ Set",
  57197. referencedClasses: ["Set"],
  57198. messageSends: []
  57199. }),
  57200. $globals.SetTest.a$cls);
  57201. $core.addClass("ConsoleTranscriptTest", $globals.TestCase, [], "Kernel-Tests");
  57202. $core.addMethod(
  57203. $core.method({
  57204. selector: "testShow",
  57205. protocol: "tests",
  57206. fn: function (){
  57207. var self=this,$self=this;
  57208. var originalTranscript;
  57209. return $core.withContext(function($ctx1) {
  57210. originalTranscript=$recv($globals.Transcript)._current();
  57211. $recv($globals.Transcript)._register_($recv($globals.ConsoleTranscript)._new());
  57212. $ctx1.sendIdx["register:"]=1;
  57213. $self._shouldnt_raise_((function(){
  57214. return $core.withContext(function($ctx2) {
  57215. return $recv($globals.Transcript)._show_("Hello console!");
  57216. $ctx2.sendIdx["show:"]=1;
  57217. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57218. }),$globals.Error);
  57219. $ctx1.sendIdx["shouldnt:raise:"]=1;
  57220. $self._shouldnt_raise_((function(){
  57221. return $core.withContext(function($ctx2) {
  57222. return $recv($globals.Transcript)._show_(console);
  57223. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  57224. }),$globals.Error);
  57225. $recv($globals.Transcript)._register_(originalTranscript);
  57226. return self;
  57227. }, function($ctx1) {$ctx1.fill(self,"testShow",{originalTranscript:originalTranscript},$globals.ConsoleTranscriptTest)});
  57228. },
  57229. args: [],
  57230. 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.",
  57231. referencedClasses: ["Transcript", "ConsoleTranscript", "Error"],
  57232. messageSends: ["current", "register:", "new", "shouldnt:raise:", "show:"]
  57233. }),
  57234. $globals.ConsoleTranscriptTest);
  57235. $core.addClass("DateTest", $globals.TestCase, [], "Kernel-Tests");
  57236. $core.addMethod(
  57237. $core.method({
  57238. selector: "testEquality",
  57239. protocol: "tests",
  57240. fn: function (){
  57241. var self=this,$self=this;
  57242. var now;
  57243. return $core.withContext(function($ctx1) {
  57244. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57245. now=$recv($globals.Date)._new();
  57246. $1=$recv(now).__eq(now);
  57247. $ctx1.sendIdx["="]=1;
  57248. $self._assert_($1);
  57249. $ctx1.sendIdx["assert:"]=1;
  57250. $3=now;
  57251. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57252. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57253. $2=$recv($3).__eq($4);
  57254. $ctx1.sendIdx["="]=2;
  57255. $self._deny_($2);
  57256. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57257. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57258. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57259. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57260. $5=$recv($6).__eq($7);
  57261. $ctx1.sendIdx["="]=3;
  57262. $self._assert_($5);
  57263. $ctx1.sendIdx["assert:"]=2;
  57264. $9=now;
  57265. $11=$recv(now)._asMilliseconds();
  57266. $ctx1.sendIdx["asMilliseconds"]=1;
  57267. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57268. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57269. $8=$recv($9).__eq($10);
  57270. $ctx1.sendIdx["="]=4;
  57271. $self._assert_($8);
  57272. $ctx1.sendIdx["assert:"]=3;
  57273. $self._assert_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq(now));
  57274. return self;
  57275. }, function($ctx1) {$ctx1.fill(self,"testEquality",{now:now},$globals.DateTest)});
  57276. },
  57277. args: [],
  57278. 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",
  57279. referencedClasses: ["Date"],
  57280. messageSends: ["new", "assert:", "=", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57281. }),
  57282. $globals.DateTest);
  57283. $core.addMethod(
  57284. $core.method({
  57285. selector: "testIdentity",
  57286. protocol: "tests",
  57287. fn: function (){
  57288. var self=this,$self=this;
  57289. var now;
  57290. return $core.withContext(function($ctx1) {
  57291. var $1,$3,$4,$2,$6,$7,$5,$9,$11,$10,$8;
  57292. now=$recv($globals.Date)._new();
  57293. $1=$recv(now).__eq_eq(now);
  57294. $ctx1.sendIdx["=="]=1;
  57295. $self._assert_($1);
  57296. $3=now;
  57297. $4=$recv($globals.Date)._fromMilliseconds_((0));
  57298. $ctx1.sendIdx["fromMilliseconds:"]=1;
  57299. $2=$recv($3).__eq_eq($4);
  57300. $ctx1.sendIdx["=="]=2;
  57301. $self._deny_($2);
  57302. $ctx1.sendIdx["deny:"]=1;
  57303. $6=$recv($globals.Date)._fromMilliseconds_((12345678));
  57304. $ctx1.sendIdx["fromMilliseconds:"]=2;
  57305. $7=$recv($globals.Date)._fromMilliseconds_((12345678));
  57306. $ctx1.sendIdx["fromMilliseconds:"]=3;
  57307. $5=$recv($6).__eq_eq($7);
  57308. $ctx1.sendIdx["=="]=3;
  57309. $self._deny_($5);
  57310. $ctx1.sendIdx["deny:"]=2;
  57311. $9=now;
  57312. $11=$recv(now)._asMilliseconds();
  57313. $ctx1.sendIdx["asMilliseconds"]=1;
  57314. $10=$recv($globals.Date)._fromMilliseconds_($11);
  57315. $ctx1.sendIdx["fromMilliseconds:"]=4;
  57316. $8=$recv($9).__eq_eq($10);
  57317. $ctx1.sendIdx["=="]=4;
  57318. $self._deny_($8);
  57319. $ctx1.sendIdx["deny:"]=3;
  57320. $self._deny_($recv($recv($globals.Date)._fromMilliseconds_($recv(now)._asMilliseconds())).__eq_eq(now));
  57321. return self;
  57322. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{now:now},$globals.DateTest)});
  57323. },
  57324. args: [],
  57325. 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",
  57326. referencedClasses: ["Date"],
  57327. messageSends: ["new", "assert:", "==", "deny:", "fromMilliseconds:", "asMilliseconds"]
  57328. }),
  57329. $globals.DateTest);
  57330. $core.addClass("JSObjectProxyTest", $globals.TestCase, [], "Kernel-Tests");
  57331. $core.addMethod(
  57332. $core.method({
  57333. selector: "jsObject",
  57334. protocol: "accessing",
  57335. fn: function (){
  57336. var self=this,$self=this;
  57337. return $core.withContext(function($ctx1) {
  57338. return {a: 1, b: function() {return 2;}, c: function(object) {return object;}, d: "", "e": null, "f": void 0};
  57339. return self;
  57340. }, function($ctx1) {$ctx1.fill(self,"jsObject",{},$globals.JSObjectProxyTest)});
  57341. },
  57342. args: [],
  57343. 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}'>",
  57344. referencedClasses: [],
  57345. messageSends: []
  57346. }),
  57347. $globals.JSObjectProxyTest);
  57348. $core.addMethod(
  57349. $core.method({
  57350. selector: "jsUndefined",
  57351. protocol: "accessing",
  57352. fn: function (){
  57353. var self=this,$self=this;
  57354. return $core.withContext(function($ctx1) {
  57355. return;
  57356. return self;
  57357. }, function($ctx1) {$ctx1.fill(self,"jsUndefined",{},$globals.JSObjectProxyTest)});
  57358. },
  57359. args: [],
  57360. source: "jsUndefined\x0a\x09<inlineJS: 'return'>",
  57361. referencedClasses: [],
  57362. messageSends: []
  57363. }),
  57364. $globals.JSObjectProxyTest);
  57365. $core.addMethod(
  57366. $core.method({
  57367. selector: "testAtIfAbsent",
  57368. protocol: "tests",
  57369. fn: function (){
  57370. var self=this,$self=this;
  57371. var testObject;
  57372. return $core.withContext(function($ctx1) {
  57373. var $1,$2,$3;
  57374. testObject=$self._jsObject();
  57375. $1=$recv(testObject)._at_ifAbsent_("abc",(function(){
  57376. return "Property does not exist";
  57377. }));
  57378. $ctx1.sendIdx["at:ifAbsent:"]=1;
  57379. $self._assert_equals_($1,"Property does not exist");
  57380. $ctx1.sendIdx["assert:equals:"]=1;
  57381. $2=$recv(testObject)._at_ifAbsent_("e",(function(){
  57382. return "Property does not exist";
  57383. }));
  57384. $ctx1.sendIdx["at:ifAbsent:"]=2;
  57385. $self._assert_equals_($2,nil);
  57386. $ctx1.sendIdx["assert:equals:"]=2;
  57387. $3=$recv(testObject)._at_ifAbsent_("a",(function(){
  57388. return "Property does not exist";
  57389. }));
  57390. $ctx1.sendIdx["at:ifAbsent:"]=3;
  57391. $self._assert_equals_($3,(1));
  57392. $ctx1.sendIdx["assert:equals:"]=3;
  57393. $self._assert_equals_($recv(testObject)._at_ifAbsent_("f",(function(){
  57394. return "Property does not exist";
  57395. })),nil);
  57396. return self;
  57397. }, function($ctx1) {$ctx1.fill(self,"testAtIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57398. },
  57399. args: [],
  57400. 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.",
  57401. referencedClasses: [],
  57402. messageSends: ["jsObject", "assert:equals:", "at:ifAbsent:"]
  57403. }),
  57404. $globals.JSObjectProxyTest);
  57405. $core.addMethod(
  57406. $core.method({
  57407. selector: "testAtIfPresent",
  57408. protocol: "tests",
  57409. fn: function (){
  57410. var self=this,$self=this;
  57411. var testObject;
  57412. return $core.withContext(function($ctx1) {
  57413. var $2,$1,$4,$3,$6,$5;
  57414. testObject=$self._jsObject();
  57415. $1=$recv(testObject)._at_ifPresent_("abc",(function(x){
  57416. return $core.withContext(function($ctx2) {
  57417. $2=$recv(x)._asString();
  57418. $ctx2.sendIdx["asString"]=1;
  57419. return "hello ".__comma($2);
  57420. $ctx2.sendIdx[","]=1;
  57421. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57422. }));
  57423. $ctx1.sendIdx["at:ifPresent:"]=1;
  57424. $self._assert_equals_($1,nil);
  57425. $ctx1.sendIdx["assert:equals:"]=1;
  57426. $3=$recv(testObject)._at_ifPresent_("e",(function(x){
  57427. return $core.withContext(function($ctx2) {
  57428. $4=$recv(x)._asString();
  57429. $ctx2.sendIdx["asString"]=2;
  57430. return "hello ".__comma($4);
  57431. $ctx2.sendIdx[","]=2;
  57432. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,2)});
  57433. }));
  57434. $ctx1.sendIdx["at:ifPresent:"]=2;
  57435. $self._assert_equals_($3,"hello nil");
  57436. $ctx1.sendIdx["assert:equals:"]=2;
  57437. $5=$recv(testObject)._at_ifPresent_("a",(function(x){
  57438. return $core.withContext(function($ctx2) {
  57439. $6=$recv(x)._asString();
  57440. $ctx2.sendIdx["asString"]=3;
  57441. return "hello ".__comma($6);
  57442. $ctx2.sendIdx[","]=3;
  57443. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57444. }));
  57445. $ctx1.sendIdx["at:ifPresent:"]=3;
  57446. $self._assert_equals_($5,"hello 1");
  57447. $ctx1.sendIdx["assert:equals:"]=3;
  57448. $self._assert_equals_($recv(testObject)._at_ifPresent_("f",(function(x){
  57449. return $core.withContext(function($ctx2) {
  57450. return "hello ".__comma($recv(x)._asString());
  57451. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,4)});
  57452. })),"hello nil");
  57453. return self;
  57454. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57455. },
  57456. args: [],
  57457. 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'.",
  57458. referencedClasses: [],
  57459. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:", ",", "asString"]
  57460. }),
  57461. $globals.JSObjectProxyTest);
  57462. $core.addMethod(
  57463. $core.method({
  57464. selector: "testAtIfPresentIfAbsent",
  57465. protocol: "tests",
  57466. fn: function (){
  57467. var self=this,$self=this;
  57468. var testObject;
  57469. return $core.withContext(function($ctx1) {
  57470. var $2,$1,$4,$3,$6,$5;
  57471. testObject=$self._jsObject();
  57472. $1=$recv(testObject)._at_ifPresent_ifAbsent_("abc",(function(x){
  57473. return $core.withContext(function($ctx2) {
  57474. $2=$recv(x)._asString();
  57475. $ctx2.sendIdx["asString"]=1;
  57476. return "hello ".__comma($2);
  57477. $ctx2.sendIdx[","]=1;
  57478. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  57479. }),(function(){
  57480. return "not present";
  57481. }));
  57482. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=1;
  57483. $self._assert_equals_($1,"not present");
  57484. $ctx1.sendIdx["assert:equals:"]=1;
  57485. $3=$recv(testObject)._at_ifPresent_ifAbsent_("e",(function(x){
  57486. return $core.withContext(function($ctx2) {
  57487. $4=$recv(x)._asString();
  57488. $ctx2.sendIdx["asString"]=2;
  57489. return "hello ".__comma($4);
  57490. $ctx2.sendIdx[","]=2;
  57491. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,3)});
  57492. }),(function(){
  57493. return "not present";
  57494. }));
  57495. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=2;
  57496. $self._assert_equals_($3,"hello nil");
  57497. $ctx1.sendIdx["assert:equals:"]=2;
  57498. $5=$recv(testObject)._at_ifPresent_ifAbsent_("a",(function(x){
  57499. return $core.withContext(function($ctx2) {
  57500. $6=$recv(x)._asString();
  57501. $ctx2.sendIdx["asString"]=3;
  57502. return "hello ".__comma($6);
  57503. $ctx2.sendIdx[","]=3;
  57504. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,5)});
  57505. }),(function(){
  57506. return "not present";
  57507. }));
  57508. $ctx1.sendIdx["at:ifPresent:ifAbsent:"]=3;
  57509. $self._assert_equals_($5,"hello 1");
  57510. $ctx1.sendIdx["assert:equals:"]=3;
  57511. $self._assert_equals_($recv(testObject)._at_ifPresent_ifAbsent_("f",(function(x){
  57512. return $core.withContext(function($ctx2) {
  57513. return "hello ".__comma($recv(x)._asString());
  57514. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,7)});
  57515. }),(function(){
  57516. return "not present";
  57517. })),"hello nil");
  57518. return self;
  57519. }, function($ctx1) {$ctx1.fill(self,"testAtIfPresentIfAbsent",{testObject:testObject},$globals.JSObjectProxyTest)});
  57520. },
  57521. args: [],
  57522. 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'.",
  57523. referencedClasses: [],
  57524. messageSends: ["jsObject", "assert:equals:", "at:ifPresent:ifAbsent:", ",", "asString"]
  57525. }),
  57526. $globals.JSObjectProxyTest);
  57527. $core.addMethod(
  57528. $core.method({
  57529. selector: "testAtPut",
  57530. protocol: "tests",
  57531. fn: function (){
  57532. var self=this,$self=this;
  57533. var testObject;
  57534. return $core.withContext(function($ctx1) {
  57535. var $2,$1;
  57536. testObject=$self._jsObject();
  57537. $2=$recv(testObject)._at_("abc");
  57538. $ctx1.sendIdx["at:"]=1;
  57539. $1=$recv($2).__tild_eq("xyz");
  57540. $self._assert_($1);
  57541. $self._assert_equals_($recv(testObject)._at_put_("abc","xyz"),"xyz");
  57542. $ctx1.sendIdx["assert:equals:"]=1;
  57543. $self._assert_equals_($recv(testObject)._at_("abc"),"xyz");
  57544. return self;
  57545. }, function($ctx1) {$ctx1.fill(self,"testAtPut",{testObject:testObject},$globals.JSObjectProxyTest)});
  57546. },
  57547. args: [],
  57548. 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'",
  57549. referencedClasses: [],
  57550. messageSends: ["jsObject", "assert:", "~=", "at:", "assert:equals:", "at:put:"]
  57551. }),
  57552. $globals.JSObjectProxyTest);
  57553. $core.addMethod(
  57554. $core.method({
  57555. selector: "testComparison",
  57556. protocol: "tests",
  57557. fn: function (){
  57558. var self=this,$self=this;
  57559. return $core.withContext(function($ctx1) {
  57560. var $1,$2;
  57561. $self._assert_equals_($recv([console,(2)])._indexOf_(console),(1));
  57562. $1=$recv(console).__eq(console);
  57563. $ctx1.sendIdx["="]=1;
  57564. $self._assert_($1);
  57565. $2=$recv(console).__eq($recv($globals.Object)._new());
  57566. $ctx1.sendIdx["="]=2;
  57567. $self._deny_($2);
  57568. $ctx1.sendIdx["deny:"]=1;
  57569. $self._deny_($recv(console).__eq($self._jsObject()));
  57570. return self;
  57571. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.JSObjectProxyTest)});
  57572. },
  57573. args: [],
  57574. 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",
  57575. referencedClasses: ["Object"],
  57576. messageSends: ["assert:equals:", "indexOf:", "assert:", "=", "deny:", "new", "jsObject"]
  57577. }),
  57578. $globals.JSObjectProxyTest);
  57579. $core.addMethod(
  57580. $core.method({
  57581. selector: "testDNU",
  57582. protocol: "tests",
  57583. fn: function (){
  57584. var self=this,$self=this;
  57585. return $core.withContext(function($ctx1) {
  57586. $self._should_raise_((function(){
  57587. return $core.withContext(function($ctx2) {
  57588. return $recv($self._jsObject())._foo();
  57589. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57590. }),$globals.MessageNotUnderstood);
  57591. return self;
  57592. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.JSObjectProxyTest)});
  57593. },
  57594. args: [],
  57595. source: "testDNU\x0a\x09self should: [ self jsObject foo ] raise: MessageNotUnderstood",
  57596. referencedClasses: ["MessageNotUnderstood"],
  57597. messageSends: ["should:raise:", "foo", "jsObject"]
  57598. }),
  57599. $globals.JSObjectProxyTest);
  57600. $core.addMethod(
  57601. $core.method({
  57602. selector: "testDNUWithAllowJavaScriptCalls",
  57603. protocol: "tests",
  57604. fn: function (){
  57605. var self=this,$self=this;
  57606. var jsObject;
  57607. return $core.withContext(function($ctx1) {
  57608. jsObject=[];
  57609. $recv(jsObject)._basicAt_put_("allowJavaScriptCalls",true);
  57610. $self._should_raise_((function(){
  57611. return $core.withContext(function($ctx2) {
  57612. return $recv(jsObject)._foo();
  57613. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57614. }),$globals.MessageNotUnderstood);
  57615. return self;
  57616. }, function($ctx1) {$ctx1.fill(self,"testDNUWithAllowJavaScriptCalls",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57617. },
  57618. args: [],
  57619. source: "testDNUWithAllowJavaScriptCalls\x0a\x09| jsObject |\x0a\x09jsObject := #().\x0a\x09jsObject basicAt: 'allowJavaScriptCalls' put: true.\x0a\x09self should: [ jsObject foo ] raise: MessageNotUnderstood",
  57620. referencedClasses: ["MessageNotUnderstood"],
  57621. messageSends: ["basicAt:put:", "should:raise:", "foo"]
  57622. }),
  57623. $globals.JSObjectProxyTest);
  57624. $core.addMethod(
  57625. $core.method({
  57626. selector: "testMessageSend",
  57627. protocol: "tests",
  57628. fn: function (){
  57629. var self=this,$self=this;
  57630. return $core.withContext(function($ctx1) {
  57631. var $2,$1,$4,$3;
  57632. $2=$self._jsObject();
  57633. $ctx1.sendIdx["jsObject"]=1;
  57634. $1=$recv($2)._a();
  57635. $self._assert_equals_($1,(1));
  57636. $ctx1.sendIdx["assert:equals:"]=1;
  57637. $4=$self._jsObject();
  57638. $ctx1.sendIdx["jsObject"]=2;
  57639. $3=$recv($4)._b();
  57640. $self._assert_equals_($3,(2));
  57641. $ctx1.sendIdx["assert:equals:"]=2;
  57642. $self._assert_equals_($recv($self._jsObject())._c_((3)),(3));
  57643. return self;
  57644. }, function($ctx1) {$ctx1.fill(self,"testMessageSend",{},$globals.JSObjectProxyTest)});
  57645. },
  57646. args: [],
  57647. 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",
  57648. referencedClasses: [],
  57649. messageSends: ["assert:equals:", "a", "jsObject", "b", "c:"]
  57650. }),
  57651. $globals.JSObjectProxyTest);
  57652. $core.addMethod(
  57653. $core.method({
  57654. selector: "testMethodWithArguments",
  57655. protocol: "tests",
  57656. fn: function (){
  57657. var self=this,$self=this;
  57658. return $core.withContext(function($ctx1) {
  57659. $self._assert_equals_($recv($self._jsObject())._c_((1)),(1));
  57660. return self;
  57661. }, function($ctx1) {$ctx1.fill(self,"testMethodWithArguments",{},$globals.JSObjectProxyTest)});
  57662. },
  57663. args: [],
  57664. source: "testMethodWithArguments\x0a\x09self assert: (self jsObject c: 1) equals: 1",
  57665. referencedClasses: [],
  57666. messageSends: ["assert:equals:", "c:", "jsObject"]
  57667. }),
  57668. $globals.JSObjectProxyTest);
  57669. $core.addMethod(
  57670. $core.method({
  57671. selector: "testNull",
  57672. protocol: "tests",
  57673. fn: function (){
  57674. var self=this,$self=this;
  57675. return $core.withContext(function($ctx1) {
  57676. var $2,$1;
  57677. $2=$recv($globals.JSObjectProxy)._null();
  57678. $ctx1.sendIdx["null"]=1;
  57679. $1=$recv($2)._isNil();
  57680. $self._assert_($1);
  57681. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._null()])),"{\x22foo\x22:null}");
  57682. return self;
  57683. }, function($ctx1) {$ctx1.fill(self,"testNull",{},$globals.JSObjectProxyTest)});
  57684. },
  57685. args: [],
  57686. source: "testNull\x0a\x09self assert: JSObjectProxy null isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy null})\x0a\x09\x09equals: '{\x22foo\x22:null}'",
  57687. referencedClasses: ["JSObjectProxy", "JSON"],
  57688. messageSends: ["assert:", "isNil", "null", "assert:equals:", "stringify:"]
  57689. }),
  57690. $globals.JSObjectProxyTest);
  57691. $core.addMethod(
  57692. $core.method({
  57693. selector: "testPrinting",
  57694. protocol: "tests",
  57695. fn: function (){
  57696. var self=this,$self=this;
  57697. return $core.withContext(function($ctx1) {
  57698. $self._assert_equals_($recv($self._jsObject())._printString(),"[object Object]");
  57699. return self;
  57700. }, function($ctx1) {$ctx1.fill(self,"testPrinting",{},$globals.JSObjectProxyTest)});
  57701. },
  57702. args: [],
  57703. source: "testPrinting\x0a\x09self assert: self jsObject printString equals: '[object Object]'",
  57704. referencedClasses: [],
  57705. messageSends: ["assert:equals:", "printString", "jsObject"]
  57706. }),
  57707. $globals.JSObjectProxyTest);
  57708. $core.addMethod(
  57709. $core.method({
  57710. selector: "testPropertyThatReturnsEmptyString",
  57711. protocol: "tests",
  57712. fn: function (){
  57713. var self=this,$self=this;
  57714. var object;
  57715. return $core.withContext(function($ctx1) {
  57716. var $1;
  57717. object=$self._jsObject();
  57718. $1=$recv(object)._d();
  57719. $ctx1.sendIdx["d"]=1;
  57720. $self._assert_equals_($1,"");
  57721. $ctx1.sendIdx["assert:equals:"]=1;
  57722. $recv(object)._d_("hello");
  57723. $self._assert_equals_($recv(object)._d(),"hello");
  57724. return self;
  57725. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsEmptyString",{object:object},$globals.JSObjectProxyTest)});
  57726. },
  57727. args: [],
  57728. 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'",
  57729. referencedClasses: [],
  57730. messageSends: ["jsObject", "assert:equals:", "d", "d:"]
  57731. }),
  57732. $globals.JSObjectProxyTest);
  57733. $core.addMethod(
  57734. $core.method({
  57735. selector: "testPropertyThatReturnsUndefined",
  57736. protocol: "tests",
  57737. fn: function (){
  57738. var self=this,$self=this;
  57739. var object;
  57740. return $core.withContext(function($ctx1) {
  57741. object=$self._jsObject();
  57742. $self._shouldnt_raise_((function(){
  57743. return $core.withContext(function($ctx2) {
  57744. return $recv(object)._e();
  57745. $ctx2.sendIdx["e"]=1;
  57746. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57747. }),$globals.MessageNotUnderstood);
  57748. $self._assert_($recv($recv(object)._e())._isNil());
  57749. return self;
  57750. }, function($ctx1) {$ctx1.fill(self,"testPropertyThatReturnsUndefined",{object:object},$globals.JSObjectProxyTest)});
  57751. },
  57752. args: [],
  57753. source: "testPropertyThatReturnsUndefined\x0a\x09| object |\x0a\x0a\x09object := self jsObject.\x0a\x09self shouldnt: [ object e ] raise: MessageNotUnderstood.\x0a\x09self assert: object e isNil",
  57754. referencedClasses: ["MessageNotUnderstood"],
  57755. messageSends: ["jsObject", "shouldnt:raise:", "e", "assert:", "isNil"]
  57756. }),
  57757. $globals.JSObjectProxyTest);
  57758. $core.addMethod(
  57759. $core.method({
  57760. selector: "testSetPropertyWithFalsyValue",
  57761. protocol: "tests",
  57762. fn: function (){
  57763. var self=this,$self=this;
  57764. var jsObject;
  57765. return $core.withContext(function($ctx1) {
  57766. var $1,$2,$3,$4,$5;
  57767. jsObject=$self._jsObject();
  57768. $1=$recv(jsObject)._a();
  57769. $ctx1.sendIdx["a"]=1;
  57770. $self._assert_equals_($1,(1));
  57771. $ctx1.sendIdx["assert:equals:"]=1;
  57772. $recv(jsObject)._a_($recv($globals.JSObjectProxy)._null());
  57773. $ctx1.sendIdx["a:"]=1;
  57774. $2=$recv(jsObject)._a();
  57775. $ctx1.sendIdx["a"]=2;
  57776. $self._assert_equals_($2,nil);
  57777. $ctx1.sendIdx["assert:equals:"]=2;
  57778. $recv(jsObject)._a_((0));
  57779. $ctx1.sendIdx["a:"]=2;
  57780. $3=$recv(jsObject)._a();
  57781. $ctx1.sendIdx["a"]=3;
  57782. $self._assert_equals_($3,(0));
  57783. $ctx1.sendIdx["assert:equals:"]=3;
  57784. $recv(jsObject)._a_($self._jsUndefined());
  57785. $ctx1.sendIdx["a:"]=3;
  57786. $4=$recv(jsObject)._a();
  57787. $ctx1.sendIdx["a"]=4;
  57788. $self._assert_equals_($4,nil);
  57789. $ctx1.sendIdx["assert:equals:"]=4;
  57790. $recv(jsObject)._a_("");
  57791. $ctx1.sendIdx["a:"]=4;
  57792. $5=$recv(jsObject)._a();
  57793. $ctx1.sendIdx["a"]=5;
  57794. $self._assert_equals_($5,"");
  57795. $ctx1.sendIdx["assert:equals:"]=5;
  57796. $recv(jsObject)._a_(false);
  57797. $self._assert_equals_($recv(jsObject)._a(),false);
  57798. return self;
  57799. }, function($ctx1) {$ctx1.fill(self,"testSetPropertyWithFalsyValue",{jsObject:jsObject},$globals.JSObjectProxyTest)});
  57800. },
  57801. args: [],
  57802. 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",
  57803. referencedClasses: ["JSObjectProxy"],
  57804. messageSends: ["jsObject", "assert:equals:", "a", "a:", "null", "jsUndefined"]
  57805. }),
  57806. $globals.JSObjectProxyTest);
  57807. $core.addMethod(
  57808. $core.method({
  57809. selector: "testUndefined",
  57810. protocol: "tests",
  57811. fn: function (){
  57812. var self=this,$self=this;
  57813. return $core.withContext(function($ctx1) {
  57814. var $2,$1;
  57815. $2=$recv($globals.JSObjectProxy)._undefined();
  57816. $ctx1.sendIdx["undefined"]=1;
  57817. $1=$recv($2)._isNil();
  57818. $self._assert_($1);
  57819. $self._assert_equals_($recv($globals.JSON)._stringify_($globals.HashedCollection._newFromPairs_(["foo",$recv($globals.JSObjectProxy)._undefined()])),"{}");
  57820. return self;
  57821. }, function($ctx1) {$ctx1.fill(self,"testUndefined",{},$globals.JSObjectProxyTest)});
  57822. },
  57823. args: [],
  57824. source: "testUndefined\x0a\x09self assert: JSObjectProxy undefined isNil.\x0a\x09self\x0a\x09\x09assert: (JSON stringify: #{#foo -> JSObjectProxy undefined})\x0a\x09\x09equals: '{}'",
  57825. referencedClasses: ["JSObjectProxy", "JSON"],
  57826. messageSends: ["assert:", "isNil", "undefined", "assert:equals:", "stringify:"]
  57827. }),
  57828. $globals.JSObjectProxyTest);
  57829. $core.addMethod(
  57830. $core.method({
  57831. selector: "testValue",
  57832. protocol: "tests",
  57833. fn: function (){
  57834. var self=this,$self=this;
  57835. var testObject;
  57836. return $core.withContext(function($ctx1) {
  57837. testObject=$self._jsObject();
  57838. $recv(testObject)._at_put_("value","aValue");
  57839. $self._assert_equals_($recv(testObject)._value(),"aValue");
  57840. return self;
  57841. }, function($ctx1) {$ctx1.fill(self,"testValue",{testObject:testObject},$globals.JSObjectProxyTest)});
  57842. },
  57843. args: [],
  57844. source: "testValue\x0a\x09| testObject |\x0a\x09testObject := self jsObject.\x0a\x09testObject at: 'value' put: 'aValue'.\x0a\x09self assert: testObject value equals: 'aValue'",
  57845. referencedClasses: [],
  57846. messageSends: ["jsObject", "at:put:", "assert:equals:", "value"]
  57847. }),
  57848. $globals.JSObjectProxyTest);
  57849. $core.addMethod(
  57850. $core.method({
  57851. selector: "testYourself",
  57852. protocol: "tests",
  57853. fn: function (){
  57854. var self=this,$self=this;
  57855. var object;
  57856. return $core.withContext(function($ctx1) {
  57857. var $1;
  57858. $1=$self._jsObject();
  57859. $recv($1)._d_("test");
  57860. object=$recv($1)._yourself();
  57861. $self._assert_equals_($recv(object)._d(),"test");
  57862. return self;
  57863. }, function($ctx1) {$ctx1.fill(self,"testYourself",{object:object},$globals.JSObjectProxyTest)});
  57864. },
  57865. args: [],
  57866. source: "testYourself\x0a\x09| object |\x0a\x09object := self jsObject\x0a\x09\x09d: 'test';\x0a\x09\x09yourself.\x0a\x0a\x09self assert: object d equals: 'test'",
  57867. referencedClasses: [],
  57868. messageSends: ["d:", "jsObject", "yourself", "assert:equals:", "d"]
  57869. }),
  57870. $globals.JSObjectProxyTest);
  57871. $core.addClass("JavaScriptExceptionTest", $globals.TestCase, [], "Kernel-Tests");
  57872. $core.addMethod(
  57873. $core.method({
  57874. selector: "testCatchingException",
  57875. protocol: "tests",
  57876. fn: function (){
  57877. var self=this,$self=this;
  57878. return $core.withContext(function($ctx1) {
  57879. $recv((function(){
  57880. return $core.withContext(function($ctx2) {
  57881. return $self._throwException();
  57882. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57883. }))._on_do_($globals.Error,(function(error){
  57884. return $core.withContext(function($ctx2) {
  57885. return $self._assert_($recv($recv(error)._exception()).__eq("test"));
  57886. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  57887. }));
  57888. return self;
  57889. }, function($ctx1) {$ctx1.fill(self,"testCatchingException",{},$globals.JavaScriptExceptionTest)});
  57890. },
  57891. args: [],
  57892. source: "testCatchingException\x0a\x09[ self throwException ]\x0a\x09\x09on: Error\x0a\x09\x09do: [ :error |\x0a\x09\x09\x09self assert: error exception = 'test' ]",
  57893. referencedClasses: ["Error"],
  57894. messageSends: ["on:do:", "throwException", "assert:", "=", "exception"]
  57895. }),
  57896. $globals.JavaScriptExceptionTest);
  57897. $core.addMethod(
  57898. $core.method({
  57899. selector: "testRaisingException",
  57900. protocol: "tests",
  57901. fn: function (){
  57902. var self=this,$self=this;
  57903. return $core.withContext(function($ctx1) {
  57904. $self._should_raise_((function(){
  57905. return $core.withContext(function($ctx2) {
  57906. return $self._throwException();
  57907. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  57908. }),$globals.JavaScriptException);
  57909. return self;
  57910. }, function($ctx1) {$ctx1.fill(self,"testRaisingException",{},$globals.JavaScriptExceptionTest)});
  57911. },
  57912. args: [],
  57913. source: "testRaisingException\x0a\x09self should: [ self throwException ] raise: JavaScriptException",
  57914. referencedClasses: ["JavaScriptException"],
  57915. messageSends: ["should:raise:", "throwException"]
  57916. }),
  57917. $globals.JavaScriptExceptionTest);
  57918. $core.addMethod(
  57919. $core.method({
  57920. selector: "throwException",
  57921. protocol: "helpers",
  57922. fn: function (){
  57923. var self=this,$self=this;
  57924. return $core.withContext(function($ctx1) {
  57925. throw "test";
  57926. return self;
  57927. }, function($ctx1) {$ctx1.fill(self,"throwException",{},$globals.JavaScriptExceptionTest)});
  57928. },
  57929. args: [],
  57930. source: "throwException\x0a\x09<inlineJS: 'throw \x22test\x22'>",
  57931. referencedClasses: [],
  57932. messageSends: []
  57933. }),
  57934. $globals.JavaScriptExceptionTest);
  57935. $core.addClass("MessageSendTest", $globals.TestCase, [], "Kernel-Tests");
  57936. $core.addMethod(
  57937. $core.method({
  57938. selector: "testValue",
  57939. protocol: "tests",
  57940. fn: function (){
  57941. var self=this,$self=this;
  57942. var messageSend;
  57943. return $core.withContext(function($ctx1) {
  57944. var $1;
  57945. $1=$recv($globals.MessageSend)._new();
  57946. $ctx1.sendIdx["new"]=1;
  57947. $recv($1)._receiver_($recv($globals.Object)._new());
  57948. $recv($1)._selector_("asString");
  57949. messageSend=$recv($1)._yourself();
  57950. $self._assert_equals_($recv(messageSend)._value(),"an Object");
  57951. return self;
  57952. }, function($ctx1) {$ctx1.fill(self,"testValue",{messageSend:messageSend},$globals.MessageSendTest)});
  57953. },
  57954. args: [],
  57955. 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'",
  57956. referencedClasses: ["MessageSend", "Object"],
  57957. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value"]
  57958. }),
  57959. $globals.MessageSendTest);
  57960. $core.addMethod(
  57961. $core.method({
  57962. selector: "testValueWithArguments",
  57963. protocol: "tests",
  57964. fn: function (){
  57965. var self=this,$self=this;
  57966. var messageSend;
  57967. return $core.withContext(function($ctx1) {
  57968. var $1;
  57969. $1=$recv($globals.MessageSend)._new();
  57970. $recv($1)._receiver_((2));
  57971. $recv($1)._selector_("+");
  57972. messageSend=$recv($1)._yourself();
  57973. $self._assert_equals_($recv(messageSend)._value_((3)),(5));
  57974. $ctx1.sendIdx["assert:equals:"]=1;
  57975. $self._assert_equals_($recv(messageSend)._valueWithPossibleArguments_([(4)]),(6));
  57976. return self;
  57977. }, function($ctx1) {$ctx1.fill(self,"testValueWithArguments",{messageSend:messageSend},$globals.MessageSendTest)});
  57978. },
  57979. args: [],
  57980. 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",
  57981. referencedClasses: ["MessageSend"],
  57982. messageSends: ["receiver:", "new", "selector:", "yourself", "assert:equals:", "value:", "valueWithPossibleArguments:"]
  57983. }),
  57984. $globals.MessageSendTest);
  57985. $core.addClass("MethodInheritanceTest", $globals.TestCase, ["receiverTop", "receiverMiddle", "receiverBottom", "method", "performBlock"], "Kernel-Tests");
  57986. $core.addMethod(
  57987. $core.method({
  57988. selector: "codeGeneratorClass",
  57989. protocol: "accessing",
  57990. fn: function (){
  57991. var self=this,$self=this;
  57992. return $globals.CodeGenerator;
  57993. },
  57994. args: [],
  57995. source: "codeGeneratorClass\x0a\x09^ CodeGenerator",
  57996. referencedClasses: ["CodeGenerator"],
  57997. messageSends: []
  57998. }),
  57999. $globals.MethodInheritanceTest);
  58000. $core.addMethod(
  58001. $core.method({
  58002. selector: "compiler",
  58003. protocol: "factory",
  58004. fn: function (){
  58005. var self=this,$self=this;
  58006. return $core.withContext(function($ctx1) {
  58007. var $1;
  58008. $1=$recv($globals.Compiler)._new();
  58009. $recv($1)._codeGeneratorClass_($self._codeGeneratorClass());
  58010. return $recv($1)._yourself();
  58011. }, function($ctx1) {$ctx1.fill(self,"compiler",{},$globals.MethodInheritanceTest)});
  58012. },
  58013. args: [],
  58014. source: "compiler\x0a\x09^ Compiler new\x0a\x09\x09codeGeneratorClass: self codeGeneratorClass;\x0a\x09\x09yourself",
  58015. referencedClasses: ["Compiler"],
  58016. messageSends: ["codeGeneratorClass:", "new", "codeGeneratorClass", "yourself"]
  58017. }),
  58018. $globals.MethodInheritanceTest);
  58019. $core.addMethod(
  58020. $core.method({
  58021. selector: "deinstallBottom",
  58022. protocol: "testing",
  58023. fn: function (){
  58024. var self=this,$self=this;
  58025. return $core.withContext(function($ctx1) {
  58026. $recv($self._targetClassBottom())._removeCompiledMethod_($self["@method"]);
  58027. return self;
  58028. }, function($ctx1) {$ctx1.fill(self,"deinstallBottom",{},$globals.MethodInheritanceTest)});
  58029. },
  58030. args: [],
  58031. source: "deinstallBottom\x0a\x09self targetClassBottom removeCompiledMethod: method",
  58032. referencedClasses: [],
  58033. messageSends: ["removeCompiledMethod:", "targetClassBottom"]
  58034. }),
  58035. $globals.MethodInheritanceTest);
  58036. $core.addMethod(
  58037. $core.method({
  58038. selector: "deinstallMiddle",
  58039. protocol: "testing",
  58040. fn: function (){
  58041. var self=this,$self=this;
  58042. return $core.withContext(function($ctx1) {
  58043. $recv($self._targetClassMiddle())._removeCompiledMethod_($self["@method"]);
  58044. return self;
  58045. }, function($ctx1) {$ctx1.fill(self,"deinstallMiddle",{},$globals.MethodInheritanceTest)});
  58046. },
  58047. args: [],
  58048. source: "deinstallMiddle\x0a\x09self targetClassMiddle removeCompiledMethod: method",
  58049. referencedClasses: [],
  58050. messageSends: ["removeCompiledMethod:", "targetClassMiddle"]
  58051. }),
  58052. $globals.MethodInheritanceTest);
  58053. $core.addMethod(
  58054. $core.method({
  58055. selector: "deinstallTop",
  58056. protocol: "testing",
  58057. fn: function (){
  58058. var self=this,$self=this;
  58059. return $core.withContext(function($ctx1) {
  58060. $recv($self._targetClassTop())._removeCompiledMethod_($self["@method"]);
  58061. return self;
  58062. }, function($ctx1) {$ctx1.fill(self,"deinstallTop",{},$globals.MethodInheritanceTest)});
  58063. },
  58064. args: [],
  58065. source: "deinstallTop\x0a\x09self targetClassTop removeCompiledMethod: method",
  58066. referencedClasses: [],
  58067. messageSends: ["removeCompiledMethod:", "targetClassTop"]
  58068. }),
  58069. $globals.MethodInheritanceTest);
  58070. $core.addMethod(
  58071. $core.method({
  58072. selector: "installBottom:",
  58073. protocol: "testing",
  58074. fn: function (aString){
  58075. var self=this,$self=this;
  58076. return $core.withContext(function($ctx1) {
  58077. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassBottom(),"tests");
  58078. return self;
  58079. }, function($ctx1) {$ctx1.fill(self,"installBottom:",{aString:aString},$globals.MethodInheritanceTest)});
  58080. },
  58081. args: ["aString"],
  58082. source: "installBottom: aString\x0a\x09method := self compiler install: aString forClass: self targetClassBottom protocol: 'tests'",
  58083. referencedClasses: [],
  58084. messageSends: ["install:forClass:protocol:", "compiler", "targetClassBottom"]
  58085. }),
  58086. $globals.MethodInheritanceTest);
  58087. $core.addMethod(
  58088. $core.method({
  58089. selector: "installMiddle:",
  58090. protocol: "testing",
  58091. fn: function (aString){
  58092. var self=this,$self=this;
  58093. return $core.withContext(function($ctx1) {
  58094. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassMiddle(),"tests");
  58095. return self;
  58096. }, function($ctx1) {$ctx1.fill(self,"installMiddle:",{aString:aString},$globals.MethodInheritanceTest)});
  58097. },
  58098. args: ["aString"],
  58099. source: "installMiddle: aString\x0a\x09method := self compiler install: aString forClass: self targetClassMiddle protocol: 'tests'",
  58100. referencedClasses: [],
  58101. messageSends: ["install:forClass:protocol:", "compiler", "targetClassMiddle"]
  58102. }),
  58103. $globals.MethodInheritanceTest);
  58104. $core.addMethod(
  58105. $core.method({
  58106. selector: "installTop:",
  58107. protocol: "testing",
  58108. fn: function (aString){
  58109. var self=this,$self=this;
  58110. return $core.withContext(function($ctx1) {
  58111. $self["@method"]=$recv($self._compiler())._install_forClass_protocol_(aString,$self._targetClassTop(),"tests");
  58112. return self;
  58113. }, function($ctx1) {$ctx1.fill(self,"installTop:",{aString:aString},$globals.MethodInheritanceTest)});
  58114. },
  58115. args: ["aString"],
  58116. source: "installTop: aString\x0a\x09method := self compiler install: aString forClass: self targetClassTop protocol: 'tests'",
  58117. referencedClasses: [],
  58118. messageSends: ["install:forClass:protocol:", "compiler", "targetClassTop"]
  58119. }),
  58120. $globals.MethodInheritanceTest);
  58121. $core.addMethod(
  58122. $core.method({
  58123. selector: "setUp",
  58124. protocol: "initialization",
  58125. fn: function (){
  58126. var self=this,$self=this;
  58127. return $core.withContext(function($ctx1) {
  58128. $self["@receiverTop"]=$recv($self._targetClassTop())._new();
  58129. $ctx1.sendIdx["new"]=1;
  58130. $self["@receiverMiddle"]=$recv($self._targetClassMiddle())._new();
  58131. $ctx1.sendIdx["new"]=2;
  58132. $self["@receiverBottom"]=$recv($self._targetClassBottom())._new();
  58133. $self["@method"]=nil;
  58134. $self["@performBlock"]=(function(){
  58135. return $core.withContext(function($ctx2) {
  58136. return $self._error_("performBlock not initialized");
  58137. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58138. });
  58139. return self;
  58140. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.MethodInheritanceTest)});
  58141. },
  58142. args: [],
  58143. 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' ]",
  58144. referencedClasses: [],
  58145. messageSends: ["new", "targetClassTop", "targetClassMiddle", "targetClassBottom", "error:"]
  58146. }),
  58147. $globals.MethodInheritanceTest);
  58148. $core.addMethod(
  58149. $core.method({
  58150. selector: "shouldMNU",
  58151. protocol: "testing",
  58152. fn: function (){
  58153. var self=this,$self=this;
  58154. return $core.withContext(function($ctx1) {
  58155. $self._shouldMNUTop();
  58156. $self._shouldMNUMiddle();
  58157. $self._shouldMNUBottom();
  58158. return self;
  58159. }, function($ctx1) {$ctx1.fill(self,"shouldMNU",{},$globals.MethodInheritanceTest)});
  58160. },
  58161. args: [],
  58162. source: "shouldMNU\x0a\x09self shouldMNUTop.\x0a\x09self shouldMNUMiddle.\x0a\x09self shouldMNUBottom",
  58163. referencedClasses: [],
  58164. messageSends: ["shouldMNUTop", "shouldMNUMiddle", "shouldMNUBottom"]
  58165. }),
  58166. $globals.MethodInheritanceTest);
  58167. $core.addMethod(
  58168. $core.method({
  58169. selector: "shouldMNUBottom",
  58170. protocol: "testing",
  58171. fn: function (){
  58172. var self=this,$self=this;
  58173. return $core.withContext(function($ctx1) {
  58174. $self._should_raise_((function(){
  58175. return $core.withContext(function($ctx2) {
  58176. return $recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58177. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58178. }),$globals.MessageNotUnderstood);
  58179. return self;
  58180. }, function($ctx1) {$ctx1.fill(self,"shouldMNUBottom",{},$globals.MethodInheritanceTest)});
  58181. },
  58182. args: [],
  58183. source: "shouldMNUBottom\x0a\x09self should: [ performBlock value: receiverBottom ] raise: MessageNotUnderstood",
  58184. referencedClasses: ["MessageNotUnderstood"],
  58185. messageSends: ["should:raise:", "value:"]
  58186. }),
  58187. $globals.MethodInheritanceTest);
  58188. $core.addMethod(
  58189. $core.method({
  58190. selector: "shouldMNUMiddle",
  58191. protocol: "testing",
  58192. fn: function (){
  58193. var self=this,$self=this;
  58194. return $core.withContext(function($ctx1) {
  58195. $self._should_raise_((function(){
  58196. return $core.withContext(function($ctx2) {
  58197. return $recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58198. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58199. }),$globals.MessageNotUnderstood);
  58200. return self;
  58201. }, function($ctx1) {$ctx1.fill(self,"shouldMNUMiddle",{},$globals.MethodInheritanceTest)});
  58202. },
  58203. args: [],
  58204. source: "shouldMNUMiddle\x0a\x09self should: [ performBlock value: receiverMiddle ] raise: MessageNotUnderstood",
  58205. referencedClasses: ["MessageNotUnderstood"],
  58206. messageSends: ["should:raise:", "value:"]
  58207. }),
  58208. $globals.MethodInheritanceTest);
  58209. $core.addMethod(
  58210. $core.method({
  58211. selector: "shouldMNUTop",
  58212. protocol: "testing",
  58213. fn: function (){
  58214. var self=this,$self=this;
  58215. return $core.withContext(function($ctx1) {
  58216. $self._should_raise_((function(){
  58217. return $core.withContext(function($ctx2) {
  58218. return $recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58219. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58220. }),$globals.MessageNotUnderstood);
  58221. return self;
  58222. }, function($ctx1) {$ctx1.fill(self,"shouldMNUTop",{},$globals.MethodInheritanceTest)});
  58223. },
  58224. args: [],
  58225. source: "shouldMNUTop\x0a\x09self should: [ performBlock value: receiverTop ] raise: MessageNotUnderstood",
  58226. referencedClasses: ["MessageNotUnderstood"],
  58227. messageSends: ["should:raise:", "value:"]
  58228. }),
  58229. $globals.MethodInheritanceTest);
  58230. $core.addMethod(
  58231. $core.method({
  58232. selector: "shouldReturn:",
  58233. protocol: "testing",
  58234. fn: function (anObject){
  58235. var self=this,$self=this;
  58236. var result;
  58237. return $core.withContext(function($ctx1) {
  58238. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58239. $ctx1.sendIdx["value:"]=1;
  58240. $self._assert_equals_(["top",anObject],["top",result]);
  58241. $ctx1.sendIdx["assert:equals:"]=1;
  58242. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58243. $ctx1.sendIdx["value:"]=2;
  58244. $self._assert_equals_(["middle",anObject],["middle",result]);
  58245. $ctx1.sendIdx["assert:equals:"]=2;
  58246. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58247. $self._assert_equals_(["bottom",anObject],["bottom",result]);
  58248. return self;
  58249. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:",{anObject:anObject,result:result},$globals.MethodInheritanceTest)});
  58250. },
  58251. args: ["anObject"],
  58252. 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 }",
  58253. referencedClasses: [],
  58254. messageSends: ["value:", "assert:equals:"]
  58255. }),
  58256. $globals.MethodInheritanceTest);
  58257. $core.addMethod(
  58258. $core.method({
  58259. selector: "shouldReturn:and:and:",
  58260. protocol: "testing",
  58261. fn: function (anObject,anObject2,anObject3){
  58262. var self=this,$self=this;
  58263. var result;
  58264. return $core.withContext(function($ctx1) {
  58265. result=$recv($self["@performBlock"])._value_($self["@receiverTop"]);
  58266. $ctx1.sendIdx["value:"]=1;
  58267. $self._assert_equals_(["top",anObject],["top",result]);
  58268. $ctx1.sendIdx["assert:equals:"]=1;
  58269. result=$recv($self["@performBlock"])._value_($self["@receiverMiddle"]);
  58270. $ctx1.sendIdx["value:"]=2;
  58271. $self._assert_equals_(["middle",anObject2],["middle",result]);
  58272. $ctx1.sendIdx["assert:equals:"]=2;
  58273. result=$recv($self["@performBlock"])._value_($self["@receiverBottom"]);
  58274. $self._assert_equals_(["bottom",anObject3],["bottom",result]);
  58275. return self;
  58276. }, function($ctx1) {$ctx1.fill(self,"shouldReturn:and:and:",{anObject:anObject,anObject2:anObject2,anObject3:anObject3,result:result},$globals.MethodInheritanceTest)});
  58277. },
  58278. args: ["anObject", "anObject2", "anObject3"],
  58279. 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 }",
  58280. referencedClasses: [],
  58281. messageSends: ["value:", "assert:equals:"]
  58282. }),
  58283. $globals.MethodInheritanceTest);
  58284. $core.addMethod(
  58285. $core.method({
  58286. selector: "targetClassBottom",
  58287. protocol: "accessing",
  58288. fn: function (){
  58289. var self=this,$self=this;
  58290. return $globals.JavaScriptException;
  58291. },
  58292. args: [],
  58293. source: "targetClassBottom\x0a\x09^ JavaScriptException",
  58294. referencedClasses: ["JavaScriptException"],
  58295. messageSends: []
  58296. }),
  58297. $globals.MethodInheritanceTest);
  58298. $core.addMethod(
  58299. $core.method({
  58300. selector: "targetClassMiddle",
  58301. protocol: "accessing",
  58302. fn: function (){
  58303. var self=this,$self=this;
  58304. return $globals.Error;
  58305. },
  58306. args: [],
  58307. source: "targetClassMiddle\x0a\x09^ Error",
  58308. referencedClasses: ["Error"],
  58309. messageSends: []
  58310. }),
  58311. $globals.MethodInheritanceTest);
  58312. $core.addMethod(
  58313. $core.method({
  58314. selector: "targetClassTop",
  58315. protocol: "accessing",
  58316. fn: function (){
  58317. var self=this,$self=this;
  58318. return $globals.Object;
  58319. },
  58320. args: [],
  58321. source: "targetClassTop\x0a\x09^ Object",
  58322. referencedClasses: ["Object"],
  58323. messageSends: []
  58324. }),
  58325. $globals.MethodInheritanceTest);
  58326. $core.addMethod(
  58327. $core.method({
  58328. selector: "tearDown",
  58329. protocol: "initialization",
  58330. fn: function (){
  58331. var self=this,$self=this;
  58332. return $core.withContext(function($ctx1) {
  58333. $recv((function(){
  58334. return $core.withContext(function($ctx2) {
  58335. return $self._deinstallTop();
  58336. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58337. }))._on_do_($globals.Error,(function(){
  58338. }));
  58339. $ctx1.sendIdx["on:do:"]=1;
  58340. $recv((function(){
  58341. return $core.withContext(function($ctx2) {
  58342. return $self._deinstallMiddle();
  58343. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58344. }))._on_do_($globals.Error,(function(){
  58345. }));
  58346. $ctx1.sendIdx["on:do:"]=2;
  58347. $recv((function(){
  58348. return $core.withContext(function($ctx2) {
  58349. return $self._deinstallBottom();
  58350. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58351. }))._on_do_($globals.Error,(function(){
  58352. }));
  58353. return self;
  58354. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.MethodInheritanceTest)});
  58355. },
  58356. args: [],
  58357. source: "tearDown\x0a\x09[ self deinstallTop ] on: Error do: [ ].\x0a\x09[ self deinstallMiddle ] on: Error do: [ ].\x0a\x09[ self deinstallBottom ] on: Error do: [ ]",
  58358. referencedClasses: ["Error"],
  58359. messageSends: ["on:do:", "deinstallTop", "deinstallMiddle", "deinstallBottom"]
  58360. }),
  58361. $globals.MethodInheritanceTest);
  58362. $core.addMethod(
  58363. $core.method({
  58364. selector: "testMNU11",
  58365. protocol: "tests",
  58366. fn: function (){
  58367. var self=this,$self=this;
  58368. return $core.withContext(function($ctx1) {
  58369. $self["@performBlock"]=(function(x){
  58370. return $core.withContext(function($ctx2) {
  58371. return $recv(x)._foo();
  58372. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58373. });
  58374. $self._shouldMNU();
  58375. $ctx1.sendIdx["shouldMNU"]=1;
  58376. $self._installTop_("foo ^ false");
  58377. $ctx1.sendIdx["installTop:"]=1;
  58378. $self._installTop_("foo ^ true");
  58379. $self._deinstallTop();
  58380. $self._shouldMNU();
  58381. return self;
  58382. }, function($ctx1) {$ctx1.fill(self,"testMNU11",{},$globals.MethodInheritanceTest)});
  58383. },
  58384. args: [],
  58385. 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",
  58386. referencedClasses: [],
  58387. messageSends: ["foo", "shouldMNU", "installTop:", "deinstallTop"]
  58388. }),
  58389. $globals.MethodInheritanceTest);
  58390. $core.addMethod(
  58391. $core.method({
  58392. selector: "testMNU22",
  58393. protocol: "tests",
  58394. fn: function (){
  58395. var self=this,$self=this;
  58396. return $core.withContext(function($ctx1) {
  58397. $self["@performBlock"]=(function(x){
  58398. return $core.withContext(function($ctx2) {
  58399. return $recv(x)._foo();
  58400. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58401. });
  58402. $self._shouldMNU();
  58403. $ctx1.sendIdx["shouldMNU"]=1;
  58404. $self._installMiddle_("foo ^ false");
  58405. $ctx1.sendIdx["installMiddle:"]=1;
  58406. $self._installMiddle_("foo ^ true");
  58407. $self._deinstallMiddle();
  58408. $self._shouldMNU();
  58409. return self;
  58410. }, function($ctx1) {$ctx1.fill(self,"testMNU22",{},$globals.MethodInheritanceTest)});
  58411. },
  58412. args: [],
  58413. 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",
  58414. referencedClasses: [],
  58415. messageSends: ["foo", "shouldMNU", "installMiddle:", "deinstallMiddle"]
  58416. }),
  58417. $globals.MethodInheritanceTest);
  58418. $core.addMethod(
  58419. $core.method({
  58420. selector: "testReturns1",
  58421. protocol: "tests",
  58422. fn: function (){
  58423. var self=this,$self=this;
  58424. return $core.withContext(function($ctx1) {
  58425. $self["@performBlock"]=(function(x){
  58426. return $core.withContext(function($ctx2) {
  58427. return $recv(x)._foo();
  58428. }, function($ctx2) {$ctx2.fillBlock({x:x},$ctx1,1)});
  58429. });
  58430. $self._installTop_("foo ^ false");
  58431. $ctx1.sendIdx["installTop:"]=1;
  58432. $self._shouldReturn_(false);
  58433. $ctx1.sendIdx["shouldReturn:"]=1;
  58434. $self._installTop_("foo ^ true");
  58435. $self._shouldReturn_(true);
  58436. return self;
  58437. }, function($ctx1) {$ctx1.fill(self,"testReturns1",{},$globals.MethodInheritanceTest)});
  58438. },
  58439. args: [],
  58440. 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",
  58441. referencedClasses: [],
  58442. messageSends: ["foo", "installTop:", "shouldReturn:"]
  58443. }),
  58444. $globals.MethodInheritanceTest);
  58445. $core.addClass("NumberTest", $globals.TestCase, [], "Kernel-Tests");
  58446. $core.addMethod(
  58447. $core.method({
  58448. selector: "testAbs",
  58449. protocol: "tests",
  58450. fn: function (){
  58451. var self=this,$self=this;
  58452. return $core.withContext(function($ctx1) {
  58453. var $1;
  58454. $1=(4)._abs();
  58455. $ctx1.sendIdx["abs"]=1;
  58456. $self._assert_equals_($1,(4));
  58457. $ctx1.sendIdx["assert:equals:"]=1;
  58458. $self._assert_equals_((-4)._abs(),(4));
  58459. return self;
  58460. }, function($ctx1) {$ctx1.fill(self,"testAbs",{},$globals.NumberTest)});
  58461. },
  58462. args: [],
  58463. source: "testAbs\x0a\x09self assert: 4 abs equals: 4.\x0a\x09self assert: -4 abs equals: 4",
  58464. referencedClasses: [],
  58465. messageSends: ["assert:equals:", "abs"]
  58466. }),
  58467. $globals.NumberTest);
  58468. $core.addMethod(
  58469. $core.method({
  58470. selector: "testArithmetic",
  58471. protocol: "tests",
  58472. fn: function (){
  58473. var self=this,$self=this;
  58474. return $core.withContext(function($ctx1) {
  58475. var $1,$2,$3,$5,$4;
  58476. $1=(1.5).__plus((1));
  58477. $ctx1.sendIdx["+"]=1;
  58478. $self._assert_equals_($1,(2.5));
  58479. $ctx1.sendIdx["assert:equals:"]=1;
  58480. $2=(2).__minus((1));
  58481. $ctx1.sendIdx["-"]=1;
  58482. $self._assert_equals_($2,(1));
  58483. $ctx1.sendIdx["assert:equals:"]=2;
  58484. $self._assert_equals_((-2).__minus((1)),(-3));
  58485. $ctx1.sendIdx["assert:equals:"]=3;
  58486. $self._assert_equals_((12).__slash((2)),(6));
  58487. $ctx1.sendIdx["assert:equals:"]=4;
  58488. $3=(3).__star((4));
  58489. $ctx1.sendIdx["*"]=1;
  58490. $self._assert_equals_($3,(12));
  58491. $ctx1.sendIdx["assert:equals:"]=5;
  58492. $self._assert_equals_((7).__slash_slash((2)),(3));
  58493. $ctx1.sendIdx["assert:equals:"]=6;
  58494. $self._assert_equals_((7).__backslash_backslash((2)),(1));
  58495. $ctx1.sendIdx["assert:equals:"]=7;
  58496. $5=(1).__plus((2));
  58497. $ctx1.sendIdx["+"]=2;
  58498. $4=$recv($5).__star((3));
  58499. $ctx1.sendIdx["*"]=2;
  58500. $self._assert_equals_($4,(9));
  58501. $ctx1.sendIdx["assert:equals:"]=8;
  58502. $self._assert_equals_((1).__plus((2).__star((3))),(7));
  58503. return self;
  58504. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.NumberTest)});
  58505. },
  58506. args: [],
  58507. 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",
  58508. referencedClasses: [],
  58509. messageSends: ["assert:equals:", "+", "-", "/", "*", "//", "\x5c\x5c"]
  58510. }),
  58511. $globals.NumberTest);
  58512. $core.addMethod(
  58513. $core.method({
  58514. selector: "testAsNumber",
  58515. protocol: "tests",
  58516. fn: function (){
  58517. var self=this,$self=this;
  58518. return $core.withContext(function($ctx1) {
  58519. $self._assert_equals_((3)._asNumber(),(3));
  58520. return self;
  58521. }, function($ctx1) {$ctx1.fill(self,"testAsNumber",{},$globals.NumberTest)});
  58522. },
  58523. args: [],
  58524. source: "testAsNumber\x0a\x09self assert: 3 asNumber equals: 3.",
  58525. referencedClasses: [],
  58526. messageSends: ["assert:equals:", "asNumber"]
  58527. }),
  58528. $globals.NumberTest);
  58529. $core.addMethod(
  58530. $core.method({
  58531. selector: "testBetweenAnd",
  58532. protocol: "tests",
  58533. fn: function (){
  58534. var self=this,$self=this;
  58535. return $core.withContext(function($ctx1) {
  58536. var $1,$3,$2,$5,$4;
  58537. $1=(4)._between_and_((3),(5));
  58538. $ctx1.sendIdx["between:and:"]=1;
  58539. $self._assert_($1);
  58540. $ctx1.sendIdx["assert:"]=1;
  58541. $3=(1)._between_and_((5),(6));
  58542. $ctx1.sendIdx["between:and:"]=2;
  58543. $2=$recv($3)._not();
  58544. $ctx1.sendIdx["not"]=1;
  58545. $self._assert_($2);
  58546. $ctx1.sendIdx["assert:"]=2;
  58547. $5=(90)._between_and_((67),(87));
  58548. $ctx1.sendIdx["between:and:"]=3;
  58549. $4=$recv($5)._not();
  58550. $self._assert_($4);
  58551. $ctx1.sendIdx["assert:"]=3;
  58552. $self._assert_((1)._between_and_((1),(1)));
  58553. return self;
  58554. }, function($ctx1) {$ctx1.fill(self,"testBetweenAnd",{},$globals.NumberTest)});
  58555. },
  58556. args: [],
  58557. 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).",
  58558. referencedClasses: [],
  58559. messageSends: ["assert:", "between:and:", "not"]
  58560. }),
  58561. $globals.NumberTest);
  58562. $core.addMethod(
  58563. $core.method({
  58564. selector: "testBitAnd",
  58565. protocol: "tests",
  58566. fn: function (){
  58567. var self=this,$self=this;
  58568. return $core.withContext(function($ctx1) {
  58569. var $1,$2;
  58570. $1=(15)._bitAnd_((2));
  58571. $ctx1.sendIdx["bitAnd:"]=1;
  58572. $self._assert_equals_($1,(2));
  58573. $ctx1.sendIdx["assert:equals:"]=1;
  58574. $2=(15)._bitAnd_((15));
  58575. $ctx1.sendIdx["bitAnd:"]=2;
  58576. $self._assert_equals_($2,(15));
  58577. $ctx1.sendIdx["assert:equals:"]=2;
  58578. $self._assert_equals_((-1)._bitAnd_((1021)),(1021));
  58579. return self;
  58580. }, function($ctx1) {$ctx1.fill(self,"testBitAnd",{},$globals.NumberTest)});
  58581. },
  58582. args: [],
  58583. 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",
  58584. referencedClasses: [],
  58585. messageSends: ["assert:equals:", "bitAnd:"]
  58586. }),
  58587. $globals.NumberTest);
  58588. $core.addMethod(
  58589. $core.method({
  58590. selector: "testBitNot",
  58591. protocol: "tests",
  58592. fn: function (){
  58593. var self=this,$self=this;
  58594. return $core.withContext(function($ctx1) {
  58595. var $1,$2;
  58596. $1=(2)._bitNot();
  58597. $ctx1.sendIdx["bitNot"]=1;
  58598. $self._assert_equals_($1,(-3));
  58599. $ctx1.sendIdx["assert:equals:"]=1;
  58600. $2=(-1)._bitNot();
  58601. $ctx1.sendIdx["bitNot"]=2;
  58602. $self._assert_equals_($2,(0));
  58603. $ctx1.sendIdx["assert:equals:"]=2;
  58604. $self._assert_equals_((-1022)._bitNot(),(1021));
  58605. return self;
  58606. }, function($ctx1) {$ctx1.fill(self,"testBitNot",{},$globals.NumberTest)});
  58607. },
  58608. args: [],
  58609. source: "testBitNot\x0a\x09self assert: 2 bitNot equals: -3.\x0a\x09self assert: -1 bitNot equals: 0.\x0a\x09self assert: -1022 bitNot equals: 1021",
  58610. referencedClasses: [],
  58611. messageSends: ["assert:equals:", "bitNot"]
  58612. }),
  58613. $globals.NumberTest);
  58614. $core.addMethod(
  58615. $core.method({
  58616. selector: "testBitOr",
  58617. protocol: "tests",
  58618. fn: function (){
  58619. var self=this,$self=this;
  58620. return $core.withContext(function($ctx1) {
  58621. var $1,$2;
  58622. $1=(2)._bitOr_((4));
  58623. $ctx1.sendIdx["bitOr:"]=1;
  58624. $self._assert_equals_($1,(6));
  58625. $ctx1.sendIdx["assert:equals:"]=1;
  58626. $2=(7)._bitOr_((2));
  58627. $ctx1.sendIdx["bitOr:"]=2;
  58628. $self._assert_equals_($2,(7));
  58629. $ctx1.sendIdx["assert:equals:"]=2;
  58630. $self._assert_equals_((-1)._bitOr_((1021)),(-1));
  58631. return self;
  58632. }, function($ctx1) {$ctx1.fill(self,"testBitOr",{},$globals.NumberTest)});
  58633. },
  58634. args: [],
  58635. 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",
  58636. referencedClasses: [],
  58637. messageSends: ["assert:equals:", "bitOr:"]
  58638. }),
  58639. $globals.NumberTest);
  58640. $core.addMethod(
  58641. $core.method({
  58642. selector: "testBitXor",
  58643. protocol: "tests",
  58644. fn: function (){
  58645. var self=this,$self=this;
  58646. return $core.withContext(function($ctx1) {
  58647. var $1,$2,$3;
  58648. $1=(2)._bitXor_((4));
  58649. $ctx1.sendIdx["bitXor:"]=1;
  58650. $self._assert_equals_($1,(6));
  58651. $ctx1.sendIdx["assert:equals:"]=1;
  58652. $2=(7)._bitXor_((2));
  58653. $ctx1.sendIdx["bitXor:"]=2;
  58654. $self._assert_equals_($2,(5));
  58655. $ctx1.sendIdx["assert:equals:"]=2;
  58656. $3=(-1)._bitXor_((1021));
  58657. $ctx1.sendIdx["bitXor:"]=3;
  58658. $self._assert_equals_($3,(-1022));
  58659. $ctx1.sendIdx["assert:equals:"]=3;
  58660. $self._assert_equals_((91)._bitXor_((91)),(0));
  58661. return self;
  58662. }, function($ctx1) {$ctx1.fill(self,"testBitXor",{},$globals.NumberTest)});
  58663. },
  58664. args: [],
  58665. 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",
  58666. referencedClasses: [],
  58667. messageSends: ["assert:equals:", "bitXor:"]
  58668. }),
  58669. $globals.NumberTest);
  58670. $core.addMethod(
  58671. $core.method({
  58672. selector: "testCeiling",
  58673. protocol: "tests",
  58674. fn: function (){
  58675. var self=this,$self=this;
  58676. return $core.withContext(function($ctx1) {
  58677. var $1,$2;
  58678. $1=(1.2)._ceiling();
  58679. $ctx1.sendIdx["ceiling"]=1;
  58680. $self._assert_equals_($1,(2));
  58681. $ctx1.sendIdx["assert:equals:"]=1;
  58682. $2=(-1.2)._ceiling();
  58683. $ctx1.sendIdx["ceiling"]=2;
  58684. $self._assert_equals_($2,(-1));
  58685. $ctx1.sendIdx["assert:equals:"]=2;
  58686. $self._assert_equals_((1)._ceiling(),(1));
  58687. return self;
  58688. }, function($ctx1) {$ctx1.fill(self,"testCeiling",{},$globals.NumberTest)});
  58689. },
  58690. args: [],
  58691. 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.",
  58692. referencedClasses: [],
  58693. messageSends: ["assert:equals:", "ceiling"]
  58694. }),
  58695. $globals.NumberTest);
  58696. $core.addMethod(
  58697. $core.method({
  58698. selector: "testComparison",
  58699. protocol: "tests",
  58700. fn: function (){
  58701. var self=this,$self=this;
  58702. return $core.withContext(function($ctx1) {
  58703. var $1,$2,$3,$4;
  58704. $1=(3).__gt((2));
  58705. $ctx1.sendIdx[">"]=1;
  58706. $self._assert_($1);
  58707. $ctx1.sendIdx["assert:"]=1;
  58708. $2=(2).__lt((3));
  58709. $ctx1.sendIdx["<"]=1;
  58710. $self._assert_($2);
  58711. $ctx1.sendIdx["assert:"]=2;
  58712. $self._deny_((3).__lt((2)));
  58713. $ctx1.sendIdx["deny:"]=1;
  58714. $self._deny_((2).__gt((3)));
  58715. $3=(3).__gt_eq((3));
  58716. $ctx1.sendIdx[">="]=1;
  58717. $self._assert_($3);
  58718. $ctx1.sendIdx["assert:"]=3;
  58719. $self._assert_((3.1).__gt_eq((3)));
  58720. $ctx1.sendIdx["assert:"]=4;
  58721. $4=(3).__lt_eq((3));
  58722. $ctx1.sendIdx["<="]=1;
  58723. $self._assert_($4);
  58724. $ctx1.sendIdx["assert:"]=5;
  58725. $self._assert_((3).__lt_eq((3.1)));
  58726. return self;
  58727. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.NumberTest)});
  58728. },
  58729. args: [],
  58730. 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",
  58731. referencedClasses: [],
  58732. messageSends: ["assert:", ">", "<", "deny:", ">=", "<="]
  58733. }),
  58734. $globals.NumberTest);
  58735. $core.addMethod(
  58736. $core.method({
  58737. selector: "testCopying",
  58738. protocol: "tests",
  58739. fn: function (){
  58740. var self=this,$self=this;
  58741. return $core.withContext(function($ctx1) {
  58742. var $1;
  58743. $1=$recv((1)._copy()).__eq_eq((1));
  58744. $ctx1.sendIdx["=="]=1;
  58745. $self._assert_($1);
  58746. $ctx1.sendIdx["assert:"]=1;
  58747. $self._assert_($recv((1)._deepCopy()).__eq_eq((1)));
  58748. return self;
  58749. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.NumberTest)});
  58750. },
  58751. args: [],
  58752. source: "testCopying\x0a\x09self assert: 1 copy == 1.\x0a\x09self assert: 1 deepCopy == 1",
  58753. referencedClasses: [],
  58754. messageSends: ["assert:", "==", "copy", "deepCopy"]
  58755. }),
  58756. $globals.NumberTest);
  58757. $core.addMethod(
  58758. $core.method({
  58759. selector: "testDegreesToRadians",
  58760. protocol: "tests",
  58761. fn: function (){
  58762. var self=this,$self=this;
  58763. return $core.withContext(function($ctx1) {
  58764. $self._assert_($recv($recv($recv((180)._degreesToRadians()).__minus($recv($globals.Number)._pi()))._abs()).__lt_eq((0.01)));
  58765. return self;
  58766. }, function($ctx1) {$ctx1.fill(self,"testDegreesToRadians",{},$globals.NumberTest)});
  58767. },
  58768. args: [],
  58769. source: "testDegreesToRadians\x0a\x09self assert: (180 degreesToRadians - Number pi) abs <= 0.01.",
  58770. referencedClasses: ["Number"],
  58771. messageSends: ["assert:", "<=", "abs", "-", "degreesToRadians", "pi"]
  58772. }),
  58773. $globals.NumberTest);
  58774. $core.addMethod(
  58775. $core.method({
  58776. selector: "testEquality",
  58777. protocol: "tests",
  58778. fn: function (){
  58779. var self=this,$self=this;
  58780. return $core.withContext(function($ctx1) {
  58781. var $1,$2,$3,$5,$4,$7,$6,$9,$8,$10,$11,$12;
  58782. $1=(1).__eq((1));
  58783. $ctx1.sendIdx["="]=1;
  58784. $self._assert_($1);
  58785. $ctx1.sendIdx["assert:"]=1;
  58786. $2=(0).__eq((0));
  58787. $ctx1.sendIdx["="]=2;
  58788. $self._assert_($2);
  58789. $ctx1.sendIdx["assert:"]=2;
  58790. $3=(1).__eq((0));
  58791. $ctx1.sendIdx["="]=3;
  58792. $self._deny_($3);
  58793. $ctx1.sendIdx["deny:"]=1;
  58794. $5=(1)._yourself();
  58795. $ctx1.sendIdx["yourself"]=1;
  58796. $4=$recv($5).__eq((1));
  58797. $ctx1.sendIdx["="]=4;
  58798. $self._assert_($4);
  58799. $ctx1.sendIdx["assert:"]=3;
  58800. $7=(1)._yourself();
  58801. $ctx1.sendIdx["yourself"]=2;
  58802. $6=(1).__eq($7);
  58803. $ctx1.sendIdx["="]=5;
  58804. $self._assert_($6);
  58805. $ctx1.sendIdx["assert:"]=4;
  58806. $9=(1)._yourself();
  58807. $ctx1.sendIdx["yourself"]=3;
  58808. $8=$recv($9).__eq((1)._yourself());
  58809. $ctx1.sendIdx["="]=6;
  58810. $self._assert_($8);
  58811. $10=(0).__eq(false);
  58812. $ctx1.sendIdx["="]=7;
  58813. $self._deny_($10);
  58814. $ctx1.sendIdx["deny:"]=2;
  58815. $11=false.__eq((0));
  58816. $ctx1.sendIdx["="]=8;
  58817. $self._deny_($11);
  58818. $ctx1.sendIdx["deny:"]=3;
  58819. $12="".__eq((0));
  58820. $ctx1.sendIdx["="]=9;
  58821. $self._deny_($12);
  58822. $ctx1.sendIdx["deny:"]=4;
  58823. $self._deny_((0).__eq(""));
  58824. return self;
  58825. }, function($ctx1) {$ctx1.fill(self,"testEquality",{},$globals.NumberTest)});
  58826. },
  58827. args: [],
  58828. 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 = ''",
  58829. referencedClasses: [],
  58830. messageSends: ["assert:", "=", "deny:", "yourself"]
  58831. }),
  58832. $globals.NumberTest);
  58833. $core.addMethod(
  58834. $core.method({
  58835. selector: "testFloor",
  58836. protocol: "tests",
  58837. fn: function (){
  58838. var self=this,$self=this;
  58839. return $core.withContext(function($ctx1) {
  58840. var $1,$2;
  58841. $1=(1.2)._floor();
  58842. $ctx1.sendIdx["floor"]=1;
  58843. $self._assert_equals_($1,(1));
  58844. $ctx1.sendIdx["assert:equals:"]=1;
  58845. $2=(-1.2)._floor();
  58846. $ctx1.sendIdx["floor"]=2;
  58847. $self._assert_equals_($2,(-2));
  58848. $ctx1.sendIdx["assert:equals:"]=2;
  58849. $self._assert_equals_((1)._floor(),(1));
  58850. return self;
  58851. }, function($ctx1) {$ctx1.fill(self,"testFloor",{},$globals.NumberTest)});
  58852. },
  58853. args: [],
  58854. 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.",
  58855. referencedClasses: [],
  58856. messageSends: ["assert:equals:", "floor"]
  58857. }),
  58858. $globals.NumberTest);
  58859. $core.addMethod(
  58860. $core.method({
  58861. selector: "testHexNumbers",
  58862. protocol: "tests",
  58863. fn: function (){
  58864. var self=this,$self=this;
  58865. return $core.withContext(function($ctx1) {
  58866. var $1,$2,$3,$4,$5;
  58867. $self._assert_equals_((9),(9));
  58868. $ctx1.sendIdx["assert:equals:"]=1;
  58869. $1=(10)._truncated();
  58870. $ctx1.sendIdx["truncated"]=1;
  58871. $self._assert_equals_($1,(10));
  58872. $ctx1.sendIdx["assert:equals:"]=2;
  58873. $2=(11)._truncated();
  58874. $ctx1.sendIdx["truncated"]=2;
  58875. $self._assert_equals_($2,(11));
  58876. $ctx1.sendIdx["assert:equals:"]=3;
  58877. $3=(12)._truncated();
  58878. $ctx1.sendIdx["truncated"]=3;
  58879. $self._assert_equals_($3,(12));
  58880. $ctx1.sendIdx["assert:equals:"]=4;
  58881. $4=(13)._truncated();
  58882. $ctx1.sendIdx["truncated"]=4;
  58883. $self._assert_equals_($4,(13));
  58884. $ctx1.sendIdx["assert:equals:"]=5;
  58885. $5=(14)._truncated();
  58886. $ctx1.sendIdx["truncated"]=5;
  58887. $self._assert_equals_($5,(14));
  58888. $ctx1.sendIdx["assert:equals:"]=6;
  58889. $self._assert_equals_((15)._truncated(),(15));
  58890. return self;
  58891. }, function($ctx1) {$ctx1.fill(self,"testHexNumbers",{},$globals.NumberTest)});
  58892. },
  58893. args: [],
  58894. 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",
  58895. referencedClasses: [],
  58896. messageSends: ["assert:equals:", "truncated"]
  58897. }),
  58898. $globals.NumberTest);
  58899. $core.addMethod(
  58900. $core.method({
  58901. selector: "testIdentity",
  58902. protocol: "tests",
  58903. fn: function (){
  58904. var self=this,$self=this;
  58905. return $core.withContext(function($ctx1) {
  58906. var $1,$2,$3,$5,$4,$7,$6,$9,$8;
  58907. $1=(1).__eq_eq((1));
  58908. $ctx1.sendIdx["=="]=1;
  58909. $self._assert_($1);
  58910. $ctx1.sendIdx["assert:"]=1;
  58911. $2=(0).__eq_eq((0));
  58912. $ctx1.sendIdx["=="]=2;
  58913. $self._assert_($2);
  58914. $ctx1.sendIdx["assert:"]=2;
  58915. $3=(1).__eq_eq((0));
  58916. $ctx1.sendIdx["=="]=3;
  58917. $self._deny_($3);
  58918. $ctx1.sendIdx["deny:"]=1;
  58919. $5=(1)._yourself();
  58920. $ctx1.sendIdx["yourself"]=1;
  58921. $4=$recv($5).__eq_eq((1));
  58922. $ctx1.sendIdx["=="]=4;
  58923. $self._assert_($4);
  58924. $ctx1.sendIdx["assert:"]=3;
  58925. $7=(1)._yourself();
  58926. $ctx1.sendIdx["yourself"]=2;
  58927. $6=(1).__eq_eq($7);
  58928. $ctx1.sendIdx["=="]=5;
  58929. $self._assert_($6);
  58930. $ctx1.sendIdx["assert:"]=4;
  58931. $9=(1)._yourself();
  58932. $ctx1.sendIdx["yourself"]=3;
  58933. $8=$recv($9).__eq_eq((1)._yourself());
  58934. $ctx1.sendIdx["=="]=6;
  58935. $self._assert_($8);
  58936. $self._deny_((1).__eq_eq((2)));
  58937. return self;
  58938. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{},$globals.NumberTest)});
  58939. },
  58940. args: [],
  58941. 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",
  58942. referencedClasses: [],
  58943. messageSends: ["assert:", "==", "deny:", "yourself"]
  58944. }),
  58945. $globals.NumberTest);
  58946. $core.addMethod(
  58947. $core.method({
  58948. selector: "testInvalidHexNumbers",
  58949. protocol: "tests",
  58950. fn: function (){
  58951. var self=this,$self=this;
  58952. return $core.withContext(function($ctx1) {
  58953. $self._should_raise_((function(){
  58954. return $core.withContext(function($ctx2) {
  58955. return (16)._rG();
  58956. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  58957. }),$globals.MessageNotUnderstood);
  58958. $ctx1.sendIdx["should:raise:"]=1;
  58959. $self._should_raise_((function(){
  58960. return $core.withContext(function($ctx2) {
  58961. return (16)._rg();
  58962. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  58963. }),$globals.MessageNotUnderstood);
  58964. $ctx1.sendIdx["should:raise:"]=2;
  58965. $self._should_raise_((function(){
  58966. return $core.withContext(function($ctx2) {
  58967. return (16)._rH();
  58968. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  58969. }),$globals.MessageNotUnderstood);
  58970. $ctx1.sendIdx["should:raise:"]=3;
  58971. $self._should_raise_((function(){
  58972. return $core.withContext(function($ctx2) {
  58973. return (16)._rh();
  58974. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  58975. }),$globals.MessageNotUnderstood);
  58976. $ctx1.sendIdx["should:raise:"]=4;
  58977. $self._should_raise_((function(){
  58978. return $core.withContext(function($ctx2) {
  58979. return (16)._rI();
  58980. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  58981. }),$globals.MessageNotUnderstood);
  58982. $ctx1.sendIdx["should:raise:"]=5;
  58983. $self._should_raise_((function(){
  58984. return $core.withContext(function($ctx2) {
  58985. return (16)._ri();
  58986. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,6)});
  58987. }),$globals.MessageNotUnderstood);
  58988. $ctx1.sendIdx["should:raise:"]=6;
  58989. $self._should_raise_((function(){
  58990. return $core.withContext(function($ctx2) {
  58991. return (16)._rJ();
  58992. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)});
  58993. }),$globals.MessageNotUnderstood);
  58994. $ctx1.sendIdx["should:raise:"]=7;
  58995. $self._should_raise_((function(){
  58996. return $core.withContext(function($ctx2) {
  58997. return (16)._rj();
  58998. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,8)});
  58999. }),$globals.MessageNotUnderstood);
  59000. $ctx1.sendIdx["should:raise:"]=8;
  59001. $self._should_raise_((function(){
  59002. return $core.withContext(function($ctx2) {
  59003. return (16)._rK();
  59004. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,9)});
  59005. }),$globals.MessageNotUnderstood);
  59006. $ctx1.sendIdx["should:raise:"]=9;
  59007. $self._should_raise_((function(){
  59008. return $core.withContext(function($ctx2) {
  59009. return (16)._rk();
  59010. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,10)});
  59011. }),$globals.MessageNotUnderstood);
  59012. $ctx1.sendIdx["should:raise:"]=10;
  59013. $self._should_raise_((function(){
  59014. return $core.withContext(function($ctx2) {
  59015. return (16)._rL();
  59016. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,11)});
  59017. }),$globals.MessageNotUnderstood);
  59018. $ctx1.sendIdx["should:raise:"]=11;
  59019. $self._should_raise_((function(){
  59020. return $core.withContext(function($ctx2) {
  59021. return (16)._rl();
  59022. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,12)});
  59023. }),$globals.MessageNotUnderstood);
  59024. $ctx1.sendIdx["should:raise:"]=12;
  59025. $self._should_raise_((function(){
  59026. return $core.withContext(function($ctx2) {
  59027. return (16)._rM();
  59028. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,13)});
  59029. }),$globals.MessageNotUnderstood);
  59030. $ctx1.sendIdx["should:raise:"]=13;
  59031. $self._should_raise_((function(){
  59032. return $core.withContext(function($ctx2) {
  59033. return (16)._rm();
  59034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,14)});
  59035. }),$globals.MessageNotUnderstood);
  59036. $ctx1.sendIdx["should:raise:"]=14;
  59037. $self._should_raise_((function(){
  59038. return $core.withContext(function($ctx2) {
  59039. return (16)._rN();
  59040. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,15)});
  59041. }),$globals.MessageNotUnderstood);
  59042. $ctx1.sendIdx["should:raise:"]=15;
  59043. $self._should_raise_((function(){
  59044. return $core.withContext(function($ctx2) {
  59045. return (16)._rn();
  59046. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,16)});
  59047. }),$globals.MessageNotUnderstood);
  59048. $ctx1.sendIdx["should:raise:"]=16;
  59049. $self._should_raise_((function(){
  59050. return $core.withContext(function($ctx2) {
  59051. return (16)._rO();
  59052. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,17)});
  59053. }),$globals.MessageNotUnderstood);
  59054. $ctx1.sendIdx["should:raise:"]=17;
  59055. $self._should_raise_((function(){
  59056. return $core.withContext(function($ctx2) {
  59057. return (16)._ro();
  59058. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,18)});
  59059. }),$globals.MessageNotUnderstood);
  59060. $ctx1.sendIdx["should:raise:"]=18;
  59061. $self._should_raise_((function(){
  59062. return $core.withContext(function($ctx2) {
  59063. return (16)._rP();
  59064. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,19)});
  59065. }),$globals.MessageNotUnderstood);
  59066. $ctx1.sendIdx["should:raise:"]=19;
  59067. $self._should_raise_((function(){
  59068. return $core.withContext(function($ctx2) {
  59069. return (16)._rp();
  59070. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,20)});
  59071. }),$globals.MessageNotUnderstood);
  59072. $ctx1.sendIdx["should:raise:"]=20;
  59073. $self._should_raise_((function(){
  59074. return $core.withContext(function($ctx2) {
  59075. return (16)._rQ();
  59076. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,21)});
  59077. }),$globals.MessageNotUnderstood);
  59078. $ctx1.sendIdx["should:raise:"]=21;
  59079. $self._should_raise_((function(){
  59080. return $core.withContext(function($ctx2) {
  59081. return (16)._rq();
  59082. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,22)});
  59083. }),$globals.MessageNotUnderstood);
  59084. $ctx1.sendIdx["should:raise:"]=22;
  59085. $self._should_raise_((function(){
  59086. return $core.withContext(function($ctx2) {
  59087. return (16)._rR();
  59088. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,23)});
  59089. }),$globals.MessageNotUnderstood);
  59090. $ctx1.sendIdx["should:raise:"]=23;
  59091. $self._should_raise_((function(){
  59092. return $core.withContext(function($ctx2) {
  59093. return (16)._rr();
  59094. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,24)});
  59095. }),$globals.MessageNotUnderstood);
  59096. $ctx1.sendIdx["should:raise:"]=24;
  59097. $self._should_raise_((function(){
  59098. return $core.withContext(function($ctx2) {
  59099. return (16)._rS();
  59100. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,25)});
  59101. }),$globals.MessageNotUnderstood);
  59102. $ctx1.sendIdx["should:raise:"]=25;
  59103. $self._should_raise_((function(){
  59104. return $core.withContext(function($ctx2) {
  59105. return (16)._rs();
  59106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,26)});
  59107. }),$globals.MessageNotUnderstood);
  59108. $ctx1.sendIdx["should:raise:"]=26;
  59109. $self._should_raise_((function(){
  59110. return $core.withContext(function($ctx2) {
  59111. return (16)._rT();
  59112. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,27)});
  59113. }),$globals.MessageNotUnderstood);
  59114. $ctx1.sendIdx["should:raise:"]=27;
  59115. $self._should_raise_((function(){
  59116. return $core.withContext(function($ctx2) {
  59117. return (16)._rt();
  59118. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,28)});
  59119. }),$globals.MessageNotUnderstood);
  59120. $ctx1.sendIdx["should:raise:"]=28;
  59121. $self._should_raise_((function(){
  59122. return $core.withContext(function($ctx2) {
  59123. return (16)._rU();
  59124. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,29)});
  59125. }),$globals.MessageNotUnderstood);
  59126. $ctx1.sendIdx["should:raise:"]=29;
  59127. $self._should_raise_((function(){
  59128. return $core.withContext(function($ctx2) {
  59129. return (16)._ru();
  59130. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,30)});
  59131. }),$globals.MessageNotUnderstood);
  59132. $ctx1.sendIdx["should:raise:"]=30;
  59133. $self._should_raise_((function(){
  59134. return $core.withContext(function($ctx2) {
  59135. return (16)._rV();
  59136. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,31)});
  59137. }),$globals.MessageNotUnderstood);
  59138. $ctx1.sendIdx["should:raise:"]=31;
  59139. $self._should_raise_((function(){
  59140. return $core.withContext(function($ctx2) {
  59141. return (16)._rv();
  59142. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,32)});
  59143. }),$globals.MessageNotUnderstood);
  59144. $ctx1.sendIdx["should:raise:"]=32;
  59145. $self._should_raise_((function(){
  59146. return $core.withContext(function($ctx2) {
  59147. return (16)._rW();
  59148. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,33)});
  59149. }),$globals.MessageNotUnderstood);
  59150. $ctx1.sendIdx["should:raise:"]=33;
  59151. $self._should_raise_((function(){
  59152. return $core.withContext(function($ctx2) {
  59153. return (16)._rw();
  59154. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,34)});
  59155. }),$globals.MessageNotUnderstood);
  59156. $ctx1.sendIdx["should:raise:"]=34;
  59157. $self._should_raise_((function(){
  59158. return $core.withContext(function($ctx2) {
  59159. return (16)._rX();
  59160. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,35)});
  59161. }),$globals.MessageNotUnderstood);
  59162. $ctx1.sendIdx["should:raise:"]=35;
  59163. $self._should_raise_((function(){
  59164. return $core.withContext(function($ctx2) {
  59165. return (16)._rx();
  59166. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,36)});
  59167. }),$globals.MessageNotUnderstood);
  59168. $ctx1.sendIdx["should:raise:"]=36;
  59169. $self._should_raise_((function(){
  59170. return $core.withContext(function($ctx2) {
  59171. return (16)._rY();
  59172. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,37)});
  59173. }),$globals.MessageNotUnderstood);
  59174. $ctx1.sendIdx["should:raise:"]=37;
  59175. $self._should_raise_((function(){
  59176. return $core.withContext(function($ctx2) {
  59177. return (16)._ry();
  59178. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,38)});
  59179. }),$globals.MessageNotUnderstood);
  59180. $ctx1.sendIdx["should:raise:"]=38;
  59181. $self._should_raise_((function(){
  59182. return $core.withContext(function($ctx2) {
  59183. return (16)._rZ();
  59184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,39)});
  59185. }),$globals.MessageNotUnderstood);
  59186. $ctx1.sendIdx["should:raise:"]=39;
  59187. $self._should_raise_((function(){
  59188. return $core.withContext(function($ctx2) {
  59189. return (16)._rz();
  59190. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,40)});
  59191. }),$globals.MessageNotUnderstood);
  59192. $ctx1.sendIdx["should:raise:"]=40;
  59193. $self._should_raise_((function(){
  59194. return $core.withContext(function($ctx2) {
  59195. return (11259375)._Z();
  59196. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,41)});
  59197. }),$globals.MessageNotUnderstood);
  59198. return self;
  59199. }, function($ctx1) {$ctx1.fill(self,"testInvalidHexNumbers",{},$globals.NumberTest)});
  59200. },
  59201. args: [],
  59202. 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.",
  59203. referencedClasses: ["MessageNotUnderstood"],
  59204. 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"]
  59205. }),
  59206. $globals.NumberTest);
  59207. $core.addMethod(
  59208. $core.method({
  59209. selector: "testLog",
  59210. protocol: "tests",
  59211. fn: function (){
  59212. var self=this,$self=this;
  59213. return $core.withContext(function($ctx1) {
  59214. $self._assert_equals_((10000)._log(),(4));
  59215. $ctx1.sendIdx["assert:equals:"]=1;
  59216. $self._assert_equals_((512)._log_((2)),(9));
  59217. $ctx1.sendIdx["assert:equals:"]=2;
  59218. $self._assert_equals_($recv($recv($globals.Number)._e())._ln(),(1));
  59219. return self;
  59220. }, function($ctx1) {$ctx1.fill(self,"testLog",{},$globals.NumberTest)});
  59221. },
  59222. args: [],
  59223. 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.",
  59224. referencedClasses: ["Number"],
  59225. messageSends: ["assert:equals:", "log", "log:", "ln", "e"]
  59226. }),
  59227. $globals.NumberTest);
  59228. $core.addMethod(
  59229. $core.method({
  59230. selector: "testMinMax",
  59231. protocol: "tests",
  59232. fn: function (){
  59233. var self=this,$self=this;
  59234. return $core.withContext(function($ctx1) {
  59235. var $1,$2;
  59236. $self._assert_equals_((2)._max_((5)),(5));
  59237. $ctx1.sendIdx["assert:equals:"]=1;
  59238. $self._assert_equals_((2)._min_((5)),(2));
  59239. $ctx1.sendIdx["assert:equals:"]=2;
  59240. $1=(2)._min_max_((5),(3));
  59241. $ctx1.sendIdx["min:max:"]=1;
  59242. $self._assert_equals_($1,(3));
  59243. $ctx1.sendIdx["assert:equals:"]=3;
  59244. $2=(7)._min_max_((5),(3));
  59245. $ctx1.sendIdx["min:max:"]=2;
  59246. $self._assert_equals_($2,(5));
  59247. $ctx1.sendIdx["assert:equals:"]=4;
  59248. $self._assert_equals_((4)._min_max_((5),(3)),(4));
  59249. return self;
  59250. }, function($ctx1) {$ctx1.fill(self,"testMinMax",{},$globals.NumberTest)});
  59251. },
  59252. args: [],
  59253. 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.",
  59254. referencedClasses: [],
  59255. messageSends: ["assert:equals:", "max:", "min:", "min:max:"]
  59256. }),
  59257. $globals.NumberTest);
  59258. $core.addMethod(
  59259. $core.method({
  59260. selector: "testNegated",
  59261. protocol: "tests",
  59262. fn: function (){
  59263. var self=this,$self=this;
  59264. return $core.withContext(function($ctx1) {
  59265. var $1;
  59266. $1=(3)._negated();
  59267. $ctx1.sendIdx["negated"]=1;
  59268. $self._assert_equals_($1,(-3));
  59269. $ctx1.sendIdx["assert:equals:"]=1;
  59270. $self._assert_equals_((-3)._negated(),(3));
  59271. return self;
  59272. }, function($ctx1) {$ctx1.fill(self,"testNegated",{},$globals.NumberTest)});
  59273. },
  59274. args: [],
  59275. source: "testNegated\x0a\x09self assert: 3 negated equals: -3.\x0a\x09self assert: -3 negated equals: 3",
  59276. referencedClasses: [],
  59277. messageSends: ["assert:equals:", "negated"]
  59278. }),
  59279. $globals.NumberTest);
  59280. $core.addMethod(
  59281. $core.method({
  59282. selector: "testPrintShowingDecimalPlaces",
  59283. protocol: "tests",
  59284. fn: function (){
  59285. var self=this,$self=this;
  59286. return $core.withContext(function($ctx1) {
  59287. var $1,$2,$4,$3,$5,$6,$8,$7,$10,$9,$11,$12,$13,$14,$15;
  59288. $1=(23)._printShowingDecimalPlaces_((2));
  59289. $ctx1.sendIdx["printShowingDecimalPlaces:"]=1;
  59290. $self._assert_equals_($1,"23.00");
  59291. $ctx1.sendIdx["assert:equals:"]=1;
  59292. $2=(23.5698)._printShowingDecimalPlaces_((2));
  59293. $ctx1.sendIdx["printShowingDecimalPlaces:"]=2;
  59294. $self._assert_equals_($2,"23.57");
  59295. $ctx1.sendIdx["assert:equals:"]=2;
  59296. $4=(234.567)._negated();
  59297. $ctx1.sendIdx["negated"]=1;
  59298. $3=$recv($4)._printShowingDecimalPlaces_((5));
  59299. $ctx1.sendIdx["printShowingDecimalPlaces:"]=3;
  59300. $self._assert_equals_($3,"-234.56700");
  59301. $ctx1.sendIdx["assert:equals:"]=3;
  59302. $5=(23.4567)._printShowingDecimalPlaces_((0));
  59303. $ctx1.sendIdx["printShowingDecimalPlaces:"]=4;
  59304. $self._assert_equals_($5,"23");
  59305. $ctx1.sendIdx["assert:equals:"]=4;
  59306. $6=(23.5567)._printShowingDecimalPlaces_((0));
  59307. $ctx1.sendIdx["printShowingDecimalPlaces:"]=5;
  59308. $self._assert_equals_($6,"24");
  59309. $ctx1.sendIdx["assert:equals:"]=5;
  59310. $8=(23.4567)._negated();
  59311. $ctx1.sendIdx["negated"]=2;
  59312. $7=$recv($8)._printShowingDecimalPlaces_((0));
  59313. $ctx1.sendIdx["printShowingDecimalPlaces:"]=6;
  59314. $self._assert_equals_($7,"-23");
  59315. $ctx1.sendIdx["assert:equals:"]=6;
  59316. $10=(23.5567)._negated();
  59317. $ctx1.sendIdx["negated"]=3;
  59318. $9=$recv($10)._printShowingDecimalPlaces_((0));
  59319. $ctx1.sendIdx["printShowingDecimalPlaces:"]=7;
  59320. $self._assert_equals_($9,"-24");
  59321. $ctx1.sendIdx["assert:equals:"]=7;
  59322. $11=(100000000)._printShowingDecimalPlaces_((1));
  59323. $ctx1.sendIdx["printShowingDecimalPlaces:"]=8;
  59324. $self._assert_equals_($11,"100000000.0");
  59325. $ctx1.sendIdx["assert:equals:"]=8;
  59326. $12=(0.98)._printShowingDecimalPlaces_((5));
  59327. $ctx1.sendIdx["printShowingDecimalPlaces:"]=9;
  59328. $self._assert_equals_($12,"0.98000");
  59329. $ctx1.sendIdx["assert:equals:"]=9;
  59330. $13=$recv((0.98)._negated())._printShowingDecimalPlaces_((2));
  59331. $ctx1.sendIdx["printShowingDecimalPlaces:"]=10;
  59332. $self._assert_equals_($13,"-0.98");
  59333. $ctx1.sendIdx["assert:equals:"]=10;
  59334. $14=(2.567)._printShowingDecimalPlaces_((2));
  59335. $ctx1.sendIdx["printShowingDecimalPlaces:"]=11;
  59336. $self._assert_equals_($14,"2.57");
  59337. $ctx1.sendIdx["assert:equals:"]=11;
  59338. $15=(-2.567)._printShowingDecimalPlaces_((2));
  59339. $ctx1.sendIdx["printShowingDecimalPlaces:"]=12;
  59340. $self._assert_equals_($15,"-2.57");
  59341. $ctx1.sendIdx["assert:equals:"]=12;
  59342. $self._assert_equals_((0)._printShowingDecimalPlaces_((2)),"0.00");
  59343. return self;
  59344. }, function($ctx1) {$ctx1.fill(self,"testPrintShowingDecimalPlaces",{},$globals.NumberTest)});
  59345. },
  59346. args: [],
  59347. 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'.",
  59348. referencedClasses: [],
  59349. messageSends: ["assert:equals:", "printShowingDecimalPlaces:", "negated"]
  59350. }),
  59351. $globals.NumberTest);
  59352. $core.addMethod(
  59353. $core.method({
  59354. selector: "testPrintStringBase",
  59355. protocol: "tests",
  59356. fn: function (){
  59357. var self=this,$self=this;
  59358. return $core.withContext(function($ctx1) {
  59359. var $1,$2,$3;
  59360. $1=(15)._printStringBase_((2));
  59361. $ctx1.sendIdx["printStringBase:"]=1;
  59362. $self._assert_equals_($1,"1111");
  59363. $ctx1.sendIdx["assert:equals:"]=1;
  59364. $2=(15)._printStringBase_((16));
  59365. $ctx1.sendIdx["printStringBase:"]=2;
  59366. $self._assert_equals_($2,"f");
  59367. $ctx1.sendIdx["assert:equals:"]=2;
  59368. $3=(256)._printStringBase_((16));
  59369. $ctx1.sendIdx["printStringBase:"]=3;
  59370. $self._assert_equals_($3,"100");
  59371. $ctx1.sendIdx["assert:equals:"]=3;
  59372. $self._assert_equals_((256)._printStringBase_((2)),"100000000");
  59373. return self;
  59374. }, function($ctx1) {$ctx1.fill(self,"testPrintStringBase",{},$globals.NumberTest)});
  59375. },
  59376. args: [],
  59377. 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'",
  59378. referencedClasses: [],
  59379. messageSends: ["assert:equals:", "printStringBase:"]
  59380. }),
  59381. $globals.NumberTest);
  59382. $core.addMethod(
  59383. $core.method({
  59384. selector: "testRadiansToDegrees",
  59385. protocol: "tests",
  59386. fn: function (){
  59387. var self=this,$self=this;
  59388. return $core.withContext(function($ctx1) {
  59389. $self._assert_($recv($recv($recv($recv($recv($globals.Number)._pi())._radiansToDegrees()).__minus((180)))._abs()).__lt_eq((0.01)));
  59390. return self;
  59391. }, function($ctx1) {$ctx1.fill(self,"testRadiansToDegrees",{},$globals.NumberTest)});
  59392. },
  59393. args: [],
  59394. source: "testRadiansToDegrees\x0a\x09self assert: (Number pi radiansToDegrees - 180) abs <= 0.01.",
  59395. referencedClasses: ["Number"],
  59396. messageSends: ["assert:", "<=", "abs", "-", "radiansToDegrees", "pi"]
  59397. }),
  59398. $globals.NumberTest);
  59399. $core.addMethod(
  59400. $core.method({
  59401. selector: "testRaisedTo",
  59402. protocol: "tests",
  59403. fn: function (){
  59404. var self=this,$self=this;
  59405. return $core.withContext(function($ctx1) {
  59406. var $1,$2,$3;
  59407. $1=(2)._raisedTo_((4));
  59408. $ctx1.sendIdx["raisedTo:"]=1;
  59409. $self._assert_equals_($1,(16));
  59410. $ctx1.sendIdx["assert:equals:"]=1;
  59411. $2=(2)._raisedTo_((0));
  59412. $ctx1.sendIdx["raisedTo:"]=2;
  59413. $self._assert_equals_($2,(1));
  59414. $ctx1.sendIdx["assert:equals:"]=2;
  59415. $3=(2)._raisedTo_((-3));
  59416. $ctx1.sendIdx["raisedTo:"]=3;
  59417. $self._assert_equals_($3,(0.125));
  59418. $ctx1.sendIdx["assert:equals:"]=3;
  59419. $self._assert_equals_((4)._raisedTo_((0.5)),(2));
  59420. $ctx1.sendIdx["assert:equals:"]=4;
  59421. $self._assert_equals_((2).__star_star((4)),(16));
  59422. return self;
  59423. }, function($ctx1) {$ctx1.fill(self,"testRaisedTo",{},$globals.NumberTest)});
  59424. },
  59425. args: [],
  59426. 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.",
  59427. referencedClasses: [],
  59428. messageSends: ["assert:equals:", "raisedTo:", "**"]
  59429. }),
  59430. $globals.NumberTest);
  59431. $core.addMethod(
  59432. $core.method({
  59433. selector: "testRounded",
  59434. protocol: "tests",
  59435. fn: function (){
  59436. var self=this,$self=this;
  59437. return $core.withContext(function($ctx1) {
  59438. var $1,$2;
  59439. $1=(3)._rounded();
  59440. $ctx1.sendIdx["rounded"]=1;
  59441. $self._assert_equals_($1,(3));
  59442. $ctx1.sendIdx["assert:equals:"]=1;
  59443. $2=(3.212)._rounded();
  59444. $ctx1.sendIdx["rounded"]=2;
  59445. $self._assert_equals_($2,(3));
  59446. $ctx1.sendIdx["assert:equals:"]=2;
  59447. $self._assert_equals_((3.51)._rounded(),(4));
  59448. return self;
  59449. }, function($ctx1) {$ctx1.fill(self,"testRounded",{},$globals.NumberTest)});
  59450. },
  59451. args: [],
  59452. 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",
  59453. referencedClasses: [],
  59454. messageSends: ["assert:equals:", "rounded"]
  59455. }),
  59456. $globals.NumberTest);
  59457. $core.addMethod(
  59458. $core.method({
  59459. selector: "testSign",
  59460. protocol: "tests",
  59461. fn: function (){
  59462. var self=this,$self=this;
  59463. return $core.withContext(function($ctx1) {
  59464. var $1,$2;
  59465. $1=(5)._sign();
  59466. $ctx1.sendIdx["sign"]=1;
  59467. $self._assert_equals_($1,(1));
  59468. $ctx1.sendIdx["assert:equals:"]=1;
  59469. $2=(0)._sign();
  59470. $ctx1.sendIdx["sign"]=2;
  59471. $self._assert_equals_($2,(0));
  59472. $ctx1.sendIdx["assert:equals:"]=2;
  59473. $self._assert_equals_((-1.4)._sign(),(-1));
  59474. return self;
  59475. }, function($ctx1) {$ctx1.fill(self,"testSign",{},$globals.NumberTest)});
  59476. },
  59477. args: [],
  59478. source: "testSign\x0a\x09self assert: 5 sign equals: 1.\x0a\x09self assert: 0 sign equals: 0.\x0a\x09self assert: -1.4 sign equals: -1.",
  59479. referencedClasses: [],
  59480. messageSends: ["assert:equals:", "sign"]
  59481. }),
  59482. $globals.NumberTest);
  59483. $core.addMethod(
  59484. $core.method({
  59485. selector: "testSqrt",
  59486. protocol: "tests",
  59487. fn: function (){
  59488. var self=this,$self=this;
  59489. return $core.withContext(function($ctx1) {
  59490. var $1;
  59491. $1=(4)._sqrt();
  59492. $ctx1.sendIdx["sqrt"]=1;
  59493. $self._assert_equals_($1,(2));
  59494. $ctx1.sendIdx["assert:equals:"]=1;
  59495. $self._assert_equals_((16)._sqrt(),(4));
  59496. return self;
  59497. }, function($ctx1) {$ctx1.fill(self,"testSqrt",{},$globals.NumberTest)});
  59498. },
  59499. args: [],
  59500. source: "testSqrt\x0a\x09\x0a\x09self assert: 4 sqrt equals: 2.\x0a\x09self assert: 16 sqrt equals: 4",
  59501. referencedClasses: [],
  59502. messageSends: ["assert:equals:", "sqrt"]
  59503. }),
  59504. $globals.NumberTest);
  59505. $core.addMethod(
  59506. $core.method({
  59507. selector: "testSquared",
  59508. protocol: "tests",
  59509. fn: function (){
  59510. var self=this,$self=this;
  59511. return $core.withContext(function($ctx1) {
  59512. $self._assert_equals_((4)._squared(),(16));
  59513. return self;
  59514. }, function($ctx1) {$ctx1.fill(self,"testSquared",{},$globals.NumberTest)});
  59515. },
  59516. args: [],
  59517. source: "testSquared\x0a\x09\x0a\x09self assert: 4 squared equals: 16",
  59518. referencedClasses: [],
  59519. messageSends: ["assert:equals:", "squared"]
  59520. }),
  59521. $globals.NumberTest);
  59522. $core.addMethod(
  59523. $core.method({
  59524. selector: "testTimesRepeat",
  59525. protocol: "tests",
  59526. fn: function (){
  59527. var self=this,$self=this;
  59528. var i;
  59529. return $core.withContext(function($ctx1) {
  59530. i=(0);
  59531. (0)._timesRepeat_((function(){
  59532. return $core.withContext(function($ctx2) {
  59533. i=$recv(i).__plus((1));
  59534. $ctx2.sendIdx["+"]=1;
  59535. return i;
  59536. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59537. }));
  59538. $ctx1.sendIdx["timesRepeat:"]=1;
  59539. $self._assert_equals_(i,(0));
  59540. $ctx1.sendIdx["assert:equals:"]=1;
  59541. (5)._timesRepeat_((function(){
  59542. return $core.withContext(function($ctx2) {
  59543. i=$recv(i).__plus((1));
  59544. return i;
  59545. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  59546. }));
  59547. $self._assert_equals_(i,(5));
  59548. return self;
  59549. }, function($ctx1) {$ctx1.fill(self,"testTimesRepeat",{i:i},$globals.NumberTest)});
  59550. },
  59551. args: [],
  59552. 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",
  59553. referencedClasses: [],
  59554. messageSends: ["timesRepeat:", "+", "assert:equals:"]
  59555. }),
  59556. $globals.NumberTest);
  59557. $core.addMethod(
  59558. $core.method({
  59559. selector: "testTo",
  59560. protocol: "tests",
  59561. fn: function (){
  59562. var self=this,$self=this;
  59563. return $core.withContext(function($ctx1) {
  59564. $self._assert_equals_((1)._to_((5)),[(1), (2), (3), (4), (5)]);
  59565. return self;
  59566. }, function($ctx1) {$ctx1.fill(self,"testTo",{},$globals.NumberTest)});
  59567. },
  59568. args: [],
  59569. source: "testTo\x0a\x09self assert: (1 to: 5) equals: #(1 2 3 4 5)",
  59570. referencedClasses: [],
  59571. messageSends: ["assert:equals:", "to:"]
  59572. }),
  59573. $globals.NumberTest);
  59574. $core.addMethod(
  59575. $core.method({
  59576. selector: "testToBy",
  59577. protocol: "tests",
  59578. fn: function (){
  59579. var self=this,$self=this;
  59580. return $core.withContext(function($ctx1) {
  59581. var $1;
  59582. $1=(0)._to_by_((6),(2));
  59583. $ctx1.sendIdx["to:by:"]=1;
  59584. $self._assert_equals_($1,[(0), (2), (4), (6)]);
  59585. $self._should_raise_((function(){
  59586. return $core.withContext(function($ctx2) {
  59587. return (1)._to_by_((4),(0));
  59588. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59589. }),$globals.Error);
  59590. return self;
  59591. }, function($ctx1) {$ctx1.fill(self,"testToBy",{},$globals.NumberTest)});
  59592. },
  59593. args: [],
  59594. 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",
  59595. referencedClasses: ["Error"],
  59596. messageSends: ["assert:equals:", "to:by:", "should:raise:"]
  59597. }),
  59598. $globals.NumberTest);
  59599. $core.addMethod(
  59600. $core.method({
  59601. selector: "testTrigonometry",
  59602. protocol: "tests",
  59603. fn: function (){
  59604. var self=this,$self=this;
  59605. return $core.withContext(function($ctx1) {
  59606. var $1;
  59607. $self._assert_equals_((0)._cos(),(1));
  59608. $ctx1.sendIdx["assert:equals:"]=1;
  59609. $self._assert_equals_((0)._sin(),(0));
  59610. $ctx1.sendIdx["assert:equals:"]=2;
  59611. $self._assert_equals_((0)._tan(),(0));
  59612. $ctx1.sendIdx["assert:equals:"]=3;
  59613. $self._assert_equals_((1)._arcCos(),(0));
  59614. $ctx1.sendIdx["assert:equals:"]=4;
  59615. $self._assert_equals_((0)._arcSin(),(0));
  59616. $ctx1.sendIdx["assert:equals:"]=5;
  59617. $self._assert_equals_((0)._arcTan(),(0));
  59618. $ctx1.sendIdx["assert:equals:"]=6;
  59619. $1=(0)._arcTan_((1));
  59620. $ctx1.sendIdx["arcTan:"]=1;
  59621. $self._assert_equals_($1,(0));
  59622. $ctx1.sendIdx["assert:equals:"]=7;
  59623. $self._assert_equals_((1)._arcTan_((0)),$recv($recv($globals.Number)._pi()).__slash((2)));
  59624. return self;
  59625. }, function($ctx1) {$ctx1.fill(self,"testTrigonometry",{},$globals.NumberTest)});
  59626. },
  59627. args: [],
  59628. 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)",
  59629. referencedClasses: ["Number"],
  59630. messageSends: ["assert:equals:", "cos", "sin", "tan", "arcCos", "arcSin", "arcTan", "arcTan:", "/", "pi"]
  59631. }),
  59632. $globals.NumberTest);
  59633. $core.addMethod(
  59634. $core.method({
  59635. selector: "testTruncated",
  59636. protocol: "tests",
  59637. fn: function (){
  59638. var self=this,$self=this;
  59639. return $core.withContext(function($ctx1) {
  59640. var $1,$2;
  59641. $1=(3)._truncated();
  59642. $ctx1.sendIdx["truncated"]=1;
  59643. $self._assert_equals_($1,(3));
  59644. $ctx1.sendIdx["assert:equals:"]=1;
  59645. $2=(3.212)._truncated();
  59646. $ctx1.sendIdx["truncated"]=2;
  59647. $self._assert_equals_($2,(3));
  59648. $ctx1.sendIdx["assert:equals:"]=2;
  59649. $self._assert_equals_((3.51)._truncated(),(3));
  59650. return self;
  59651. }, function($ctx1) {$ctx1.fill(self,"testTruncated",{},$globals.NumberTest)});
  59652. },
  59653. args: [],
  59654. 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",
  59655. referencedClasses: [],
  59656. messageSends: ["assert:equals:", "truncated"]
  59657. }),
  59658. $globals.NumberTest);
  59659. $core.addClass("ObjectMock", $globals.Object, ["foo", "bar"], "Kernel-Tests");
  59660. $globals.ObjectMock.comment="ObjectMock is there only to perform tests on classes.";
  59661. $core.addMethod(
  59662. $core.method({
  59663. selector: "foo",
  59664. protocol: "not yet classified",
  59665. fn: function (){
  59666. var self=this,$self=this;
  59667. return $self["@foo"];
  59668. },
  59669. args: [],
  59670. source: "foo\x0a\x09^ foo",
  59671. referencedClasses: [],
  59672. messageSends: []
  59673. }),
  59674. $globals.ObjectMock);
  59675. $core.addMethod(
  59676. $core.method({
  59677. selector: "foo:",
  59678. protocol: "not yet classified",
  59679. fn: function (anObject){
  59680. var self=this,$self=this;
  59681. $self["@foo"]=anObject;
  59682. return self;
  59683. },
  59684. args: ["anObject"],
  59685. source: "foo: anObject\x0a\x09foo := anObject",
  59686. referencedClasses: [],
  59687. messageSends: []
  59688. }),
  59689. $globals.ObjectMock);
  59690. $core.addClass("ObjectTest", $globals.TestCase, [], "Kernel-Tests");
  59691. $core.addMethod(
  59692. $core.method({
  59693. selector: "notDefined",
  59694. protocol: "tests",
  59695. fn: function (){
  59696. var self=this,$self=this;
  59697. return $core.withContext(function($ctx1) {
  59698. return void 0;;
  59699. return self;
  59700. }, function($ctx1) {$ctx1.fill(self,"notDefined",{},$globals.ObjectTest)});
  59701. },
  59702. args: [],
  59703. source: "notDefined\x0a\x09<inlineJS: 'return void 0;'>",
  59704. referencedClasses: [],
  59705. messageSends: []
  59706. }),
  59707. $globals.ObjectTest);
  59708. $core.addMethod(
  59709. $core.method({
  59710. selector: "testBasicAccess",
  59711. protocol: "tests",
  59712. fn: function (){
  59713. var self=this,$self=this;
  59714. var o;
  59715. return $core.withContext(function($ctx1) {
  59716. var $1;
  59717. o=$recv($globals.Object)._new();
  59718. $recv(o)._basicAt_put_("a",(1));
  59719. $1=$recv(o)._basicAt_("a");
  59720. $ctx1.sendIdx["basicAt:"]=1;
  59721. $self._assert_equals_($1,(1));
  59722. $ctx1.sendIdx["assert:equals:"]=1;
  59723. $self._assert_equals_($recv(o)._basicAt_("b"),nil);
  59724. return self;
  59725. }, function($ctx1) {$ctx1.fill(self,"testBasicAccess",{o:o},$globals.ObjectTest)});
  59726. },
  59727. args: [],
  59728. 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",
  59729. referencedClasses: ["Object"],
  59730. messageSends: ["new", "basicAt:put:", "assert:equals:", "basicAt:"]
  59731. }),
  59732. $globals.ObjectTest);
  59733. $core.addMethod(
  59734. $core.method({
  59735. selector: "testBasicPerform",
  59736. protocol: "tests",
  59737. fn: function (){
  59738. var self=this,$self=this;
  59739. var o;
  59740. return $core.withContext(function($ctx1) {
  59741. o=$recv($globals.Object)._new();
  59742. $recv(o)._basicAt_put_("func",(function(){
  59743. return "hello";
  59744. }));
  59745. $ctx1.sendIdx["basicAt:put:"]=1;
  59746. $recv(o)._basicAt_put_("func2",(function(a){
  59747. return $core.withContext(function($ctx2) {
  59748. return $recv(a).__plus((1));
  59749. }, function($ctx2) {$ctx2.fillBlock({a:a},$ctx1,2)});
  59750. }));
  59751. $self._assert_equals_($recv(o)._basicPerform_("func"),"hello");
  59752. $ctx1.sendIdx["assert:equals:"]=1;
  59753. $self._assert_equals_($recv(o)._basicPerform_withArguments_("func2",[(3)]),(4));
  59754. return self;
  59755. }, function($ctx1) {$ctx1.fill(self,"testBasicPerform",{o:o},$globals.ObjectTest)});
  59756. },
  59757. args: [],
  59758. 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",
  59759. referencedClasses: ["Object"],
  59760. messageSends: ["new", "basicAt:put:", "+", "assert:equals:", "basicPerform:", "basicPerform:withArguments:"]
  59761. }),
  59762. $globals.ObjectTest);
  59763. $core.addMethod(
  59764. $core.method({
  59765. selector: "testDNU",
  59766. protocol: "tests",
  59767. fn: function (){
  59768. var self=this,$self=this;
  59769. return $core.withContext(function($ctx1) {
  59770. $self._should_raise_((function(){
  59771. return $core.withContext(function($ctx2) {
  59772. return $recv($recv($globals.Object)._new())._foo();
  59773. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59774. }),$globals.MessageNotUnderstood);
  59775. return self;
  59776. }, function($ctx1) {$ctx1.fill(self,"testDNU",{},$globals.ObjectTest)});
  59777. },
  59778. args: [],
  59779. source: "testDNU\x0a\x09self should: [ Object new foo ] raise: MessageNotUnderstood",
  59780. referencedClasses: ["Object", "MessageNotUnderstood"],
  59781. messageSends: ["should:raise:", "foo", "new"]
  59782. }),
  59783. $globals.ObjectTest);
  59784. $core.addMethod(
  59785. $core.method({
  59786. selector: "testEquality",
  59787. protocol: "tests",
  59788. fn: function (){
  59789. var self=this,$self=this;
  59790. var o;
  59791. return $core.withContext(function($ctx1) {
  59792. var $1,$2,$4,$3;
  59793. o=$recv($globals.Object)._new();
  59794. $ctx1.sendIdx["new"]=1;
  59795. $1=$recv(o).__eq($recv($globals.Object)._new());
  59796. $ctx1.sendIdx["="]=1;
  59797. $self._deny_($1);
  59798. $2=$recv(o).__eq(o);
  59799. $ctx1.sendIdx["="]=2;
  59800. $self._assert_($2);
  59801. $ctx1.sendIdx["assert:"]=1;
  59802. $4=$recv(o)._yourself();
  59803. $ctx1.sendIdx["yourself"]=1;
  59804. $3=$recv($4).__eq(o);
  59805. $ctx1.sendIdx["="]=3;
  59806. $self._assert_($3);
  59807. $ctx1.sendIdx["assert:"]=2;
  59808. $self._assert_($recv(o).__eq($recv(o)._yourself()));
  59809. return self;
  59810. }, function($ctx1) {$ctx1.fill(self,"testEquality",{o:o},$globals.ObjectTest)});
  59811. },
  59812. args: [],
  59813. 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)",
  59814. referencedClasses: ["Object"],
  59815. messageSends: ["new", "deny:", "=", "assert:", "yourself"]
  59816. }),
  59817. $globals.ObjectTest);
  59818. $core.addMethod(
  59819. $core.method({
  59820. selector: "testHalt",
  59821. protocol: "tests",
  59822. fn: function (){
  59823. var self=this,$self=this;
  59824. return $core.withContext(function($ctx1) {
  59825. $self._should_raise_((function(){
  59826. return $core.withContext(function($ctx2) {
  59827. return $recv($recv($globals.Object)._new())._halt();
  59828. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  59829. }),$globals.Error);
  59830. return self;
  59831. }, function($ctx1) {$ctx1.fill(self,"testHalt",{},$globals.ObjectTest)});
  59832. },
  59833. args: [],
  59834. source: "testHalt\x0a\x09self should: [ Object new halt ] raise: Error",
  59835. referencedClasses: ["Object", "Error"],
  59836. messageSends: ["should:raise:", "halt", "new"]
  59837. }),
  59838. $globals.ObjectTest);
  59839. $core.addMethod(
  59840. $core.method({
  59841. selector: "testIdentity",
  59842. protocol: "tests",
  59843. fn: function (){
  59844. var self=this,$self=this;
  59845. var o;
  59846. return $core.withContext(function($ctx1) {
  59847. var $1,$2,$4,$3;
  59848. o=$recv($globals.Object)._new();
  59849. $ctx1.sendIdx["new"]=1;
  59850. $1=$recv(o).__eq_eq($recv($globals.Object)._new());
  59851. $ctx1.sendIdx["=="]=1;
  59852. $self._deny_($1);
  59853. $2=$recv(o).__eq_eq(o);
  59854. $ctx1.sendIdx["=="]=2;
  59855. $self._assert_($2);
  59856. $ctx1.sendIdx["assert:"]=1;
  59857. $4=$recv(o)._yourself();
  59858. $ctx1.sendIdx["yourself"]=1;
  59859. $3=$recv($4).__eq_eq(o);
  59860. $ctx1.sendIdx["=="]=3;
  59861. $self._assert_($3);
  59862. $ctx1.sendIdx["assert:"]=2;
  59863. $self._assert_($recv(o).__eq_eq($recv(o)._yourself()));
  59864. return self;
  59865. }, function($ctx1) {$ctx1.fill(self,"testIdentity",{o:o},$globals.ObjectTest)});
  59866. },
  59867. args: [],
  59868. 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",
  59869. referencedClasses: ["Object"],
  59870. messageSends: ["new", "deny:", "==", "assert:", "yourself"]
  59871. }),
  59872. $globals.ObjectTest);
  59873. $core.addMethod(
  59874. $core.method({
  59875. selector: "testIfNil",
  59876. protocol: "tests",
  59877. fn: function (){
  59878. var self=this,$self=this;
  59879. return $core.withContext(function($ctx1) {
  59880. var $2,$1,$5,$4,$3,$7,$6,$9,$8,$11,$10,$receiver;
  59881. $2=$recv($globals.Object)._new();
  59882. $ctx1.sendIdx["new"]=1;
  59883. $1=$recv($2)._isNil();
  59884. $self._deny_($1);
  59885. $ctx1.sendIdx["deny:"]=1;
  59886. $5=$recv($globals.Object)._new();
  59887. $ctx1.sendIdx["new"]=2;
  59888. if(($receiver = $5) == null || $receiver.a$nil){
  59889. $4=true;
  59890. } else {
  59891. $4=$5;
  59892. }
  59893. $3=$recv($4).__eq(true);
  59894. $self._deny_($3);
  59895. $7=$recv($globals.Object)._new();
  59896. $ctx1.sendIdx["new"]=3;
  59897. if(($receiver = $7) == null || $receiver.a$nil){
  59898. $6=$7;
  59899. } else {
  59900. $6=true;
  59901. }
  59902. $self._assert_equals_($6,true);
  59903. $ctx1.sendIdx["assert:equals:"]=1;
  59904. $9=$recv($globals.Object)._new();
  59905. $ctx1.sendIdx["new"]=4;
  59906. if(($receiver = $9) == null || $receiver.a$nil){
  59907. $8=false;
  59908. } else {
  59909. $8=true;
  59910. }
  59911. $self._assert_equals_($8,true);
  59912. $ctx1.sendIdx["assert:equals:"]=2;
  59913. $11=$recv($globals.Object)._new();
  59914. if(($receiver = $11) == null || $receiver.a$nil){
  59915. $10=false;
  59916. } else {
  59917. $10=true;
  59918. }
  59919. $self._assert_equals_($10,true);
  59920. return self;
  59921. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.ObjectTest)});
  59922. },
  59923. args: [],
  59924. 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",
  59925. referencedClasses: ["Object"],
  59926. messageSends: ["deny:", "isNil", "new", "=", "ifNil:", "assert:equals:", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  59927. }),
  59928. $globals.ObjectTest);
  59929. $core.addMethod(
  59930. $core.method({
  59931. selector: "testInstVars",
  59932. protocol: "tests",
  59933. fn: function (){
  59934. var self=this,$self=this;
  59935. var o;
  59936. return $core.withContext(function($ctx1) {
  59937. var $1,$2;
  59938. o=$recv($globals.ObjectMock)._new();
  59939. $1=$recv(o)._instVarAt_("foo");
  59940. $ctx1.sendIdx["instVarAt:"]=1;
  59941. $self._assert_equals_($1,nil);
  59942. $ctx1.sendIdx["assert:equals:"]=1;
  59943. $recv(o)._instVarAt_put_("foo",(1));
  59944. $2=$recv(o)._instVarAt_("foo");
  59945. $ctx1.sendIdx["instVarAt:"]=2;
  59946. $self._assert_equals_($2,(1));
  59947. $ctx1.sendIdx["assert:equals:"]=2;
  59948. $self._assert_equals_($recv(o)._instVarAt_("foo"),(1));
  59949. return self;
  59950. }, function($ctx1) {$ctx1.fill(self,"testInstVars",{o:o},$globals.ObjectTest)});
  59951. },
  59952. args: [],
  59953. 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",
  59954. referencedClasses: ["ObjectMock"],
  59955. messageSends: ["new", "assert:equals:", "instVarAt:", "instVarAt:put:"]
  59956. }),
  59957. $globals.ObjectTest);
  59958. $core.addMethod(
  59959. $core.method({
  59960. selector: "testNilUndefined",
  59961. protocol: "tests",
  59962. fn: function (){
  59963. var self=this,$self=this;
  59964. return $core.withContext(function($ctx1) {
  59965. $self._assert_equals_($self._notDefined(),nil);
  59966. return self;
  59967. }, function($ctx1) {$ctx1.fill(self,"testNilUndefined",{},$globals.ObjectTest)});
  59968. },
  59969. args: [],
  59970. source: "testNilUndefined\x0a\x09\x22nil in Smalltalk is the undefined object in JS\x22\x0a\x0a\x09self assert: self notDefined equals: nil",
  59971. referencedClasses: [],
  59972. messageSends: ["assert:equals:", "notDefined"]
  59973. }),
  59974. $globals.ObjectTest);
  59975. $core.addMethod(
  59976. $core.method({
  59977. selector: "testYourself",
  59978. protocol: "tests",
  59979. fn: function (){
  59980. var self=this,$self=this;
  59981. var o;
  59982. return $core.withContext(function($ctx1) {
  59983. o=$recv($globals.ObjectMock)._new();
  59984. $self._assert_($recv($recv(o)._yourself()).__eq_eq(o));
  59985. return self;
  59986. }, function($ctx1) {$ctx1.fill(self,"testYourself",{o:o},$globals.ObjectTest)});
  59987. },
  59988. args: [],
  59989. source: "testYourself\x0a\x09| o |\x0a\x09o := ObjectMock new.\x0a\x09self assert: o yourself == o",
  59990. referencedClasses: ["ObjectMock"],
  59991. messageSends: ["new", "assert:", "==", "yourself"]
  59992. }),
  59993. $globals.ObjectTest);
  59994. $core.addClass("PointTest", $globals.TestCase, [], "Kernel-Tests");
  59995. $core.addMethod(
  59996. $core.method({
  59997. selector: "testAccessing",
  59998. protocol: "tests",
  59999. fn: function (){
  60000. var self=this,$self=this;
  60001. return $core.withContext(function($ctx1) {
  60002. var $2,$1,$3,$6,$5,$4;
  60003. $2=$recv($globals.Point)._x_y_((3),(4));
  60004. $ctx1.sendIdx["x:y:"]=1;
  60005. $1=$recv($2)._x();
  60006. $ctx1.sendIdx["x"]=1;
  60007. $self._assert_equals_($1,(3));
  60008. $ctx1.sendIdx["assert:equals:"]=1;
  60009. $3=$recv($recv($globals.Point)._x_y_((3),(4)))._y();
  60010. $ctx1.sendIdx["y"]=1;
  60011. $self._assert_equals_($3,(4));
  60012. $ctx1.sendIdx["assert:equals:"]=2;
  60013. $6=$recv($globals.Point)._new();
  60014. $ctx1.sendIdx["new"]=1;
  60015. $5=$recv($6)._x_((3));
  60016. $4=$recv($5)._x();
  60017. $self._assert_equals_($4,(3));
  60018. $ctx1.sendIdx["assert:equals:"]=3;
  60019. $self._assert_equals_($recv($recv($recv($globals.Point)._new())._y_((4)))._y(),(4));
  60020. return self;
  60021. }, function($ctx1) {$ctx1.fill(self,"testAccessing",{},$globals.PointTest)});
  60022. },
  60023. args: [],
  60024. 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",
  60025. referencedClasses: ["Point"],
  60026. messageSends: ["assert:equals:", "x", "x:y:", "y", "x:", "new", "y:"]
  60027. }),
  60028. $globals.PointTest);
  60029. $core.addMethod(
  60030. $core.method({
  60031. selector: "testAngle",
  60032. protocol: "tests",
  60033. fn: function (){
  60034. var self=this,$self=this;
  60035. return $core.withContext(function($ctx1) {
  60036. $self._assert_equals_($recv((-1).__at((0)))._angle(),$recv($globals.Number)._pi());
  60037. return self;
  60038. }, function($ctx1) {$ctx1.fill(self,"testAngle",{},$globals.PointTest)});
  60039. },
  60040. args: [],
  60041. source: "testAngle\x0a\x09self assert: (-1@0) angle equals: Number pi",
  60042. referencedClasses: ["Number"],
  60043. messageSends: ["assert:equals:", "angle", "@", "pi"]
  60044. }),
  60045. $globals.PointTest);
  60046. $core.addMethod(
  60047. $core.method({
  60048. selector: "testArithmetic",
  60049. protocol: "tests",
  60050. fn: function (){
  60051. var self=this,$self=this;
  60052. return $core.withContext(function($ctx1) {
  60053. var $2,$3,$1,$4,$6,$7,$5,$8,$10,$11,$9,$12,$14,$13;
  60054. $2=(3).__at((4));
  60055. $ctx1.sendIdx["@"]=1;
  60056. $3=(3).__at((4));
  60057. $ctx1.sendIdx["@"]=2;
  60058. $1=$recv($2).__star($3);
  60059. $4=$recv($globals.Point)._x_y_((9),(16));
  60060. $ctx1.sendIdx["x:y:"]=1;
  60061. $self._assert_equals_($1,$4);
  60062. $ctx1.sendIdx["assert:equals:"]=1;
  60063. $6=(3).__at((4));
  60064. $ctx1.sendIdx["@"]=3;
  60065. $7=(3).__at((4));
  60066. $ctx1.sendIdx["@"]=4;
  60067. $5=$recv($6).__plus($7);
  60068. $8=$recv($globals.Point)._x_y_((6),(8));
  60069. $ctx1.sendIdx["x:y:"]=2;
  60070. $self._assert_equals_($5,$8);
  60071. $ctx1.sendIdx["assert:equals:"]=2;
  60072. $10=(3).__at((4));
  60073. $ctx1.sendIdx["@"]=5;
  60074. $11=(3).__at((4));
  60075. $ctx1.sendIdx["@"]=6;
  60076. $9=$recv($10).__minus($11);
  60077. $12=$recv($globals.Point)._x_y_((0),(0));
  60078. $ctx1.sendIdx["x:y:"]=3;
  60079. $self._assert_equals_($9,$12);
  60080. $ctx1.sendIdx["assert:equals:"]=3;
  60081. $14=(6).__at((8));
  60082. $ctx1.sendIdx["@"]=7;
  60083. $13=$recv($14).__slash((3).__at((4)));
  60084. $self._assert_equals_($13,$recv($globals.Point)._x_y_((2),(2)));
  60085. return self;
  60086. }, function($ctx1) {$ctx1.fill(self,"testArithmetic",{},$globals.PointTest)});
  60087. },
  60088. args: [],
  60089. 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)",
  60090. referencedClasses: ["Point"],
  60091. messageSends: ["assert:equals:", "*", "@", "x:y:", "+", "-", "/"]
  60092. }),
  60093. $globals.PointTest);
  60094. $core.addMethod(
  60095. $core.method({
  60096. selector: "testAt",
  60097. protocol: "tests",
  60098. fn: function (){
  60099. var self=this,$self=this;
  60100. return $core.withContext(function($ctx1) {
  60101. $self._assert_equals_((3).__at((4)),$recv($globals.Point)._x_y_((3),(4)));
  60102. return self;
  60103. }, function($ctx1) {$ctx1.fill(self,"testAt",{},$globals.PointTest)});
  60104. },
  60105. args: [],
  60106. source: "testAt\x0a\x09self assert: 3@4 equals: (Point x: 3 y: 4)",
  60107. referencedClasses: ["Point"],
  60108. messageSends: ["assert:equals:", "@", "x:y:"]
  60109. }),
  60110. $globals.PointTest);
  60111. $core.addMethod(
  60112. $core.method({
  60113. selector: "testComparison",
  60114. protocol: "tests",
  60115. fn: function (){
  60116. var self=this,$self=this;
  60117. return $core.withContext(function($ctx1) {
  60118. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$18,$16,$20,$21,$19,$23,$22;
  60119. $2=(3).__at((4));
  60120. $ctx1.sendIdx["@"]=1;
  60121. $3=(4).__at((5));
  60122. $ctx1.sendIdx["@"]=2;
  60123. $1=$recv($2).__lt($3);
  60124. $ctx1.sendIdx["<"]=1;
  60125. $self._assert_($1);
  60126. $ctx1.sendIdx["assert:"]=1;
  60127. $5=(3).__at((4));
  60128. $ctx1.sendIdx["@"]=3;
  60129. $6=(4).__at((4));
  60130. $ctx1.sendIdx["@"]=4;
  60131. $4=$recv($5).__lt($6);
  60132. $self._deny_($4);
  60133. $ctx1.sendIdx["deny:"]=1;
  60134. $8=(4).__at((5));
  60135. $ctx1.sendIdx["@"]=5;
  60136. $9=(4).__at((5));
  60137. $ctx1.sendIdx["@"]=6;
  60138. $7=$recv($8).__lt_eq($9);
  60139. $ctx1.sendIdx["<="]=1;
  60140. $self._assert_($7);
  60141. $ctx1.sendIdx["assert:"]=2;
  60142. $11=(4).__at((5));
  60143. $ctx1.sendIdx["@"]=7;
  60144. $12=(3).__at((5));
  60145. $ctx1.sendIdx["@"]=8;
  60146. $10=$recv($11).__lt_eq($12);
  60147. $self._deny_($10);
  60148. $ctx1.sendIdx["deny:"]=2;
  60149. $14=(5).__at((6));
  60150. $ctx1.sendIdx["@"]=9;
  60151. $15=(4).__at((5));
  60152. $ctx1.sendIdx["@"]=10;
  60153. $13=$recv($14).__gt($15);
  60154. $ctx1.sendIdx[">"]=1;
  60155. $self._assert_($13);
  60156. $ctx1.sendIdx["assert:"]=3;
  60157. $17=(5).__at((6));
  60158. $ctx1.sendIdx["@"]=11;
  60159. $18=(6).__at((6));
  60160. $ctx1.sendIdx["@"]=12;
  60161. $16=$recv($17).__gt($18);
  60162. $self._deny_($16);
  60163. $ctx1.sendIdx["deny:"]=3;
  60164. $20=(4).__at((5));
  60165. $ctx1.sendIdx["@"]=13;
  60166. $21=(4).__at((5));
  60167. $ctx1.sendIdx["@"]=14;
  60168. $19=$recv($20).__gt_eq($21);
  60169. $ctx1.sendIdx[">="]=1;
  60170. $self._assert_($19);
  60171. $23=(4).__at((5));
  60172. $ctx1.sendIdx["@"]=15;
  60173. $22=$recv($23).__gt_eq((5).__at((5)));
  60174. $self._deny_($22);
  60175. return self;
  60176. }, function($ctx1) {$ctx1.fill(self,"testComparison",{},$globals.PointTest)});
  60177. },
  60178. args: [],
  60179. 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)",
  60180. referencedClasses: [],
  60181. messageSends: ["assert:", "<", "@", "deny:", "<=", ">", ">="]
  60182. }),
  60183. $globals.PointTest);
  60184. $core.addMethod(
  60185. $core.method({
  60186. selector: "testDotProduct",
  60187. protocol: "tests",
  60188. fn: function (){
  60189. var self=this,$self=this;
  60190. return $core.withContext(function($ctx1) {
  60191. var $2,$1;
  60192. $2=(2).__at((3));
  60193. $ctx1.sendIdx["@"]=1;
  60194. $1=$recv($2)._dotProduct_((3).__at((7)));
  60195. $self._assert_equals_($1,(27));
  60196. return self;
  60197. }, function($ctx1) {$ctx1.fill(self,"testDotProduct",{},$globals.PointTest)});
  60198. },
  60199. args: [],
  60200. source: "testDotProduct\x0a\x09self assert: (2@3 dotProduct: 3@7) equals: 27",
  60201. referencedClasses: [],
  60202. messageSends: ["assert:equals:", "dotProduct:", "@"]
  60203. }),
  60204. $globals.PointTest);
  60205. $core.addMethod(
  60206. $core.method({
  60207. selector: "testEgality",
  60208. protocol: "tests",
  60209. fn: function (){
  60210. var self=this,$self=this;
  60211. return $core.withContext(function($ctx1) {
  60212. var $2,$3,$1,$5,$4;
  60213. $2=(3).__at((4));
  60214. $ctx1.sendIdx["@"]=1;
  60215. $3=(3).__at((4));
  60216. $ctx1.sendIdx["@"]=2;
  60217. $1=$recv($2).__eq($3);
  60218. $ctx1.sendIdx["="]=1;
  60219. $self._assert_($1);
  60220. $5=(3).__at((5));
  60221. $ctx1.sendIdx["@"]=3;
  60222. $4=$recv($5).__eq((3).__at((6)));
  60223. $self._deny_($4);
  60224. return self;
  60225. }, function($ctx1) {$ctx1.fill(self,"testEgality",{},$globals.PointTest)});
  60226. },
  60227. args: [],
  60228. source: "testEgality\x0a\x09self assert: (3@4 = (3@4)).\x0a\x09self deny: 3@5 = (3@6)",
  60229. referencedClasses: [],
  60230. messageSends: ["assert:", "=", "@", "deny:"]
  60231. }),
  60232. $globals.PointTest);
  60233. $core.addMethod(
  60234. $core.method({
  60235. selector: "testNew",
  60236. protocol: "tests",
  60237. fn: function (){
  60238. var self=this,$self=this;
  60239. return $core.withContext(function($ctx1) {
  60240. var $3,$2,$1,$7,$6,$5,$4,$10,$9,$8;
  60241. $3=$recv($globals.Point)._new();
  60242. $ctx1.sendIdx["new"]=1;
  60243. $2=$recv($3)._x_((3));
  60244. $ctx1.sendIdx["x:"]=1;
  60245. $1=$recv($2)._y();
  60246. $ctx1.sendIdx["y"]=1;
  60247. $self._assert_equals_($1,nil);
  60248. $ctx1.sendIdx["assert:equals:"]=1;
  60249. $7=$recv($globals.Point)._new();
  60250. $ctx1.sendIdx["new"]=2;
  60251. $6=$recv($7)._x_((3));
  60252. $5=$recv($6)._x();
  60253. $ctx1.sendIdx["x"]=1;
  60254. $4=$recv($5).__eq((0));
  60255. $ctx1.sendIdx["="]=1;
  60256. $self._deny_($4);
  60257. $ctx1.sendIdx["deny:"]=1;
  60258. $10=$recv($globals.Point)._new();
  60259. $ctx1.sendIdx["new"]=3;
  60260. $9=$recv($10)._y_((4));
  60261. $ctx1.sendIdx["y:"]=1;
  60262. $8=$recv($9)._x();
  60263. $self._assert_equals_($8,nil);
  60264. $self._deny_($recv($recv($recv($recv($globals.Point)._new())._y_((4)))._y()).__eq((0)));
  60265. return self;
  60266. }, function($ctx1) {$ctx1.fill(self,"testNew",{},$globals.PointTest)});
  60267. },
  60268. args: [],
  60269. 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",
  60270. referencedClasses: ["Point"],
  60271. messageSends: ["assert:equals:", "y", "x:", "new", "deny:", "=", "x", "y:"]
  60272. }),
  60273. $globals.PointTest);
  60274. $core.addMethod(
  60275. $core.method({
  60276. selector: "testNormal",
  60277. protocol: "tests",
  60278. fn: function (){
  60279. var self=this,$self=this;
  60280. return $core.withContext(function($ctx1) {
  60281. var $2,$1;
  60282. $2=(1).__at((0));
  60283. $ctx1.sendIdx["@"]=1;
  60284. $1=$recv($2)._normal();
  60285. $self._assert_equals_($1,(0).__at((1)));
  60286. return self;
  60287. }, function($ctx1) {$ctx1.fill(self,"testNormal",{},$globals.PointTest)});
  60288. },
  60289. args: [],
  60290. source: "testNormal\x0a\x09self assert: (1@0) normal equals: 0@1",
  60291. referencedClasses: [],
  60292. messageSends: ["assert:equals:", "normal", "@"]
  60293. }),
  60294. $globals.PointTest);
  60295. $core.addMethod(
  60296. $core.method({
  60297. selector: "testNormalized",
  60298. protocol: "tests",
  60299. fn: function (){
  60300. var self=this,$self=this;
  60301. return $core.withContext(function($ctx1) {
  60302. var $2,$1,$3,$5,$4;
  60303. $2=(0).__at((2));
  60304. $ctx1.sendIdx["@"]=1;
  60305. $1=$recv($2)._normalized();
  60306. $ctx1.sendIdx["normalized"]=1;
  60307. $3=(0).__at((1));
  60308. $ctx1.sendIdx["@"]=2;
  60309. $self._assert_equals_($1,$3);
  60310. $ctx1.sendIdx["assert:equals:"]=1;
  60311. $5=(0).__at((0));
  60312. $ctx1.sendIdx["@"]=3;
  60313. $4=$recv($5)._normalized();
  60314. $self._assert_equals_($4,(0).__at((0)));
  60315. return self;
  60316. }, function($ctx1) {$ctx1.fill(self,"testNormalized",{},$globals.PointTest)});
  60317. },
  60318. args: [],
  60319. source: "testNormalized\x0a\x09self assert: (0@2) normalized equals: 0@1.\x0a\x09self assert: (0@0) normalized equals: 0@0.",
  60320. referencedClasses: [],
  60321. messageSends: ["assert:equals:", "normalized", "@"]
  60322. }),
  60323. $globals.PointTest);
  60324. $core.addMethod(
  60325. $core.method({
  60326. selector: "testPolarCoordinates",
  60327. protocol: "tests",
  60328. fn: function (){
  60329. var self=this,$self=this;
  60330. return $core.withContext(function($ctx1) {
  60331. var $2,$1;
  60332. $2=(1).__at((0));
  60333. $ctx1.sendIdx["@"]=1;
  60334. $1=$recv($2)._r();
  60335. $ctx1.sendIdx["r"]=1;
  60336. $self._assert_equals_($1,(1));
  60337. $ctx1.sendIdx["assert:equals:"]=1;
  60338. $self._assert_equals_($recv((0).__at((0)))._r(),(0));
  60339. return self;
  60340. }, function($ctx1) {$ctx1.fill(self,"testPolarCoordinates",{},$globals.PointTest)});
  60341. },
  60342. args: [],
  60343. source: "testPolarCoordinates\x0a\x09self assert: (1@0) r equals: 1.\x0a\x09self assert: (0@0) r equals: 0.",
  60344. referencedClasses: [],
  60345. messageSends: ["assert:equals:", "r", "@"]
  60346. }),
  60347. $globals.PointTest);
  60348. $core.addMethod(
  60349. $core.method({
  60350. selector: "testRectangleCreation",
  60351. protocol: "tests",
  60352. fn: function (){
  60353. var self=this,$self=this;
  60354. return $core.withContext(function($ctx1) {
  60355. var $2,$3,$1,$5,$6,$4,$8,$9,$7,$11,$12,$10,$14,$15,$13,$17,$16;
  60356. $2=(1).__at((1));
  60357. $ctx1.sendIdx["@"]=1;
  60358. $3=(2).__at((2));
  60359. $ctx1.sendIdx["@"]=2;
  60360. $1=$recv($2)._corner_($3);
  60361. $5=(1).__at((1));
  60362. $ctx1.sendIdx["@"]=3;
  60363. $6=(2).__at((2));
  60364. $ctx1.sendIdx["@"]=4;
  60365. $4=$recv($globals.Rectangle)._origin_corner_($5,$6);
  60366. $self._assert_equals_($1,$4);
  60367. $ctx1.sendIdx["assert:equals:"]=1;
  60368. $8=(1).__at((1));
  60369. $ctx1.sendIdx["@"]=5;
  60370. $9=(2).__at((2));
  60371. $ctx1.sendIdx["@"]=6;
  60372. $7=$recv($8)._rectangle_($9);
  60373. $11=(1).__at((1));
  60374. $ctx1.sendIdx["@"]=7;
  60375. $12=(2).__at((2));
  60376. $ctx1.sendIdx["@"]=8;
  60377. $10=$recv($globals.Rectangle)._point_point_($11,$12);
  60378. $self._assert_equals_($7,$10);
  60379. $ctx1.sendIdx["assert:equals:"]=2;
  60380. $14=(1).__at((1));
  60381. $ctx1.sendIdx["@"]=9;
  60382. $15=(2).__at((2));
  60383. $ctx1.sendIdx["@"]=10;
  60384. $13=$recv($14)._extent_($15);
  60385. $17=(1).__at((1));
  60386. $ctx1.sendIdx["@"]=11;
  60387. $16=$recv($globals.Rectangle)._origin_extent_($17,(2).__at((2)));
  60388. $self._assert_equals_($13,$16);
  60389. return self;
  60390. }, function($ctx1) {$ctx1.fill(self,"testRectangleCreation",{},$globals.PointTest)});
  60391. },
  60392. args: [],
  60393. 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)",
  60394. referencedClasses: ["Rectangle"],
  60395. messageSends: ["assert:equals:", "corner:", "@", "origin:corner:", "rectangle:", "point:point:", "extent:", "origin:extent:"]
  60396. }),
  60397. $globals.PointTest);
  60398. $core.addMethod(
  60399. $core.method({
  60400. selector: "testTranslateBy",
  60401. protocol: "tests",
  60402. fn: function (){
  60403. var self=this,$self=this;
  60404. return $core.withContext(function($ctx1) {
  60405. var $2,$3,$1,$4,$6,$8,$7,$5,$9,$11,$12,$10,$13,$15,$16,$14;
  60406. $2=(3).__at((3));
  60407. $ctx1.sendIdx["@"]=1;
  60408. $3=(0).__at((1));
  60409. $ctx1.sendIdx["@"]=2;
  60410. $1=$recv($2)._translateBy_($3);
  60411. $ctx1.sendIdx["translateBy:"]=1;
  60412. $4=(3).__at((4));
  60413. $ctx1.sendIdx["@"]=3;
  60414. $self._assert_equals_($1,$4);
  60415. $ctx1.sendIdx["assert:equals:"]=1;
  60416. $6=(3).__at((3));
  60417. $ctx1.sendIdx["@"]=4;
  60418. $8=(1)._negated();
  60419. $ctx1.sendIdx["negated"]=1;
  60420. $7=(0).__at($8);
  60421. $ctx1.sendIdx["@"]=5;
  60422. $5=$recv($6)._translateBy_($7);
  60423. $ctx1.sendIdx["translateBy:"]=2;
  60424. $9=(3).__at((2));
  60425. $ctx1.sendIdx["@"]=6;
  60426. $self._assert_equals_($5,$9);
  60427. $ctx1.sendIdx["assert:equals:"]=2;
  60428. $11=(3).__at((3));
  60429. $ctx1.sendIdx["@"]=7;
  60430. $12=(2).__at((3));
  60431. $ctx1.sendIdx["@"]=8;
  60432. $10=$recv($11)._translateBy_($12);
  60433. $ctx1.sendIdx["translateBy:"]=3;
  60434. $13=(5).__at((6));
  60435. $ctx1.sendIdx["@"]=9;
  60436. $self._assert_equals_($10,$13);
  60437. $ctx1.sendIdx["assert:equals:"]=3;
  60438. $15=(3).__at((3));
  60439. $ctx1.sendIdx["@"]=10;
  60440. $16=$recv((3)._negated()).__at((0));
  60441. $ctx1.sendIdx["@"]=11;
  60442. $14=$recv($15)._translateBy_($16);
  60443. $self._assert_equals_($14,(0).__at((3)));
  60444. return self;
  60445. }, function($ctx1) {$ctx1.fill(self,"testTranslateBy",{},$globals.PointTest)});
  60446. },
  60447. args: [],
  60448. 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.",
  60449. referencedClasses: [],
  60450. messageSends: ["assert:equals:", "translateBy:", "@", "negated"]
  60451. }),
  60452. $globals.PointTest);
  60453. $core.addClass("QueueTest", $globals.TestCase, [], "Kernel-Tests");
  60454. $core.addMethod(
  60455. $core.method({
  60456. selector: "testNextIfAbsent",
  60457. protocol: "tests",
  60458. fn: function (){
  60459. var self=this,$self=this;
  60460. var queue;
  60461. return $core.withContext(function($ctx1) {
  60462. var $2,$1;
  60463. queue=$recv($globals.Queue)._new();
  60464. $recv(queue)._nextPut_("index1");
  60465. $2=$recv(queue)._nextIfAbsent_("empty");
  60466. $ctx1.sendIdx["nextIfAbsent:"]=1;
  60467. $1=$recv($2).__eq("index1");
  60468. $ctx1.sendIdx["="]=1;
  60469. $self._assert_($1);
  60470. $self._deny_($recv($recv(queue)._nextIfAbsent_("empty")).__eq("index1"));
  60471. return self;
  60472. }, function($ctx1) {$ctx1.fill(self,"testNextIfAbsent",{queue:queue},$globals.QueueTest)});
  60473. },
  60474. args: [],
  60475. 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'",
  60476. referencedClasses: ["Queue"],
  60477. messageSends: ["new", "nextPut:", "assert:", "=", "nextIfAbsent:", "deny:"]
  60478. }),
  60479. $globals.QueueTest);
  60480. $core.addMethod(
  60481. $core.method({
  60482. selector: "testQueueNext",
  60483. protocol: "tests",
  60484. fn: function (){
  60485. var self=this,$self=this;
  60486. var queue;
  60487. return $core.withContext(function($ctx1) {
  60488. var $1,$3,$2,$5,$4;
  60489. queue=$recv($globals.Queue)._new();
  60490. $1=queue;
  60491. $recv($1)._nextPut_("index1");
  60492. $ctx1.sendIdx["nextPut:"]=1;
  60493. $recv($1)._nextPut_("index2");
  60494. $3=$recv(queue)._next();
  60495. $ctx1.sendIdx["next"]=1;
  60496. $2=$recv($3).__eq("index1");
  60497. $ctx1.sendIdx["="]=1;
  60498. $self._assert_($2);
  60499. $5=$recv(queue)._next();
  60500. $ctx1.sendIdx["next"]=2;
  60501. $4=$recv($5).__eq("index");
  60502. $self._deny_($4);
  60503. $self._should_raise_((function(){
  60504. return $core.withContext(function($ctx2) {
  60505. return $recv(queue)._next();
  60506. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60507. }),$globals.Error);
  60508. return self;
  60509. }, function($ctx1) {$ctx1.fill(self,"testQueueNext",{queue:queue},$globals.QueueTest)});
  60510. },
  60511. args: [],
  60512. 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",
  60513. referencedClasses: ["Queue", "Error"],
  60514. messageSends: ["new", "nextPut:", "assert:", "=", "next", "deny:", "should:raise:"]
  60515. }),
  60516. $globals.QueueTest);
  60517. $core.addClass("RandomTest", $globals.TestCase, [], "Kernel-Tests");
  60518. $core.addMethod(
  60519. $core.method({
  60520. selector: "testAtRandomNumber",
  60521. protocol: "tests",
  60522. fn: function (){
  60523. var self=this,$self=this;
  60524. var val;
  60525. return $core.withContext(function($ctx1) {
  60526. (100)._timesRepeat_((function(){
  60527. return $core.withContext(function($ctx2) {
  60528. val=(10)._atRandom();
  60529. $self._assert_($recv(val).__gt((0)));
  60530. $ctx2.sendIdx["assert:"]=1;
  60531. return $self._assert_($recv(val).__lt((11)));
  60532. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60533. }));
  60534. return self;
  60535. }, function($ctx1) {$ctx1.fill(self,"testAtRandomNumber",{val:val},$globals.RandomTest)});
  60536. },
  60537. args: [],
  60538. 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]",
  60539. referencedClasses: [],
  60540. messageSends: ["timesRepeat:", "atRandom", "assert:", ">", "<"]
  60541. }),
  60542. $globals.RandomTest);
  60543. $core.addMethod(
  60544. $core.method({
  60545. selector: "testAtRandomSequenceableCollection",
  60546. protocol: "tests",
  60547. fn: function (){
  60548. var self=this,$self=this;
  60549. var val;
  60550. return $core.withContext(function($ctx1) {
  60551. var $3,$4,$2,$1;
  60552. (100)._timesRepeat_((function(){
  60553. return $core.withContext(function($ctx2) {
  60554. val="abc"._atRandom();
  60555. $3=$recv(val).__eq("a");
  60556. $ctx2.sendIdx["="]=1;
  60557. $4=$recv(val).__eq("b");
  60558. $ctx2.sendIdx["="]=2;
  60559. $2=$recv($3).__or($4);
  60560. $1=$recv($2).__or($recv(val).__eq("c"));
  60561. $ctx2.sendIdx["|"]=1;
  60562. return $self._assert_($1);
  60563. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  60564. }));
  60565. return self;
  60566. }, function($ctx1) {$ctx1.fill(self,"testAtRandomSequenceableCollection",{val:val},$globals.RandomTest)});
  60567. },
  60568. args: [],
  60569. 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].",
  60570. referencedClasses: [],
  60571. messageSends: ["timesRepeat:", "atRandom", "assert:", "|", "="]
  60572. }),
  60573. $globals.RandomTest);
  60574. $core.addMethod(
  60575. $core.method({
  60576. selector: "textNext",
  60577. protocol: "tests",
  60578. fn: function (){
  60579. var self=this,$self=this;
  60580. return $core.withContext(function($ctx1) {
  60581. var $1;
  60582. (10000)._timesRepeat_((function(){
  60583. var current,next;
  60584. return $core.withContext(function($ctx2) {
  60585. next=$recv($recv($globals.Random)._new())._next();
  60586. $self._assert_($recv(next).__gt_eq((0)));
  60587. $ctx2.sendIdx["assert:"]=1;
  60588. $self._assert_($recv(next).__lt((1)));
  60589. $1=$recv(current).__eq(next);
  60590. $ctx2.sendIdx["="]=1;
  60591. $self._deny_($1);
  60592. return $recv(next).__eq(current);
  60593. }, function($ctx2) {$ctx2.fillBlock({current:current,next:next},$ctx1,1)});
  60594. }));
  60595. return self;
  60596. }, function($ctx1) {$ctx1.fill(self,"textNext",{},$globals.RandomTest)});
  60597. },
  60598. args: [],
  60599. 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 ]",
  60600. referencedClasses: ["Random"],
  60601. messageSends: ["timesRepeat:", "next", "new", "assert:", ">=", "<", "deny:", "="]
  60602. }),
  60603. $globals.RandomTest);
  60604. $core.addClass("RectangleTest", $globals.TestCase, [], "Kernel-Tests");
  60605. $core.addMethod(
  60606. $core.method({
  60607. selector: "testContainsPoint",
  60608. protocol: "tests",
  60609. fn: function (){
  60610. var self=this,$self=this;
  60611. var rect;
  60612. return $core.withContext(function($ctx1) {
  60613. var $1,$2,$4,$5,$3;
  60614. $1=(0).__at((0));
  60615. $ctx1.sendIdx["@"]=1;
  60616. $2=(4).__at((4));
  60617. $ctx1.sendIdx["@"]=2;
  60618. rect=$recv($globals.Rectangle)._origin_corner_($1,$2);
  60619. $4=rect;
  60620. $5=(1).__at((2));
  60621. $ctx1.sendIdx["@"]=3;
  60622. $3=$recv($4)._containsPoint_($5);
  60623. $ctx1.sendIdx["containsPoint:"]=1;
  60624. $self._assert_($3);
  60625. $ctx1.sendIdx["assert:"]=1;
  60626. $self._assert_($recv($recv(rect)._containsPoint_((5).__at((4))))._not());
  60627. return self;
  60628. }, function($ctx1) {$ctx1.fill(self,"testContainsPoint",{rect:rect},$globals.RectangleTest)});
  60629. },
  60630. args: [],
  60631. 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.",
  60632. referencedClasses: ["Rectangle"],
  60633. messageSends: ["origin:corner:", "@", "assert:", "containsPoint:", "not"]
  60634. }),
  60635. $globals.RectangleTest);
  60636. $core.addMethod(
  60637. $core.method({
  60638. selector: "testContainsRect",
  60639. protocol: "tests",
  60640. fn: function (){
  60641. var self=this,$self=this;
  60642. return $core.withContext(function($ctx1) {
  60643. var $3,$4,$2,$6,$7,$5,$1,$11,$12,$10,$14,$13,$9,$8;
  60644. $3=(0).__at((0));
  60645. $ctx1.sendIdx["@"]=1;
  60646. $4=(6).__at((6));
  60647. $ctx1.sendIdx["@"]=2;
  60648. $2=$recv($globals.Rectangle)._origin_corner_($3,$4);
  60649. $ctx1.sendIdx["origin:corner:"]=1;
  60650. $6=(1).__at((1));
  60651. $ctx1.sendIdx["@"]=3;
  60652. $7=(5).__at((5));
  60653. $ctx1.sendIdx["@"]=4;
  60654. $5=$recv($globals.Rectangle)._origin_corner_($6,$7);
  60655. $ctx1.sendIdx["origin:corner:"]=2;
  60656. $1=$recv($2)._containsRect_($5);
  60657. $ctx1.sendIdx["containsRect:"]=1;
  60658. $self._assert_($1);
  60659. $ctx1.sendIdx["assert:"]=1;
  60660. $11=(0).__at((0));
  60661. $ctx1.sendIdx["@"]=5;
  60662. $12=(6).__at((6));
  60663. $ctx1.sendIdx["@"]=6;
  60664. $10=$recv($globals.Rectangle)._origin_corner_($11,$12);
  60665. $ctx1.sendIdx["origin:corner:"]=3;
  60666. $14=(1).__at((-1));
  60667. $ctx1.sendIdx["@"]=7;
  60668. $13=$recv($globals.Rectangle)._origin_corner_($14,(5).__at((5)));
  60669. $9=$recv($10)._containsRect_($13);
  60670. $8=$recv($9)._not();
  60671. $self._assert_($8);
  60672. return self;
  60673. }, function($ctx1) {$ctx1.fill(self,"testContainsRect",{},$globals.RectangleTest)});
  60674. },
  60675. args: [],
  60676. 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.",
  60677. referencedClasses: ["Rectangle"],
  60678. messageSends: ["assert:", "containsRect:", "origin:corner:", "@", "not"]
  60679. }),
  60680. $globals.RectangleTest);
  60681. $core.addMethod(
  60682. $core.method({
  60683. selector: "testOriginExtent",
  60684. protocol: "tests",
  60685. fn: function (){
  60686. var self=this,$self=this;
  60687. var rectangle;
  60688. return $core.withContext(function($ctx1) {
  60689. var $1,$2,$3,$4;
  60690. $1=(3).__at((4));
  60691. $ctx1.sendIdx["@"]=1;
  60692. $2=(7).__at((8));
  60693. $ctx1.sendIdx["@"]=2;
  60694. rectangle=$recv($globals.Rectangle)._origin_extent_($1,$2);
  60695. $3=$recv(rectangle)._origin();
  60696. $4=(3).__at((4));
  60697. $ctx1.sendIdx["@"]=3;
  60698. $self._assert_equals_($3,$4);
  60699. $ctx1.sendIdx["assert:equals:"]=1;
  60700. $self._assert_equals_($recv(rectangle)._corner(),(10).__at((12)));
  60701. return self;
  60702. }, function($ctx1) {$ctx1.fill(self,"testOriginExtent",{rectangle:rectangle},$globals.RectangleTest)});
  60703. },
  60704. args: [],
  60705. 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.",
  60706. referencedClasses: ["Rectangle"],
  60707. messageSends: ["origin:extent:", "@", "assert:equals:", "origin", "corner"]
  60708. }),
  60709. $globals.RectangleTest);
  60710. $core.addClass("StreamTest", $globals.TestCase, [], "Kernel-Tests");
  60711. $core.addMethod(
  60712. $core.method({
  60713. selector: "collectionClass",
  60714. protocol: "accessing",
  60715. fn: function (){
  60716. var self=this,$self=this;
  60717. return $core.withContext(function($ctx1) {
  60718. return $recv($self._class())._collectionClass();
  60719. }, function($ctx1) {$ctx1.fill(self,"collectionClass",{},$globals.StreamTest)});
  60720. },
  60721. args: [],
  60722. source: "collectionClass\x0a\x09^ self class collectionClass",
  60723. referencedClasses: [],
  60724. messageSends: ["collectionClass", "class"]
  60725. }),
  60726. $globals.StreamTest);
  60727. $core.addMethod(
  60728. $core.method({
  60729. selector: "newCollection",
  60730. protocol: "accessing",
  60731. fn: function (){
  60732. var self=this,$self=this;
  60733. return $core.withContext(function($ctx1) {
  60734. return $recv($self._collectionClass())._new();
  60735. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.StreamTest)});
  60736. },
  60737. args: [],
  60738. source: "newCollection\x0a\x09^ self collectionClass new",
  60739. referencedClasses: [],
  60740. messageSends: ["new", "collectionClass"]
  60741. }),
  60742. $globals.StreamTest);
  60743. $core.addMethod(
  60744. $core.method({
  60745. selector: "newStream",
  60746. protocol: "accessing",
  60747. fn: function (){
  60748. var self=this,$self=this;
  60749. return $core.withContext(function($ctx1) {
  60750. return $recv($recv($self._collectionClass())._new())._stream();
  60751. }, function($ctx1) {$ctx1.fill(self,"newStream",{},$globals.StreamTest)});
  60752. },
  60753. args: [],
  60754. source: "newStream\x0a\x09^ self collectionClass new stream",
  60755. referencedClasses: [],
  60756. messageSends: ["stream", "new", "collectionClass"]
  60757. }),
  60758. $globals.StreamTest);
  60759. $core.addMethod(
  60760. $core.method({
  60761. selector: "testAtStartAtEnd",
  60762. protocol: "tests",
  60763. fn: function (){
  60764. var self=this,$self=this;
  60765. var stream;
  60766. return $core.withContext(function($ctx1) {
  60767. var $1,$2,$3,$4;
  60768. stream=$self._newStream();
  60769. $1=$recv(stream)._atStart();
  60770. $ctx1.sendIdx["atStart"]=1;
  60771. $self._assert_($1);
  60772. $ctx1.sendIdx["assert:"]=1;
  60773. $2=$recv(stream)._atEnd();
  60774. $ctx1.sendIdx["atEnd"]=1;
  60775. $self._assert_($2);
  60776. $ctx1.sendIdx["assert:"]=2;
  60777. $recv(stream)._nextPutAll_($self._newCollection());
  60778. $3=$recv(stream)._atEnd();
  60779. $ctx1.sendIdx["atEnd"]=2;
  60780. $self._assert_($3);
  60781. $4=$recv(stream)._atStart();
  60782. $ctx1.sendIdx["atStart"]=2;
  60783. $self._deny_($4);
  60784. $ctx1.sendIdx["deny:"]=1;
  60785. $recv(stream)._position_((1));
  60786. $self._deny_($recv(stream)._atEnd());
  60787. $ctx1.sendIdx["deny:"]=2;
  60788. $self._deny_($recv(stream)._atStart());
  60789. return self;
  60790. }, function($ctx1) {$ctx1.fill(self,"testAtStartAtEnd",{stream:stream},$globals.StreamTest)});
  60791. },
  60792. args: [],
  60793. 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",
  60794. referencedClasses: [],
  60795. messageSends: ["newStream", "assert:", "atStart", "atEnd", "nextPutAll:", "newCollection", "deny:", "position:"]
  60796. }),
  60797. $globals.StreamTest);
  60798. $core.addMethod(
  60799. $core.method({
  60800. selector: "testContents",
  60801. protocol: "tests",
  60802. fn: function (){
  60803. var self=this,$self=this;
  60804. var stream;
  60805. return $core.withContext(function($ctx1) {
  60806. var $1,$2;
  60807. stream=$self._newStream();
  60808. $1=stream;
  60809. $2=$self._newCollection();
  60810. $ctx1.sendIdx["newCollection"]=1;
  60811. $recv($1)._nextPutAll_($2);
  60812. $self._assert_equals_($recv(stream)._contents(),$self._newCollection());
  60813. return self;
  60814. }, function($ctx1) {$ctx1.fill(self,"testContents",{stream:stream},$globals.StreamTest)});
  60815. },
  60816. args: [],
  60817. 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",
  60818. referencedClasses: [],
  60819. messageSends: ["newStream", "nextPutAll:", "newCollection", "assert:equals:", "contents"]
  60820. }),
  60821. $globals.StreamTest);
  60822. $core.addMethod(
  60823. $core.method({
  60824. selector: "testIsEmpty",
  60825. protocol: "tests",
  60826. fn: function (){
  60827. var self=this,$self=this;
  60828. var stream;
  60829. return $core.withContext(function($ctx1) {
  60830. var $1;
  60831. stream=$self._newStream();
  60832. $1=$recv(stream)._isEmpty();
  60833. $ctx1.sendIdx["isEmpty"]=1;
  60834. $self._assert_($1);
  60835. $recv(stream)._nextPutAll_($self._newCollection());
  60836. $self._deny_($recv(stream)._isEmpty());
  60837. return self;
  60838. }, function($ctx1) {$ctx1.fill(self,"testIsEmpty",{stream:stream},$globals.StreamTest)});
  60839. },
  60840. args: [],
  60841. 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",
  60842. referencedClasses: [],
  60843. messageSends: ["newStream", "assert:", "isEmpty", "nextPutAll:", "newCollection", "deny:"]
  60844. }),
  60845. $globals.StreamTest);
  60846. $core.addMethod(
  60847. $core.method({
  60848. selector: "testPosition",
  60849. protocol: "tests",
  60850. fn: function (){
  60851. var self=this,$self=this;
  60852. var collection,stream;
  60853. return $core.withContext(function($ctx1) {
  60854. var $1,$2,$3;
  60855. collection=$self._newCollection();
  60856. stream=$self._newStream();
  60857. $recv(stream)._nextPutAll_(collection);
  60858. $1=$recv(stream)._position();
  60859. $ctx1.sendIdx["position"]=1;
  60860. $self._assert_equals_($1,$recv(collection)._size());
  60861. $ctx1.sendIdx["assert:equals:"]=1;
  60862. $recv(stream)._position_((0));
  60863. $2=$recv(stream)._position();
  60864. $ctx1.sendIdx["position"]=2;
  60865. $self._assert_equals_($2,(0));
  60866. $ctx1.sendIdx["assert:equals:"]=2;
  60867. $recv(stream)._next();
  60868. $ctx1.sendIdx["next"]=1;
  60869. $3=$recv(stream)._position();
  60870. $ctx1.sendIdx["position"]=3;
  60871. $self._assert_equals_($3,(1));
  60872. $ctx1.sendIdx["assert:equals:"]=3;
  60873. $recv(stream)._next();
  60874. $self._assert_equals_($recv(stream)._position(),(2));
  60875. return self;
  60876. }, function($ctx1) {$ctx1.fill(self,"testPosition",{collection:collection,stream:stream},$globals.StreamTest)});
  60877. },
  60878. args: [],
  60879. 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",
  60880. referencedClasses: [],
  60881. messageSends: ["newCollection", "newStream", "nextPutAll:", "assert:equals:", "position", "size", "position:", "next"]
  60882. }),
  60883. $globals.StreamTest);
  60884. $core.addMethod(
  60885. $core.method({
  60886. selector: "testReading",
  60887. protocol: "tests",
  60888. fn: function (){
  60889. var self=this,$self=this;
  60890. var stream,collection;
  60891. return $core.withContext(function($ctx1) {
  60892. var $1,$2;
  60893. collection=$self._newCollection();
  60894. stream=$self._newStream();
  60895. $1=stream;
  60896. $recv($1)._nextPutAll_(collection);
  60897. $recv($1)._position_((0));
  60898. $recv(collection)._do_((function(each){
  60899. return $core.withContext(function($ctx2) {
  60900. $2=$recv(stream)._next();
  60901. $ctx2.sendIdx["next"]=1;
  60902. return $self._assert_equals_($2,each);
  60903. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60904. }));
  60905. $self._assert_($recv($recv(stream)._next())._isNil());
  60906. return self;
  60907. }, function($ctx1) {$ctx1.fill(self,"testReading",{stream:stream,collection:collection},$globals.StreamTest)});
  60908. },
  60909. args: [],
  60910. 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",
  60911. referencedClasses: [],
  60912. messageSends: ["newCollection", "newStream", "nextPutAll:", "position:", "do:", "assert:equals:", "next", "assert:", "isNil"]
  60913. }),
  60914. $globals.StreamTest);
  60915. $core.addMethod(
  60916. $core.method({
  60917. selector: "testStreamContents",
  60918. protocol: "tests",
  60919. fn: function (){
  60920. var self=this,$self=this;
  60921. return self;
  60922. },
  60923. args: [],
  60924. source: "testStreamContents",
  60925. referencedClasses: [],
  60926. messageSends: []
  60927. }),
  60928. $globals.StreamTest);
  60929. $core.addMethod(
  60930. $core.method({
  60931. selector: "testWrite",
  60932. protocol: "tests",
  60933. fn: function (){
  60934. var self=this,$self=this;
  60935. var stream,collection;
  60936. return $core.withContext(function($ctx1) {
  60937. collection=$self._newCollection();
  60938. stream=$self._newStream();
  60939. $recv(collection)._do_((function(each){
  60940. return $core.withContext(function($ctx2) {
  60941. return $recv(stream).__lt_lt(each);
  60942. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60943. }));
  60944. $self._assert_equals_($recv(stream)._contents(),collection);
  60945. return self;
  60946. }, function($ctx1) {$ctx1.fill(self,"testWrite",{stream:stream,collection:collection},$globals.StreamTest)});
  60947. },
  60948. args: [],
  60949. 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",
  60950. referencedClasses: [],
  60951. messageSends: ["newCollection", "newStream", "do:", "<<", "assert:equals:", "contents"]
  60952. }),
  60953. $globals.StreamTest);
  60954. $core.addMethod(
  60955. $core.method({
  60956. selector: "testWriting",
  60957. protocol: "tests",
  60958. fn: function (){
  60959. var self=this,$self=this;
  60960. var stream,collection;
  60961. return $core.withContext(function($ctx1) {
  60962. var $1;
  60963. collection=$self._newCollection();
  60964. stream=$self._newStream();
  60965. $ctx1.sendIdx["newStream"]=1;
  60966. $recv(collection)._do_((function(each){
  60967. return $core.withContext(function($ctx2) {
  60968. return $recv(stream)._nextPut_(each);
  60969. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  60970. }));
  60971. $1=$recv(stream)._contents();
  60972. $ctx1.sendIdx["contents"]=1;
  60973. $self._assert_equals_($1,collection);
  60974. $ctx1.sendIdx["assert:equals:"]=1;
  60975. stream=$self._newStream();
  60976. $recv(stream)._nextPutAll_(collection);
  60977. $self._assert_equals_($recv(stream)._contents(),collection);
  60978. return self;
  60979. }, function($ctx1) {$ctx1.fill(self,"testWriting",{stream:stream,collection:collection},$globals.StreamTest)});
  60980. },
  60981. args: [],
  60982. 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",
  60983. referencedClasses: [],
  60984. messageSends: ["newCollection", "newStream", "do:", "nextPut:", "assert:equals:", "contents", "nextPutAll:"]
  60985. }),
  60986. $globals.StreamTest);
  60987. $core.addMethod(
  60988. $core.method({
  60989. selector: "collectionClass",
  60990. protocol: "accessing",
  60991. fn: function (){
  60992. var self=this,$self=this;
  60993. return nil;
  60994. },
  60995. args: [],
  60996. source: "collectionClass\x0a\x09^ nil",
  60997. referencedClasses: [],
  60998. messageSends: []
  60999. }),
  61000. $globals.StreamTest.a$cls);
  61001. $core.addMethod(
  61002. $core.method({
  61003. selector: "isAbstract",
  61004. protocol: "testing",
  61005. fn: function (){
  61006. var self=this,$self=this;
  61007. return $core.withContext(function($ctx1) {
  61008. return $recv($self._collectionClass())._isNil();
  61009. }, function($ctx1) {$ctx1.fill(self,"isAbstract",{},$globals.StreamTest.a$cls)});
  61010. },
  61011. args: [],
  61012. source: "isAbstract\x0a\x09^ self collectionClass isNil",
  61013. referencedClasses: [],
  61014. messageSends: ["isNil", "collectionClass"]
  61015. }),
  61016. $globals.StreamTest.a$cls);
  61017. $core.addClass("ArrayStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61018. $core.addMethod(
  61019. $core.method({
  61020. selector: "newCollection",
  61021. protocol: "accessing",
  61022. fn: function (){
  61023. var self=this,$self=this;
  61024. return $core.withContext(function($ctx1) {
  61025. return [true,(1),(3).__at((4)),"foo"];
  61026. }, function($ctx1) {$ctx1.fill(self,"newCollection",{},$globals.ArrayStreamTest)});
  61027. },
  61028. args: [],
  61029. source: "newCollection\x0a\x09^ { true. 1. 3@4. 'foo' }",
  61030. referencedClasses: [],
  61031. messageSends: ["@"]
  61032. }),
  61033. $globals.ArrayStreamTest);
  61034. $core.addMethod(
  61035. $core.method({
  61036. selector: "collectionClass",
  61037. protocol: "accessing",
  61038. fn: function (){
  61039. var self=this,$self=this;
  61040. return $globals.Array;
  61041. },
  61042. args: [],
  61043. source: "collectionClass\x0a\x09^ Array",
  61044. referencedClasses: ["Array"],
  61045. messageSends: []
  61046. }),
  61047. $globals.ArrayStreamTest.a$cls);
  61048. $core.addClass("StringStreamTest", $globals.StreamTest, [], "Kernel-Tests");
  61049. $core.addMethod(
  61050. $core.method({
  61051. selector: "newCollection",
  61052. protocol: "accessing",
  61053. fn: function (){
  61054. var self=this,$self=this;
  61055. return "hello world";
  61056. },
  61057. args: [],
  61058. source: "newCollection\x0a\x09^ 'hello world'",
  61059. referencedClasses: [],
  61060. messageSends: []
  61061. }),
  61062. $globals.StringStreamTest);
  61063. $core.addMethod(
  61064. $core.method({
  61065. selector: "collectionClass",
  61066. protocol: "accessing",
  61067. fn: function (){
  61068. var self=this,$self=this;
  61069. return $globals.String;
  61070. },
  61071. args: [],
  61072. source: "collectionClass\x0a\x09^ String",
  61073. referencedClasses: ["String"],
  61074. messageSends: []
  61075. }),
  61076. $globals.StringStreamTest.a$cls);
  61077. $core.addClass("UndefinedTest", $globals.TestCase, [], "Kernel-Tests");
  61078. $core.addMethod(
  61079. $core.method({
  61080. selector: "testCopying",
  61081. protocol: "tests",
  61082. fn: function (){
  61083. var self=this,$self=this;
  61084. return $core.withContext(function($ctx1) {
  61085. $self._assert_equals_(nil._copy(),nil);
  61086. return self;
  61087. }, function($ctx1) {$ctx1.fill(self,"testCopying",{},$globals.UndefinedTest)});
  61088. },
  61089. args: [],
  61090. source: "testCopying\x0a\x09self assert: nil copy equals: nil",
  61091. referencedClasses: [],
  61092. messageSends: ["assert:equals:", "copy"]
  61093. }),
  61094. $globals.UndefinedTest);
  61095. $core.addMethod(
  61096. $core.method({
  61097. selector: "testDeepCopy",
  61098. protocol: "tests",
  61099. fn: function (){
  61100. var self=this,$self=this;
  61101. return $core.withContext(function($ctx1) {
  61102. $self._assert_($recv(nil._deepCopy()).__eq(nil));
  61103. return self;
  61104. }, function($ctx1) {$ctx1.fill(self,"testDeepCopy",{},$globals.UndefinedTest)});
  61105. },
  61106. args: [],
  61107. source: "testDeepCopy\x0a\x09self assert: nil deepCopy = nil",
  61108. referencedClasses: [],
  61109. messageSends: ["assert:", "=", "deepCopy"]
  61110. }),
  61111. $globals.UndefinedTest);
  61112. $core.addMethod(
  61113. $core.method({
  61114. selector: "testIfNil",
  61115. protocol: "tests",
  61116. fn: function (){
  61117. var self=this,$self=this;
  61118. return $core.withContext(function($ctx1) {
  61119. var $1,$3,$2,$4,$6,$5,$receiver;
  61120. if(($receiver = nil) == null || $receiver.a$nil){
  61121. $1=true;
  61122. } else {
  61123. $1=nil;
  61124. }
  61125. $self._assert_equals_($1,true);
  61126. $ctx1.sendIdx["assert:equals:"]=1;
  61127. if(($receiver = nil) == null || $receiver.a$nil){
  61128. $3=nil;
  61129. } else {
  61130. $3=true;
  61131. }
  61132. $2=$recv($3).__eq(true);
  61133. $ctx1.sendIdx["="]=1;
  61134. $self._deny_($2);
  61135. $ctx1.sendIdx["deny:"]=1;
  61136. if(($receiver = nil) == null || $receiver.a$nil){
  61137. $4=true;
  61138. } else {
  61139. $4=false;
  61140. }
  61141. $self._assert_equals_($4,true);
  61142. if(($receiver = nil) == null || $receiver.a$nil){
  61143. $6=false;
  61144. } else {
  61145. $6=true;
  61146. }
  61147. $5=$recv($6).__eq(true);
  61148. $self._deny_($5);
  61149. return self;
  61150. }, function($ctx1) {$ctx1.fill(self,"testIfNil",{},$globals.UndefinedTest)});
  61151. },
  61152. args: [],
  61153. 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",
  61154. referencedClasses: [],
  61155. messageSends: ["assert:equals:", "ifNil:", "deny:", "=", "ifNotNil:", "ifNil:ifNotNil:", "ifNotNil:ifNil:"]
  61156. }),
  61157. $globals.UndefinedTest);
  61158. $core.addMethod(
  61159. $core.method({
  61160. selector: "testIsNil",
  61161. protocol: "tests",
  61162. fn: function (){
  61163. var self=this,$self=this;
  61164. return $core.withContext(function($ctx1) {
  61165. $self._assert_(nil._isNil());
  61166. $self._deny_(nil._notNil());
  61167. return self;
  61168. }, function($ctx1) {$ctx1.fill(self,"testIsNil",{},$globals.UndefinedTest)});
  61169. },
  61170. args: [],
  61171. source: "testIsNil\x0a\x09self assert: nil isNil.\x0a\x09self deny: nil notNil.",
  61172. referencedClasses: [],
  61173. messageSends: ["assert:", "isNil", "deny:", "notNil"]
  61174. }),
  61175. $globals.UndefinedTest);
  61176. });
  61177. define('amber_core/Platform-DOM-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61178. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61179. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61180. $core.addPackage("Platform-DOM-Tests");
  61181. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].innerEval = function (expr) { return eval(expr); };
  61182. ($core.packageDescriptors||$core.packages)["Platform-DOM-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61183. $core.addClass("PlatformDomTest", $globals.TestCase, ["fixtureDiv"], "Platform-DOM-Tests");
  61184. $core.addMethod(
  61185. $core.method({
  61186. selector: "testEntityConversion",
  61187. protocol: "testing",
  61188. fn: function (){
  61189. var self=this,$self=this;
  61190. return $core.withContext(function($ctx1) {
  61191. var $1;
  61192. $1=$recv($globals.PlatformDom)._isFeasible();
  61193. if($core.assert($1)){
  61194. $self._assert_equals_("&copy;"._htmlTextContent(),"©");
  61195. }
  61196. return self;
  61197. }, function($ctx1) {$ctx1.fill(self,"testEntityConversion",{},$globals.PlatformDomTest)});
  61198. },
  61199. args: [],
  61200. source: "testEntityConversion\x0a\x09PlatformDom isFeasible ifTrue: [ self assert: '&copy;' htmlTextContent equals: '©' ]",
  61201. referencedClasses: ["PlatformDom"],
  61202. messageSends: ["ifTrue:", "isFeasible", "assert:equals:", "htmlTextContent"]
  61203. }),
  61204. $globals.PlatformDomTest);
  61205. $core.addMethod(
  61206. $core.method({
  61207. selector: "testTextContentDoesNotRunScript",
  61208. protocol: "testing",
  61209. fn: function (){
  61210. var self=this,$self=this;
  61211. return $core.withContext(function($ctx1) {
  61212. var $1;
  61213. $1=$recv($globals.PlatformDom)._isFeasible();
  61214. if($core.assert($1)){
  61215. $self._shouldnt_raise_((function(){
  61216. return $core.withContext(function($ctx2) {
  61217. return "<script>throw new Error(\x22Intentional\x22)</script>"._htmlTextContent();
  61218. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61219. }),$globals.Error);
  61220. }
  61221. return self;
  61222. }, function($ctx1) {$ctx1.fill(self,"testTextContentDoesNotRunScript",{},$globals.PlatformDomTest)});
  61223. },
  61224. args: [],
  61225. source: "testTextContentDoesNotRunScript\x0a\x09PlatformDom isFeasible ifTrue: [\x0a\x09\x09self shouldnt: [ '<script>throw new Error(\x22Intentional\x22)</script>' htmlTextContent ] raise: Error ]",
  61226. referencedClasses: ["PlatformDom", "Error"],
  61227. messageSends: ["ifTrue:", "isFeasible", "shouldnt:raise:", "htmlTextContent"]
  61228. }),
  61229. $globals.PlatformDomTest);
  61230. });
  61231. define('amber_core/SUnit-Tests',["amber/boot", "amber_core/SUnit"], function($boot){"use strict";
  61232. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61233. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61234. $core.addPackage("SUnit-Tests");
  61235. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].innerEval = function (expr) { return eval(expr); };
  61236. ($core.packageDescriptors||$core.packages)["SUnit-Tests"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61237. $core.addClass("ExampleSetTest", $globals.TestCase, ["empty", "full"], "SUnit-Tests");
  61238. $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.";
  61239. $core.addMethod(
  61240. $core.method({
  61241. selector: "setUp",
  61242. protocol: "running",
  61243. fn: function (){
  61244. var self=this,$self=this;
  61245. return $core.withContext(function($ctx1) {
  61246. $self["@empty"]=$recv($globals.Set)._new();
  61247. $self["@full"]=$recv($globals.Set)._with_with_((5),"abc");
  61248. return self;
  61249. }, function($ctx1) {$ctx1.fill(self,"setUp",{},$globals.ExampleSetTest)});
  61250. },
  61251. args: [],
  61252. source: "setUp\x0a\x09empty := Set new.\x0a\x09full := Set with: 5 with: #abc",
  61253. referencedClasses: ["Set"],
  61254. messageSends: ["new", "with:with:"]
  61255. }),
  61256. $globals.ExampleSetTest);
  61257. $core.addMethod(
  61258. $core.method({
  61259. selector: "testAdd",
  61260. protocol: "tests",
  61261. fn: function (){
  61262. var self=this,$self=this;
  61263. return $core.withContext(function($ctx1) {
  61264. $recv($self["@empty"])._add_((5));
  61265. $self._assert_($recv($self["@empty"])._includes_((5)));
  61266. return self;
  61267. }, function($ctx1) {$ctx1.fill(self,"testAdd",{},$globals.ExampleSetTest)});
  61268. },
  61269. args: [],
  61270. source: "testAdd\x0a\x09empty add: 5.\x0a\x09self assert: (empty includes: 5)",
  61271. referencedClasses: [],
  61272. messageSends: ["add:", "assert:", "includes:"]
  61273. }),
  61274. $globals.ExampleSetTest);
  61275. $core.addMethod(
  61276. $core.method({
  61277. selector: "testGrow",
  61278. protocol: "tests",
  61279. fn: function (){
  61280. var self=this,$self=this;
  61281. return $core.withContext(function($ctx1) {
  61282. $recv($self["@empty"])._addAll_((1)._to_((100)));
  61283. $self._assert_equals_($recv($self["@empty"])._size(),(100));
  61284. return self;
  61285. }, function($ctx1) {$ctx1.fill(self,"testGrow",{},$globals.ExampleSetTest)});
  61286. },
  61287. args: [],
  61288. source: "testGrow\x0a\x09empty addAll: (1 to: 100).\x0a\x09self assert: empty size equals: 100",
  61289. referencedClasses: [],
  61290. messageSends: ["addAll:", "to:", "assert:equals:", "size"]
  61291. }),
  61292. $globals.ExampleSetTest);
  61293. $core.addMethod(
  61294. $core.method({
  61295. selector: "testIllegal",
  61296. protocol: "tests",
  61297. fn: function (){
  61298. var self=this,$self=this;
  61299. return $core.withContext(function($ctx1) {
  61300. $self._should_raise_((function(){
  61301. return $core.withContext(function($ctx2) {
  61302. return $recv($self["@empty"])._at_((5));
  61303. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61304. }),$globals.Error);
  61305. $ctx1.sendIdx["should:raise:"]=1;
  61306. $self._should_raise_((function(){
  61307. return $core.withContext(function($ctx2) {
  61308. return $recv($self["@empty"])._at_put_((5),"abc");
  61309. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61310. }),$globals.Error);
  61311. return self;
  61312. }, function($ctx1) {$ctx1.fill(self,"testIllegal",{},$globals.ExampleSetTest)});
  61313. },
  61314. args: [],
  61315. 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",
  61316. referencedClasses: ["Error"],
  61317. messageSends: ["should:raise:", "at:", "at:put:"]
  61318. }),
  61319. $globals.ExampleSetTest);
  61320. $core.addMethod(
  61321. $core.method({
  61322. selector: "testIncludes",
  61323. protocol: "tests",
  61324. fn: function (){
  61325. var self=this,$self=this;
  61326. return $core.withContext(function($ctx1) {
  61327. var $1;
  61328. $1=$recv($self["@full"])._includes_((5));
  61329. $ctx1.sendIdx["includes:"]=1;
  61330. $self._assert_($1);
  61331. $ctx1.sendIdx["assert:"]=1;
  61332. $self._assert_($recv($self["@full"])._includes_("abc"));
  61333. return self;
  61334. }, function($ctx1) {$ctx1.fill(self,"testIncludes",{},$globals.ExampleSetTest)});
  61335. },
  61336. args: [],
  61337. source: "testIncludes\x0a\x09self assert: (full includes: 5).\x0a\x09self assert: (full includes: #abc)",
  61338. referencedClasses: [],
  61339. messageSends: ["assert:", "includes:"]
  61340. }),
  61341. $globals.ExampleSetTest);
  61342. $core.addMethod(
  61343. $core.method({
  61344. selector: "testOccurrences",
  61345. protocol: "tests",
  61346. fn: function (){
  61347. var self=this,$self=this;
  61348. return $core.withContext(function($ctx1) {
  61349. var $1,$2;
  61350. $1=$recv($self["@empty"])._occurrencesOf_((0));
  61351. $ctx1.sendIdx["occurrencesOf:"]=1;
  61352. $self._assert_equals_($1,(0));
  61353. $ctx1.sendIdx["assert:equals:"]=1;
  61354. $2=$recv($self["@full"])._occurrencesOf_((5));
  61355. $ctx1.sendIdx["occurrencesOf:"]=2;
  61356. $self._assert_equals_($2,(1));
  61357. $ctx1.sendIdx["assert:equals:"]=2;
  61358. $recv($self["@full"])._add_((5));
  61359. $self._assert_equals_($recv($self["@full"])._occurrencesOf_((5)),(1));
  61360. return self;
  61361. }, function($ctx1) {$ctx1.fill(self,"testOccurrences",{},$globals.ExampleSetTest)});
  61362. },
  61363. args: [],
  61364. 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",
  61365. referencedClasses: [],
  61366. messageSends: ["assert:equals:", "occurrencesOf:", "add:"]
  61367. }),
  61368. $globals.ExampleSetTest);
  61369. $core.addMethod(
  61370. $core.method({
  61371. selector: "testRemove",
  61372. protocol: "tests",
  61373. fn: function (){
  61374. var self=this,$self=this;
  61375. return $core.withContext(function($ctx1) {
  61376. var $1;
  61377. $recv($self["@full"])._remove_((5));
  61378. $1=$recv($self["@full"])._includes_("abc");
  61379. $ctx1.sendIdx["includes:"]=1;
  61380. $self._assert_($1);
  61381. $self._deny_($recv($self["@full"])._includes_((5)));
  61382. return self;
  61383. }, function($ctx1) {$ctx1.fill(self,"testRemove",{},$globals.ExampleSetTest)});
  61384. },
  61385. args: [],
  61386. source: "testRemove\x0a\x09full remove: 5.\x0a\x09self assert: (full includes: #abc).\x0a\x09self deny: (full includes: 5)",
  61387. referencedClasses: [],
  61388. messageSends: ["remove:", "assert:", "includes:", "deny:"]
  61389. }),
  61390. $globals.ExampleSetTest);
  61391. $core.addClass("SUnitAsyncTest", $globals.TestCase, ["flag"], "SUnit-Tests");
  61392. $core.addMethod(
  61393. $core.method({
  61394. selector: "fakeError",
  61395. protocol: "helpers",
  61396. fn: function (){
  61397. var self=this,$self=this;
  61398. return $core.withContext(function($ctx1) {
  61399. $self["@flag"]="bad";
  61400. $self._timeout_((30));
  61401. $self["@flag"]=$recv($self._async_((function(){
  61402. return $core.withContext(function($ctx2) {
  61403. $self["@flag"]="ok";
  61404. return $self._error_("Intentional");
  61405. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61406. })))._valueWithTimeout_((20));
  61407. return self;
  61408. }, function($ctx1) {$ctx1.fill(self,"fakeError",{},$globals.SUnitAsyncTest)});
  61409. },
  61410. args: [],
  61411. source: "fakeError\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self error: 'Intentional' ]) valueWithTimeout: 20",
  61412. referencedClasses: [],
  61413. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61414. }),
  61415. $globals.SUnitAsyncTest);
  61416. $core.addMethod(
  61417. $core.method({
  61418. selector: "fakeErrorFailingInTearDown",
  61419. protocol: "helpers",
  61420. fn: function (){
  61421. var self=this,$self=this;
  61422. return $core.withContext(function($ctx1) {
  61423. $self["@flag"]="bad";
  61424. $self._timeout_((30));
  61425. $self["@flag"]=$recv($self._async_((function(){
  61426. return $core.withContext(function($ctx2) {
  61427. return $self._error_("Intentional");
  61428. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61429. })))._valueWithTimeout_((20));
  61430. return self;
  61431. }, function($ctx1) {$ctx1.fill(self,"fakeErrorFailingInTearDown",{},$globals.SUnitAsyncTest)});
  61432. },
  61433. args: [],
  61434. source: "fakeErrorFailingInTearDown\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ self error: 'Intentional' ]) valueWithTimeout: 20",
  61435. referencedClasses: [],
  61436. messageSends: ["timeout:", "valueWithTimeout:", "async:", "error:"]
  61437. }),
  61438. $globals.SUnitAsyncTest);
  61439. $core.addMethod(
  61440. $core.method({
  61441. selector: "fakeFailure",
  61442. protocol: "helpers",
  61443. fn: function (){
  61444. var self=this,$self=this;
  61445. return $core.withContext(function($ctx1) {
  61446. $self["@flag"]="bad";
  61447. $self._timeout_((30));
  61448. $self["@flag"]=$recv($self._async_((function(){
  61449. return $core.withContext(function($ctx2) {
  61450. $self["@flag"]="ok";
  61451. return $self._assert_(false);
  61452. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61453. })))._valueWithTimeout_((20));
  61454. return self;
  61455. }, function($ctx1) {$ctx1.fill(self,"fakeFailure",{},$globals.SUnitAsyncTest)});
  61456. },
  61457. args: [],
  61458. source: "fakeFailure\x0a\x09flag := 'bad'.\x0a\x09self timeout: 30.\x0a\x09flag := (self async: [ flag := 'ok'. self assert: false ]) valueWithTimeout: 20",
  61459. referencedClasses: [],
  61460. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:"]
  61461. }),
  61462. $globals.SUnitAsyncTest);
  61463. $core.addMethod(
  61464. $core.method({
  61465. selector: "fakeMultipleTimeoutFailing",
  61466. protocol: "helpers",
  61467. fn: function (){
  61468. var self=this,$self=this;
  61469. return $core.withContext(function($ctx1) {
  61470. var $1;
  61471. $self._timeout_((100));
  61472. $ctx1.sendIdx["timeout:"]=1;
  61473. $1=$self._async_((function(){
  61474. return $core.withContext(function($ctx2) {
  61475. $self._timeout_((20));
  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_((30));
  61481. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61482. }));
  61483. $ctx1.sendIdx["async:"]=1;
  61484. $recv($1)._valueWithTimeout_((20));
  61485. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61486. return self;
  61487. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutFailing",{},$globals.SUnitAsyncTest)});
  61488. },
  61489. args: [],
  61490. 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",
  61491. referencedClasses: [],
  61492. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61493. }),
  61494. $globals.SUnitAsyncTest);
  61495. $core.addMethod(
  61496. $core.method({
  61497. selector: "fakeMultipleTimeoutPassing",
  61498. protocol: "helpers",
  61499. fn: function (){
  61500. var self=this,$self=this;
  61501. return $core.withContext(function($ctx1) {
  61502. var $1;
  61503. $self._timeout_((20));
  61504. $ctx1.sendIdx["timeout:"]=1;
  61505. $1=$self._async_((function(){
  61506. return $core.withContext(function($ctx2) {
  61507. $self._timeout_((40));
  61508. return $recv($self._async_((function(){
  61509. return $core.withContext(function($ctx3) {
  61510. return $self._finished();
  61511. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  61512. })))._valueWithTimeout_((20));
  61513. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61514. }));
  61515. $ctx1.sendIdx["async:"]=1;
  61516. $recv($1)._valueWithTimeout_((10));
  61517. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61518. return self;
  61519. }, function($ctx1) {$ctx1.fill(self,"fakeMultipleTimeoutPassing",{},$globals.SUnitAsyncTest)});
  61520. },
  61521. args: [],
  61522. 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",
  61523. referencedClasses: [],
  61524. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61525. }),
  61526. $globals.SUnitAsyncTest);
  61527. $core.addMethod(
  61528. $core.method({
  61529. selector: "fakeTimeout",
  61530. protocol: "helpers",
  61531. fn: function (){
  61532. var self=this,$self=this;
  61533. return $core.withContext(function($ctx1) {
  61534. $self._timeout_((10));
  61535. $recv($self._async_((function(){
  61536. return $core.withContext(function($ctx2) {
  61537. return $self._finished();
  61538. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61539. })))._valueWithTimeout_((20));
  61540. return self;
  61541. }, function($ctx1) {$ctx1.fill(self,"fakeTimeout",{},$globals.SUnitAsyncTest)});
  61542. },
  61543. args: [],
  61544. source: "fakeTimeout\x0a\x09self timeout: 10.\x0a\x09(self async: [ self finished ]) valueWithTimeout: 20",
  61545. referencedClasses: [],
  61546. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished"]
  61547. }),
  61548. $globals.SUnitAsyncTest);
  61549. $core.addMethod(
  61550. $core.method({
  61551. selector: "selectorSetOf:",
  61552. protocol: "private",
  61553. fn: function (aCollection){
  61554. var self=this,$self=this;
  61555. return $core.withContext(function($ctx1) {
  61556. return $recv($recv(aCollection)._collect_((function(each){
  61557. return $core.withContext(function($ctx2) {
  61558. return $recv(each)._selector();
  61559. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61560. })))._asSet();
  61561. }, function($ctx1) {$ctx1.fill(self,"selectorSetOf:",{aCollection:aCollection},$globals.SUnitAsyncTest)});
  61562. },
  61563. args: ["aCollection"],
  61564. source: "selectorSetOf: aCollection\x0a\x09^ (aCollection collect: [ :each | each selector ]) asSet",
  61565. referencedClasses: [],
  61566. messageSends: ["asSet", "collect:", "selector"]
  61567. }),
  61568. $globals.SUnitAsyncTest);
  61569. $core.addMethod(
  61570. $core.method({
  61571. selector: "setUp",
  61572. protocol: "running",
  61573. fn: function (){
  61574. var self=this,$self=this;
  61575. $self["@flag"]="ok";
  61576. return self;
  61577. },
  61578. args: [],
  61579. source: "setUp\x0a\x09flag := 'ok'",
  61580. referencedClasses: [],
  61581. messageSends: []
  61582. }),
  61583. $globals.SUnitAsyncTest);
  61584. $core.addMethod(
  61585. $core.method({
  61586. selector: "tearDown",
  61587. protocol: "running",
  61588. fn: function (){
  61589. var self=this,$self=this;
  61590. return $core.withContext(function($ctx1) {
  61591. $self._assert_equals_("ok",$self["@flag"]);
  61592. return self;
  61593. }, function($ctx1) {$ctx1.fill(self,"tearDown",{},$globals.SUnitAsyncTest)});
  61594. },
  61595. args: [],
  61596. source: "tearDown\x0a\x09self assert: 'ok' equals: flag",
  61597. referencedClasses: [],
  61598. messageSends: ["assert:equals:"]
  61599. }),
  61600. $globals.SUnitAsyncTest);
  61601. $core.addMethod(
  61602. $core.method({
  61603. selector: "testAsyncErrorsAndFailures",
  61604. protocol: "tests",
  61605. fn: function (){
  61606. var self=this,$self=this;
  61607. var suite,runner,result,assertBlock;
  61608. return $core.withContext(function($ctx1) {
  61609. var $1,$2,$3,$4;
  61610. suite=["fakeError", "fakeErrorFailingInTearDown", "fakeFailure", "testPass"]._collect_((function(each){
  61611. return $core.withContext(function($ctx2) {
  61612. return $recv($self._class())._selector_(each);
  61613. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61614. }));
  61615. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61616. $self._timeout_((200));
  61617. result=$recv(runner)._result();
  61618. $ctx1.sendIdx["result"]=1;
  61619. assertBlock=$self._async_((function(){
  61620. return $core.withContext(function($ctx2) {
  61621. $1=$self._selectorSetOf_($recv(result)._errors());
  61622. $ctx2.sendIdx["selectorSetOf:"]=1;
  61623. $2=["fakeError"]._asSet();
  61624. $ctx2.sendIdx["asSet"]=1;
  61625. $self._assert_equals_($1,$2);
  61626. $ctx2.sendIdx["assert:equals:"]=1;
  61627. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeErrorFailingInTearDown", "fakeFailure"]._asSet());
  61628. return $self._finished();
  61629. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61630. }));
  61631. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61632. return $core.withContext(function($ctx2) {
  61633. $3=$recv($recv(ann)._result()).__eq_eq(result);
  61634. if($core.assert($3)){
  61635. $4=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61636. return $recv($4)._ifTrue_(assertBlock);
  61637. }
  61638. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61639. }));
  61640. $recv(runner)._run();
  61641. return self;
  61642. }, function($ctx1) {$ctx1.fill(self,"testAsyncErrorsAndFailures",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61643. },
  61644. args: [],
  61645. 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",
  61646. referencedClasses: ["TestSuiteRunner", "ResultAnnouncement"],
  61647. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "asSet", "failures", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61648. }),
  61649. $globals.SUnitAsyncTest);
  61650. $core.addMethod(
  61651. $core.method({
  61652. selector: "testAsyncNeedsTimeout",
  61653. protocol: "tests",
  61654. fn: function (){
  61655. var self=this,$self=this;
  61656. return $core.withContext(function($ctx1) {
  61657. $self._should_raise_((function(){
  61658. return $core.withContext(function($ctx2) {
  61659. return $self._async_((function(){
  61660. }));
  61661. $ctx2.sendIdx["async:"]=1;
  61662. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61663. }),$globals.Error);
  61664. $self._timeout_((0));
  61665. $self._shouldnt_raise_((function(){
  61666. return $core.withContext(function($ctx2) {
  61667. return $self._async_((function(){
  61668. }));
  61669. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  61670. }),$globals.Error);
  61671. $self._finished();
  61672. return self;
  61673. }, function($ctx1) {$ctx1.fill(self,"testAsyncNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61674. },
  61675. args: [],
  61676. source: "testAsyncNeedsTimeout\x0a\x09self should: [ self async: [ ] ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self async: [ ] ] raise: Error.\x0a\x09self finished",
  61677. referencedClasses: ["Error"],
  61678. messageSends: ["should:raise:", "async:", "timeout:", "shouldnt:raise:", "finished"]
  61679. }),
  61680. $globals.SUnitAsyncTest);
  61681. $core.addMethod(
  61682. $core.method({
  61683. selector: "testFinishedNeedsTimeout",
  61684. protocol: "tests",
  61685. fn: function (){
  61686. var self=this,$self=this;
  61687. return $core.withContext(function($ctx1) {
  61688. $self._should_raise_((function(){
  61689. return $core.withContext(function($ctx2) {
  61690. return $self._finished();
  61691. $ctx2.sendIdx["finished"]=1;
  61692. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61693. }),$globals.Error);
  61694. $self._timeout_((0));
  61695. $self._shouldnt_raise_((function(){
  61696. return $core.withContext(function($ctx2) {
  61697. return $self._finished();
  61698. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61699. }),$globals.Error);
  61700. return self;
  61701. }, function($ctx1) {$ctx1.fill(self,"testFinishedNeedsTimeout",{},$globals.SUnitAsyncTest)});
  61702. },
  61703. args: [],
  61704. source: "testFinishedNeedsTimeout\x0a\x09self should: [ self finished ] raise: Error.\x0a\x09self timeout: 0.\x0a\x09self shouldnt: [ self finished ] raise: Error.",
  61705. referencedClasses: ["Error"],
  61706. messageSends: ["should:raise:", "finished", "timeout:", "shouldnt:raise:"]
  61707. }),
  61708. $globals.SUnitAsyncTest);
  61709. $core.addMethod(
  61710. $core.method({
  61711. selector: "testIsAsyncReturnsCorrectValues",
  61712. protocol: "tests",
  61713. fn: function (){
  61714. var self=this,$self=this;
  61715. return $core.withContext(function($ctx1) {
  61716. var $1,$2;
  61717. $1=$self._isAsync();
  61718. $ctx1.sendIdx["isAsync"]=1;
  61719. $self._deny_($1);
  61720. $ctx1.sendIdx["deny:"]=1;
  61721. $self._timeout_((0));
  61722. $2=$self._isAsync();
  61723. $ctx1.sendIdx["isAsync"]=2;
  61724. $self._assert_($2);
  61725. $self._finished();
  61726. $self._deny_($self._isAsync());
  61727. return self;
  61728. }, function($ctx1) {$ctx1.fill(self,"testIsAsyncReturnsCorrectValues",{},$globals.SUnitAsyncTest)});
  61729. },
  61730. args: [],
  61731. source: "testIsAsyncReturnsCorrectValues\x0a\x09self deny: self isAsync.\x0a\x09self timeout: 0.\x0a\x09self assert: self isAsync.\x0a\x09self finished.\x0a\x09self deny: self isAsync",
  61732. referencedClasses: [],
  61733. messageSends: ["deny:", "isAsync", "timeout:", "assert:", "finished"]
  61734. }),
  61735. $globals.SUnitAsyncTest);
  61736. $core.addMethod(
  61737. $core.method({
  61738. selector: "testPass",
  61739. protocol: "tests",
  61740. fn: function (){
  61741. var self=this,$self=this;
  61742. return $core.withContext(function($ctx1) {
  61743. $self["@flag"]="bad";
  61744. $self._timeout_((10));
  61745. $self["@flag"]=$recv($self._async_((function(){
  61746. return $core.withContext(function($ctx2) {
  61747. $self._assert_(true);
  61748. $self._finished();
  61749. $self["@flag"]="ok";
  61750. return $self["@flag"];
  61751. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61752. })))._valueWithTimeout_((5));
  61753. return self;
  61754. }, function($ctx1) {$ctx1.fill(self,"testPass",{},$globals.SUnitAsyncTest)});
  61755. },
  61756. args: [],
  61757. source: "testPass\x0a\x09flag := 'bad'.\x0a\x09self timeout: 10.\x0a\x09flag := (self async: [ self assert: true. self finished. flag := 'ok' ]) valueWithTimeout: 5",
  61758. referencedClasses: [],
  61759. messageSends: ["timeout:", "valueWithTimeout:", "async:", "assert:", "finished"]
  61760. }),
  61761. $globals.SUnitAsyncTest);
  61762. $core.addMethod(
  61763. $core.method({
  61764. selector: "testTimeouts",
  61765. protocol: "tests",
  61766. fn: function (){
  61767. var self=this,$self=this;
  61768. var suite,runner,result,assertBlock;
  61769. return $core.withContext(function($ctx1) {
  61770. var $1,$2,$3;
  61771. suite=["fakeTimeout", "fakeMultipleTimeoutFailing", "fakeMultipleTimeoutPassing", "testPass"]._collect_((function(each){
  61772. return $core.withContext(function($ctx2) {
  61773. return $recv($self._class())._selector_(each);
  61774. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61775. }));
  61776. runner=$recv($globals.TestSuiteRunner)._on_(suite);
  61777. $self._timeout_((200));
  61778. result=$recv(runner)._result();
  61779. $ctx1.sendIdx["result"]=1;
  61780. assertBlock=$self._async_((function(){
  61781. return $core.withContext(function($ctx2) {
  61782. $1=$self._selectorSetOf_($recv(result)._errors());
  61783. $ctx2.sendIdx["selectorSetOf:"]=1;
  61784. $self._assert_equals_($1,$recv($globals.Set)._new());
  61785. $ctx2.sendIdx["assert:equals:"]=1;
  61786. $self._assert_equals_($self._selectorSetOf_($recv(result)._failures()),["fakeMultipleTimeoutFailing", "fakeTimeout"]._asSet());
  61787. return $self._finished();
  61788. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61789. }));
  61790. $recv($recv(runner)._announcer())._on_do_($globals.ResultAnnouncement,(function(ann){
  61791. return $core.withContext(function($ctx2) {
  61792. $2=$recv($recv(ann)._result()).__eq_eq(result);
  61793. if($core.assert($2)){
  61794. $3=$recv($recv(result)._runs()).__eq($recv(result)._total());
  61795. return $recv($3)._ifTrue_(assertBlock);
  61796. }
  61797. }, function($ctx2) {$ctx2.fillBlock({ann:ann},$ctx1,3)});
  61798. }));
  61799. $recv(runner)._run();
  61800. return self;
  61801. }, function($ctx1) {$ctx1.fill(self,"testTimeouts",{suite:suite,runner:runner,result:result,assertBlock:assertBlock},$globals.SUnitAsyncTest)});
  61802. },
  61803. args: [],
  61804. 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",
  61805. referencedClasses: ["TestSuiteRunner", "Set", "ResultAnnouncement"],
  61806. messageSends: ["collect:", "selector:", "class", "on:", "timeout:", "result", "async:", "assert:equals:", "selectorSetOf:", "errors", "new", "failures", "asSet", "finished", "on:do:", "announcer", "ifTrue:", "==", "=", "runs", "total", "run"]
  61807. }),
  61808. $globals.SUnitAsyncTest);
  61809. $core.addMethod(
  61810. $core.method({
  61811. selector: "testTwoAsyncPassesWithFinishedOnlyOneIsRun",
  61812. protocol: "tests",
  61813. fn: function (){
  61814. var self=this,$self=this;
  61815. var x;
  61816. return $core.withContext(function($ctx1) {
  61817. var $1;
  61818. $self["@flag"]="bad";
  61819. $self._timeout_((10));
  61820. x=(0);
  61821. $1=$self._async_((function(){
  61822. return $core.withContext(function($ctx2) {
  61823. $self._finished();
  61824. $ctx2.sendIdx["finished"]=1;
  61825. $self["@flag"]="ok";
  61826. x=$recv(x).__plus((1));
  61827. $ctx2.sendIdx["+"]=1;
  61828. return $self._assert_equals_(x,(1));
  61829. $ctx2.sendIdx["assert:equals:"]=1;
  61830. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  61831. }));
  61832. $ctx1.sendIdx["async:"]=1;
  61833. $self["@flag"]=$recv($1)._valueWithTimeout_((0));
  61834. $ctx1.sendIdx["valueWithTimeout:"]=1;
  61835. $self["@flag"]=$recv($self._async_((function(){
  61836. return $core.withContext(function($ctx2) {
  61837. $self._finished();
  61838. $self["@flag"]="ok";
  61839. x=$recv(x).__plus((1));
  61840. return $self._assert_equals_(x,(1));
  61841. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  61842. })))._valueWithTimeout_((0));
  61843. return self;
  61844. }, function($ctx1) {$ctx1.fill(self,"testTwoAsyncPassesWithFinishedOnlyOneIsRun",{x:x},$globals.SUnitAsyncTest)});
  61845. },
  61846. args: [],
  61847. 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.",
  61848. referencedClasses: [],
  61849. messageSends: ["timeout:", "valueWithTimeout:", "async:", "finished", "+", "assert:equals:"]
  61850. }),
  61851. $globals.SUnitAsyncTest);
  61852. });
  61853. define('amber/devel',[
  61854. './lang',
  61855. './brikz', // pre-fetch, dep of ./boot
  61856. './kernel-checks', // pre-fetch, dep of ./boot
  61857. './kernel-fundamentals', // pre-fetch, dep of ./boot
  61858. './kernel-language', // pre-fetch, dep of ./boot
  61859. './boot', // pre-fetch, class loader
  61860. './deploy', // pre-fetch, dep of ./lang
  61861. // --- packages of the development only Amber begin here ---
  61862. 'amber_core/Platform-DOM',
  61863. 'amber_core/SUnit',
  61864. 'amber_core/Compiler-Tests',
  61865. 'amber_core/Kernel-Tests',
  61866. 'amber_core/Platform-DOM-Tests',
  61867. 'amber_core/SUnit-Tests'
  61868. // --- packages of the development only Amber end here ---
  61869. ], function (amber) {
  61870. return amber;
  61871. });
  61872. define('amber_core/Platform-Node',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61873. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61874. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61875. $core.addPackage("Platform-Node");
  61876. ($core.packageDescriptors||$core.packages)["Platform-Node"].innerEval = function (expr) { return eval(expr); };
  61877. ($core.packageDescriptors||$core.packages)["Platform-Node"].transport = {"type":"amd","amdNamespace":"amber_core"};
  61878. $core.addClass("NodePlatform", $globals.Object, [], "Platform-Node");
  61879. $globals.NodePlatform.comment="I am `Platform` service implementation for node-like environment.";
  61880. $core.addMethod(
  61881. $core.method({
  61882. selector: "globals",
  61883. protocol: "accessing",
  61884. fn: function (){
  61885. var self=this,$self=this;
  61886. return global;
  61887. },
  61888. args: [],
  61889. source: "globals\x0a\x09^ global",
  61890. referencedClasses: [],
  61891. messageSends: []
  61892. }),
  61893. $globals.NodePlatform);
  61894. $core.addMethod(
  61895. $core.method({
  61896. selector: "newXhr",
  61897. protocol: "accessing",
  61898. fn: function (){
  61899. var self=this,$self=this;
  61900. return $core.withContext(function($ctx1) {
  61901. var $receiver;
  61902. if(($receiver = $globals.XMLHttpRequest) == null || $receiver.a$nil){
  61903. $self._error_("XMLHttpRequest not available.");
  61904. } else {
  61905. return $recv($globals.XMLHttpRequest)._new();
  61906. }
  61907. return self;
  61908. }, function($ctx1) {$ctx1.fill(self,"newXhr",{},$globals.NodePlatform)});
  61909. },
  61910. args: [],
  61911. source: "newXhr\x0a\x09XMLHttpRequest\x0a\x09\x09ifNotNil: [ ^ XMLHttpRequest new ]\x0a\x09\x09ifNil: [ self error: 'XMLHttpRequest not available.' ]",
  61912. referencedClasses: ["XMLHttpRequest"],
  61913. messageSends: ["ifNotNil:ifNil:", "new", "error:"]
  61914. }),
  61915. $globals.NodePlatform);
  61916. $core.addMethod(
  61917. $core.method({
  61918. selector: "initialize",
  61919. protocol: "testing",
  61920. fn: function (){
  61921. var self=this,$self=this;
  61922. return $core.withContext(function($ctx1) {
  61923. var $1;
  61924. $1=$self._isFeasible();
  61925. if($core.assert($1)){
  61926. $recv($globals.Platform)._registerIfNone_($self._new());
  61927. }
  61928. return self;
  61929. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.NodePlatform.a$cls)});
  61930. },
  61931. args: [],
  61932. source: "initialize\x0a\x09self isFeasible ifTrue: [ Platform registerIfNone: self new ]",
  61933. referencedClasses: ["Platform"],
  61934. messageSends: ["ifTrue:", "isFeasible", "registerIfNone:", "new"]
  61935. }),
  61936. $globals.NodePlatform.a$cls);
  61937. $core.addMethod(
  61938. $core.method({
  61939. selector: "isFeasible",
  61940. protocol: "testing",
  61941. fn: function (){
  61942. var self=this,$self=this;
  61943. return $core.withContext(function($ctx1) {
  61944. return typeof global !== "undefined";
  61945. return self;
  61946. }, function($ctx1) {$ctx1.fill(self,"isFeasible",{},$globals.NodePlatform.a$cls)});
  61947. },
  61948. args: [],
  61949. source: "isFeasible\x0a<inlineJS: 'return typeof global !== \x22undefined\x22'>",
  61950. referencedClasses: [],
  61951. messageSends: []
  61952. }),
  61953. $globals.NodePlatform.a$cls);
  61954. });
  61955. define('amber_cli/AmberCli',["amber/boot", "amber_core/Kernel-Objects"], function($boot){"use strict";
  61956. if(!("nilAsValue" in $boot))$boot.nilAsValue=$boot.nilAsReceiver;
  61957. var $core=$boot.api,nil=$boot.nilAsValue,$nil=$boot.nilAsReceiver,$recv=$boot.asReceiver,$globals=$boot.globals;
  61958. $core.addPackage("AmberCli");
  61959. ($core.packageDescriptors||$core.packages)["AmberCli"].innerEval = function (expr) { return eval(expr); };
  61960. ($core.packageDescriptors||$core.packages)["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  61961. $core.addClass("AmberCli", $globals.Object, [], "AmberCli");
  61962. $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.";
  61963. $core.addMethod(
  61964. $core.method({
  61965. selector: "commandLineSwitches",
  61966. protocol: "commandline",
  61967. fn: function (){
  61968. var self=this,$self=this;
  61969. var switches;
  61970. return $core.withContext(function($ctx1) {
  61971. switches=$recv($recv($self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  61972. return $core.withContext(function($ctx2) {
  61973. return $recv(each)._selector();
  61974. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  61975. }));
  61976. $ctx1.sendIdx["collect:"]=1;
  61977. switches=$recv(switches)._select_((function(each){
  61978. return $core.withContext(function($ctx2) {
  61979. return $recv(each)._match_("^[^:]*:$");
  61980. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  61981. }));
  61982. switches=$recv(switches)._collect_((function(each){
  61983. return $core.withContext(function($ctx2) {
  61984. return $recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  61985. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  61986. }));
  61987. return switches;
  61988. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.AmberCli.a$cls)});
  61989. },
  61990. args: [],
  61991. 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",
  61992. referencedClasses: [],
  61993. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"]
  61994. }),
  61995. $globals.AmberCli.a$cls);
  61996. $core.addMethod(
  61997. $core.method({
  61998. selector: "config:",
  61999. protocol: "commands",
  62000. fn: function (args){
  62001. var self=this,$self=this;
  62002. return $core.withContext(function($ctx1) {
  62003. $recv($recv($globals.Configurator)._new())._start();
  62004. return self;
  62005. }, function($ctx1) {$ctx1.fill(self,"config:",{args:args},$globals.AmberCli.a$cls)});
  62006. },
  62007. args: ["args"],
  62008. source: "config: args\x0a\x09Configurator new start",
  62009. referencedClasses: ["Configurator"],
  62010. messageSends: ["start", "new"]
  62011. }),
  62012. $globals.AmberCli.a$cls);
  62013. $core.addMethod(
  62014. $core.method({
  62015. selector: "handleArguments:",
  62016. protocol: "commandline",
  62017. fn: function (args){
  62018. var self=this,$self=this;
  62019. var selector;
  62020. return $core.withContext(function($ctx1) {
  62021. var $1;
  62022. $1=$recv(args)._first();
  62023. $ctx1.sendIdx["first"]=1;
  62024. selector=$self._selectorForCommandLineSwitch_($1);
  62025. $recv(args)._remove_($recv(args)._first());
  62026. $self._perform_withArguments_(selector,$recv($globals.Array)._with_(args));
  62027. return self;
  62028. }, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},$globals.AmberCli.a$cls)});
  62029. },
  62030. args: ["args"],
  62031. 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)",
  62032. referencedClasses: ["Array"],
  62033. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"]
  62034. }),
  62035. $globals.AmberCli.a$cls);
  62036. $core.addMethod(
  62037. $core.method({
  62038. selector: "help:",
  62039. protocol: "commands",
  62040. fn: function (args){
  62041. var self=this,$self=this;
  62042. return $core.withContext(function($ctx1) {
  62043. $recv($globals.Transcript)._show_("Available commands");
  62044. $recv($self._commandLineSwitches())._do_((function(each){
  62045. return $core.withContext(function($ctx2) {
  62046. return $recv(console)._log_(each);
  62047. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  62048. }));
  62049. return self;
  62050. }, function($ctx1) {$ctx1.fill(self,"help:",{args:args},$globals.AmberCli.a$cls)});
  62051. },
  62052. args: ["args"],
  62053. source: "help: args\x0a\x09Transcript show: 'Available commands'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  62054. referencedClasses: ["Transcript"],
  62055. messageSends: ["show:", "do:", "commandLineSwitches", "log:"]
  62056. }),
  62057. $globals.AmberCli.a$cls);
  62058. $core.addMethod(
  62059. $core.method({
  62060. selector: "init:",
  62061. protocol: "commands",
  62062. fn: function (args){
  62063. var self=this,$self=this;
  62064. return $core.withContext(function($ctx1) {
  62065. $recv($recv($globals.Initer)._new())._start();
  62066. return self;
  62067. }, function($ctx1) {$ctx1.fill(self,"init:",{args:args},$globals.AmberCli.a$cls)});
  62068. },
  62069. args: ["args"],
  62070. source: "init: args\x0a\x09Initer new start",
  62071. referencedClasses: ["Initer"],
  62072. messageSends: ["start", "new"]
  62073. }),
  62074. $globals.AmberCli.a$cls);
  62075. $core.addMethod(
  62076. $core.method({
  62077. selector: "main",
  62078. protocol: "startup",
  62079. fn: function (){
  62080. var self=this,$self=this;
  62081. var args,packageJSON;
  62082. return $core.withContext(function($ctx1) {
  62083. var $7,$6,$5,$4,$3,$2,$1;
  62084. var $early={};
  62085. try {
  62086. packageJSON=$recv(require)._value_("../package.json");
  62087. $7=$recv(packageJSON)._version();
  62088. $ctx1.sendIdx["version"]=1;
  62089. $6="Welcome to Amber CLI version ".__comma($7);
  62090. $5=$recv($6).__comma(" (Amber ");
  62091. $ctx1.sendIdx[","]=5;
  62092. $4=$recv($5).__comma($recv($globals.Smalltalk)._version());
  62093. $ctx1.sendIdx[","]=4;
  62094. $3=$recv($4).__comma(", NodeJS ");
  62095. $ctx1.sendIdx[","]=3;
  62096. $2=$recv($3).__comma($recv($recv(process)._versions())._node());
  62097. $ctx1.sendIdx[","]=2;
  62098. $1=$recv($2).__comma(").");
  62099. $ctx1.sendIdx[","]=1;
  62100. $recv($globals.Transcript)._show_($1);
  62101. args=$recv(process)._argv();
  62102. $recv(args)._removeFrom_to_((1),(2));
  62103. $recv(args)._ifEmpty_ifNotEmpty_((function(){
  62104. return $core.withContext(function($ctx2) {
  62105. return $self._help_(nil);
  62106. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62107. }),(function(){
  62108. return $core.withContext(function($ctx2) {
  62109. throw $early=[$self._handleArguments_(args)];
  62110. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  62111. }));
  62112. return self;
  62113. }
  62114. catch(e) {if(e===$early)return e[0]; throw e}
  62115. }, function($ctx1) {$ctx1.fill(self,"main",{args:args,packageJSON:packageJSON},$globals.AmberCli.a$cls)});
  62116. },
  62117. args: [],
  62118. 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]",
  62119. referencedClasses: ["Transcript", "Smalltalk"],
  62120. messageSends: ["value:", "show:", ",", "version", "node", "versions", "argv", "removeFrom:to:", "ifEmpty:ifNotEmpty:", "help:", "handleArguments:"]
  62121. }),
  62122. $globals.AmberCli.a$cls);
  62123. $core.addMethod(
  62124. $core.method({
  62125. selector: "repl:",
  62126. protocol: "commands",
  62127. fn: function (args){
  62128. var self=this,$self=this;
  62129. return $core.withContext(function($ctx1) {
  62130. return $recv($recv($globals.Repl)._new())._createInterface();
  62131. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},$globals.AmberCli.a$cls)});
  62132. },
  62133. args: ["args"],
  62134. source: "repl: args\x0a\x09^ Repl new createInterface",
  62135. referencedClasses: ["Repl"],
  62136. messageSends: ["createInterface", "new"]
  62137. }),
  62138. $globals.AmberCli.a$cls);
  62139. $core.addMethod(
  62140. $core.method({
  62141. selector: "selectorForCommandLineSwitch:",
  62142. protocol: "commandline",
  62143. fn: function (aSwitch){
  62144. var self=this,$self=this;
  62145. var command,selector;
  62146. return $core.withContext(function($ctx1) {
  62147. var $1;
  62148. $1=$recv($self._commandLineSwitches())._includes_(aSwitch);
  62149. if($core.assert($1)){
  62150. selector=$recv($recv(aSwitch)._replace_with_("-[a-z]",(function(each){
  62151. return $core.withContext(function($ctx2) {
  62152. return $recv($recv(each)._second())._asUppercase();
  62153. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  62154. }))).__comma(":");
  62155. selector;
  62156. } else {
  62157. selector="help:";
  62158. selector;
  62159. }
  62160. return selector;
  62161. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},$globals.AmberCli.a$cls)});
  62162. },
  62163. args: ["aSwitch"],
  62164. 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",
  62165. referencedClasses: [],
  62166. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"]
  62167. }),
  62168. $globals.AmberCli.a$cls);
  62169. $core.addMethod(
  62170. $core.method({
  62171. selector: "serve:",
  62172. protocol: "commands",
  62173. fn: function (args){
  62174. var self=this,$self=this;
  62175. return $core.withContext(function($ctx1) {
  62176. return $recv($recv($globals.FileServer)._createServerWithArguments_(args))._start();
  62177. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},$globals.AmberCli.a$cls)});
  62178. },
  62179. args: ["args"],
  62180. source: "serve: args\x0a\x09^ (FileServer createServerWithArguments: args) start",
  62181. referencedClasses: ["FileServer"],
  62182. messageSends: ["start", "createServerWithArguments:"]
  62183. }),
  62184. $globals.AmberCli.a$cls);
  62185. $core.addMethod(
  62186. $core.method({
  62187. selector: "version:",
  62188. protocol: "commands",
  62189. fn: function (arguments_){
  62190. var self=this,$self=this;
  62191. return self;
  62192. },
  62193. args: ["arguments"],
  62194. source: "version: arguments",
  62195. referencedClasses: [],
  62196. messageSends: []
  62197. }),
  62198. $globals.AmberCli.a$cls);
  62199. $core.addClass("BaseFileManipulator", $globals.Object, ["path", "fs"], "AmberCli");
  62200. $core.addMethod(
  62201. $core.method({
  62202. selector: "dirname",
  62203. protocol: "private",
  62204. fn: function (){
  62205. var self=this,$self=this;
  62206. return $core.withContext(function($ctx1) {
  62207. return __dirname;
  62208. return self;
  62209. }, function($ctx1) {$ctx1.fill(self,"dirname",{},$globals.BaseFileManipulator)});
  62210. },
  62211. args: [],
  62212. source: "dirname\x0a\x09<inlineJS: 'return __dirname'>",
  62213. referencedClasses: [],
  62214. messageSends: []
  62215. }),
  62216. $globals.BaseFileManipulator);
  62217. $core.addMethod(
  62218. $core.method({
  62219. selector: "initialize",
  62220. protocol: "initialization",
  62221. fn: function (){
  62222. var self=this,$self=this;
  62223. return $core.withContext(function($ctx1) {
  62224. (
  62225. $ctx1.supercall = true,
  62226. ($globals.BaseFileManipulator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62227. $ctx1.supercall = false;
  62228. $self["@path"]=$recv(require)._value_("path");
  62229. $ctx1.sendIdx["value:"]=1;
  62230. $self["@fs"]=$recv(require)._value_("fs");
  62231. return self;
  62232. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.BaseFileManipulator)});
  62233. },
  62234. args: [],
  62235. source: "initialize\x0a\x09super initialize.\x0a\x09path := require value: 'path'.\x0a\x09fs := require value: 'fs'",
  62236. referencedClasses: [],
  62237. messageSends: ["initialize", "value:"]
  62238. }),
  62239. $globals.BaseFileManipulator);
  62240. $core.addMethod(
  62241. $core.method({
  62242. selector: "rootDirname",
  62243. protocol: "private",
  62244. fn: function (){
  62245. var self=this,$self=this;
  62246. return $core.withContext(function($ctx1) {
  62247. return $recv($self["@path"])._join_with_($self._dirname(),"..");
  62248. }, function($ctx1) {$ctx1.fill(self,"rootDirname",{},$globals.BaseFileManipulator)});
  62249. },
  62250. args: [],
  62251. source: "rootDirname\x0a\x09^ path join: self dirname with: '..'",
  62252. referencedClasses: [],
  62253. messageSends: ["join:with:", "dirname"]
  62254. }),
  62255. $globals.BaseFileManipulator);
  62256. $core.addClass("Configurator", $globals.BaseFileManipulator, [], "AmberCli");
  62257. $core.addMethod(
  62258. $core.method({
  62259. selector: "initialize",
  62260. protocol: "initialization",
  62261. fn: function (){
  62262. var self=this,$self=this;
  62263. return $core.withContext(function($ctx1) {
  62264. (
  62265. $ctx1.supercall = true,
  62266. ($globals.Configurator.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62267. $ctx1.supercall = false;
  62268. return self;
  62269. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Configurator)});
  62270. },
  62271. args: [],
  62272. source: "initialize\x0a\x09super initialize",
  62273. referencedClasses: [],
  62274. messageSends: ["initialize"]
  62275. }),
  62276. $globals.Configurator);
  62277. $core.addMethod(
  62278. $core.method({
  62279. selector: "start",
  62280. protocol: "action",
  62281. fn: function (){
  62282. var self=this,$self=this;
  62283. return $core.withContext(function($ctx1) {
  62284. var $receiver;
  62285. $self._writeConfigThenDo_((function(err){
  62286. return $core.withContext(function($ctx2) {
  62287. if(($receiver = err) == null || $receiver.a$nil){
  62288. return $recv(process)._exit();
  62289. } else {
  62290. return $recv(process)._exit_((111));
  62291. }
  62292. }, function($ctx2) {$ctx2.fillBlock({err:err},$ctx1,1)});
  62293. }));
  62294. return self;
  62295. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Configurator)});
  62296. },
  62297. args: [],
  62298. source: "start\x0a\x09self writeConfigThenDo: [ :err | err\x0a\x09\x09ifNotNil: [ process exit: 111 ]\x0a\x09\x09ifNil: [ process exit ]]",
  62299. referencedClasses: [],
  62300. messageSends: ["writeConfigThenDo:", "ifNotNil:ifNil:", "exit:", "exit"]
  62301. }),
  62302. $globals.Configurator);
  62303. $core.addMethod(
  62304. $core.method({
  62305. selector: "writeConfigThenDo:",
  62306. protocol: "action",
  62307. fn: function (aBlock){
  62308. var self=this,$self=this;
  62309. return $core.withContext(function($ctx1) {
  62310. $recv($recv($recv(require)._value_("@ambers/sdk"))._configBuilder())._writeConfig_toFile_thenDo_($recv(process)._cwd(),"config.js",aBlock);
  62311. return self;
  62312. }, function($ctx1) {$ctx1.fill(self,"writeConfigThenDo:",{aBlock:aBlock},$globals.Configurator)});
  62313. },
  62314. args: ["aBlock"],
  62315. source: "writeConfigThenDo: aBlock\x0a\x09(require value: '@ambers/sdk') configBuilder\x0a\x09\x09writeConfig: process cwd\x0a\x09\x09toFile: 'config.js'\x0a\x09\x09thenDo: aBlock",
  62316. referencedClasses: [],
  62317. messageSends: ["writeConfig:toFile:thenDo:", "configBuilder", "value:", "cwd"]
  62318. }),
  62319. $globals.Configurator);
  62320. $core.addClass("FileServer", $globals.BaseFileManipulator, ["http", "url", "host", "port", "basePath", "util", "username", "password", "fallbackPage"], "AmberCli");
  62321. $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.";
  62322. $core.addMethod(
  62323. $core.method({
  62324. selector: "base64Decode:",
  62325. protocol: "private",
  62326. fn: function (aString){
  62327. var self=this,$self=this;
  62328. return $core.withContext(function($ctx1) {
  62329. return (new Buffer(aString, "base64").toString());
  62330. return self;
  62331. }, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},$globals.FileServer)});
  62332. },
  62333. args: ["aString"],
  62334. source: "base64Decode: aString\x0a\x09<inlineJS: 'return (new Buffer(aString, \x22base64\x22).toString())'>",
  62335. referencedClasses: [],
  62336. messageSends: []
  62337. }),
  62338. $globals.FileServer);
  62339. $core.addMethod(
  62340. $core.method({
  62341. selector: "basePath",
  62342. protocol: "accessing",
  62343. fn: function (){
  62344. var self=this,$self=this;
  62345. return $core.withContext(function($ctx1) {
  62346. var $1,$receiver;
  62347. $1=$self["@basePath"];
  62348. if(($receiver = $1) == null || $receiver.a$nil){
  62349. return $recv($self._class())._defaultBasePath();
  62350. } else {
  62351. return $1;
  62352. }
  62353. }, function($ctx1) {$ctx1.fill(self,"basePath",{},$globals.FileServer)});
  62354. },
  62355. args: [],
  62356. source: "basePath\x0a\x09^ basePath ifNil: [self class defaultBasePath]",
  62357. referencedClasses: [],
  62358. messageSends: ["ifNil:", "defaultBasePath", "class"]
  62359. }),
  62360. $globals.FileServer);
  62361. $core.addMethod(
  62362. $core.method({
  62363. selector: "basePath:",
  62364. protocol: "accessing",
  62365. fn: function (aString){
  62366. var self=this,$self=this;
  62367. return $core.withContext(function($ctx1) {
  62368. $self["@basePath"]=aString;
  62369. $self._validateBasePath();
  62370. return self;
  62371. }, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},$globals.FileServer)});
  62372. },
  62373. args: ["aString"],
  62374. source: "basePath: aString\x0a\x09basePath := aString.\x0a\x09self validateBasePath.",
  62375. referencedClasses: [],
  62376. messageSends: ["validateBasePath"]
  62377. }),
  62378. $globals.FileServer);
  62379. $core.addMethod(
  62380. $core.method({
  62381. selector: "checkDirectoryLayout",
  62382. protocol: "initialization",
  62383. fn: function (){
  62384. var self=this,$self=this;
  62385. return $core.withContext(function($ctx1) {
  62386. var $1;
  62387. $1=$recv($self["@fs"])._existsSync_($self._withBasePath_("index.html"));
  62388. if(!$core.assert($1)){
  62389. $recv(console)._warn_("Warning: project directory does not contain index.html.");
  62390. $ctx1.sendIdx["warn:"]=1;
  62391. $recv(console)._warn_(" You can specify the directory containing index.html with --base-path.");
  62392. $ctx1.sendIdx["warn:"]=2;
  62393. $recv(console)._warn_(" You can also specify a page to be served by default,");
  62394. $ctx1.sendIdx["warn:"]=3;
  62395. $recv(console)._warn_(" for all paths that do not map to a file, with --fallback-page.");
  62396. }
  62397. return self;
  62398. }, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},$globals.FileServer)});
  62399. },
  62400. args: [],
  62401. 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.'].",
  62402. referencedClasses: [],
  62403. messageSends: ["ifFalse:", "existsSync:", "withBasePath:", "warn:"]
  62404. }),
  62405. $globals.FileServer);
  62406. $core.addMethod(
  62407. $core.method({
  62408. selector: "fallbackPage",
  62409. protocol: "accessing",
  62410. fn: function (){
  62411. var self=this,$self=this;
  62412. return $self["@fallbackPage"];
  62413. },
  62414. args: [],
  62415. source: "fallbackPage\x0a\x09^ fallbackPage",
  62416. referencedClasses: [],
  62417. messageSends: []
  62418. }),
  62419. $globals.FileServer);
  62420. $core.addMethod(
  62421. $core.method({
  62422. selector: "fallbackPage:",
  62423. protocol: "accessing",
  62424. fn: function (aString){
  62425. var self=this,$self=this;
  62426. $self["@fallbackPage"]=aString;
  62427. return self;
  62428. },
  62429. args: ["aString"],
  62430. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  62431. referencedClasses: [],
  62432. messageSends: []
  62433. }),
  62434. $globals.FileServer);
  62435. $core.addMethod(
  62436. $core.method({
  62437. selector: "handleGETRequest:respondTo:",
  62438. protocol: "request handling",
  62439. fn: function (aRequest,aResponse){
  62440. var self=this,$self=this;
  62441. var uri,filename;
  62442. return $core.withContext(function($ctx1) {
  62443. var $1;
  62444. uri=$recv($self["@url"])._parse_($recv(aRequest)._url());
  62445. filename=$recv($self["@path"])._join_with_($self._basePath(),$recv(uri)._pathname());
  62446. $recv($self["@fs"])._exists_do_(filename,(function(aBoolean){
  62447. return $core.withContext(function($ctx2) {
  62448. if($core.assert(aBoolean)){
  62449. $1=$recv($recv($self["@fs"])._statSync_(filename))._isDirectory();
  62450. if($core.assert($1)){
  62451. return $self._respondDirectoryNamed_from_to_(filename,uri,aResponse);
  62452. } else {
  62453. return $self._respondFileNamed_to_(filename,aResponse);
  62454. }
  62455. } else {
  62456. return $self._respondNotFoundTo_(aResponse);
  62457. }
  62458. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)});
  62459. }));
  62460. return self;
  62461. }, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},$globals.FileServer)});
  62462. },
  62463. args: ["aRequest", "aResponse"],
  62464. 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]]]",
  62465. referencedClasses: [],
  62466. messageSends: ["parse:", "url", "join:with:", "basePath", "pathname", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "ifTrue:ifFalse:", "isDirectory", "statSync:", "respondDirectoryNamed:from:to:", "respondFileNamed:to:"]
  62467. }),
  62468. $globals.FileServer);
  62469. $core.addMethod(
  62470. $core.method({
  62471. selector: "handleOPTIONSRequest:respondTo:",
  62472. protocol: "request handling",
  62473. fn: function (aRequest,aResponse){
  62474. var self=this,$self=this;
  62475. return $core.withContext(function($ctx1) {
  62476. $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)]));
  62477. $recv(aResponse)._end();
  62478. return self;
  62479. }, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62480. },
  62481. args: ["aRequest", "aResponse"],
  62482. 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",
  62483. referencedClasses: [],
  62484. messageSends: ["writeHead:options:", "end"]
  62485. }),
  62486. $globals.FileServer);
  62487. $core.addMethod(
  62488. $core.method({
  62489. selector: "handlePUTRequest:respondTo:",
  62490. protocol: "request handling",
  62491. fn: function (aRequest,aResponse){
  62492. var self=this,$self=this;
  62493. var file,stream;
  62494. return $core.withContext(function($ctx1) {
  62495. var $1,$2,$3,$4;
  62496. $1=$self._isAuthenticated_(aRequest);
  62497. if(!$core.assert($1)){
  62498. $self._respondAuthenticationRequiredTo_(aResponse);
  62499. return nil;
  62500. }
  62501. file=".".__comma($recv(aRequest)._url());
  62502. $ctx1.sendIdx[","]=1;
  62503. stream=$recv($self["@fs"])._createWriteStream_(file);
  62504. $recv(stream)._on_do_("error",(function(error){
  62505. return $core.withContext(function($ctx2) {
  62506. $2=console;
  62507. $3="Error creating WriteStream for file ".__comma(file);
  62508. $ctx2.sendIdx[","]=2;
  62509. $recv($2)._warn_($3);
  62510. $ctx2.sendIdx["warn:"]=1;
  62511. $recv(console)._warn_(" Did you forget to create the necessary directory in your project (often /src)?");
  62512. $ctx2.sendIdx["warn:"]=2;
  62513. $recv(console)._warn_(" The exact error is: ".__comma(error));
  62514. return $self._respondNotCreatedTo_(aResponse);
  62515. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  62516. }));
  62517. $ctx1.sendIdx["on:do:"]=1;
  62518. $recv(stream)._on_do_("close",(function(){
  62519. return $core.withContext(function($ctx2) {
  62520. return $self._respondCreatedTo_(aResponse);
  62521. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  62522. }));
  62523. $ctx1.sendIdx["on:do:"]=2;
  62524. $recv(aRequest)._setEncoding_("utf8");
  62525. $recv(aRequest)._on_do_("data",(function(data){
  62526. return $core.withContext(function($ctx2) {
  62527. return $recv(stream)._write_(data);
  62528. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)});
  62529. }));
  62530. $ctx1.sendIdx["on:do:"]=3;
  62531. $recv(aRequest)._on_do_("end",(function(){
  62532. return $core.withContext(function($ctx2) {
  62533. $4=$recv(stream)._writable();
  62534. if($core.assert($4)){
  62535. return $recv(stream)._end();
  62536. }
  62537. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62538. }));
  62539. return self;
  62540. }, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},$globals.FileServer)});
  62541. },
  62542. args: ["aRequest", "aResponse"],
  62543. 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]]",
  62544. referencedClasses: [],
  62545. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"]
  62546. }),
  62547. $globals.FileServer);
  62548. $core.addMethod(
  62549. $core.method({
  62550. selector: "handleRequest:respondTo:",
  62551. protocol: "request handling",
  62552. fn: function (aRequest,aResponse){
  62553. var self=this,$self=this;
  62554. return $core.withContext(function($ctx1) {
  62555. var $2,$1,$4,$3,$5;
  62556. $2=$recv(aRequest)._method();
  62557. $ctx1.sendIdx["method"]=1;
  62558. $1=$recv($2).__eq("PUT");
  62559. $ctx1.sendIdx["="]=1;
  62560. if($core.assert($1)){
  62561. $self._handlePUTRequest_respondTo_(aRequest,aResponse);
  62562. }
  62563. $4=$recv(aRequest)._method();
  62564. $ctx1.sendIdx["method"]=2;
  62565. $3=$recv($4).__eq("GET");
  62566. $ctx1.sendIdx["="]=2;
  62567. if($core.assert($3)){
  62568. $self._handleGETRequest_respondTo_(aRequest,aResponse);
  62569. }
  62570. $5=$recv($recv(aRequest)._method()).__eq("OPTIONS");
  62571. if($core.assert($5)){
  62572. $self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  62573. }
  62574. return self;
  62575. }, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},$globals.FileServer)});
  62576. },
  62577. args: ["aRequest", "aResponse"],
  62578. 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]",
  62579. referencedClasses: [],
  62580. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"]
  62581. }),
  62582. $globals.FileServer);
  62583. $core.addMethod(
  62584. $core.method({
  62585. selector: "host",
  62586. protocol: "accessing",
  62587. fn: function (){
  62588. var self=this,$self=this;
  62589. return $self["@host"];
  62590. },
  62591. args: [],
  62592. source: "host\x0a\x09^ host",
  62593. referencedClasses: [],
  62594. messageSends: []
  62595. }),
  62596. $globals.FileServer);
  62597. $core.addMethod(
  62598. $core.method({
  62599. selector: "host:",
  62600. protocol: "accessing",
  62601. fn: function (hostname){
  62602. var self=this,$self=this;
  62603. $self["@host"]=hostname;
  62604. return self;
  62605. },
  62606. args: ["hostname"],
  62607. source: "host: hostname\x0a\x09host := hostname",
  62608. referencedClasses: [],
  62609. messageSends: []
  62610. }),
  62611. $globals.FileServer);
  62612. $core.addMethod(
  62613. $core.method({
  62614. selector: "initialize",
  62615. protocol: "initialization",
  62616. fn: function (){
  62617. var self=this,$self=this;
  62618. return $core.withContext(function($ctx1) {
  62619. var $1;
  62620. (
  62621. $ctx1.supercall = true,
  62622. ($globals.FileServer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  62623. $ctx1.supercall = false;
  62624. $self["@http"]=$self._require_("http");
  62625. $ctx1.sendIdx["require:"]=1;
  62626. $self["@util"]=$self._require_("util");
  62627. $ctx1.sendIdx["require:"]=2;
  62628. $self["@url"]=$self._require_("url");
  62629. $1=$self._class();
  62630. $ctx1.sendIdx["class"]=1;
  62631. $self["@host"]=$recv($1)._defaultHost();
  62632. $self["@port"]=$recv($self._class())._defaultPort();
  62633. $self["@username"]=nil;
  62634. $self["@password"]=nil;
  62635. $self["@fallbackPage"]=nil;
  62636. return self;
  62637. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.FileServer)});
  62638. },
  62639. args: [],
  62640. 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.",
  62641. referencedClasses: [],
  62642. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"]
  62643. }),
  62644. $globals.FileServer);
  62645. $core.addMethod(
  62646. $core.method({
  62647. selector: "isAuthenticated:",
  62648. protocol: "private",
  62649. fn: function (aRequest){
  62650. var self=this,$self=this;
  62651. var header,token,auth,parts;
  62652. return $core.withContext(function($ctx1) {
  62653. var $2,$1,$3,$4,$5,$8,$9,$7,$6,$receiver;
  62654. var $early={};
  62655. try {
  62656. $2=$recv($self["@username"])._isNil();
  62657. $ctx1.sendIdx["isNil"]=1;
  62658. $1=$recv($2)._and_((function(){
  62659. return $core.withContext(function($ctx2) {
  62660. return $recv($self["@password"])._isNil();
  62661. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  62662. }));
  62663. $ctx1.sendIdx["and:"]=1;
  62664. if($core.assert($1)){
  62665. return true;
  62666. }
  62667. $3=$recv($recv(aRequest)._headers())._at_("authorization");
  62668. $ctx1.sendIdx["at:"]=1;
  62669. if(($receiver = $3) == null || $receiver.a$nil){
  62670. header="";
  62671. } else {
  62672. header=$3;
  62673. }
  62674. $recv(header)._ifEmpty_ifNotEmpty_((function(){
  62675. throw $early=[false];
  62676. }),(function(){
  62677. return $core.withContext(function($ctx2) {
  62678. $4=$recv(header)._tokenize_(" ");
  62679. $ctx2.sendIdx["tokenize:"]=1;
  62680. if(($receiver = $4) == null || $receiver.a$nil){
  62681. token="";
  62682. } else {
  62683. token=$4;
  62684. }
  62685. $5=$recv(token)._at_((2));
  62686. $ctx2.sendIdx["at:"]=2;
  62687. auth=$self._base64Decode_($5);
  62688. parts=$recv(auth)._tokenize_(":");
  62689. $8=$self["@username"];
  62690. $9=$recv(parts)._at_((1));
  62691. $ctx2.sendIdx["at:"]=3;
  62692. $7=$recv($8).__eq($9);
  62693. $ctx2.sendIdx["="]=1;
  62694. $6=$recv($7)._and_((function(){
  62695. return $core.withContext(function($ctx3) {
  62696. return $recv($self["@password"]).__eq($recv(parts)._at_((2)));
  62697. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,7)});
  62698. }));
  62699. if($core.assert($6)){
  62700. throw $early=[true];
  62701. } else {
  62702. throw $early=[false];
  62703. }
  62704. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  62705. }));
  62706. return self;
  62707. }
  62708. catch(e) {if(e===$early)return e[0]; throw e}
  62709. }, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},$globals.FileServer)});
  62710. },
  62711. args: ["aRequest"],
  62712. 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].",
  62713. referencedClasses: [],
  62714. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifEmpty:ifNotEmpty:", "tokenize:", "base64Decode:", "ifTrue:ifFalse:", "="]
  62715. }),
  62716. $globals.FileServer);
  62717. $core.addMethod(
  62718. $core.method({
  62719. selector: "password:",
  62720. protocol: "accessing",
  62721. fn: function (aPassword){
  62722. var self=this,$self=this;
  62723. $self["@password"]=aPassword;
  62724. return self;
  62725. },
  62726. args: ["aPassword"],
  62727. source: "password: aPassword\x0a\x09password := aPassword.",
  62728. referencedClasses: [],
  62729. messageSends: []
  62730. }),
  62731. $globals.FileServer);
  62732. $core.addMethod(
  62733. $core.method({
  62734. selector: "port",
  62735. protocol: "accessing",
  62736. fn: function (){
  62737. var self=this,$self=this;
  62738. return $self["@port"];
  62739. },
  62740. args: [],
  62741. source: "port\x0a\x09^ port",
  62742. referencedClasses: [],
  62743. messageSends: []
  62744. }),
  62745. $globals.FileServer);
  62746. $core.addMethod(
  62747. $core.method({
  62748. selector: "port:",
  62749. protocol: "accessing",
  62750. fn: function (aNumber){
  62751. var self=this,$self=this;
  62752. $self["@port"]=aNumber;
  62753. return self;
  62754. },
  62755. args: ["aNumber"],
  62756. source: "port: aNumber\x0a\x09port := aNumber",
  62757. referencedClasses: [],
  62758. messageSends: []
  62759. }),
  62760. $globals.FileServer);
  62761. $core.addMethod(
  62762. $core.method({
  62763. selector: "require:",
  62764. protocol: "private",
  62765. fn: function (aModuleString){
  62766. var self=this,$self=this;
  62767. return $core.withContext(function($ctx1) {
  62768. return $recv(require)._value_(aModuleString);
  62769. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},$globals.FileServer)});
  62770. },
  62771. args: ["aModuleString"],
  62772. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  62773. referencedClasses: [],
  62774. messageSends: ["value:"]
  62775. }),
  62776. $globals.FileServer);
  62777. $core.addMethod(
  62778. $core.method({
  62779. selector: "respondAuthenticationRequiredTo:",
  62780. protocol: "request handling",
  62781. fn: function (aResponse){
  62782. var self=this,$self=this;
  62783. return $core.withContext(function($ctx1) {
  62784. $recv(aResponse)._writeHead_options_((401),$globals.HashedCollection._newFromPairs_(["WWW-Authenticate","Basic realm=\x22Secured Developer Area\x22"]));
  62785. $recv(aResponse)._write_("<html><body>Authentication needed</body></html>");
  62786. $recv(aResponse)._end();
  62787. return self;
  62788. }, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},$globals.FileServer)});
  62789. },
  62790. args: ["aResponse"],
  62791. 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.",
  62792. referencedClasses: [],
  62793. messageSends: ["writeHead:options:", "write:", "end"]
  62794. }),
  62795. $globals.FileServer);
  62796. $core.addMethod(
  62797. $core.method({
  62798. selector: "respondCreatedTo:",
  62799. protocol: "request handling",
  62800. fn: function (aResponse){
  62801. var self=this,$self=this;
  62802. return $core.withContext(function($ctx1) {
  62803. $recv(aResponse)._writeHead_options_((201),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62804. $recv(aResponse)._end();
  62805. return self;
  62806. }, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62807. },
  62808. args: ["aResponse"],
  62809. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62810. referencedClasses: [],
  62811. messageSends: ["writeHead:options:", "end"]
  62812. }),
  62813. $globals.FileServer);
  62814. $core.addMethod(
  62815. $core.method({
  62816. selector: "respondDirectoryNamed:from:to:",
  62817. protocol: "request handling",
  62818. fn: function (aDirname,aUrl,aResponse){
  62819. var self=this,$self=this;
  62820. return $core.withContext(function($ctx1) {
  62821. var $2,$1,$3,$5,$7,$6,$4,$receiver;
  62822. $2=$recv(aUrl)._pathname();
  62823. $ctx1.sendIdx["pathname"]=1;
  62824. $1=$recv($2)._endsWith_("/");
  62825. if($core.assert($1)){
  62826. $3=$recv(aDirname).__comma("index.html");
  62827. $ctx1.sendIdx[","]=1;
  62828. $self._respondFileNamed_to_($3,aResponse);
  62829. } else {
  62830. $5=$recv($recv(aUrl)._pathname()).__comma("/");
  62831. $7=$recv(aUrl)._search();
  62832. if(($receiver = $7) == null || $receiver.a$nil){
  62833. $6="";
  62834. } else {
  62835. $6=$7;
  62836. }
  62837. $4=$recv($5).__comma($6);
  62838. $ctx1.sendIdx[","]=2;
  62839. $self._respondRedirect_to_($4,aResponse);
  62840. }
  62841. return self;
  62842. }, function($ctx1) {$ctx1.fill(self,"respondDirectoryNamed:from:to:",{aDirname:aDirname,aUrl:aUrl,aResponse:aResponse},$globals.FileServer)});
  62843. },
  62844. args: ["aDirname", "aUrl", "aResponse"],
  62845. 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]",
  62846. referencedClasses: [],
  62847. messageSends: ["ifTrue:ifFalse:", "endsWith:", "pathname", "respondFileNamed:to:", ",", "respondRedirect:to:", "ifNil:", "search"]
  62848. }),
  62849. $globals.FileServer);
  62850. $core.addMethod(
  62851. $core.method({
  62852. selector: "respondFileNamed:to:",
  62853. protocol: "request handling",
  62854. fn: function (aFilename,aResponse){
  62855. var self=this,$self=this;
  62856. var type,filename;
  62857. return $core.withContext(function($ctx1) {
  62858. var $1,$2,$3,$4;
  62859. filename=aFilename;
  62860. $recv($self["@fs"])._readFile_do_(filename,(function(ex,file){
  62861. return $core.withContext(function($ctx2) {
  62862. $1=$recv(ex)._notNil();
  62863. if($core.assert($1)){
  62864. $2=console;
  62865. $3=$recv(filename).__comma(" does not exist");
  62866. $ctx2.sendIdx[","]=1;
  62867. $recv($2)._log_($3);
  62868. return $self._respondNotFoundTo_(aResponse);
  62869. } else {
  62870. type=$recv($self._class())._mimeTypeFor_(filename);
  62871. $4=$recv(type).__eq("application/javascript");
  62872. if($core.assert($4)){
  62873. type=$recv(type).__comma(";charset=utf-8");
  62874. type;
  62875. }
  62876. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type",type]));
  62877. $recv(aResponse)._write_encoding_(file,"binary");
  62878. return $recv(aResponse)._end();
  62879. }
  62880. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,1)});
  62881. }));
  62882. return self;
  62883. }, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},$globals.FileServer)});
  62884. },
  62885. args: ["aFilename", "aResponse"],
  62886. 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]]",
  62887. referencedClasses: [],
  62888. messageSends: ["readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", ",", "respondNotFoundTo:", "mimeTypeFor:", "class", "ifTrue:", "=", "writeHead:options:", "write:encoding:", "end"]
  62889. }),
  62890. $globals.FileServer);
  62891. $core.addMethod(
  62892. $core.method({
  62893. selector: "respondInternalErrorTo:",
  62894. protocol: "request handling",
  62895. fn: function (aResponse){
  62896. var self=this,$self=this;
  62897. return $core.withContext(function($ctx1) {
  62898. $recv(aResponse)._writeHead_options_((500),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62899. $recv(aResponse)._write_("500 Internal server error");
  62900. $recv(aResponse)._end();
  62901. return self;
  62902. }, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},$globals.FileServer)});
  62903. },
  62904. args: ["aResponse"],
  62905. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  62906. referencedClasses: [],
  62907. messageSends: ["writeHead:options:", "write:", "end"]
  62908. }),
  62909. $globals.FileServer);
  62910. $core.addMethod(
  62911. $core.method({
  62912. selector: "respondNotCreatedTo:",
  62913. protocol: "request handling",
  62914. fn: function (aResponse){
  62915. var self=this,$self=this;
  62916. return $core.withContext(function($ctx1) {
  62917. $recv(aResponse)._writeHead_options_((400),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain"]));
  62918. $recv(aResponse)._write_("File could not be created. Did you forget to create the src directory on the server?");
  62919. $recv(aResponse)._end();
  62920. return self;
  62921. }, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},$globals.FileServer)});
  62922. },
  62923. args: ["aResponse"],
  62924. 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.",
  62925. referencedClasses: [],
  62926. messageSends: ["writeHead:options:", "write:", "end"]
  62927. }),
  62928. $globals.FileServer);
  62929. $core.addMethod(
  62930. $core.method({
  62931. selector: "respondNotFoundTo:",
  62932. protocol: "request handling",
  62933. fn: function (aResponse){
  62934. var self=this,$self=this;
  62935. return $core.withContext(function($ctx1) {
  62936. var $2,$1;
  62937. $2=$self._fallbackPage();
  62938. $ctx1.sendIdx["fallbackPage"]=1;
  62939. $1=$recv($2)._isNil();
  62940. if(!$core.assert($1)){
  62941. return $self._respondFileNamed_to_($self._fallbackPage(),aResponse);
  62942. }
  62943. $recv(aResponse)._writeHead_options_((404),$globals.HashedCollection._newFromPairs_(["Content-Type","text/html"]));
  62944. $recv(aResponse)._write_("<html><body><p>404 Not found</p>");
  62945. $ctx1.sendIdx["write:"]=1;
  62946. $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>");
  62947. $ctx1.sendIdx["write:"]=2;
  62948. $recv(aResponse)._write_("<li>create an index.html in the served directory.</li>");
  62949. $ctx1.sendIdx["write:"]=3;
  62950. $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>");
  62951. $ctx1.sendIdx["write:"]=4;
  62952. $recv(aResponse)._write_("<li>change the directory to be served with the \x22--base-path\x22 option.</li>");
  62953. $ctx1.sendIdx["write:"]=5;
  62954. $recv(aResponse)._write_("</ul></p></body></html>");
  62955. $recv(aResponse)._end();
  62956. return self;
  62957. }, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},$globals.FileServer)});
  62958. },
  62959. args: ["aResponse"],
  62960. 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",
  62961. referencedClasses: [],
  62962. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "write:", "end"]
  62963. }),
  62964. $globals.FileServer);
  62965. $core.addMethod(
  62966. $core.method({
  62967. selector: "respondOKTo:",
  62968. protocol: "request handling",
  62969. fn: function (aResponse){
  62970. var self=this,$self=this;
  62971. return $core.withContext(function($ctx1) {
  62972. $recv(aResponse)._writeHead_options_((200),$globals.HashedCollection._newFromPairs_(["Content-Type","text/plain","Access-Control-Allow-Origin","*"]));
  62973. $recv(aResponse)._end();
  62974. return self;
  62975. }, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},$globals.FileServer)});
  62976. },
  62977. args: ["aResponse"],
  62978. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  62979. referencedClasses: [],
  62980. messageSends: ["writeHead:options:", "end"]
  62981. }),
  62982. $globals.FileServer);
  62983. $core.addMethod(
  62984. $core.method({
  62985. selector: "respondRedirect:to:",
  62986. protocol: "request handling",
  62987. fn: function (aString,aResponse){
  62988. var self=this,$self=this;
  62989. return $core.withContext(function($ctx1) {
  62990. $recv(aResponse)._writeHead_options_((303),$globals.HashedCollection._newFromPairs_(["Location",aString]));
  62991. $recv(aResponse)._end();
  62992. return self;
  62993. }, function($ctx1) {$ctx1.fill(self,"respondRedirect:to:",{aString:aString,aResponse:aResponse},$globals.FileServer)});
  62994. },
  62995. args: ["aString", "aResponse"],
  62996. source: "respondRedirect: aString to: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 303 options: #{'Location' -> aString};\x0a\x09\x09end.",
  62997. referencedClasses: [],
  62998. messageSends: ["writeHead:options:", "end"]
  62999. }),
  63000. $globals.FileServer);
  63001. $core.addMethod(
  63002. $core.method({
  63003. selector: "start",
  63004. protocol: "starting",
  63005. fn: function (){
  63006. var self=this,$self=this;
  63007. return $core.withContext(function($ctx1) {
  63008. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5;
  63009. $self._checkDirectoryLayout();
  63010. $1=$recv($self["@http"])._createServer_((function(request,response){
  63011. return $core.withContext(function($ctx2) {
  63012. return $self._handleRequest_respondTo_(request,response);
  63013. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)});
  63014. }));
  63015. $recv($1)._on_do_("error",(function(error){
  63016. return $core.withContext(function($ctx2) {
  63017. $2=console;
  63018. $3="Error starting server: ".__comma(error);
  63019. $ctx2.sendIdx[","]=1;
  63020. return $recv($2)._log_($3);
  63021. $ctx2.sendIdx["log:"]=1;
  63022. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)});
  63023. }));
  63024. $ctx1.sendIdx["on:do:"]=1;
  63025. $recv($1)._on_do_("listening",(function(){
  63026. return $core.withContext(function($ctx2) {
  63027. $4=console;
  63028. $8=$self._host();
  63029. $ctx2.sendIdx["host"]=1;
  63030. $7="Starting file server on http://".__comma($8);
  63031. $6=$recv($7).__comma(":");
  63032. $ctx2.sendIdx[","]=3;
  63033. $10=$self._port();
  63034. $ctx2.sendIdx["port"]=1;
  63035. $9=$recv($10)._asString();
  63036. $5=$recv($6).__comma($9);
  63037. $ctx2.sendIdx[","]=2;
  63038. return $recv($4)._log_($5);
  63039. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63040. }));
  63041. $recv($1)._listen_host_($self._port(),$self._host());
  63042. return self;
  63043. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.FileServer)});
  63044. },
  63045. args: [],
  63046. 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.",
  63047. referencedClasses: [],
  63048. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"]
  63049. }),
  63050. $globals.FileServer);
  63051. $core.addMethod(
  63052. $core.method({
  63053. selector: "startOn:",
  63054. protocol: "starting",
  63055. fn: function (aPort){
  63056. var self=this,$self=this;
  63057. return $core.withContext(function($ctx1) {
  63058. $self._port_(aPort);
  63059. $self._start();
  63060. return self;
  63061. }, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},$globals.FileServer)});
  63062. },
  63063. args: ["aPort"],
  63064. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  63065. referencedClasses: [],
  63066. messageSends: ["port:", "start"]
  63067. }),
  63068. $globals.FileServer);
  63069. $core.addMethod(
  63070. $core.method({
  63071. selector: "username:",
  63072. protocol: "accessing",
  63073. fn: function (aUsername){
  63074. var self=this,$self=this;
  63075. $self["@username"]=aUsername;
  63076. return self;
  63077. },
  63078. args: ["aUsername"],
  63079. source: "username: aUsername\x0a\x09username := aUsername.",
  63080. referencedClasses: [],
  63081. messageSends: []
  63082. }),
  63083. $globals.FileServer);
  63084. $core.addMethod(
  63085. $core.method({
  63086. selector: "validateBasePath",
  63087. protocol: "private",
  63088. fn: function (){
  63089. var self=this,$self=this;
  63090. return $core.withContext(function($ctx1) {
  63091. var $1,$2,$3,$4,$7,$6,$5,$8,$9,$receiver;
  63092. $1=$self["@fs"];
  63093. $2=$self._basePath();
  63094. $ctx1.sendIdx["basePath"]=1;
  63095. $recv($1)._stat_then_($2,(function(err,stat){
  63096. return $core.withContext(function($ctx2) {
  63097. if(($receiver = err) == null || $receiver.a$nil){
  63098. $3=$recv(stat)._isDirectory();
  63099. if(!$core.assert($3)){
  63100. $4=console;
  63101. $7=$self._basePath();
  63102. $ctx2.sendIdx["basePath"]=2;
  63103. $6="Warning: --base-path parameter ".__comma($7);
  63104. $ctx2.sendIdx[","]=2;
  63105. $5=$recv($6).__comma(" is not a directory.");
  63106. $ctx2.sendIdx[","]=1;
  63107. return $recv($4)._warn_($5);
  63108. $ctx2.sendIdx["warn:"]=1;
  63109. }
  63110. } else {
  63111. $8=console;
  63112. $9=$recv("Warning: path at --base-path parameter ".__comma($self._basePath())).__comma(" does not exist.");
  63113. $ctx2.sendIdx[","]=3;
  63114. return $recv($8)._warn_($9);
  63115. }
  63116. }, function($ctx2) {$ctx2.fillBlock({err:err,stat:stat},$ctx1,1)});
  63117. }));
  63118. return self;
  63119. }, function($ctx1) {$ctx1.fill(self,"validateBasePath",{},$globals.FileServer)});
  63120. },
  63121. args: [],
  63122. 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.' ]].",
  63123. referencedClasses: [],
  63124. messageSends: ["stat:then:", "basePath", "ifNil:ifNotNil:", "ifFalse:", "isDirectory", "warn:", ","]
  63125. }),
  63126. $globals.FileServer);
  63127. $core.addMethod(
  63128. $core.method({
  63129. selector: "withBasePath:",
  63130. protocol: "private",
  63131. fn: function (aBaseRelativePath){
  63132. var self=this,$self=this;
  63133. return $core.withContext(function($ctx1) {
  63134. return $recv($self["@path"])._join_with_($self._basePath(),aBaseRelativePath);
  63135. }, function($ctx1) {$ctx1.fill(self,"withBasePath:",{aBaseRelativePath:aBaseRelativePath},$globals.FileServer)});
  63136. },
  63137. args: ["aBaseRelativePath"],
  63138. source: "withBasePath: aBaseRelativePath\x0a\x09\x22return a file path which is relative to the basePath.\x22\x0a\x09^ path join: self basePath with: aBaseRelativePath",
  63139. referencedClasses: [],
  63140. messageSends: ["join:with:", "basePath"]
  63141. }),
  63142. $globals.FileServer);
  63143. $core.addMethod(
  63144. $core.method({
  63145. selector: "writeData:toFileNamed:",
  63146. protocol: "private",
  63147. fn: function (data,aFilename){
  63148. var self=this,$self=this;
  63149. return $core.withContext(function($ctx1) {
  63150. $recv(console)._log_(aFilename);
  63151. return self;
  63152. }, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},$globals.FileServer)});
  63153. },
  63154. args: ["data", "aFilename"],
  63155. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  63156. referencedClasses: [],
  63157. messageSends: ["log:"]
  63158. }),
  63159. $globals.FileServer);
  63160. $globals.FileServer.a$cls.iVarNames = ["mimeTypes"];
  63161. $core.addMethod(
  63162. $core.method({
  63163. selector: "commandLineSwitches",
  63164. protocol: "accessing",
  63165. fn: function (){
  63166. var self=this,$self=this;
  63167. var switches;
  63168. return $core.withContext(function($ctx1) {
  63169. switches=$recv($self._methodsInProtocol_("accessing"))._collect_((function(each){
  63170. return $core.withContext(function($ctx2) {
  63171. return $recv(each)._selector();
  63172. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63173. }));
  63174. $ctx1.sendIdx["collect:"]=1;
  63175. switches=$recv(switches)._select_((function(each){
  63176. return $core.withContext(function($ctx2) {
  63177. return $recv(each)._match_("^[^:]*:$");
  63178. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)});
  63179. }));
  63180. switches=$recv(switches)._collect_((function(each){
  63181. return $core.withContext(function($ctx2) {
  63182. return $recv($recv($recv($recv(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase())._replace_with_("^([a-z])","--$1");
  63183. $ctx2.sendIdx["replace:with:"]=1;
  63184. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)});
  63185. }));
  63186. return switches;
  63187. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},$globals.FileServer.a$cls)});
  63188. },
  63189. args: [],
  63190. 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",
  63191. referencedClasses: [],
  63192. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"]
  63193. }),
  63194. $globals.FileServer.a$cls);
  63195. $core.addMethod(
  63196. $core.method({
  63197. selector: "createServerWithArguments:",
  63198. protocol: "initialization",
  63199. fn: function (options){
  63200. var self=this,$self=this;
  63201. var server,popFront,front,optionName,optionValue,switches;
  63202. return $core.withContext(function($ctx1) {
  63203. var $1,$2,$3,$4,$5,$6,$7,$8;
  63204. var $early={};
  63205. try {
  63206. switches=$self._commandLineSwitches();
  63207. server=$self._new();
  63208. $recv(options)._ifEmpty_((function(){
  63209. throw $early=[server];
  63210. }));
  63211. $1=$recv($recv(options)._size())._even();
  63212. if(!$core.assert($1)){
  63213. $recv(console)._log_("Using default parameters.");
  63214. $ctx1.sendIdx["log:"]=1;
  63215. $2=console;
  63216. $3="Wrong commandline options or not enough arguments for: ".__comma(options);
  63217. $ctx1.sendIdx[","]=1;
  63218. $recv($2)._log_($3);
  63219. $ctx1.sendIdx["log:"]=2;
  63220. $4=console;
  63221. $5="Use any of the following ones: ".__comma(switches);
  63222. $ctx1.sendIdx[","]=2;
  63223. $recv($4)._log_($5);
  63224. $ctx1.sendIdx["log:"]=3;
  63225. return server;
  63226. }
  63227. popFront=(function(args){
  63228. return $core.withContext(function($ctx2) {
  63229. front=$recv(args)._first();
  63230. $recv(args)._remove_(front);
  63231. return front;
  63232. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)});
  63233. });
  63234. $recv((function(){
  63235. return $core.withContext(function($ctx2) {
  63236. return $recv(options)._notEmpty();
  63237. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)});
  63238. }))._whileTrue_((function(){
  63239. return $core.withContext(function($ctx2) {
  63240. optionName=$recv(popFront)._value_(options);
  63241. $ctx2.sendIdx["value:"]=1;
  63242. optionValue=$recv(popFront)._value_(options);
  63243. $6=$recv(switches)._includes_(optionName);
  63244. if($core.assert($6)){
  63245. optionName=$self._selectorForCommandLineSwitch_(optionName);
  63246. return $recv(server)._perform_withArguments_(optionName,$recv($globals.Array)._with_(optionValue));
  63247. } else {
  63248. $7=console;
  63249. $8=$recv(optionName).__comma(" is not a valid commandline option");
  63250. $ctx2.sendIdx[","]=3;
  63251. $recv($7)._log_($8);
  63252. $ctx2.sendIdx["log:"]=4;
  63253. return $recv(console)._log_("Use any of the following ones: ".__comma(switches));
  63254. }
  63255. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)});
  63256. }));
  63257. return server;
  63258. }
  63259. catch(e) {if(e===$early)return e[0]; throw e}
  63260. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},$globals.FileServer.a$cls)});
  63261. },
  63262. args: ["options"],
  63263. 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.",
  63264. referencedClasses: ["Array"],
  63265. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"]
  63266. }),
  63267. $globals.FileServer.a$cls);
  63268. $core.addMethod(
  63269. $core.method({
  63270. selector: "defaultBasePath",
  63271. protocol: "accessing",
  63272. fn: function (){
  63273. var self=this,$self=this;
  63274. return "./";
  63275. },
  63276. args: [],
  63277. source: "defaultBasePath\x0a\x09^ './'",
  63278. referencedClasses: [],
  63279. messageSends: []
  63280. }),
  63281. $globals.FileServer.a$cls);
  63282. $core.addMethod(
  63283. $core.method({
  63284. selector: "defaultHost",
  63285. protocol: "accessing",
  63286. fn: function (){
  63287. var self=this,$self=this;
  63288. return "127.0.0.1";
  63289. },
  63290. args: [],
  63291. source: "defaultHost\x0a\x09^ '127.0.0.1'",
  63292. referencedClasses: [],
  63293. messageSends: []
  63294. }),
  63295. $globals.FileServer.a$cls);
  63296. $core.addMethod(
  63297. $core.method({
  63298. selector: "defaultMimeTypes",
  63299. protocol: "accessing",
  63300. fn: function (){
  63301. var self=this,$self=this;
  63302. 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"]);
  63303. },
  63304. args: [],
  63305. 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}",
  63306. referencedClasses: [],
  63307. messageSends: []
  63308. }),
  63309. $globals.FileServer.a$cls);
  63310. $core.addMethod(
  63311. $core.method({
  63312. selector: "defaultPort",
  63313. protocol: "accessing",
  63314. fn: function (){
  63315. var self=this,$self=this;
  63316. return (4000);
  63317. },
  63318. args: [],
  63319. source: "defaultPort\x0a\x09^ 4000",
  63320. referencedClasses: [],
  63321. messageSends: []
  63322. }),
  63323. $globals.FileServer.a$cls);
  63324. $core.addMethod(
  63325. $core.method({
  63326. selector: "main",
  63327. protocol: "initialization",
  63328. fn: function (){
  63329. var self=this,$self=this;
  63330. var fileServer,args;
  63331. return $core.withContext(function($ctx1) {
  63332. var $1;
  63333. var $early={};
  63334. try {
  63335. args=$recv(process)._argv();
  63336. $recv(args)._removeFrom_to_((1),(3));
  63337. $recv(args)._detect_ifNone_((function(each){
  63338. return $core.withContext(function($ctx2) {
  63339. $1=$recv(each).__eq("--help");
  63340. if($core.assert($1)){
  63341. return $recv($globals.FileServer)._printHelp();
  63342. }
  63343. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63344. }),(function(){
  63345. return $core.withContext(function($ctx2) {
  63346. fileServer=$recv($globals.FileServer)._createServerWithArguments_(args);
  63347. throw $early=[$recv(fileServer)._start()];
  63348. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)});
  63349. }));
  63350. return self;
  63351. }
  63352. catch(e) {if(e===$early)return e[0]; throw e}
  63353. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},$globals.FileServer.a$cls)});
  63354. },
  63355. args: [],
  63356. 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]",
  63357. referencedClasses: ["FileServer"],
  63358. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"]
  63359. }),
  63360. $globals.FileServer.a$cls);
  63361. $core.addMethod(
  63362. $core.method({
  63363. selector: "mimeTypeFor:",
  63364. protocol: "accessing",
  63365. fn: function (aString){
  63366. var self=this,$self=this;
  63367. return $core.withContext(function($ctx1) {
  63368. return $recv($self._mimeTypes())._at_ifAbsent_($recv(aString)._replace_with_(".*[\x5c.]",""),(function(){
  63369. return "text/plain";
  63370. }));
  63371. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},$globals.FileServer.a$cls)});
  63372. },
  63373. args: ["aString"],
  63374. source: "mimeTypeFor: aString\x0a\x09^ self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  63375. referencedClasses: [],
  63376. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"]
  63377. }),
  63378. $globals.FileServer.a$cls);
  63379. $core.addMethod(
  63380. $core.method({
  63381. selector: "mimeTypes",
  63382. protocol: "accessing",
  63383. fn: function (){
  63384. var self=this,$self=this;
  63385. return $core.withContext(function($ctx1) {
  63386. var $1,$receiver;
  63387. $1=$self["@mimeTypes"];
  63388. if(($receiver = $1) == null || $receiver.a$nil){
  63389. $self["@mimeTypes"]=$self._defaultMimeTypes();
  63390. return $self["@mimeTypes"];
  63391. } else {
  63392. return $1;
  63393. }
  63394. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},$globals.FileServer.a$cls)});
  63395. },
  63396. args: [],
  63397. source: "mimeTypes\x0a\x09^ mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  63398. referencedClasses: [],
  63399. messageSends: ["ifNil:", "defaultMimeTypes"]
  63400. }),
  63401. $globals.FileServer.a$cls);
  63402. $core.addMethod(
  63403. $core.method({
  63404. selector: "printHelp",
  63405. protocol: "accessing",
  63406. fn: function (){
  63407. var self=this,$self=this;
  63408. return $core.withContext(function($ctx1) {
  63409. $recv(console)._log_("Available commandline options are:");
  63410. $ctx1.sendIdx["log:"]=1;
  63411. $recv(console)._log_("--help");
  63412. $ctx1.sendIdx["log:"]=2;
  63413. $recv($self._commandLineSwitches())._do_((function(each){
  63414. return $core.withContext(function($ctx2) {
  63415. return $recv(console)._log_($recv(each).__comma(" <parameter>"));
  63416. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63417. }));
  63418. return self;
  63419. }, function($ctx1) {$ctx1.fill(self,"printHelp",{},$globals.FileServer.a$cls)});
  63420. },
  63421. args: [],
  63422. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  63423. referencedClasses: [],
  63424. messageSends: ["log:", "do:", "commandLineSwitches", ","]
  63425. }),
  63426. $globals.FileServer.a$cls);
  63427. $core.addMethod(
  63428. $core.method({
  63429. selector: "selectorForCommandLineSwitch:",
  63430. protocol: "accessing",
  63431. fn: function (aSwitch){
  63432. var self=this,$self=this;
  63433. return $core.withContext(function($ctx1) {
  63434. var $1;
  63435. $1=$recv($recv(aSwitch)._replace_with_("^--",""))._replace_with_("-[a-z]",(function(each){
  63436. return $core.withContext(function($ctx2) {
  63437. return $recv($recv(each)._second())._asUppercase();
  63438. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  63439. }));
  63440. $ctx1.sendIdx["replace:with:"]=1;
  63441. return $recv($1).__comma(":");
  63442. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},$globals.FileServer.a$cls)});
  63443. },
  63444. args: ["aSwitch"],
  63445. 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 ]), ':'",
  63446. referencedClasses: [],
  63447. messageSends: [",", "replace:with:", "asUppercase", "second"]
  63448. }),
  63449. $globals.FileServer.a$cls);
  63450. $core.addClass("Initer", $globals.BaseFileManipulator, ["childProcess", "nmPath"], "AmberCli");
  63451. $core.addMethod(
  63452. $core.method({
  63453. selector: "bowerInstallThenDo:",
  63454. protocol: "action",
  63455. fn: function (aBlock){
  63456. var self=this,$self=this;
  63457. var child;
  63458. return $core.withContext(function($ctx1) {
  63459. var $1,$3,$2;
  63460. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("bower","bower"),["install"]);
  63461. $1=child;
  63462. $recv($1)._on_do_("error",aBlock);
  63463. $ctx1.sendIdx["on:do:"]=1;
  63464. $recv($1)._on_do_("close",(function(code){
  63465. return $core.withContext(function($ctx2) {
  63466. $3=$recv(code).__eq((0));
  63467. if($core.assert($3)){
  63468. $2=nil;
  63469. } else {
  63470. $2=code;
  63471. }
  63472. return $recv(aBlock)._value_($2);
  63473. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63474. }));
  63475. return self;
  63476. }, function($ctx1) {$ctx1.fill(self,"bowerInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63477. },
  63478. args: ["aBlock"],
  63479. 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 ]) ]",
  63480. referencedClasses: [],
  63481. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63482. }),
  63483. $globals.Initer);
  63484. $core.addMethod(
  63485. $core.method({
  63486. selector: "finishMessage",
  63487. protocol: "action",
  63488. fn: function (){
  63489. var self=this,$self=this;
  63490. return $core.withContext(function($ctx1) {
  63491. $recv(console)._log_([" ", "The project should now be set up.", " ", " "]._join_($recv($globals.String)._lf()));
  63492. $recv((function(){
  63493. }))._valueWithTimeout_((600));
  63494. return self;
  63495. }, function($ctx1) {$ctx1.fill(self,"finishMessage",{},$globals.Initer)});
  63496. },
  63497. args: [],
  63498. 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",
  63499. referencedClasses: ["String"],
  63500. messageSends: ["log:", "join:", "lf", "valueWithTimeout:"]
  63501. }),
  63502. $globals.Initer);
  63503. $core.addMethod(
  63504. $core.method({
  63505. selector: "gruntInitThenDo:",
  63506. protocol: "action",
  63507. fn: function (aBlock){
  63508. var self=this,$self=this;
  63509. var child,sanitizedTemplatePath;
  63510. return $core.withContext(function($ctx1) {
  63511. var $1,$3,$2;
  63512. sanitizedTemplatePath=$recv($recv($recv($self["@path"])._join_with_($self["@nmPath"],"@ambers/grunt-init-amber-project"))._replace_with_("\x5c\x5c","\x5c\x5c"))._replace_with_(":","\x5c:");
  63513. $ctx1.sendIdx["replace:with:"]=1;
  63514. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-init","grunt-init"),[sanitizedTemplatePath]);
  63515. $1=child;
  63516. $recv($1)._on_do_("error",aBlock);
  63517. $ctx1.sendIdx["on:do:"]=1;
  63518. $recv($1)._on_do_("close",(function(code){
  63519. return $core.withContext(function($ctx2) {
  63520. $3=$recv(code).__eq((0));
  63521. if($core.assert($3)){
  63522. $2=nil;
  63523. } else {
  63524. $2=code;
  63525. }
  63526. return $recv(aBlock)._value_($2);
  63527. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63528. }));
  63529. return self;
  63530. }, function($ctx1) {$ctx1.fill(self,"gruntInitThenDo:",{aBlock:aBlock,child:child,sanitizedTemplatePath:sanitizedTemplatePath},$globals.Initer)});
  63531. },
  63532. args: ["aBlock"],
  63533. 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 ]) ]",
  63534. referencedClasses: [],
  63535. messageSends: ["replace:with:", "join:with:", "fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63536. }),
  63537. $globals.Initer);
  63538. $core.addMethod(
  63539. $core.method({
  63540. selector: "gruntThenDo:",
  63541. protocol: "action",
  63542. fn: function (aBlock){
  63543. var self=this,$self=this;
  63544. var child;
  63545. return $core.withContext(function($ctx1) {
  63546. var $1,$3,$2;
  63547. child=$recv($self["@childProcess"])._fork_args_($self._npmScriptForModule_named_("grunt-cli","grunt"),["default", "devel"]);
  63548. $1=child;
  63549. $recv($1)._on_do_("error",aBlock);
  63550. $ctx1.sendIdx["on:do:"]=1;
  63551. $recv($1)._on_do_("close",(function(code){
  63552. return $core.withContext(function($ctx2) {
  63553. $3=$recv(code).__eq((0));
  63554. if($core.assert($3)){
  63555. $2=nil;
  63556. } else {
  63557. $2=code;
  63558. }
  63559. return $recv(aBlock)._value_($2);
  63560. }, function($ctx2) {$ctx2.fillBlock({code:code},$ctx1,1)});
  63561. }));
  63562. return self;
  63563. }, function($ctx1) {$ctx1.fill(self,"gruntThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63564. },
  63565. args: ["aBlock"],
  63566. 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 ]) ]",
  63567. referencedClasses: [],
  63568. messageSends: ["fork:args:", "npmScriptForModule:named:", "on:do:", "value:", "ifTrue:ifFalse:", "="]
  63569. }),
  63570. $globals.Initer);
  63571. $core.addMethod(
  63572. $core.method({
  63573. selector: "initialize",
  63574. protocol: "initialization",
  63575. fn: function (){
  63576. var self=this,$self=this;
  63577. return $core.withContext(function($ctx1) {
  63578. (
  63579. $ctx1.supercall = true,
  63580. ($globals.Initer.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  63581. $ctx1.supercall = false;
  63582. $self["@childProcess"]=$recv(require)._value_("child_process");
  63583. $self["@nmPath"]=$recv($self["@path"])._join_with_($self._rootDirname(),"node_modules");
  63584. return self;
  63585. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Initer)});
  63586. },
  63587. args: [],
  63588. source: "initialize\x0a\x09super initialize.\x0a\x09childProcess := require value: 'child_process'.\x0a\x09nmPath := path join: self rootDirname with: 'node_modules'",
  63589. referencedClasses: [],
  63590. messageSends: ["initialize", "value:", "join:with:", "rootDirname"]
  63591. }),
  63592. $globals.Initer);
  63593. $core.addMethod(
  63594. $core.method({
  63595. selector: "npmInstallThenDo:",
  63596. protocol: "action",
  63597. fn: function (aBlock){
  63598. var self=this,$self=this;
  63599. var child;
  63600. return $core.withContext(function($ctx1) {
  63601. var $1;
  63602. child=$recv($self["@childProcess"])._exec_thenDo_("npm install",aBlock);
  63603. $1=$recv(child)._stdout();
  63604. $ctx1.sendIdx["stdout"]=1;
  63605. $recv($1)._pipe_options_($recv(process)._stdout(),$globals.HashedCollection._newFromPairs_(["end",false]));
  63606. return self;
  63607. }, function($ctx1) {$ctx1.fill(self,"npmInstallThenDo:",{aBlock:aBlock,child:child},$globals.Initer)});
  63608. },
  63609. args: ["aBlock"],
  63610. 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 }",
  63611. referencedClasses: [],
  63612. messageSends: ["exec:thenDo:", "pipe:options:", "stdout"]
  63613. }),
  63614. $globals.Initer);
  63615. $core.addMethod(
  63616. $core.method({
  63617. selector: "npmScriptForModule:named:",
  63618. protocol: "npm",
  63619. fn: function (aString,anotherString){
  63620. var self=this,$self=this;
  63621. var modulePath,packageJson,binSection,scriptPath;
  63622. return $core.withContext(function($ctx1) {
  63623. var $1,$3,$4,$2,$5;
  63624. $1=$self["@path"];
  63625. $3=$recv(require)._provided();
  63626. $4=$recv(aString).__comma("/package.json");
  63627. $ctx1.sendIdx[","]=1;
  63628. $2=$recv($3)._resolve_($4);
  63629. modulePath=$recv($1)._dirname_($2);
  63630. packageJson=$recv($globals.Smalltalk)._readJSObject_($recv(require)._value_($recv(aString).__comma("/package.json")));
  63631. binSection=$recv(packageJson)._at_("bin");
  63632. $ctx1.sendIdx["at:"]=1;
  63633. $5=$recv(binSection)._isString();
  63634. if($core.assert($5)){
  63635. scriptPath=binSection;
  63636. } else {
  63637. scriptPath=$recv(binSection)._at_(anotherString);
  63638. }
  63639. return $recv($self["@path"])._join_with_(modulePath,scriptPath);
  63640. }, function($ctx1) {$ctx1.fill(self,"npmScriptForModule:named:",{aString:aString,anotherString:anotherString,modulePath:modulePath,packageJson:packageJson,binSection:binSection,scriptPath:scriptPath},$globals.Initer)});
  63641. },
  63642. args: ["aString", "anotherString"],
  63643. source: "npmScriptForModule: aString named: anotherString\x0a\x09| modulePath packageJson binSection scriptPath |\x0a\x09modulePath := path dirname: (\x0a\x09\x09require provided resolve: 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",
  63644. referencedClasses: ["Smalltalk"],
  63645. messageSends: ["dirname:", "resolve:", "provided", ",", "readJSObject:", "value:", "at:", "ifTrue:ifFalse:", "isString", "join:with:"]
  63646. }),
  63647. $globals.Initer);
  63648. $core.addMethod(
  63649. $core.method({
  63650. selector: "start",
  63651. protocol: "action",
  63652. fn: function (){
  63653. var self=this,$self=this;
  63654. return $core.withContext(function($ctx1) {
  63655. var $1,$2,$3,$4,$5,$6,$7,$receiver;
  63656. $self._gruntInitThenDo_((function(error){
  63657. return $core.withContext(function($ctx2) {
  63658. if(($receiver = error) == null || $receiver.a$nil){
  63659. return $self._bowerInstallThenDo_((function(error2){
  63660. return $core.withContext(function($ctx3) {
  63661. if(($receiver = error2) == null || $receiver.a$nil){
  63662. return $self._npmInstallThenDo_((function(error3){
  63663. return $core.withContext(function($ctx4) {
  63664. if(($receiver = error3) == null || $receiver.a$nil){
  63665. return $self._gruntThenDo_((function(error4){
  63666. return $core.withContext(function($ctx5) {
  63667. if(($receiver = error4) == null || $receiver.a$nil){
  63668. $self._finishMessage();
  63669. return $recv(process)._exit();
  63670. } else {
  63671. $7=console;
  63672. $recv($7)._log_("grunt exec error:");
  63673. $ctx5.sendIdx["log:"]=7;
  63674. $recv($7)._log_(error4);
  63675. return $recv(process)._exit_((104));
  63676. }
  63677. }, function($ctx5) {$ctx5.fillBlock({error4:error4},$ctx4,10)});
  63678. }));
  63679. } else {
  63680. $5=console;
  63681. $recv($5)._log_("npm install exec error:");
  63682. $ctx4.sendIdx["log:"]=5;
  63683. $6=$recv($5)._log_(error3);
  63684. $ctx4.sendIdx["log:"]=6;
  63685. return $recv(process)._exit_((103));
  63686. $ctx4.sendIdx["exit:"]=3;
  63687. }
  63688. }, function($ctx4) {$ctx4.fillBlock({error3:error3},$ctx3,7)});
  63689. }));
  63690. } else {
  63691. $3=console;
  63692. $recv($3)._log_("bower install exec error:");
  63693. $ctx3.sendIdx["log:"]=3;
  63694. $4=$recv($3)._log_(error2);
  63695. $ctx3.sendIdx["log:"]=4;
  63696. return $recv(process)._exit_((102));
  63697. $ctx3.sendIdx["exit:"]=2;
  63698. }
  63699. }, function($ctx3) {$ctx3.fillBlock({error2:error2},$ctx2,4)});
  63700. }));
  63701. } else {
  63702. $1=console;
  63703. $recv($1)._log_("grunt-init exec error:");
  63704. $ctx2.sendIdx["log:"]=1;
  63705. $2=$recv($1)._log_(error);
  63706. $ctx2.sendIdx["log:"]=2;
  63707. return $recv(process)._exit_((101));
  63708. $ctx2.sendIdx["exit:"]=1;
  63709. }
  63710. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,1)});
  63711. }));
  63712. return self;
  63713. }, function($ctx1) {$ctx1.fill(self,"start",{},$globals.Initer)});
  63714. },
  63715. args: [],
  63716. 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 ]]]]]]]]",
  63717. referencedClasses: [],
  63718. messageSends: ["gruntInitThenDo:", "ifNotNil:ifNil:", "log:", "exit:", "bowerInstallThenDo:", "npmInstallThenDo:", "gruntThenDo:", "finishMessage", "exit"]
  63719. }),
  63720. $globals.Initer);
  63721. $core.addClass("Repl", $globals.Object, ["readline", "interface", "util", "session", "resultCount", "commands"], "AmberCli");
  63722. $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.";
  63723. $core.addMethod(
  63724. $core.method({
  63725. selector: "addVariableNamed:to:",
  63726. protocol: "private",
  63727. fn: function (aString,anObject){
  63728. var self=this,$self=this;
  63729. var newClass,newObject;
  63730. return $core.withContext(function($ctx1) {
  63731. newClass=$self._subclass_withVariable_($recv(anObject)._class(),aString);
  63732. $self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  63733. newObject=$recv(newClass)._new();
  63734. $self._setPreviousVariablesFor_from_(newObject,anObject);
  63735. return newObject;
  63736. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},$globals.Repl)});
  63737. },
  63738. args: ["aString", "anObject"],
  63739. 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",
  63740. referencedClasses: [],
  63741. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"]
  63742. }),
  63743. $globals.Repl);
  63744. $core.addMethod(
  63745. $core.method({
  63746. selector: "assignNewVariable:do:",
  63747. protocol: "private",
  63748. fn: function (buffer,aBlock){
  63749. var self=this,$self=this;
  63750. return $core.withContext(function($ctx1) {
  63751. var $2,$3,$1,$receiver;
  63752. return $self._parseAssignment_do_(buffer,(function(name,expr){
  63753. var varName,value;
  63754. return $core.withContext(function($ctx2) {
  63755. if(($receiver = name) == null || $receiver.a$nil){
  63756. varName=$self._nextResultName();
  63757. } else {
  63758. varName=name;
  63759. }
  63760. $self["@session"]=$self._addVariableNamed_to_(varName,$self["@session"]);
  63761. $recv((function(){
  63762. return $core.withContext(function($ctx3) {
  63763. $2=$recv(varName).__comma(" := ");
  63764. if(($receiver = expr) == null || $receiver.a$nil){
  63765. $3=buffer;
  63766. } else {
  63767. $3=expr;
  63768. }
  63769. $1=$recv($2).__comma($3);
  63770. $ctx3.sendIdx[","]=1;
  63771. value=$self._eval_on_($1,$self["@session"]);
  63772. return value;
  63773. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)});
  63774. }))._on_do_($globals.Error,(function(e){
  63775. return $core.withContext(function($ctx3) {
  63776. $recv($recv($globals.ConsoleErrorHandler)._new())._logError_(e);
  63777. value=nil;
  63778. return value;
  63779. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)});
  63780. }));
  63781. return $recv(aBlock)._value_value_(varName,value);
  63782. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)});
  63783. }));
  63784. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},$globals.Repl)});
  63785. },
  63786. args: ["buffer", "aBlock"],
  63787. 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]",
  63788. referencedClasses: ["Error", "ConsoleErrorHandler"],
  63789. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"]
  63790. }),
  63791. $globals.Repl);
  63792. $core.addMethod(
  63793. $core.method({
  63794. selector: "clearScreen",
  63795. protocol: "actions",
  63796. fn: function (){
  63797. var self=this,$self=this;
  63798. var esc,cls;
  63799. return $core.withContext(function($ctx1) {
  63800. var $1;
  63801. esc=$recv($globals.String)._fromCharCode_((27));
  63802. $1=$recv($recv(esc).__comma("[2J")).__comma(esc);
  63803. $ctx1.sendIdx[","]=2;
  63804. cls=$recv($1).__comma("[0;0f");
  63805. $ctx1.sendIdx[","]=1;
  63806. $recv($recv(process)._stdout())._write_(cls);
  63807. $recv($self["@interface"])._prompt();
  63808. return self;
  63809. }, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},$globals.Repl)});
  63810. },
  63811. args: [],
  63812. 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",
  63813. referencedClasses: ["String"],
  63814. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"]
  63815. }),
  63816. $globals.Repl);
  63817. $core.addMethod(
  63818. $core.method({
  63819. selector: "close",
  63820. protocol: "actions",
  63821. fn: function (){
  63822. var self=this,$self=this;
  63823. return $core.withContext(function($ctx1) {
  63824. $recv($recv(process)._stdin())._destroy();
  63825. return self;
  63826. }, function($ctx1) {$ctx1.fill(self,"close",{},$globals.Repl)});
  63827. },
  63828. args: [],
  63829. source: "close\x0a\x09process stdin destroy",
  63830. referencedClasses: [],
  63831. messageSends: ["destroy", "stdin"]
  63832. }),
  63833. $globals.Repl);
  63834. $core.addMethod(
  63835. $core.method({
  63836. selector: "commands",
  63837. protocol: "accessing",
  63838. fn: function (){
  63839. var self=this,$self=this;
  63840. return $self["@commands"];
  63841. },
  63842. args: [],
  63843. source: "commands\x0a\x09^ commands",
  63844. referencedClasses: [],
  63845. messageSends: []
  63846. }),
  63847. $globals.Repl);
  63848. $core.addMethod(
  63849. $core.method({
  63850. selector: "createInterface",
  63851. protocol: "actions",
  63852. fn: function (){
  63853. var self=this,$self=this;
  63854. return $core.withContext(function($ctx1) {
  63855. $self["@interface"]=$recv($self["@readline"])._createInterface_stdout_($recv(process)._stdin(),$recv(process)._stdout());
  63856. $recv($self["@interface"])._on_do_("line",(function(buffer){
  63857. return $core.withContext(function($ctx2) {
  63858. return $self._processLine_(buffer);
  63859. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)});
  63860. }));
  63861. $ctx1.sendIdx["on:do:"]=1;
  63862. $recv($self["@interface"])._on_do_("close",(function(){
  63863. return $core.withContext(function($ctx2) {
  63864. return $self._close();
  63865. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  63866. }));
  63867. $self._printWelcome();
  63868. $self._setupHotkeys();
  63869. $self._setPrompt();
  63870. $recv($self["@interface"])._prompt();
  63871. return self;
  63872. }, function($ctx1) {$ctx1.fill(self,"createInterface",{},$globals.Repl)});
  63873. },
  63874. args: [],
  63875. 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",
  63876. referencedClasses: [],
  63877. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"]
  63878. }),
  63879. $globals.Repl);
  63880. $core.addMethod(
  63881. $core.method({
  63882. selector: "encapsulateVariable:withValue:in:",
  63883. protocol: "private",
  63884. fn: function (aString,anObject,aClass){
  63885. var self=this,$self=this;
  63886. var compiler;
  63887. return $core.withContext(function($ctx1) {
  63888. var $1,$4,$3,$2,$5,$6;
  63889. compiler=$recv($globals.Compiler)._new();
  63890. $1=compiler;
  63891. $4=$recv(aString).__comma(": anObject ^ ");
  63892. $ctx1.sendIdx[","]=3;
  63893. $3=$recv($4).__comma(aString);
  63894. $ctx1.sendIdx[","]=2;
  63895. $2=$recv($3).__comma(" := anObject");
  63896. $ctx1.sendIdx[","]=1;
  63897. $recv($1)._install_forClass_protocol_($2,aClass,"session");
  63898. $ctx1.sendIdx["install:forClass:protocol:"]=1;
  63899. $5=compiler;
  63900. $6=$recv($recv(aString).__comma(" ^ ")).__comma(aString);
  63901. $ctx1.sendIdx[","]=4;
  63902. $recv($5)._install_forClass_protocol_($6,aClass,"session");
  63903. return self;
  63904. }, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},$globals.Repl)});
  63905. },
  63906. args: ["aString", "anObject", "aClass"],
  63907. 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'.",
  63908. referencedClasses: ["Compiler"],
  63909. messageSends: ["new", "install:forClass:protocol:", ","]
  63910. }),
  63911. $globals.Repl);
  63912. $core.addMethod(
  63913. $core.method({
  63914. selector: "eval:",
  63915. protocol: "actions",
  63916. fn: function (buffer){
  63917. var self=this,$self=this;
  63918. return $core.withContext(function($ctx1) {
  63919. return $self._eval_on_(buffer,$recv($globals.DoIt)._new());
  63920. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},$globals.Repl)});
  63921. },
  63922. args: ["buffer"],
  63923. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  63924. referencedClasses: ["DoIt"],
  63925. messageSends: ["eval:on:", "new"]
  63926. }),
  63927. $globals.Repl);
  63928. $core.addMethod(
  63929. $core.method({
  63930. selector: "eval:on:",
  63931. protocol: "actions",
  63932. fn: function (buffer,anObject){
  63933. var self=this,$self=this;
  63934. var result;
  63935. return $core.withContext(function($ctx1) {
  63936. var $1;
  63937. $recv(buffer)._ifNotEmpty_((function(){
  63938. return $core.withContext(function($ctx2) {
  63939. return $recv((function(){
  63940. return $core.withContext(function($ctx3) {
  63941. result=$recv($recv($globals.Compiler)._new())._evaluateExpression_on_(buffer,anObject);
  63942. return result;
  63943. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,2)});
  63944. }))._tryCatch_((function(e){
  63945. return $core.withContext(function($ctx3) {
  63946. $1=$recv(e)._isSmalltalkError();
  63947. if($core.assert($1)){
  63948. return $recv(e)._pass();
  63949. } else {
  63950. return $recv($recv(process)._stdout())._write_($recv(e)._jsStack());
  63951. }
  63952. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,3)});
  63953. }));
  63954. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  63955. }));
  63956. return result;
  63957. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},$globals.Repl)});
  63958. },
  63959. args: ["buffer", "anObject"],
  63960. 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",
  63961. referencedClasses: ["Compiler"],
  63962. messageSends: ["ifNotEmpty:", "tryCatch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "pass", "write:", "stdout", "jsStack"]
  63963. }),
  63964. $globals.Repl);
  63965. $core.addMethod(
  63966. $core.method({
  63967. selector: "executeCommand:",
  63968. protocol: "private",
  63969. fn: function (aString){
  63970. var self=this,$self=this;
  63971. return $core.withContext(function($ctx1) {
  63972. var $1;
  63973. var $early={};
  63974. try {
  63975. $recv($self._commands())._keysAndValuesDo_((function(names,cmd){
  63976. return $core.withContext(function($ctx2) {
  63977. $1=$recv(names)._includes_(aString);
  63978. if($core.assert($1)){
  63979. $recv(cmd)._value();
  63980. throw $early=[true];
  63981. }
  63982. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)});
  63983. }));
  63984. return false;
  63985. }
  63986. catch(e) {if(e===$early)return e[0]; throw e}
  63987. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},$globals.Repl)});
  63988. },
  63989. args: ["aString"],
  63990. 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",
  63991. referencedClasses: [],
  63992. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"]
  63993. }),
  63994. $globals.Repl);
  63995. $core.addMethod(
  63996. $core.method({
  63997. selector: "initialize",
  63998. protocol: "initialization",
  63999. fn: function (){
  64000. var self=this,$self=this;
  64001. return $core.withContext(function($ctx1) {
  64002. (
  64003. $ctx1.supercall = true,
  64004. ($globals.Repl.superclass||$boot.nilAsClass).fn.prototype._initialize.apply($self, []));
  64005. $ctx1.supercall = false;
  64006. $self["@session"]=$recv($globals.DoIt)._new();
  64007. $self["@readline"]=$recv(require)._value_("readline");
  64008. $ctx1.sendIdx["value:"]=1;
  64009. $self["@util"]=$recv(require)._value_("util");
  64010. $self._setupCommands();
  64011. return self;
  64012. }, function($ctx1) {$ctx1.fill(self,"initialize",{},$globals.Repl)});
  64013. },
  64014. args: [],
  64015. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  64016. referencedClasses: ["DoIt"],
  64017. messageSends: ["initialize", "new", "value:", "setupCommands"]
  64018. }),
  64019. $globals.Repl);
  64020. $core.addMethod(
  64021. $core.method({
  64022. selector: "instanceVariableNamesFor:",
  64023. protocol: "private",
  64024. fn: function (aClass){
  64025. var self=this,$self=this;
  64026. return $core.withContext(function($ctx1) {
  64027. var $1,$2,$receiver;
  64028. $1=$recv(aClass)._superclass();
  64029. $ctx1.sendIdx["superclass"]=1;
  64030. if(($receiver = $1) == null || $receiver.a$nil){
  64031. return $recv(aClass)._instanceVariableNames();
  64032. } else {
  64033. $2=$recv(aClass)._instanceVariableNames();
  64034. $ctx1.sendIdx["instanceVariableNames"]=1;
  64035. return $recv($2)._copyWithAll_($self._instanceVariableNamesFor_($recv(aClass)._superclass()));
  64036. }
  64037. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},$globals.Repl)});
  64038. },
  64039. args: ["aClass"],
  64040. 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]",
  64041. referencedClasses: [],
  64042. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"]
  64043. }),
  64044. $globals.Repl);
  64045. $core.addMethod(
  64046. $core.method({
  64047. selector: "isIdentifier:",
  64048. protocol: "private",
  64049. fn: function (aString){
  64050. var self=this,$self=this;
  64051. return $core.withContext(function($ctx1) {
  64052. return $recv(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  64053. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},$globals.Repl)});
  64054. },
  64055. args: ["aString"],
  64056. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  64057. referencedClasses: [],
  64058. messageSends: ["match:", "asRegexp"]
  64059. }),
  64060. $globals.Repl);
  64061. $core.addMethod(
  64062. $core.method({
  64063. selector: "isVariableDefined:",
  64064. protocol: "private",
  64065. fn: function (aString){
  64066. var self=this,$self=this;
  64067. return $core.withContext(function($ctx1) {
  64068. return $recv($self._instanceVariableNamesFor_($recv($self["@session"])._class()))._includes_(aString);
  64069. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},$globals.Repl)});
  64070. },
  64071. args: ["aString"],
  64072. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  64073. referencedClasses: [],
  64074. messageSends: ["includes:", "instanceVariableNamesFor:", "class"]
  64075. }),
  64076. $globals.Repl);
  64077. $core.addMethod(
  64078. $core.method({
  64079. selector: "nextResultName",
  64080. protocol: "private",
  64081. fn: function (){
  64082. var self=this,$self=this;
  64083. return $core.withContext(function($ctx1) {
  64084. var $1,$receiver;
  64085. $1=$self["@resultCount"];
  64086. if(($receiver = $1) == null || $receiver.a$nil){
  64087. $self["@resultCount"]=(1);
  64088. } else {
  64089. $self["@resultCount"]=$recv($self["@resultCount"]).__plus((1));
  64090. }
  64091. return "res".__comma($recv($self["@resultCount"])._asString());
  64092. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},$globals.Repl)});
  64093. },
  64094. args: [],
  64095. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  64096. referencedClasses: [],
  64097. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"]
  64098. }),
  64099. $globals.Repl);
  64100. $core.addMethod(
  64101. $core.method({
  64102. selector: "onKeyPress:",
  64103. protocol: "private",
  64104. fn: function (key){
  64105. var self=this,$self=this;
  64106. return $core.withContext(function($ctx1) {
  64107. var $1;
  64108. $1=$recv($recv(key)._ctrl())._and_((function(){
  64109. return $core.withContext(function($ctx2) {
  64110. return $recv($recv(key)._name()).__eq("l");
  64111. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64112. }));
  64113. if($core.assert($1)){
  64114. $self._clearScreen();
  64115. }
  64116. return self;
  64117. }, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},$globals.Repl)});
  64118. },
  64119. args: ["key"],
  64120. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  64121. referencedClasses: [],
  64122. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"]
  64123. }),
  64124. $globals.Repl);
  64125. $core.addMethod(
  64126. $core.method({
  64127. selector: "parseAssignment:do:",
  64128. protocol: "private",
  64129. fn: function (aString,aBlock){
  64130. var self=this,$self=this;
  64131. var assignment;
  64132. return $core.withContext(function($ctx1) {
  64133. var $2,$1;
  64134. assignment=$recv($recv(aString)._tokenize_(":="))._collect_((function(s){
  64135. return $core.withContext(function($ctx2) {
  64136. return $recv(s)._trimBoth();
  64137. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)});
  64138. }));
  64139. $1=$recv($recv($recv(assignment)._size()).__eq((2)))._and_((function(){
  64140. return $core.withContext(function($ctx2) {
  64141. $2=$recv(assignment)._first();
  64142. $ctx2.sendIdx["first"]=1;
  64143. return $self._isIdentifier_($2);
  64144. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64145. }));
  64146. if($core.assert($1)){
  64147. return $recv(aBlock)._value_value_($recv(assignment)._first(),$recv(assignment)._last());
  64148. $ctx1.sendIdx["value:value:"]=1;
  64149. } else {
  64150. return $recv(aBlock)._value_value_(nil,nil);
  64151. }
  64152. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},$globals.Repl)});
  64153. },
  64154. args: ["aString", "aBlock"],
  64155. 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 ]",
  64156. referencedClasses: [],
  64157. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"]
  64158. }),
  64159. $globals.Repl);
  64160. $core.addMethod(
  64161. $core.method({
  64162. selector: "presentResultNamed:withValue:",
  64163. protocol: "private",
  64164. fn: function (varName,value){
  64165. var self=this,$self=this;
  64166. return $core.withContext(function($ctx1) {
  64167. var $3,$2,$1;
  64168. $3=$recv($recv(varName).__comma(": ")).__comma($recv($recv(value)._class())._name());
  64169. $ctx1.sendIdx[","]=3;
  64170. $2=$recv($3).__comma(" = ");
  64171. $ctx1.sendIdx[","]=2;
  64172. $1=$recv($2).__comma($recv(value)._asString());
  64173. $ctx1.sendIdx[","]=1;
  64174. $recv($globals.Transcript)._show_($1);
  64175. $recv($globals.Transcript)._cr();
  64176. $recv($self["@interface"])._prompt();
  64177. return self;
  64178. }, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},$globals.Repl)});
  64179. },
  64180. args: ["varName", "value"],
  64181. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  64182. referencedClasses: ["Transcript"],
  64183. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"]
  64184. }),
  64185. $globals.Repl);
  64186. $core.addMethod(
  64187. $core.method({
  64188. selector: "printWelcome",
  64189. protocol: "actions",
  64190. fn: function (){
  64191. var self=this,$self=this;
  64192. return $core.withContext(function($ctx1) {
  64193. $recv($globals.Transcript)._show_("Type :q to exit.");
  64194. $recv($globals.Transcript)._cr();
  64195. return self;
  64196. }, function($ctx1) {$ctx1.fill(self,"printWelcome",{},$globals.Repl)});
  64197. },
  64198. args: [],
  64199. source: "printWelcome\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  64200. referencedClasses: ["Transcript"],
  64201. messageSends: ["show:", "cr"]
  64202. }),
  64203. $globals.Repl);
  64204. $core.addMethod(
  64205. $core.method({
  64206. selector: "processLine:",
  64207. protocol: "private",
  64208. fn: function (buffer){
  64209. var self=this,$self=this;
  64210. var show;
  64211. return $core.withContext(function($ctx1) {
  64212. var $1,$2;
  64213. show=(function(varName,value){
  64214. return $core.withContext(function($ctx2) {
  64215. return $self._presentResultNamed_withValue_(varName,value);
  64216. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)});
  64217. });
  64218. $1=$self._executeCommand_(buffer);
  64219. if(!$core.assert($1)){
  64220. $2=$self._isVariableDefined_(buffer);
  64221. if($core.assert($2)){
  64222. $recv(show)._value_value_(buffer,$recv($self["@session"])._perform_(buffer));
  64223. } else {
  64224. $self._assignNewVariable_do_(buffer,show);
  64225. }
  64226. }
  64227. return self;
  64228. }, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},$globals.Repl)});
  64229. },
  64230. args: ["buffer"],
  64231. 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]]",
  64232. referencedClasses: [],
  64233. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"]
  64234. }),
  64235. $globals.Repl);
  64236. $core.addMethod(
  64237. $core.method({
  64238. selector: "prompt",
  64239. protocol: "accessing",
  64240. fn: function (){
  64241. var self=this,$self=this;
  64242. return "amber >> ";
  64243. },
  64244. args: [],
  64245. source: "prompt\x0a\x09^ 'amber >> '",
  64246. referencedClasses: [],
  64247. messageSends: []
  64248. }),
  64249. $globals.Repl);
  64250. $core.addMethod(
  64251. $core.method({
  64252. selector: "setPreviousVariablesFor:from:",
  64253. protocol: "private",
  64254. fn: function (newObject,oldObject){
  64255. var self=this,$self=this;
  64256. return $core.withContext(function($ctx1) {
  64257. $recv($self._instanceVariableNamesFor_($recv(oldObject)._class()))._do_((function(each){
  64258. return $core.withContext(function($ctx2) {
  64259. return $recv(newObject)._perform_withArguments_($recv(each).__comma(":"),[$recv(oldObject)._perform_(each)]);
  64260. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)});
  64261. }));
  64262. return self;
  64263. }, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},$globals.Repl)});
  64264. },
  64265. args: ["newObject", "oldObject"],
  64266. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  64267. referencedClasses: [],
  64268. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"]
  64269. }),
  64270. $globals.Repl);
  64271. $core.addMethod(
  64272. $core.method({
  64273. selector: "setPrompt",
  64274. protocol: "actions",
  64275. fn: function (){
  64276. var self=this,$self=this;
  64277. return $core.withContext(function($ctx1) {
  64278. $recv($self["@interface"])._setPrompt_($self._prompt());
  64279. return self;
  64280. }, function($ctx1) {$ctx1.fill(self,"setPrompt",{},$globals.Repl)});
  64281. },
  64282. args: [],
  64283. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  64284. referencedClasses: [],
  64285. messageSends: ["setPrompt:", "prompt"]
  64286. }),
  64287. $globals.Repl);
  64288. $core.addMethod(
  64289. $core.method({
  64290. selector: "setupCommands",
  64291. protocol: "initialization",
  64292. fn: function (){
  64293. var self=this,$self=this;
  64294. return $core.withContext(function($ctx1) {
  64295. var $2,$1;
  64296. $2=$recv([":q"]).__minus_gt((function(){
  64297. return $core.withContext(function($ctx2) {
  64298. return $recv(process)._exit();
  64299. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)});
  64300. }));
  64301. $ctx1.sendIdx["->"]=1;
  64302. $1=[$2,$recv([""]).__minus_gt((function(){
  64303. return $core.withContext(function($ctx2) {
  64304. return $recv($self["@interface"])._prompt();
  64305. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)});
  64306. }))];
  64307. $self["@commands"]=$recv($globals.Dictionary)._from_($1);
  64308. return self;
  64309. }, function($ctx1) {$ctx1.fill(self,"setupCommands",{},$globals.Repl)});
  64310. },
  64311. args: [],
  64312. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  64313. referencedClasses: ["Dictionary"],
  64314. messageSends: ["from:", "->", "exit", "prompt"]
  64315. }),
  64316. $globals.Repl);
  64317. $core.addMethod(
  64318. $core.method({
  64319. selector: "setupHotkeys",
  64320. protocol: "initialization",
  64321. fn: function (){
  64322. var self=this,$self=this;
  64323. return $core.withContext(function($ctx1) {
  64324. var $receiver;
  64325. $recv($recv(process)._stdin())._on_do_("keypress",(function(s,key){
  64326. return $core.withContext(function($ctx2) {
  64327. if(($receiver = key) == null || $receiver.a$nil){
  64328. return key;
  64329. } else {
  64330. return $self._onKeyPress_(key);
  64331. }
  64332. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)});
  64333. }));
  64334. return self;
  64335. }, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},$globals.Repl)});
  64336. },
  64337. args: [],
  64338. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  64339. referencedClasses: [],
  64340. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"]
  64341. }),
  64342. $globals.Repl);
  64343. $core.addMethod(
  64344. $core.method({
  64345. selector: "subclass:withVariable:",
  64346. protocol: "private",
  64347. fn: function (aClass,varName){
  64348. var self=this,$self=this;
  64349. return $core.withContext(function($ctx1) {
  64350. return $recv($recv($globals.ClassBuilder)._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,$recv($self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  64351. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},$globals.Repl)});
  64352. },
  64353. args: ["aClass", "varName"],
  64354. 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'",
  64355. referencedClasses: ["ClassBuilder"],
  64356. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"]
  64357. }),
  64358. $globals.Repl);
  64359. $core.addMethod(
  64360. $core.method({
  64361. selector: "subclassNameFor:",
  64362. protocol: "private",
  64363. fn: function (aClass){
  64364. var self=this,$self=this;
  64365. return $core.withContext(function($ctx1) {
  64366. var $2,$1,$6,$5,$4,$3,$7,$receiver;
  64367. $2=$recv(aClass)._name();
  64368. $ctx1.sendIdx["name"]=1;
  64369. $1=$recv($2)._matchesOf_("\x5cd+$");
  64370. $ctx1.sendIdx["matchesOf:"]=1;
  64371. if(($receiver = $1) == null || $receiver.a$nil){
  64372. return $recv($recv(aClass)._name()).__comma("2");
  64373. } else {
  64374. var counter;
  64375. $6=$recv(aClass)._name();
  64376. $ctx1.sendIdx["name"]=2;
  64377. $5=$recv($6)._matchesOf_("\x5cd+$");
  64378. $4=$recv($5)._first();
  64379. $3=$recv($4)._asNumber();
  64380. counter=$recv($3).__plus((1));
  64381. $7=$recv(aClass)._name();
  64382. $ctx1.sendIdx["name"]=3;
  64383. return $recv($7)._replaceRegexp_with_("\x5cd+$"._asRegexp(),$recv(counter)._asString());
  64384. }
  64385. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},$globals.Repl)});
  64386. },
  64387. args: ["aClass"],
  64388. 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'].",
  64389. referencedClasses: [],
  64390. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","]
  64391. }),
  64392. $globals.Repl);
  64393. $core.addMethod(
  64394. $core.method({
  64395. selector: "main",
  64396. protocol: "initialization",
  64397. fn: function (){
  64398. var self=this,$self=this;
  64399. return $core.withContext(function($ctx1) {
  64400. $recv($self._new())._createInterface();
  64401. return self;
  64402. }, function($ctx1) {$ctx1.fill(self,"main",{},$globals.Repl.a$cls)});
  64403. },
  64404. args: [],
  64405. source: "main\x0a\x09self new createInterface",
  64406. referencedClasses: [],
  64407. messageSends: ["createInterface", "new"]
  64408. }),
  64409. $globals.Repl.a$cls);
  64410. });
  64411. (function () {
  64412. define('__app__',["amber/devel", "amber_core/Platform-Node", "amber_cli/AmberCli"], function (amber) {
  64413. amber.initialize().then(function () {
  64414. amber.globals.AmberCli._main();
  64415. });
  64416. });
  64417. }());
  64418. require(["app"]);
  64419. });
  64420. define.require('__wrap__');
  64421. }((function amdefine(module, requireFn) {
  64422. 'use strict';
  64423. var defineCache = {},
  64424. loaderCache = {},
  64425. alreadyCalled = false,
  64426. path = require('path'),
  64427. makeRequire, stringRequire;
  64428. /**
  64429. * Trims the . and .. from an array of path segments.
  64430. * It will keep a leading path segment if a .. will become
  64431. * the first path segment, to help with module name lookups,
  64432. * which act like paths, but can be remapped. But the end result,
  64433. * all paths that use this function should look normalized.
  64434. * NOTE: this method MODIFIES the input array.
  64435. * @param {Array} ary the array of path segments.
  64436. */
  64437. function trimDots(ary) {
  64438. var i, part;
  64439. for (i = 0; ary[i]; i+= 1) {
  64440. part = ary[i];
  64441. if (part === '.') {
  64442. ary.splice(i, 1);
  64443. i -= 1;
  64444. } else if (part === '..') {
  64445. if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
  64446. //End of the line. Keep at least one non-dot
  64447. //path segment at the front so it can be mapped
  64448. //correctly to disk. Otherwise, there is likely
  64449. //no path mapping for a path starting with '..'.
  64450. //This can still fail, but catches the most reasonable
  64451. //uses of ..
  64452. break;
  64453. } else if (i > 0) {
  64454. ary.splice(i - 1, 2);
  64455. i -= 2;
  64456. }
  64457. }
  64458. }
  64459. }
  64460. function normalize(name, baseName) {
  64461. var baseParts;
  64462. //Adjust any relative paths.
  64463. if (name && name.charAt(0) === '.') {
  64464. //If have a base name, try to normalize against it,
  64465. //otherwise, assume it is a top-level require that will
  64466. //be relative to baseUrl in the end.
  64467. if (baseName) {
  64468. baseParts = baseName.split('/');
  64469. baseParts = baseParts.slice(0, baseParts.length - 1);
  64470. baseParts = baseParts.concat(name.split('/'));
  64471. trimDots(baseParts);
  64472. name = baseParts.join('/');
  64473. }
  64474. }
  64475. return name;
  64476. }
  64477. /**
  64478. * Create the normalize() function passed to a loader plugin's
  64479. * normalize method.
  64480. */
  64481. function makeNormalize(relName) {
  64482. return function (name) {
  64483. return normalize(name, relName);
  64484. };
  64485. }
  64486. function makeLoad(id) {
  64487. function load(value) {
  64488. loaderCache[id] = value;
  64489. }
  64490. load.fromText = function (id, text) {
  64491. //This one is difficult because the text can/probably uses
  64492. //define, and any relative paths and requires should be relative
  64493. //to that id was it would be found on disk. But this would require
  64494. //bootstrapping a module/require fairly deeply from node core.
  64495. //Not sure how best to go about that yet.
  64496. throw new Error('amdefine does not implement load.fromText');
  64497. };
  64498. return load;
  64499. }
  64500. makeRequire = function (systemRequire, exports, module, relId) {
  64501. function amdRequire(deps, callback) {
  64502. if (typeof deps === 'string') {
  64503. //Synchronous, single module require('')
  64504. return stringRequire(systemRequire, exports, module, deps, relId);
  64505. } else {
  64506. //Array of dependencies with a callback.
  64507. //Convert the dependencies to modules.
  64508. deps = deps.map(function (depName) {
  64509. return stringRequire(systemRequire, exports, module, depName, relId);
  64510. });
  64511. //Wait for next tick to call back the require call.
  64512. if (callback) {
  64513. process.nextTick(function () {
  64514. callback.apply(null, deps);
  64515. });
  64516. }
  64517. }
  64518. }
  64519. amdRequire.toUrl = function (filePath) {
  64520. if (filePath.indexOf('.') === 0) {
  64521. return normalize(filePath, path.dirname(module.filename));
  64522. } else {
  64523. return filePath;
  64524. }
  64525. };
  64526. return amdRequire;
  64527. };
  64528. //Favor explicit value, passed in if the module wants to support Node 0.4.
  64529. requireFn = requireFn || function req() {
  64530. return module.require.apply(module, arguments);
  64531. };
  64532. function runFactory(id, deps, factory) {
  64533. var r, e, m, result;
  64534. if (id) {
  64535. e = loaderCache[id] = {};
  64536. m = {
  64537. id: id,
  64538. uri: __filename,
  64539. exports: e
  64540. };
  64541. r = makeRequire(requireFn, e, m, id);
  64542. } else {
  64543. //Only support one define call per file
  64544. if (alreadyCalled) {
  64545. throw new Error('amdefine with no module ID cannot be called more than once per file.');
  64546. }
  64547. alreadyCalled = true;
  64548. //Use the real variables from node
  64549. //Use module.exports for exports, since
  64550. //the exports in here is amdefine exports.
  64551. e = module.exports;
  64552. m = module;
  64553. r = makeRequire(requireFn, e, m, module.id);
  64554. }
  64555. //If there are dependencies, they are strings, so need
  64556. //to convert them to dependency values.
  64557. if (deps) {
  64558. deps = deps.map(function (depName) {
  64559. return r(depName);
  64560. });
  64561. }
  64562. //Call the factory with the right dependencies.
  64563. if (typeof factory === 'function') {
  64564. result = factory.apply(m.exports, deps);
  64565. } else {
  64566. result = factory;
  64567. }
  64568. if (result !== undefined) {
  64569. m.exports = result;
  64570. if (id) {
  64571. loaderCache[id] = m.exports;
  64572. }
  64573. }
  64574. }
  64575. stringRequire = function (systemRequire, exports, module, id, relId) {
  64576. //Split the ID by a ! so that
  64577. var index = id.indexOf('!'),
  64578. originalId = id,
  64579. prefix, plugin;
  64580. if (index === -1) {
  64581. id = normalize(id, relId);
  64582. //Straight module lookup. If it is one of the special dependencies,
  64583. //deal with it, otherwise, delegate to node.
  64584. if (id === 'require') {
  64585. return makeRequire(systemRequire, exports, module, relId);
  64586. } else if (id === 'exports') {
  64587. return exports;
  64588. } else if (id === 'module') {
  64589. return module;
  64590. } else if (loaderCache.hasOwnProperty(id)) {
  64591. return loaderCache[id];
  64592. } else if (defineCache[id]) {
  64593. runFactory.apply(null, defineCache[id]);
  64594. return loaderCache[id];
  64595. } else {
  64596. if(systemRequire) {
  64597. return systemRequire(originalId);
  64598. } else {
  64599. throw new Error('No module with ID: ' + id);
  64600. }
  64601. }
  64602. } else {
  64603. //There is a plugin in play.
  64604. prefix = id.substring(0, index);
  64605. id = id.substring(index + 1, id.length);
  64606. plugin = stringRequire(systemRequire, exports, module, prefix, relId);
  64607. if (plugin.normalize) {
  64608. id = plugin.normalize(id, makeNormalize(relId));
  64609. } else {
  64610. //Normalize the ID normally.
  64611. id = normalize(id, relId);
  64612. }
  64613. if (loaderCache[id]) {
  64614. return loaderCache[id];
  64615. } else {
  64616. plugin.load(id, makeRequire(systemRequire, exports, module, relId), makeLoad(id), {});
  64617. return loaderCache[id];
  64618. }
  64619. }
  64620. };
  64621. //Create a define function specific to the module asking for amdefine.
  64622. function define(id, deps, factory) {
  64623. if (Array.isArray(id)) {
  64624. factory = deps;
  64625. deps = id;
  64626. id = undefined;
  64627. } else if (typeof id !== 'string') {
  64628. factory = id;
  64629. id = deps = undefined;
  64630. }
  64631. if (deps && !Array.isArray(deps)) {
  64632. factory = deps;
  64633. deps = undefined;
  64634. }
  64635. if (!deps) {
  64636. deps = ['require', 'exports', 'module'];
  64637. }
  64638. //Set up properties for this module. If an ID, then use
  64639. //internal cache. If no ID, then use the external variables
  64640. //for this node module.
  64641. if (id) {
  64642. //Put the module in deep freeze until there is a
  64643. //require call for it.
  64644. defineCache[id] = [id, deps, factory];
  64645. } else {
  64646. runFactory(id, deps, factory);
  64647. }
  64648. }
  64649. //define.require, which has access to all the values in the
  64650. //cache. Useful for AMD modules that all have IDs in the file,
  64651. //but need to finally export a value to node based on one of those
  64652. //IDs.
  64653. define.require = function (id) {
  64654. if (loaderCache[id]) {
  64655. return loaderCache[id];
  64656. }
  64657. if (defineCache[id]) {
  64658. runFactory.apply(null, defineCache[id]);
  64659. return loaderCache[id];
  64660. }
  64661. };
  64662. define.amd = {};
  64663. return define;
  64664. }(module)), require));